diff --git a/mupen64plus-core/data/pifdata_ntsc.bin b/mupen64plus-core/data/pifdata_ntsc.bin new file mode 100644 index 0000000..58ed067 Binary files /dev/null and b/mupen64plus-core/data/pifdata_ntsc.bin differ diff --git a/mupen64plus-core/data/pifdata_pal.bin b/mupen64plus-core/data/pifdata_pal.bin new file mode 100644 index 0000000..6397015 Binary files /dev/null and b/mupen64plus-core/data/pifdata_pal.bin differ diff --git a/mupen64plus-core/src/main/main.c b/mupen64plus-core/src/main/main.c index 7ab330c..fdab9b7 100644 --- a/mupen64plus-core/src/main/main.c +++ b/mupen64plus-core/src/main/main.c @@ -1462,6 +1462,22 @@ void main_change_gb_cart(int control_id) } } +static const char* get_pif_path(m64p_system_type systemtype) +{ + const char *filename; + switch(systemtype) + { + case SYSTEM_PAL: + filename = "pifdata_pal.bin"; + break; + case SYSTEM_MPAL: + case SYSTEM_NTSC: + default: + filename = "pifdata_ntsc.bin"; + break; + } + return ConfigGetSharedDataFilepath(filename); +} /********************************************************************************************************* * emulation thread - runs the core @@ -1504,6 +1520,17 @@ m64p_error main_run(void) break; } + /* Load PIF */ + FILE* PifFile = fopen(get_pif_path(ROM_PARAMS.systemtype), "rb"); + if (PifFile != NULL) + { + unsigned char* pif_buffer = malloc(2048); + size_t file_size = fread(pif_buffer, 1, 2048, PifFile); + fclose(PifFile); + open_pif(pif_buffer, file_size); + free(pif_buffer); + } + /* Seed MPK ID gen using current time */ uint64_t mpk_seed = !netplay_is_init() ? (uint64_t)time(NULL) : 0; l_mpk_idgen = xoshiro256pp_seed(mpk_seed);