Integrate the new slot2 system in gtk/cli frontends.

This commit is contained in:
thelemonman 2013-11-11 17:28:25 +00:00
parent 3cd1e909fc
commit b4c243fade
3 changed files with 89 additions and 39 deletions

View File

@ -56,7 +56,7 @@
#include "GPU_osd.h" #include "GPU_osd.h"
#include "desmume_config.h" #include "desmume_config.h"
#include "commandline.h" #include "commandline.h"
#include "addons.h" #include "slot2.h"
#ifdef GDB_STUB #ifdef GDB_STUB
#include "gdbstub.h" #include "gdbstub.h"
#endif #endif
@ -539,28 +539,52 @@ int main(int argc, char ** argv) {
fw_config.language = my_config.firmware_language; fw_config.language = my_config.firmware_language;
} }
/* addons */ my_config.process_addonCommands();
my_config.process_addonCommands();
addon_type = NDS_ADDON_NONE;
if (my_config.is_cflash_configured)
addon_type = NDS_ADDON_CFLASH;
if(my_config.gbaslot_rom != "") { int slot2_device_type = NDS_SLOT2_AUTO;
addon_type = NDS_ADDON_GBAGAME;
strncpy(GBAgameName, my_config.gbaslot_rom.c_str(), MAX_PATH);
}
switch (addon_type) { if (my_config.is_cflash_configured)
case NDS_ADDON_CFLASH: slot2_device_type = NDS_SLOT2_CFLASH;
case NDS_ADDON_RUMBLEPAK:
case NDS_ADDON_NONE: if(my_config.gbaslot_rom != "") {
case NDS_ADDON_GBAGAME: strncpy(GBAgameName, my_config.gbaslot_rom.c_str(), MAX_PATH);
break; // Check if the file exists and can be opened
default: FILE * test = fopen(GBAgameName, "rb");
addon_type = NDS_ADDON_NONE; if (test) {
break; slot2_device_type = NDS_SLOT2_GBACART;
} fclose(test);
addonsChangePak (addon_type); }
}
switch (slot2_device_type)
{
case NDS_SLOT2_NONE:
break;
case NDS_SLOT2_AUTO:
break;
case NDS_SLOT2_CFLASH:
break;
case NDS_SLOT2_RUMBLEPAK:
break;
case NDS_SLOT2_GBACART:
break;
case NDS_SLOT2_GUITARGRIP:
break;
case NDS_SLOT2_EXPMEMORY:
break;
case NDS_SLOT2_EASYPIANO:
break;
case NDS_SLOT2_PADDLE:
break;
case NDS_SLOT2_PASSME:
break;
default:
slot2_device_type = NDS_SLOT2_NONE;
break;
}
slot2_Init();
slot2_Change((NDS_SLOT2_TYPE)slot2_device_type);
if ( !g_thread_supported()) { if ( !g_thread_supported()) {
g_thread_init( NULL); g_thread_init( NULL);

View File

@ -51,7 +51,7 @@
#include "commandline.h" #include "commandline.h"
#include "addons.h" #include "slot2.h"
#include "filter/videofilter.h" #include "filter/videofilter.h"
@ -2159,28 +2159,54 @@ common_gtk_main( class configured_features *my_config)
fw_config.language = my_config->firmware_language; fw_config.language = my_config->firmware_language;
} }
//------------------addons---------- //------------------addons----------
my_config->process_addonCommands(); my_config->process_addonCommands();
addon_type = NDS_ADDON_NONE;
int slot2_device_type = NDS_SLOT2_AUTO;
if (my_config->is_cflash_configured) if (my_config->is_cflash_configured)
addon_type = NDS_ADDON_CFLASH; slot2_device_type = NDS_SLOT2_CFLASH;
if(my_config->gbaslot_rom != "") { if(my_config->gbaslot_rom != "") {
addon_type = NDS_ADDON_GBAGAME;
strncpy(GBAgameName, my_config->gbaslot_rom.c_str(), MAX_PATH); strncpy(GBAgameName, my_config->gbaslot_rom.c_str(), MAX_PATH);
// Check if the file exists and can be opened
FILE * test = fopen(GBAgameName, "rb");
if (test) {
slot2_device_type = NDS_SLOT2_GBACART;
fclose(test);
}
} }
switch (addon_type) { switch (slot2_device_type)
case NDS_ADDON_CFLASH: {
case NDS_ADDON_RUMBLEPAK: case NDS_SLOT2_NONE:
case NDS_ADDON_NONE: break;
case NDS_ADDON_GBAGAME: case NDS_SLOT2_AUTO:
break; break;
default: case NDS_SLOT2_CFLASH:
addon_type = NDS_ADDON_NONE; break;
break; case NDS_SLOT2_RUMBLEPAK:
} break;
addonsChangePak (addon_type); case NDS_SLOT2_GBACART:
break;
case NDS_SLOT2_GUITARGRIP:
break;
case NDS_SLOT2_EXPMEMORY:
break;
case NDS_SLOT2_EASYPIANO:
break;
case NDS_SLOT2_PADDLE:
break;
case NDS_SLOT2_PASSME:
break;
default:
slot2_device_type = NDS_SLOT2_NONE;
break;
}
slot2_Init();
slot2_Change((NDS_SLOT2_TYPE)slot2_device_type);
#ifdef GDB_STUB #ifdef GDB_STUB
if ( my_config->arm9_gdb_port != 0) { if ( my_config->arm9_gdb_port != 0) {

View File

@ -15,9 +15,9 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>. along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "slot2.h" #include "slot2.h"
#include "../types.h" #include "types.h"
#include "../mem.h" #include "mem.h"
#include "../MMU.h" #include "MMU.h"
//this is the currently-configured cflash mode //this is the currently-configured cflash mode
ADDON_CFLASH_MODE CFlash_Mode = ADDON_CFLASH_MODE_RomPath; ADDON_CFLASH_MODE CFlash_Mode = ADDON_CFLASH_MODE_RomPath;