本帖最后由 沙漠点灰 于 2013-7-11 17:56 编辑
把附件的dll文件加到“工程/System”目录下,因为能力有限,所以有bug,打开多个RGSS Player时,即会出现。
在脚本最上面添加
$hookrgss = Win32API.new("System/DllExitSave", "hookrgss", "v", "v") $hookrgss.call
$hookrgss = Win32API.new("System/DllExitSave", "hookrgss", "v", "v")
$hookrgss.call
再搜索“save_game",得到下面的
#-------------------------------------------------------------------------- # ● 执行存档 #-------------------------------------------------------------------------- def self.save_game(index) begin save_game_without_rescue(index) rescue delete_save_file(index) false end end
#--------------------------------------------------------------------------
# ● 执行存档
#--------------------------------------------------------------------------
def self.save_game(index)
begin
save_game_without_rescue(index)
rescue
delete_save_file(index)
false
end
end
修改为:
#-------------------------------------------------------------------------- # ● 执行存档 #-------------------------------------------------------------------------- def self.save_game(index) return if SceneManager.scene.is_a?(Scene_Title) begin save_game_without_rescue(index) rescue delete_save_file(index) false end end
#--------------------------------------------------------------------------
# ● 执行存档
#--------------------------------------------------------------------------
def self.save_game(index)
return if SceneManager.scene.is_a?(Scene_Title)
begin
save_game_without_rescue(index)
rescue
delete_save_file(index)
false
end
end
即加了行,这样能保证在标题退出不会进行存档。
附:dll文件
DllExitSave.7z
(3.18 KB, 下载次数: 71)
dll源代码
#include <windows.h> #include <stdio.h> typedef DWORD (*EVALFUNC)(LPCSTR); LONG oldWndProc; EVALFUNC eval; const char buf[] = "DataManager.save_game(3)"; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CLOSE: eval(buf); default: return CallWindowProc((WNDPROC)oldWndProc, hWnd, uMsg, wParam, lParam); } } extern "C" void __declspec(dllexport) hookrgss() { HMODULE hRGSS; oldWndProc = SetWindowLong(FindWindow(TEXT("RGSS Player"), NULL), GWL_WNDPROC, (LONG)WindowProc); hRGSS = LoadLibrary(L"RGSS300.dll"); eval = (EVALFUNC)GetProcAddress(hRGSS, "RGSSEval"); }
#include <windows.h>
#include <stdio.h>
typedef DWORD (*EVALFUNC)(LPCSTR);
LONG oldWndProc;
EVALFUNC eval;
const char buf[] = "DataManager.save_game(3)";
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_CLOSE:
eval(buf);
default:
return CallWindowProc((WNDPROC)oldWndProc, hWnd, uMsg, wParam, lParam);
}
}
extern "C" void __declspec(dllexport) hookrgss() {
HMODULE hRGSS;
oldWndProc = SetWindowLong(FindWindow(TEXT("RGSS Player"), NULL), GWL_WNDPROC, (LONG)WindowProc);
hRGSS = LoadLibrary(L"RGSS300.dll");
eval = (EVALFUNC)GetProcAddress(hRGSS, "RGSSEval");
}
|