- add commend line option to set max block size [1..100] (1-accuracy, 100-faster);
This commit is contained in:
mtabachenko 2013-03-31 22:20:06 +00:00
parent 59ff024507
commit c542768e68
5 changed files with 28 additions and 11 deletions

View File

@ -490,6 +490,7 @@ extern struct TCommonSettings {
, GFX3D_LineHack(true)
, GFX3D_Zelda_Shadow_Depth_Hack(0)
, GFX3D_Renderer_Multisample(false)
, jit_max_block_size(100)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, PatchSWI3(false)
@ -571,6 +572,7 @@ extern struct TCommonSettings {
FAST_ALIGN bool advanced_timing;
bool use_jit;
u32 jit_max_block_size;
struct _Wifi {
int mode;

View File

@ -39,7 +39,6 @@
#include "arm_jit.h"
#include "bios.h"
#define MAX_JIT_BLOCK_SIZE 100
#define LOG_JIT_LEVEL 0
#define PROFILER_JIT_LEVEL 0
@ -4084,7 +4083,7 @@ static u32 compile_basicblock()
u32 cycles = instr_cycles(opcode);
bEndBlock = (i >= (MAX_JIT_BLOCK_SIZE - 1)) || instr_is_branch(opcode);
bEndBlock = (i >= (CommonSettings.jit_max_block_size - 1)) || instr_is_branch(opcode);
#if LOG_JIT
if (instr_is_conditional(opcode) && (cycles > 1) || (cycles == 0))
@ -4215,6 +4214,7 @@ void arm_jit_reset(bool enable)
scratchptr = scratchpad;
#endif
printf("CPU mode: %s\n", enable?"JIT":"Interpreter");
printf("JIT max block size %d instruction(s)\n", CommonSettings.jit_max_block_size);
if (enable)
{

View File

@ -51,6 +51,7 @@ CommandLine::CommandLine()
, _slot1_fat_dir(NULL)
#ifdef HAVE_JIT
, _cpu_mode(-1)
, _jit_size(-1)
#endif
, _console_type(NULL)
, depth_threshold(-1)
@ -103,6 +104,7 @@ void CommandLine::loadCommonOptions()
{ "console-type", 0, 0, G_OPTION_ARG_STRING, &_console_type, "Select console type: {fat,lite,ique,debug,dsi}", "CONSOLETYPE" },
#ifdef HAVE_JIT
{ "cpu-mode", 0, 0, G_OPTION_ARG_INT, &_cpu_mode, "ARM CPU emulation mode: 0 - interpreter, 1 - dynarec (default 1)", NULL},
{ "jit-size", 0, 0, G_OPTION_ARG_INT, &_jit_size, "ARM JIT block size: 1..100 (1 - accuracy, 100 - faster) (default 100)", NULL},
#endif
#ifndef _MSC_VER
{ "disable-sound", 0, 0, G_OPTION_ARG_NONE, &disable_sound, "Disables the sound emulation", NULL},
@ -146,6 +148,13 @@ bool CommandLine::parse(int argc,char **argv)
if(_advanced_timing != -1) CommonSettings.advanced_timing = _advanced_timing==1;
#ifdef HAVE_JIT
if(_cpu_mode != -1) CommonSettings.use_jit = (_cpu_mode==1);
if(_jit_size != -1)
{
if ((_jit_size < 1) || (_jit_size > 100))
CommonSettings.jit_max_block_size = 100;
else
CommonSettings.jit_max_block_size = _jit_size;
}
#endif
if(depth_threshold != -1)
CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack = depth_threshold;
@ -236,6 +245,9 @@ bool CommandLine::validate()
if (_cpu_mode < -1 || _cpu_mode > 1) {
g_printerr("Invalid cpu mode emulation (0 - interpreter, 1 - dynarec)\n");
}
if (_jit_size < 1 || _jit_size > 100) {
g_printerr("Invalid jit block size [1..100]. set to 100\n");
}
#endif
return true;

View File

@ -92,6 +92,7 @@ private:
int _advanced_timing;
#ifdef HAVE_JIT
int _cpu_mode;
int _jit_size;
#endif
char* _slot1;
char *_slot1_fat_dir;

View File

@ -2940,6 +2940,16 @@ int _main()
GetPrivateProfileString("Scripting", str, "", &Recent_Scripts[i][0], 1024, IniName);
}
#ifdef HAVE_JIT
//zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
//id rather have people discover a bonus speedhack than discover new bugs in a new version
CommonSettings.use_jit = GetPrivateProfileBool("Emulation", "CPUmode", false, IniName);
CommonSettings.jit_max_block_size = GetPrivateProfileInt("Emulation", "JitSize", 100, IniName);
if ((CommonSettings.jit_max_block_size < 1) || (CommonSettings.jit_max_block_size > 100))
CommonSettings.jit_max_block_size = 100;
#else
CommonSettings.use_jit = false;
#endif
//i think we should override the ini file with anything from the commandline
CommandLine cmdline;
@ -3244,15 +3254,7 @@ int _main()
GetPrivateProfileString("Firmware", "FirmwareFile", "firmware.bin", CommonSettings.Firmware, 256, IniName);
CommonSettings.BootFromFirmware = GetPrivateProfileBool("Firmware", "BootFromFirmware", false, IniName);
#ifdef HAVE_JIT
//zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
//id rather have people discover a bonus speedhack than discover new bugs in a new version
CommonSettings.use_jit = GetPrivateProfileBool("Emulation", "CPUmode", false, IniName);
#else
CommonSettings.use_jit = false;
#endif
video.setfilter(GetPrivateProfileInt("Video", "Filter", video.NONE, IniName));
video.setfilter(GetPrivateProfileInt("Video", "Filter", video.NONE, IniName));
FilterUpdate(MainWindow->getHWnd(),false);
/* Read the firmware settings from the init file */