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 "desmume_config.h"
#include "commandline.h"
#include "addons.h"
#include "slot2.h"
#ifdef GDB_STUB
#include "gdbstub.h"
#endif
@ -539,28 +539,52 @@ int main(int argc, char ** argv) {
fw_config.language = my_config.firmware_language;
}
/* addons */
my_config.process_addonCommands();
addon_type = NDS_ADDON_NONE;
if (my_config.is_cflash_configured)
addon_type = NDS_ADDON_CFLASH;
my_config.process_addonCommands();
if(my_config.gbaslot_rom != "") {
addon_type = NDS_ADDON_GBAGAME;
strncpy(GBAgameName, my_config.gbaslot_rom.c_str(), MAX_PATH);
}
int slot2_device_type = NDS_SLOT2_AUTO;
switch (addon_type) {
case NDS_ADDON_CFLASH:
case NDS_ADDON_RUMBLEPAK:
case NDS_ADDON_NONE:
case NDS_ADDON_GBAGAME:
break;
default:
addon_type = NDS_ADDON_NONE;
break;
}
addonsChangePak (addon_type);
if (my_config.is_cflash_configured)
slot2_device_type = NDS_SLOT2_CFLASH;
if(my_config.gbaslot_rom != "") {
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 (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()) {
g_thread_init( NULL);

View File

@ -51,7 +51,7 @@
#include "commandline.h"
#include "addons.h"
#include "slot2.h"
#include "filter/videofilter.h"
@ -2159,28 +2159,54 @@ common_gtk_main( class configured_features *my_config)
fw_config.language = my_config->firmware_language;
}
//------------------addons----------
my_config->process_addonCommands();
addon_type = NDS_ADDON_NONE;
int slot2_device_type = NDS_SLOT2_AUTO;
if (my_config->is_cflash_configured)
addon_type = NDS_ADDON_CFLASH;
slot2_device_type = NDS_SLOT2_CFLASH;
if(my_config->gbaslot_rom != "") {
addon_type = NDS_ADDON_GBAGAME;
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) {
case NDS_ADDON_CFLASH:
case NDS_ADDON_RUMBLEPAK:
case NDS_ADDON_NONE:
case NDS_ADDON_GBAGAME:
break;
default:
addon_type = NDS_ADDON_NONE;
break;
}
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);
#ifdef GDB_STUB
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/>.
*/
#include "slot2.h"
#include "../types.h"
#include "../mem.h"
#include "../MMU.h"
#include "types.h"
#include "mem.h"
#include "MMU.h"
//this is the currently-configured cflash mode
ADDON_CFLASH_MODE CFlash_Mode = ADDON_CFLASH_MODE_RomPath;