diff --git a/src/main/main.c b/src/main/main.c index 2dd11eff5..8aaa2f2a8 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -739,7 +739,7 @@ m64p_error main_run(void) delay_si = ConfigGetParamBool(g_CoreConfig, "DelaySI"); count_per_op = ConfigGetParamInt(g_CoreConfig, "CountPerOp"); if (count_per_op <= 0) - count_per_op = 2; + count_per_op = ROM_PARAMS.countperop; // initialize memory, and do byte-swapping if it's not been done yet if (g_MemHasBeenBSwapped == 0) diff --git a/src/main/rom.c b/src/main/rom.c index 5cd1b3e7c..23c3631fd 100644 --- a/src/main/rom.c +++ b/src/main/rom.c @@ -37,6 +37,7 @@ #include "util.h" #include "memory/memory.h" +#include "r4300/r4300.h" #include "osal/preproc.h" #include "osd/osd.h" @@ -163,6 +164,7 @@ m64p_error open_rom(const unsigned char* romimage, unsigned int size) ROM_PARAMS.systemtype = rom_country_code_to_system_type(ROM_HEADER.Country_code); ROM_PARAMS.vilimit = rom_system_type_to_vi_limit(ROM_PARAMS.systemtype); ROM_PARAMS.aidacrate = rom_system_type_to_ai_dac_rate(ROM_PARAMS.systemtype); + ROM_PARAMS.countperop = COUNT_PER_OP_DEFAULT; memcpy(ROM_PARAMS.headername, ROM_HEADER.Name, 20); ROM_PARAMS.headername[20] = '\0'; @@ -178,6 +180,7 @@ m64p_error open_rom(const unsigned char* romimage, unsigned int size) ROM_SETTINGS.status = entry->status; ROM_SETTINGS.players = entry->players; ROM_SETTINGS.rumble = entry->rumble; + ROM_PARAMS.countperop = entry->countperop; } else { @@ -187,6 +190,7 @@ m64p_error open_rom(const unsigned char* romimage, unsigned int size) ROM_SETTINGS.status = 0; ROM_SETTINGS.players = 0; ROM_SETTINGS.rumble = 0; + ROM_PARAMS.countperop = COUNT_PER_OP_DEFAULT; } /* print out a bunch of info about the ROM */ @@ -355,6 +359,7 @@ void romdatabase_open(void) search->entry.savetype = DEFAULT; search->entry.players = DEFAULT; search->entry.rumble = DEFAULT; + search->entry.countperop = COUNT_PER_OP_DEFAULT; search->next_entry = NULL; search->next_crc = NULL; @@ -445,6 +450,13 @@ void romdatabase_open(void) else DebugMessage(M64MSG_WARNING, "ROM Database: Invalid rumble string on line %i", lineno); } + else if(!strcmp(l.name, "CountPerOp")) + { + if (string_to_int(l.value, &value) && value > 0 && value <= 4) + search->entry.countperop = value; + else + DebugMessage(M64MSG_WARNING, "ROM Database: Invalid CountPerOp on line %i", lineno); + } else { DebugMessage(M64MSG_WARNING, "ROM Database: Unknown property on line %i", lineno); @@ -473,6 +485,8 @@ void romdatabase_open(void) search->entry.players = ref->players; if(ref->rumble!=DEFAULT) search->entry.rumble = ref->rumble; + if (ref->countperop != COUNT_PER_OP_DEFAULT) + search->entry.countperop = ref->countperop; } else DebugMessage(M64MSG_WARNING, "ROM Database: Error solving RefMD5s"); diff --git a/src/main/rom.h b/src/main/rom.h index 5b91ace72..b8be154ec 100644 --- a/src/main/rom.h +++ b/src/main/rom.h @@ -42,6 +42,7 @@ typedef struct _rom_params int vilimit; int aidacrate; char headername[21]; /* ROM Name as in the header, removing trailing whitespace */ + unsigned char countperop; } rom_params; extern m64p_rom_header ROM_HEADER; @@ -111,6 +112,7 @@ typedef struct unsigned char savetype; unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */ unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */ + unsigned char countperop; } romdatabase_entry; typedef struct _romdatabase_search diff --git a/src/r4300/r4300.c b/src/r4300/r4300.c index b7ed7c383..fc4d4c890 100644 --- a/src/r4300/r4300.c +++ b/src/r4300/r4300.c @@ -45,7 +45,7 @@ unsigned int r4300emu = 0; int no_compiled_jump = 0; -unsigned int count_per_op = 2; +unsigned int count_per_op = COUNT_PER_OP_DEFAULT; int llbit, rompause; #if NEW_DYNAREC != NEW_DYNAREC_ARM int stop; diff --git a/src/r4300/r4300.h b/src/r4300/r4300.h index 679690351..2363412bc 100644 --- a/src/r4300/r4300.h +++ b/src/r4300/r4300.h @@ -46,6 +46,7 @@ extern unsigned int last_addr; extern char invalid_code[0x100000]; extern unsigned int jump_to_address; extern int no_compiled_jump; +#define COUNT_PER_OP_DEFAULT 2 extern unsigned int count_per_op; void init_blocks(void);