Skip to content

Commit

Permalink
- Moved the loading of the emulator settings to BEFORE the rom is
Browse files Browse the repository at this point in the history
loaded.
- Adding configuration for changing the CD-ROM BIOS
- Updated the CIA banners, inc and rsf.
  • Loading branch information
bubble2k16 committed Jun 18, 2017
1 parent 4b66c9a commit 2e9788b
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 9 deletions.
Binary file modified Thumbs.db
Binary file not shown.
19 changes: 17 additions & 2 deletions src/3ds/3dsmain.cpp
Expand Up @@ -100,22 +100,37 @@ bool emulatorLoadRom()
{
menu3dsShowDialog("Load ROM", "Loading... this may take a while.", DIALOGCOLOR_CYAN, NULL);

char romFileNameFullPathOriginal[_MAX_PATH];
strncpy(romFileNameFullPathOriginal, romFileNameFullPath, _MAX_PATH - 1);

emulatorSettingsSave(false, false);
snprintf(romFileNameFullPath, _MAX_PATH, "%s%s", file3dsGetCurrentDir(), romFileName);

char romFileNameFullPath2[_MAX_PATH];
strncpy(romFileNameFullPath2, romFileNameFullPath, _MAX_PATH - 1);

// Load up the new ROM settings first.
//
emulatorSettingsLoad(true, false);
impl3dsApplyAllSettings();

if (!impl3dsLoadROM(romFileNameFullPath2))
{
// If the ROM loading fails:
// 1. Restore the original ROM file path.
strncpy(romFileNameFullPath, romFileNameFullPathOriginal, _MAX_PATH - 1);

// 2. Reload original settings
emulatorSettingsLoad(true, false);
impl3dsApplyAllSettings();

menu3dsHideDialog();

return false;
}

emulator.emulatorState = EMUSTATE_EMULATE;

emulatorSettingsLoad(true, false);
impl3dsApplyAllSettings();
cheat3dsLoadCheatTextFile(file3dsReplaceFilenameExtension(romFileNameFullPath, ".chx"));
menu3dsHideDialog();

Expand Down
53 changes: 50 additions & 3 deletions src/cores/temperpce/3ds/3dsimpl.cpp
Expand Up @@ -48,6 +48,7 @@ SSettings3DS settings3DS;

#define SETTINGS_SOFTWARERENDERING 0
#define SETTINGS_IDLELOOPPATCH 1
#define SETTINGS_BIOS 2

//----------------------------------------------------------------------
// Menu options
Expand Down Expand Up @@ -138,6 +139,17 @@ SMenuItem optionsForRendering[] =
MENU_MAKE_LASTITEM ()
};

SMenuItem optionsForBIOS[] =
{
MENU_MAKE_DIALOG_ACTION (2, "CD-ROM v1", "/3ds/syscards/syscard1.pce"),
MENU_MAKE_DIALOG_ACTION (1, "CD-ROM v2", "/3ds/syscards/syscard2.pce"),
MENU_MAKE_DIALOG_ACTION (0, "CD-ROM v3", "/3ds/syscards/syscard3.pce"),
MENU_MAKE_DIALOG_ACTION (3, "Arcade CD", "/3ds/syscards/syscard3.pce"),
MENU_MAKE_DIALOG_ACTION (4, "Games Express", "/3ds/syscards/games_express.pce"),
MENU_MAKE_LASTITEM ()
};


SMenuItem optionMenu[] = {
MENU_MAKE_HEADER1 ("GLOBAL SETTINGS"),
MENU_MAKE_PICKER (11000, " Screen Stretch", "How would you like the final screen to appear?", optionsForStretch, DIALOGCOLOR_CYAN),
Expand All @@ -147,7 +159,7 @@ SMenuItem optionMenu[] = {
MENU_MAKE_HEADER1 ("GAME-SPECIFIC SETTINGS"),
MENU_MAKE_PICKER (20000, " Idle Loop Patching", "You must reload the ROM after changing this.", optionsForIdleLoopPatch, DIALOGCOLOR_CYAN),
MENU_MAKE_PICKER (10000, " Frameskip", "Try changing this if the game runs slow. Skipping frames help it run faster but less smooth.", optionsForFrameskip, DIALOGCOLOR_CYAN),
MENU_MAKE_PICKER (12000, " Framerate", "Some games run at 50 or 60 FPS by default. Override if required.", optionsForFrameRate, DIALOGCOLOR_CYAN),
MENU_MAKE_PICKER (21000, " BIOS", "The BIOS must be in your /3ds/syscards folder. Re-load ROM after changing.", optionsForBIOS, DIALOGCOLOR_CYAN),
MENU_MAKE_DISABLED (""),
MENU_MAKE_HEADER1 ("AUDIO"),
MENU_MAKE_CHECKBOX (50002, " Apply volume to all games", 0),
Expand Down Expand Up @@ -544,6 +556,15 @@ bool impl3dsLoadROM(char *romFilePath)

if (load_rom(romFilePath) == -1)
return false;

SMenuItem *menuItem = menu3dsGetMenuItemByID(1, 21000);
if (menuItem != NULL)
{
if (config.cd_loaded)
menuItem->Type = MENUITEM_PICKER;
else
menuItem->Type = MENUITEM_DISABLED;
}

impl3dsResetConsole();

Expand Down Expand Up @@ -1180,6 +1201,7 @@ void impl3dsInitializeDefaultSettings()

settings3DS.OtherOptions[SETTINGS_IDLELOOPPATCH] = 0;
settings3DS.OtherOptions[SETTINGS_SOFTWARERENDERING] = 0;
settings3DS.OtherOptions[SETTINGS_BIOS] = 0;
}


Expand Down Expand Up @@ -1215,13 +1237,13 @@ bool impl3dsReadWriteSettingsByGame(bool writeMode)
config3dsReadWriteInt32("TurboL=%d\n", &settings3DS.Turbo[4], 0, 10);
config3dsReadWriteInt32("TurboR=%d\n", &settings3DS.Turbo[5], 0, 10);
config3dsReadWriteInt32("Vol=%d\n", &settings3DS.Volume, 0, 8);
config3dsReadWriteInt32("SRAMInterval=%d\n", &settings3DS.SRAMSaveInterval, 0, 4);
config3dsReadWriteInt32("ButtonMapA=%d\n", &settings3DS.ButtonMapping[0], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapB=%d\n", &settings3DS.ButtonMapping[1], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapX=%d\n", &settings3DS.ButtonMapping[2], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapY=%d\n", &settings3DS.ButtonMapping[3], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapL=%d\n", &settings3DS.ButtonMapping[4], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapR=%d\n", &settings3DS.ButtonMapping[5], 0, 0xffff);
config3dsReadWriteInt32("BIOS=%d\n", &settings3DS.OtherOptions[SETTINGS_BIOS], 0, 4);

// All new options should come here!

Expand Down Expand Up @@ -1254,6 +1276,19 @@ bool impl3dsReadWriteSettingsGlobal(bool writeMode)
config3dsReadWriteString("ROM=%s\n", "ROM=%1000[^\n]s\n", romFileNameLastSelected);

// All new options should come here!
config3dsReadWriteInt32("TurboA=%d\n", &settings3DS.GlobalTurbo[0], 0, 10);
config3dsReadWriteInt32("TurboB=%d\n", &settings3DS.GlobalTurbo[1], 0, 10);
config3dsReadWriteInt32("TurboX=%d\n", &settings3DS.GlobalTurbo[2], 0, 10);
config3dsReadWriteInt32("TurboY=%d\n", &settings3DS.GlobalTurbo[3], 0, 10);
config3dsReadWriteInt32("TurboL=%d\n", &settings3DS.GlobalTurbo[4], 0, 10);
config3dsReadWriteInt32("TurboR=%d\n", &settings3DS.GlobalTurbo[5], 0, 10);
config3dsReadWriteInt32("Vol=%d\n", &settings3DS.GlobalVolume, 0, 8);
config3dsReadWriteInt32("ButtonMapA=%d\n", &settings3DS.GlobalButtonMapping[0], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapB=%d\n", &settings3DS.GlobalButtonMapping[1], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapX=%d\n", &settings3DS.GlobalButtonMapping[2], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapY=%d\n", &settings3DS.GlobalButtonMapping[3], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapL=%d\n", &settings3DS.GlobalButtonMapping[4], 0, 0xffff);
config3dsReadWriteInt32("ButtonMapR=%d\n", &settings3DS.GlobalButtonMapping[5], 0, 0xffff);

config3dsCloseFile();
return true;
Expand Down Expand Up @@ -1326,7 +1361,18 @@ bool impl3dsApplyAllSettings(bool updateGameSettings)
config.patch_idle_loops = 1;
else
config.patch_idle_loops = 0;


if (settings3DS.OtherOptions[SETTINGS_BIOS] == 0)
config.cd_system_type = CD_SYSTEM_TYPE_V3;
else if (settings3DS.OtherOptions[SETTINGS_BIOS] == 1)
config.cd_system_type = CD_SYSTEM_TYPE_V2;
else if (settings3DS.OtherOptions[SETTINGS_BIOS] == 2)
config.cd_system_type = CD_SYSTEM_TYPE_V1;
else if (settings3DS.OtherOptions[SETTINGS_BIOS] == 3)
config.cd_system_type = CD_SYSTEM_TYPE_ACD;
else if (settings3DS.OtherOptions[SETTINGS_BIOS] == 4)
config.cd_system_type = CD_SYSTEM_TYPE_GECD;

}

return settingsChanged;
Expand Down Expand Up @@ -1412,6 +1458,7 @@ bool impl3dsCopyMenuToOrFromSettings(bool copyMenuToSettings)
UPDATE_SETTINGS(settings3DS.SRAMSaveInterval, 1, 17000);
UPDATE_SETTINGS(settings3DS.OtherOptions[SETTINGS_SOFTWARERENDERING], 1, 19000);
UPDATE_SETTINGS(settings3DS.OtherOptions[SETTINGS_IDLELOOPPATCH], 1, 20000);
UPDATE_SETTINGS(settings3DS.OtherOptions[SETTINGS_BIOS], 1, 21000);

return settingsUpdated;

Expand Down
2 changes: 1 addition & 1 deletion src/cores/temperpce/adpcm.c
Expand Up @@ -419,7 +419,7 @@ void update_adpcm()

sample_index_fractional += frequency_step;
audio_buffer_index =
(audio_buffer_index + 2) % AUDIO_BUFFER_SIZE;
(audio_buffer_index + 2) % ADPCM_AUDIO_BUFFER_SIZE;

clocks_remaining -= psg.clock_step;
}
Expand Down
Binary file added src/cores/temperpce/assets/Thumbs.db
Binary file not shown.
Binary file modified src/cores/temperpce/assets/cia.bnr
Binary file not shown.
Binary file modified src/cores/temperpce/assets/cia.icn
Binary file not shown.
4 changes: 2 additions & 2 deletions src/cores/temperpce/assets/cia.rsf
@@ -1,7 +1,7 @@
BasicInfo:
Title : "VirtuaNES for 3DS"
CompanyCode : "00"
ProductCode : "CTR-P-VNES"
ProductCode : "CTR-P-TPCE"
ContentType : Application
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem

Expand All @@ -10,7 +10,7 @@ RomFs:
RootPath : "romfs"

TitleInfo:
UniqueId : 0x384a
UniqueId : 0x384b
Category : Application

CardInfo:
Expand Down
Binary file modified src/cores/temperpce/assets/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/cores/temperpce/memory.c
Expand Up @@ -1304,7 +1304,7 @@ s32 load_syscard()
break;
}

printf("loading syscard %s\n", syscard_name);
//printf("loading syscard %s\n", syscard_name);

//sprintf(syscard_path, "%s%csyscards%c%s.bin", config.main_path,
// DIR_SEPARATOR_CHAR, DIR_SEPARATOR_CHAR, syscard_name);
Expand Down
Binary file modified temperpce_3ds.smdh
Binary file not shown.
Binary file added temperpce_3ds_top.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2e9788b

Please sign in to comment.