制作便携版 RPG Maker

由于 RPG Maker MV 的程序并没有管理员权限的需求,因此只要将 RPGMV 下的所有文件复制一份即可。 可以使用下面的脚本(cmd)设置关联。

@ECHO OFF

@SET HCUSC=HKEY_CURRENT_USER\Software\Classes

REG add "%HCUSC%\.rpgproject" /ve /t REG_SZ /d "RPGMV.Project" /f
REG add "%HCUSC%\RPGMV.Project" /ve /t REG_SZ /d "RPGMV Project" /f
REG add "%HCUSC%\RPGMV.Project\DefaultIcon" /ve /t REG_SZ /d "\"%~dp0RPGMV.exe\",1" /f
REG add "%HCUSC%\RPGMV.Project\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGMV.exe\" \"%%1\"" /f

而 RPG Maker VX Ace 依赖于 rtp 的安装,所以需要管理员权限。

@ECHO OFF

SET "INSTALLDIR=%~dp0"
SET "INSTALLDIR=%INSTALLDIR:~0,-1%"
@SET HCUSC=HKEY_CURRENT_USER\Software\Classes

REG add "HKLM\SOFTWARE\enterbrain\rgss3\rtp" /v "rpgvxace" /t REG_SZ /d "%~dp0rtp" /f /reg:32
REG add "HKLM\SOFTWARE\enterbrain\rpgvxace" /v "applicationpath" /t REG_SZ /d "%INSTALLDIR%" /f /reg:32
REG add "%HCUSC%\.rvproj2" /ve /t REG_SZ /d "RPGVXAce.Project" /f
REG add "%HCUSC%\.rvdata2" /ve /t REG_SZ /d "RPGVXAce.Data" /f
REG add "%HCUSC%\.rgss3a" /ve /t REG_SZ /d "RPGVXAce.Archive" /f
REG add "%HCUSC%\rpgvxace.project" /ve /t REG_SZ /d "RPGVXAce Project" /f
REG add "%HCUSC%\rpgvxace.project\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\",1" /f
REG add "%HCUSC%\rpgvxace.project\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\"  \"%%1\"" /f
REG add "%HCUSC%\rpgvxace.archive" /ve /t REG_SZ /d "RGSS Encrypted Archive" /f
REG add "%HCUSC%\rpgvxace.archive\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\",3" /f
REG add "%HCUSC%\rpgvxace.archive\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\" /n \"%%1\"" /f
REG add "%HCUSC%\rpgvxace.data" /ve /t REG_SZ /d "RPGVXAce Data" /f
REG add "%HCUSC%\rpgvxace.data\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\",2" /f
REG add "%HCUSC%\rpgvxace.data\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVXAce.exe\" /n \"%%1\"" /f

RPG Maker VX 版:

@ECHO OFF

SET "INSTALLDIR=%~dp0"
SET "INSTALLDIR=%INSTALLDIR:~0,-1%"
@SET HCUSC=HKEY_CURRENT_USER\Software\Classes

REG add "HKLM\SOFTWARE\enterbrain\rgss2\rtp" /v "rpgvx" /t REG_SZ /d "%~dp0rtp" /f /reg:32
REG add "HKLM\SOFTWARE\enterbrain\rpgvx" /v "applicationpath" /t REG_SZ /d "%INSTALLDIR%" /f /reg:32
REG add "%HCUSC%\.rvproj" /ve /t REG_SZ /d "RPGVX.Project" /f
REG add "%HCUSC%\.rvdata" /ve /t REG_SZ /d "RPGVX.Data" /f
REG add "%HCUSC%\.rgss2a" /ve /t REG_SZ /d "RPGVX.Archive" /f
REG add "%HCUSC%\rpgvx.project" /ve /t REG_SZ /d "RPGVX Project" /f
REG add "%HCUSC%\rpgvx.project\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\",1" /f
REG add "%HCUSC%\rpgvx.project\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\"  \"%%1\"" /f
REG add "%HCUSC%\rpgvx.archive" /ve /t REG_SZ /d "RGSS Encrypted Archive" /f
REG add "%HCUSC%\rpgvx.archive\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\",3" /f
REG add "%HCUSC%\rpgvx.archive\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\" /n \"%%1\"" /f
REG add "%HCUSC%\rpgvx.data" /ve /t REG_SZ /d "RPGVX Data" /f
REG add "%HCUSC%\rpgvx.data\defaulticon" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\",2" /f
REG add "%HCUSC%\rpgvx.data\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGVX.exe\" /n \"%%1\"" /f

RPG Maker XP 版:

@ECHO OFF

SET "INSTALLDIR=%~dp0"
SET "INSTALLDIR=%INSTALLDIR:~0,-1%"
@SET HCUSC=HKEY_CURRENT_USER\Software\Classes

REG add "HKLM\SOFTWARE\enterbrain\RGSS\RTP" /v "Standard" /t REG_SZ /d "%~dp0rtp" /f /reg:32
REG add "HKLM\SOFTWARE\enterbrain\RPGXP" /v "applicationpath" /t REG_SZ /d "%INSTALLDIR%" /f /reg:32
REG add "%HCUSC%\.rxproj" /ve /t REG_SZ /d "RPGXP.Project" /f
REG add "%HCUSC%\.rxdata" /ve /t REG_SZ /d "RPGXP.Data" /f
REG add "%HCUSC%\.rgssad" /ve /t REG_SZ /d "RPGXP.Archive" /f
REG add "%HCUSC%\RPGXP.Project" /ve /t REG_SZ /d "RPGXP Project" /f
REG add "%HCUSC%\RPGXP.Project\DefaultIcon" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\",1" /f
REG add "%HCUSC%\RPGXP.Project\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\"  \"%%1\"" /f
REG add "%HCUSC%\RPGXP.Archive" /ve /t REG_SZ /d "RGSS Encrypted Archive" /f
REG add "%HCUSC%\RPGXP.Archive\DefaultIcon" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\",3" /f
REG add "%HCUSC%\RPGXP.Archive\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\" /n \"%%1\"" /f
REG add "%HCUSC%\RPGXP.Data" /ve /t REG_SZ /d "RPGXP Data" /f
REG add "%HCUSC%\RPGXP.Data\DefaultIcon" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\",2" /f
REG add "%HCUSC%\RPGXP.Data\shell\open\command" /ve /t REG_SZ /d "\"%~dp0RPGXP.exe\" /n \"%%1\"" /f
Windows 10 相关 Cheatsheet

设置 Powershell Profile:

# Load posh git
Import-Module 'D:\local\posh-git\src\posh-git.psd1'

# Customize git prompt
$s = $Global:GitPromptSettings
$s.BranchIdenticalStatusSymbol = $null
$s.BranchAheadStatusSymbol = $null
$s.BranchBehindStatusSymbol = $null
$s.BranchGoneStatusSymbol = $null
$s.BranchBehindAndAheadStatusSymbol = $null
$s.BranchBehindAndAheadDisplay = "Minimal"
$s.LocalWorkingStatusSymbol = $null
$s.LocalStagedStatusSymbol = $null
$s.WindowTitle = $null
$s.DefaultPromptAbbreviateHomeDirectory = False

设置网络属性为专用网络:

Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex <index number> -NetworkCategory Private

清理组件:

dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
Windows 下 Ruby 编译 C 扩展

注:大部分代码来源于 rubyinline

#!/usr/bin/env ruby -wKU

# usage: ruby path/to/this/script path/to/your/c/source

require "rbconfig"

class MKCMD

  def self.cmd(base_name)
    new("#{base_name}.c", "#{base_name}.so").cmd
  end

  def initialize(src_name, so_name)
    @src_name = src_name
    @so_name  = so_name
  end

  def cmd
    hdrdir = %w(srcdir includedir archdir rubyhdrdir).map { |name|
      RbConfig::CONFIG[name]
    }.find { |dir|
      dir and File.exist? File.join(dir, "ruby.h")
    } or abort "ERROR: Can't find header dir for ruby. Exiting..."

    config_hdrdir = if RbConfig::CONFIG['rubyarchhdrdir']
      "-I #{RbConfig::CONFIG['rubyarchhdrdir']}"
    elsif RUBY_VERSION > '1.9'
      "-I #{File.join hdrdir, RbConfig::CONFIG['arch']}"
    end

    cmd = [
      RbConfig::CONFIG['LDSHARED'],
      RbConfig::CONFIG['CFLAGS'],
      '-I', hdrdir,
      config_hdrdir,
      '-I', RbConfig::CONFIG['includedir'],
      File.expand_path(@src_name).inspect,
      crap_for_windoze,
      RbConfig::CONFIG['LDFLAGS'],
      RbConfig::CONFIG['CCDLFLAGS'],
    ].compact.join(' ')

    # odd compilation error on clang + freebsd 10. Ruby built w/ rbenv.
    cmd.gsub!(/-Wl,-soname,\$@/, "-Wl,-soname,#{File.basename @so_name}")

    # strip off some makefile macros for mingw 1.9
    cmd.gsub!(/\$\(.*\)/, '') if RUBY_PLATFORM =~ /mingw/

    cmd
  end


  private

  def crap_for_windoze
    # gawd windoze land sucks
    case RUBY_PLATFORM
    when /mswin32/ then
      " -link /OUT:\"#{self.so_name}\" /LIBPATH:\"#{RbConfig::CONFIG['libdir']}\" /DEFAULTLIB:\"#{RbConfig::CONFIG['LIBRUBY']}\" /INCREMENTAL:no /EXPORT:Init_#{module_name}"
    when /mingw32/ then
      c = RbConfig::CONFIG
      " -Wl,--enable-auto-import -L#{c['libdir']} -l#{c['RUBY_SO_NAME']} -o #{@so_name.inspect}"
    when /i386-cygwin/ then
      ' -L/usr/local/lib -lruby.dll'
    else
      ''
    end
  end
end

system MKCMD.cmd((ARGV[0] || gets.chomp).chomp('.c')) if $0 == __FILE__