reorganize SI and EXI interfaces, add a gui for picking devices. XK, that was annoying. Now, you can deal with SI_Channel. This commit changes how memcards are handled a little, now they are .REGION.raw, like .USA.raw, and can be in any dir.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2075 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
cdf0349646
commit
cfc128abff
|
@ -36,6 +36,7 @@
|
|||
#define CACHE_DIR "Cache"
|
||||
#define STATESAVES_DIR "StateSaves"
|
||||
#define SCREENSHOTS_DIR "ScreenShots"
|
||||
#define DUMP_DIR "Dump"
|
||||
#define LOGS_DIR "Logs"
|
||||
#define MAIL_LOGS_DIR "Mail"
|
||||
|
||||
|
@ -48,10 +49,10 @@
|
|||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define TOTALDB "totaldb.dsy"
|
||||
|
||||
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
|
||||
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
|
||||
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_PadSimple" PLUGIN_SUFFIX
|
||||
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
|
||||
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
|
||||
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
|
||||
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_PadSimple" PLUGIN_SUFFIX
|
||||
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
|
||||
|
||||
#define FONT_ANSI "font_ansi.bin"
|
||||
#define FONT_SJIS "font_sjis.bin"
|
||||
|
@ -61,8 +62,8 @@
|
|||
|
||||
#define GC_IPL "IPL.bin"
|
||||
#define GC_SRAM "SRAM.raw"
|
||||
#define GC_MEMCARDA "MemoryCardA.raw"
|
||||
#define GC_MEMCARDB "MemoryCardB.raw"
|
||||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
|
||||
#define WII_MASTERKEY "masterkey.bin"
|
||||
#define WII_MASTERKEY_HEX "masterkey.txt"
|
||||
|
@ -76,54 +77,55 @@
|
|||
// User dirs
|
||||
#define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
|
||||
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
|
||||
//#define GC_USER_EUR_DIR FULL_GC_USER_DIR EUR_DIR
|
||||
//#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR
|
||||
//#define GC_USER_JAP_DIR FULL_GC_USER_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
|
||||
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
|
||||
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
|
||||
|
||||
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
|
||||
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
|
||||
#define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
|
||||
#define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP
|
||||
#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
|
||||
#define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
|
||||
#define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
|
||||
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
|
||||
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP
|
||||
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
|
||||
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP
|
||||
|
||||
#define FULL_MEMORY_DUMP_DIR FULL_CACHE_DIR MEMORY_DUMP_FILE
|
||||
|
||||
// Sys dirs
|
||||
#define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP
|
||||
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP
|
||||
//#define GC_SYS_EUR_DIR FULL_GC_SYS_DIR EUR_DIR
|
||||
//#define GC_SYS_USA_DIR FULL_GC_SYS_DIR USA_DIR
|
||||
//#define GC_SYS_JAP_DIR FULL_GC_SYS_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP
|
||||
#define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP
|
||||
|
||||
// Shorts - files
|
||||
// User files
|
||||
#define CONFIG_FILE FULL_CONFIG_DIR DOLPHIN_CONFIG
|
||||
#define DEBUGGER_CONFIG_FILE FULL_CONFIG_DIR DEBUGGER_CONFIG
|
||||
#define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
|
||||
#define CONFIG_FILE FULL_CONFIG_DIR DOLPHIN_CONFIG
|
||||
#define DEBUGGER_CONFIG_FILE FULL_CONFIG_DIR DEBUGGER_CONFIG
|
||||
#define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
|
||||
|
||||
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
|
||||
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
|
||||
|
||||
// Sys files
|
||||
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
|
||||
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS
|
||||
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
|
||||
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS
|
||||
|
||||
#define DSP_ROM_FILE FULL_GC_SYS_DIR DSP_ROM
|
||||
#define DSP_COEF_FILE FULL_GC_SYS_DIR DSP_COEF
|
||||
#define DSP_ROM_FILE FULL_GC_SYS_DIR DSP_ROM
|
||||
#define DSP_COEF_FILE FULL_GC_SYS_DIR DSP_COEF
|
||||
|
||||
#define WII_MASTERKEY_FILE FULL_WII_SYS_DIR WII_MASTERKEY
|
||||
#define WII_MASTERKEY_FILE_HEX FULL_WII_SYS_DIR WII_MASTERKEY_HEX
|
||||
#define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING
|
||||
#define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING
|
||||
#define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
|
||||
#define WII_MASTERKEY_FILE FULL_WII_SYS_DIR WII_MASTERKEY
|
||||
#define WII_MASTERKEY_FILE_HEX FULL_WII_SYS_DIR WII_MASTERKEY_HEX
|
||||
#define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING
|
||||
#define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING
|
||||
#define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
|
||||
|
||||
#endif // PATHS_H
|
||||
|
|
|
@ -618,6 +618,14 @@
|
|||
RelativePath=".\Src\HW\SI.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\SI_Channel.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\SI_Channel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\SI_Device.cpp"
|
||||
>
|
||||
|
@ -627,11 +635,11 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\SI_DeviceGBAController.cpp"
|
||||
RelativePath=".\Src\HW\SI_DeviceGBA.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\SI_DeviceGBAController.h"
|
||||
RelativePath=".\Src\HW\SI_DeviceGBA.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
|
@ -76,19 +76,30 @@ void SConfig::SaveSettings()
|
|||
ini.Set("Interface", "Language", m_InterfaceLanguage);
|
||||
|
||||
// Core
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
|
||||
ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore);
|
||||
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
|
||||
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
|
||||
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
|
||||
ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore);
|
||||
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
|
||||
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
|
||||
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
||||
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
|
||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
|
||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
ini.Set("Core", "MemcardA", m_strMemoryCardA);
|
||||
ini.Set("Core", "MemcardB", m_strMemoryCardB);
|
||||
ini.Set("Core", "SlotA", m_EXIDevice[0]);
|
||||
ini.Set("Core", "SlotB", m_EXIDevice[1]);
|
||||
ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
|
||||
char sidevicenum[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
sprintf(sidevicenum, "SIDevice%i", i);
|
||||
ini.Set("Core", sidevicenum, m_SIDevice[i]);
|
||||
}
|
||||
|
||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
|
||||
// Plugins
|
||||
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
|
@ -98,9 +109,6 @@ void SConfig::SaveSettings()
|
|||
ini.Set("Core", "Pad3Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[2]);
|
||||
ini.Set("Core", "Pad4Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[3]);
|
||||
ini.Set("Core", "WiiMote1Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
|
||||
ini.Set("Core", "WiiMote2Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[1]);
|
||||
ini.Set("Core", "WiiMote3Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[2]);
|
||||
ini.Set("Core", "WiiMote4Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[3]);
|
||||
}
|
||||
|
||||
ini.Save(CONFIG_FILE);
|
||||
|
@ -141,9 +149,9 @@ void SConfig::LoadSettings()
|
|||
// Hard coded default plugin
|
||||
{
|
||||
m_DefaultGFXPlugin = PLUGINS_DIR DIR_SEP DEFAULT_GFX_PLUGIN;
|
||||
m_DefaultDSPPlugin = PLUGINS_DIR DIR_SEP DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN;
|
||||
m_DefaultDSPPlugin = PLUGINS_DIR DIR_SEP DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN;
|
||||
}
|
||||
#endif
|
||||
// General
|
||||
|
@ -188,6 +196,17 @@ void SConfig::LoadSettings()
|
|||
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
|
||||
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
|
||||
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
||||
ini.Get("Core", "MemcardA", &m_strMemoryCardA);
|
||||
ini.Get("Core", "MemcardB", &m_strMemoryCardB);
|
||||
ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0]);
|
||||
ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1]);
|
||||
ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2]);
|
||||
char sidevicenum[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
sprintf(sidevicenum, "SIDevice%i", i);
|
||||
ini.Get("Core", sidevicenum, (u32*)&m_SIDevice[i]);
|
||||
}
|
||||
|
||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||
|
@ -201,10 +220,6 @@ void SConfig::LoadSettings()
|
|||
std::string TmpName = StringFromFormat("Pad%iPlugin", (i + 1));
|
||||
ini.Get("Core", TmpName.c_str(), &m_LocalCoreStartupParameter.m_strPadPlugin[i], m_DefaultPADPlugin.c_str());
|
||||
}
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
{
|
||||
std::string TmpName = StringFromFormat("WiiMote%iPlugin", (i + 1));
|
||||
ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[i], m_DefaultWiiMotePlugin.c_str());
|
||||
}
|
||||
ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Boot/Boot.h"
|
||||
#include "HW/EXI_Device.h"
|
||||
#include "HW/SI_Device.h"
|
||||
|
||||
// HyperIris: not sure but a temporary implement
|
||||
enum INTERFACE_LANGUAGE
|
||||
|
@ -52,6 +54,11 @@ struct SConfig
|
|||
|
||||
SCoreStartupParameter m_LocalCoreStartupParameter;
|
||||
|
||||
std::string m_strMemoryCardA;
|
||||
std::string m_strMemoryCardB;
|
||||
TEXIDevices m_EXIDevice[3];
|
||||
TSIDevices m_SIDevice[4];
|
||||
|
||||
// interface language
|
||||
INTERFACE_LANGUAGE m_InterfaceLanguage;
|
||||
// save settings
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "Boot/Boot.h" // Core
|
||||
#include "Boot/Boot_DOL.h"
|
||||
#include "CoreParameter.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Core.h" // for bWii
|
||||
|
||||
SCoreStartupParameter::SCoreStartupParameter()
|
||||
|
@ -155,10 +156,10 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
|
|||
}
|
||||
|
||||
// Setup paths
|
||||
m_strBios = FULL_GC_SYS_DIR + Region + DIR_SEP GC_IPL;
|
||||
m_strMemoryCardA = FULL_GC_USER_DIR + Region + DIR_SEP GC_MEMCARDA;
|
||||
m_strMemoryCardB = FULL_GC_USER_DIR + Region + DIR_SEP GC_MEMCARDB;
|
||||
m_strSRAM = GC_SRAM_FILE;
|
||||
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, Region, true);
|
||||
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, Region, false);
|
||||
m_strSRAM = GC_SRAM_FILE;
|
||||
m_strBios = FULL_GC_SYS_DIR + Region + DIR_SEP GC_IPL;
|
||||
if (!File::Exists(m_strBios.c_str())) {
|
||||
LOG(BOOT, "BIOS file %s not found - using HLE.", m_strBios.c_str());
|
||||
bHLEBios = true;
|
||||
|
@ -166,3 +167,50 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA)
|
||||
{
|
||||
std::string ext("." + gameRegion + ".raw");
|
||||
if (memcardPath.empty())
|
||||
{
|
||||
// Use default memcard path if there is no user defined name
|
||||
std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB;
|
||||
memcardPath = FULL_GC_USER_DIR + defaultFilename + ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string filename = memcardPath;
|
||||
std::string region = filename.substr(filename.size()-7, 3);
|
||||
bool hasregion = false;
|
||||
hasregion |= region.compare(USA_DIR) == 0;
|
||||
hasregion |= region.compare(JAP_DIR) == 0;
|
||||
hasregion |= region.compare(EUR_DIR) == 0;
|
||||
if (!hasregion)
|
||||
{
|
||||
// filename doesn't have region in the extension
|
||||
if (File::Exists(filename.c_str()))
|
||||
{
|
||||
// If the old file exists we are polite and ask if we should copy it
|
||||
std::string oldFilename = filename;
|
||||
filename.replace(filename.size()-4, 4, ext);
|
||||
if (PanicYesNo("Memory Card filename in Slot %c is incorrect\n"
|
||||
"Region not specified\n\n"
|
||||
"Slot %c path was changed to\n"
|
||||
"%s\n"
|
||||
"Would you like to copy the old file to this new location?\n",
|
||||
isSlotA ? 'A':'B', isSlotA ? 'A':'B', filename.c_str()))
|
||||
{
|
||||
if (!File::Copy(oldFilename.c_str(), filename.c_str()))
|
||||
PanicAlert("Copy failed");
|
||||
}
|
||||
}
|
||||
memcardPath = filename; // Always correct the path!
|
||||
}
|
||||
else if (region.compare(gameRegion) != 0)
|
||||
{
|
||||
// filename has region, but it's not == gameRegion
|
||||
// Just set the correct filename, the EXI Device will create it if it doesn't exist
|
||||
memcardPath = filename.replace(filename.size()-ext.size(), ext.size(), ext);;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ struct SCoreStartupParameter
|
|||
bool bEnableDebugging; bool bAutomaticStart; bool bBootToPause;
|
||||
bool bUseJIT;
|
||||
|
||||
// JIT
|
||||
// JIT
|
||||
bool bJITUnlimitedCache, bJITBlockLinking;
|
||||
bool bJITOff;
|
||||
bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff;
|
||||
|
@ -69,9 +69,11 @@ struct SCoreStartupParameter
|
|||
|
||||
int SelectedLanguage;
|
||||
|
||||
bool bWii; bool bWiiLeds; bool bWiiSpeakers; // Wii settings
|
||||
// Wii settings
|
||||
bool bWii; bool bWiiLeds; bool bWiiSpeakers;
|
||||
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor; // Interface settings
|
||||
// Interface settings
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor;
|
||||
int iTheme;
|
||||
|
||||
enum EBootBios
|
||||
|
@ -98,25 +100,20 @@ struct SCoreStartupParameter
|
|||
std::string m_strWiimotePlugin[MAXWIIMOTES];
|
||||
|
||||
std::string m_strFilename;
|
||||
std::string m_strBios;
|
||||
std::string m_strMemoryCardA;
|
||||
std::string m_strMemoryCardB;
|
||||
std::string m_strBios;
|
||||
std::string m_strSRAM;
|
||||
std::string m_strDefaultGCM;
|
||||
std::string m_strDVDRoot;
|
||||
std::string m_strUniqueID;
|
||||
std::string m_strName;
|
||||
|
||||
//
|
||||
// Constructor just calls LoadDefaults
|
||||
SCoreStartupParameter();
|
||||
|
||||
void LoadDefaults();
|
||||
bool AutoSetup(EBootBios _BootBios);
|
||||
const std::string &GetUniqueID() const { return m_strUniqueID; }
|
||||
void CheckMemcardPath(std::string& memcardPath, std::string Region, bool isSlotA);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,11 +17,11 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "../ConfigManager.h"
|
||||
|
||||
#include "PeripheralInterface.h"
|
||||
#include "../PowerPC/PowerPC.h"
|
||||
|
||||
#include "EXI_Device.h"
|
||||
#include "EXI_Channel.h"
|
||||
|
||||
namespace ExpansionInterface
|
||||
|
@ -36,17 +36,19 @@ CEXIChannel *g_Channels;
|
|||
|
||||
void Init()
|
||||
{
|
||||
g_Channels = new CEXIChannel[3];
|
||||
g_Channels = new CEXIChannel[NUM_CHANNELS];
|
||||
g_Channels[0].m_ChannelId = 0;
|
||||
g_Channels[1].m_ChannelId = 1;
|
||||
g_Channels[2].m_ChannelId = 2;
|
||||
|
||||
g_Channels[0].AddDevice(EXIDEVICE_MEMORYCARD_A, 0);
|
||||
g_Channels[0].AddDevice(EXIDEVICE_IPL, 1);
|
||||
g_Channels[1].AddDevice(EXIDEVICE_MEMORYCARD_B, 0);
|
||||
//g_Channels[0].AddDevice(EXIDEVICE_ETH, 2);
|
||||
//g_Channels[1].AddDevice(EXIDEVICE_MIC, 0);
|
||||
g_Channels[2].AddDevice(EXIDEVICE_AD16, 0);
|
||||
// m_EXIDevice[0] = SlotA
|
||||
// m_EXIDevice[1] = SlotB
|
||||
// m_EXIDevice[2] = Serial Port 1 (ETH)
|
||||
g_Channels[0].AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0);
|
||||
g_Channels[0].AddDevice(EXIDEVICE_IPL, 1);
|
||||
g_Channels[0].AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2);
|
||||
g_Channels[1].AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0);
|
||||
g_Channels[2].AddDevice(EXIDEVICE_AD16, 0);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,4 +36,3 @@ void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
|
|||
} // end of namespace ExpansionInterface
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,6 +16,7 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "EXI_Channel.h"
|
||||
#include "EXI_Device.h"
|
||||
#include "EXI.h"
|
||||
|
||||
#define EXI_READ 0
|
||||
|
@ -28,7 +29,7 @@
|
|||
|
||||
CEXIChannel::CEXIChannel() :
|
||||
m_DMAMemoryAddress(0),
|
||||
m_DMALength(0),
|
||||
m_DMALength(0),
|
||||
m_ImmData(0),
|
||||
m_ChannelId(-1)
|
||||
{
|
||||
|
@ -53,7 +54,7 @@ CEXIChannel::~CEXIChannel()
|
|||
|
||||
void CEXIChannel::RemoveDevices()
|
||||
{
|
||||
for (int i = 0; i < NUM_DEVICES; i++)
|
||||
for (int i = 0; i < NUM_DEVICES; i++)
|
||||
{
|
||||
if (m_pDevices[i] != NULL)
|
||||
{
|
||||
|
@ -101,7 +102,7 @@ bool CEXIChannel::IsCausingInterrupt()
|
|||
|
||||
if ((m_Status.EXIINT & m_Status.EXIINTMASK) ||
|
||||
(m_Status.TCINT & m_Status.TCINTMASK) ||
|
||||
(m_Status.EXTINT & m_Status.EXTINTMASK))
|
||||
(m_Status.EXTINT & m_Status.EXTINTMASK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ bool CEXIChannel::IsCausingInterrupt()
|
|||
|
||||
IEXIDevice* CEXIChannel::GetDevice(u8 _CHIP_SELECT)
|
||||
{
|
||||
switch(_CHIP_SELECT)
|
||||
switch(_CHIP_SELECT)
|
||||
{
|
||||
case 1: return m_pDevices[0];
|
||||
case 2: return m_pDevices[1];
|
||||
|
@ -164,7 +165,7 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
|
|||
_uReturnValue = m_Control.hex;
|
||||
break;
|
||||
|
||||
case EXI_IMMDATA:
|
||||
case EXI_IMMDATA:
|
||||
_uReturnValue = m_ImmData;
|
||||
break;
|
||||
|
||||
|
@ -172,7 +173,7 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
|
|||
_dbg_assert_(EXPANSIONINTERFACE, 0);
|
||||
_uReturnValue = 0xDEADBEEF;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
|
||||
|
@ -185,12 +186,12 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
|
|||
{
|
||||
UEXI_STATUS newStatus(_iValue);
|
||||
|
||||
// static
|
||||
// static
|
||||
m_Status.EXIINTMASK = newStatus.EXIINTMASK;
|
||||
m_Status.TCINTMASK = newStatus.TCINTMASK;
|
||||
m_Status.EXTINTMASK = newStatus.EXTINTMASK;
|
||||
m_Status.CLK = newStatus.CLK;
|
||||
m_Status.ROMDIS = newStatus.ROMDIS;
|
||||
m_Status.ROMDIS = newStatus.ROMDIS;
|
||||
|
||||
// Device
|
||||
if (m_Status.CHIP_SELECT != newStatus.CHIP_SELECT)
|
||||
|
@ -200,7 +201,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
|
|||
u8 dwDeviceMask = 1 << i;
|
||||
IEXIDevice* pDevice = GetDevice(dwDeviceMask);
|
||||
if (pDevice != NULL)
|
||||
{
|
||||
{
|
||||
if (((newStatus.CHIP_SELECT & dwDeviceMask) == dwDeviceMask) &&
|
||||
((m_Status.CHIP_SELECT & dwDeviceMask) == 0))
|
||||
// device gets activated
|
||||
|
@ -211,8 +212,8 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
|
|||
// device gets deactivated
|
||||
pDevice->SetCS(0);
|
||||
}
|
||||
}
|
||||
m_Status.CHIP_SELECT = newStatus.CHIP_SELECT;
|
||||
}
|
||||
m_Status.CHIP_SELECT = newStatus.CHIP_SELECT;
|
||||
}
|
||||
|
||||
// External Status
|
||||
|
@ -262,7 +263,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
|
|||
pDevice->ImmWrite(m_ImmData, m_Control.TLEN + 1);
|
||||
m_ImmData = pDevice->ImmRead(m_Control.TLEN + 1); */
|
||||
break;
|
||||
|
||||
|
||||
default: _dbg_assert_msg_(EXPANSIONINTERFACE,0,"EXI Imm: Unknown transfer type %i", m_Control.RW);
|
||||
}
|
||||
m_Control.TSTART = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,18 +40,18 @@ private:
|
|||
u32 hex;
|
||||
struct
|
||||
{
|
||||
unsigned EXIINTMASK : 1; // 31
|
||||
unsigned EXIINTMASK : 1; //31
|
||||
unsigned EXIINT : 1; //30
|
||||
unsigned TCINTMASK : 1; //29
|
||||
unsigned TCINT : 1; //28
|
||||
unsigned CLK : 3; //27
|
||||
unsigned CLK : 3; //27
|
||||
unsigned CHIP_SELECT : 3; //24
|
||||
unsigned EXTINTMASK : 1; //21
|
||||
unsigned EXTINT : 1; //20
|
||||
unsigned EXT : 1; // External Insertion Status (1: External EXI device present) //19
|
||||
unsigned ROMDIS : 1; // ROM Disable //18
|
||||
unsigned EXT : 1; //19 // External Insertion Status (1: External EXI device present)
|
||||
unsigned ROMDIS : 1; //18 // ROM Disable
|
||||
unsigned :18;
|
||||
};
|
||||
};
|
||||
UEXI_STATUS() {hex = 0;}
|
||||
UEXI_STATUS(u32 _hex) {hex = _hex;}
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
union UEXI_CONTROL
|
||||
{
|
||||
u32 hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned TSTART : 1;
|
||||
unsigned DMA : 1;
|
||||
|
@ -73,13 +73,13 @@ private:
|
|||
// STATE_TO_SAVE
|
||||
UEXI_STATUS m_Status;
|
||||
UEXI_CONTROL m_Control;
|
||||
u32 m_DMAMemoryAddress;
|
||||
u32 m_DMALength;
|
||||
u32 m_ImmData;
|
||||
|
||||
u32 m_DMAMemoryAddress;
|
||||
u32 m_DMALength;
|
||||
u32 m_ImmData;
|
||||
|
||||
// get device
|
||||
IEXIDevice* GetDevice(u8 _CHIP_SELECT);
|
||||
|
||||
|
||||
// Devices
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,10 +26,10 @@
|
|||
|
||||
#include "../Core.h"
|
||||
#include "../ConfigManager.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- interface IEXIDevice ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- interface IEXIDevice ---
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void IEXIDevice::ImmWrite(u32 _uData, u32 _uSize)
|
||||
{
|
||||
while (_uSize--)
|
||||
|
@ -56,21 +56,21 @@ u32 IEXIDevice::ImmRead(u32 _uSize)
|
|||
void IEXIDevice::DMAWrite(u32 _uAddr, u32 _uSize)
|
||||
{
|
||||
// _dbg_assert_(EXPANSIONINTERFACE, 0);
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = Memory::Read_U8(_uAddr++);
|
||||
TransferByte(uByte);
|
||||
}
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = Memory::Read_U8(_uAddr++);
|
||||
TransferByte(uByte);
|
||||
}
|
||||
}
|
||||
|
||||
void IEXIDevice::DMARead(u32 _uAddr, u32 _uSize)
|
||||
void IEXIDevice::DMARead(u32 _uAddr, u32 _uSize)
|
||||
{
|
||||
// _dbg_assert_(EXPANSIONINTERFACE, 0);
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = 0;
|
||||
TransferByte(uByte);
|
||||
Memory::Write_U8(uByte, _uAddr++);
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = 0;
|
||||
TransferByte(uByte);
|
||||
Memory::Write_U8(uByte, _uAddr++);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -92,11 +92,10 @@ void IEXIDevice::SetCS(int _iCS)
|
|||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- class CEXIDummy ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// just a dummy that logs reads and writes
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Just a dummy that logs reads and writes
|
||||
// to be used for EXI devices we haven't emulated
|
||||
class CEXIDummy : public IEXIDevice
|
||||
{
|
||||
|
@ -112,15 +111,15 @@ public:
|
|||
|
||||
virtual ~CEXIDummy(){}
|
||||
|
||||
void ImmWrite(u32 data, u32 size){LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x",m_strName.c_str(),data);}
|
||||
u32 ImmRead (u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead",m_strName.c_str()); return 0;}
|
||||
void DMAWrite(u32 addr, u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device",m_strName.c_str(),size,addr);}
|
||||
void DMARead (u32 addr, u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x",m_strName.c_str(),size,addr);}
|
||||
void ImmWrite(u32 data, u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);}
|
||||
u32 ImmRead (u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;}
|
||||
void DMAWrite(u32 addr, u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
|
||||
void DMARead (u32 addr, u32 size) {LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);}
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// F A C T O R Y ////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// F A C T O R Y /////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice)
|
||||
{
|
||||
|
@ -131,11 +130,11 @@ IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice)
|
|||
break;
|
||||
|
||||
case EXIDEVICE_MEMORYCARD_A:
|
||||
return new CEXIMemoryCard("MemoryCardA", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strMemoryCardA, 0);
|
||||
return new CEXIMemoryCard("MemoryCardA", SConfig::GetInstance().m_strMemoryCardA, 0);
|
||||
break;
|
||||
|
||||
case EXIDEVICE_MEMORYCARD_B:
|
||||
return new CEXIMemoryCard("MemoryCardB", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strMemoryCardB, 1);
|
||||
return new CEXIMemoryCard("MemoryCardB", SConfig::GetInstance().m_strMemoryCardB, 1);
|
||||
break;
|
||||
|
||||
case EXIDEVICE_IPL:
|
||||
|
@ -145,7 +144,7 @@ IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice)
|
|||
case EXIDEVICE_AD16:
|
||||
return new CEXIAD16();
|
||||
break;
|
||||
|
||||
|
||||
case EXIDEVICE_MIC:
|
||||
return new CEXIMic(1);
|
||||
break;
|
||||
|
@ -157,4 +156,3 @@ IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,25 +23,25 @@
|
|||
class IEXIDevice
|
||||
{
|
||||
private:
|
||||
// byte transfer function for this device
|
||||
// Byte transfer function for this device
|
||||
virtual void TransferByte(u8& _byte) {};
|
||||
|
||||
public:
|
||||
// immediate copy functions
|
||||
// Immediate copy functions
|
||||
virtual void ImmWrite(u32 _uData, u32 _uSize);
|
||||
virtual u32 ImmRead(u32 _uSize);
|
||||
|
||||
// dma copy functions
|
||||
// DMA copy functions
|
||||
virtual void DMAWrite(u32 _uAddr, u32 _uSize);
|
||||
virtual void DMARead (u32 _uAddr, u32 _uSize);
|
||||
|
||||
virtual bool IsPresent();
|
||||
virtual void SetCS(int _iCS);
|
||||
|
||||
// update
|
||||
// Update
|
||||
virtual void Update();
|
||||
|
||||
// is generating interrupt ?
|
||||
// Is generating interrupt ?
|
||||
virtual bool IsInterruptSet();
|
||||
|
||||
virtual ~IEXIDevice() {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -15,117 +15,30 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
#include "Common.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "../ConfigManager.h"
|
||||
|
||||
#include "PeripheralInterface.h"
|
||||
|
||||
#include "../PluginManager.h"
|
||||
|
||||
#include "SI.h"
|
||||
#include "SI_Device.h"
|
||||
#include "SI_DeviceGCController.h"
|
||||
//////////////////////////////
|
||||
#include "SI_Channel.h"
|
||||
|
||||
|
||||
namespace SerialInterface
|
||||
{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
void RunSIBuffer();
|
||||
void UpdateInterrupts();
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
// SI Interrupt Types
|
||||
enum SIInterruptType
|
||||
{
|
||||
INT_RDSTINT = 0,
|
||||
INT_TCINT = 1,
|
||||
};
|
||||
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
|
||||
|
||||
// SI number of channels
|
||||
enum
|
||||
{
|
||||
NUMBER_OF_CHANNELS = 0x04
|
||||
};
|
||||
|
||||
// SI Internal Hardware Addresses
|
||||
enum
|
||||
{
|
||||
SI_CHANNEL_0_OUT = 0x00,
|
||||
SI_CHANNEL_0_IN_HI = 0x04,
|
||||
SI_CHANNEL_0_IN_LO = 0x08,
|
||||
SI_CHANNEL_1_OUT = 0x0C,
|
||||
SI_CHANNEL_1_IN_HI = 0x10,
|
||||
SI_CHANNEL_1_IN_LO = 0x14,
|
||||
SI_CHANNEL_2_OUT = 0x18,
|
||||
SI_CHANNEL_2_IN_HI = 0x1C,
|
||||
SI_CHANNEL_2_IN_LO = 0x20,
|
||||
SI_CHANNEL_3_OUT = 0x24,
|
||||
SI_CHANNEL_3_IN_HI = 0x28,
|
||||
SI_CHANNEL_3_IN_LO = 0x2C,
|
||||
SI_POLL = 0x30,
|
||||
SI_COM_CSR = 0x34,
|
||||
SI_STATUS_REG = 0x38,
|
||||
SI_EXI_CLOCK_COUNT = 0x3C,
|
||||
};
|
||||
|
||||
// SI Channel Output
|
||||
union USIChannelOut
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned OUTPUT1 : 8;
|
||||
unsigned OUTPUT0 : 8;
|
||||
unsigned CMD : 8;
|
||||
unsigned : 8;
|
||||
};
|
||||
};
|
||||
|
||||
// SI Channel Input High u32
|
||||
union USIChannelIn_Hi
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned INPUT3 : 8;
|
||||
unsigned INPUT2 : 8;
|
||||
unsigned INPUT1 : 8;
|
||||
unsigned INPUT0 : 6;
|
||||
unsigned ERRLATCH : 1; // 0: no error 1: Error latched. Check SISR.
|
||||
unsigned ERRSTAT : 1; // 0: no error 1: error on last transfer
|
||||
};
|
||||
};
|
||||
|
||||
// SI Channel Input Low u32
|
||||
union USIChannelIn_Lo
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned INPUT7 : 8;
|
||||
unsigned INPUT6 : 8;
|
||||
unsigned INPUT5 : 8;
|
||||
unsigned INPUT4 : 8;
|
||||
};
|
||||
};
|
||||
|
||||
// SI Channel
|
||||
struct SSIChannel
|
||||
{
|
||||
USIChannelOut m_Out;
|
||||
USIChannelIn_Hi m_InHi;
|
||||
USIChannelIn_Lo m_InLo;
|
||||
ISIDevice* m_pDevice;
|
||||
NUMBER_OF_CHANNELS = 4
|
||||
};
|
||||
|
||||
// SI Poll: Controls how often a device is polled
|
||||
|
@ -155,17 +68,17 @@ union USIComCSR
|
|||
struct
|
||||
{
|
||||
unsigned TSTART : 1;
|
||||
unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface.
|
||||
unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface.
|
||||
unsigned : 5;
|
||||
unsigned INLNGTH : 7;
|
||||
unsigned : 1;
|
||||
unsigned OUTLNGTH : 7; // Communication Channel Output Length in bytes
|
||||
unsigned OUTLNGTH : 7; // Communication Channel Output Length in bytes
|
||||
unsigned : 4;
|
||||
unsigned RDSTINTMSK : 1; // Read Status Interrupt Status Mask
|
||||
unsigned RDSTINT : 1; // Read Status Interrupt Status
|
||||
unsigned COMERR : 1; // Communication Error (set 0)
|
||||
unsigned TCINTMSK : 1; // Transfer Complete Interrupt Mask
|
||||
unsigned TCINT : 1; // Transfer Complete Interrupt
|
||||
unsigned RDSTINTMSK : 1; // Read Status Interrupt Status Mask
|
||||
unsigned RDSTINT : 1; // Read Status Interrupt Status
|
||||
unsigned COMERR : 1; // Communication Error (set 0)
|
||||
unsigned TCINTMSK : 1; // Transfer Complete Interrupt Mask
|
||||
unsigned TCINT : 1; // Transfer Complete Interrupt
|
||||
};
|
||||
USIComCSR() {Hex = 0;}
|
||||
USIComCSR(u32 _hex) {Hex = _hex;}
|
||||
|
@ -175,37 +88,37 @@ union USIComCSR
|
|||
union USIStatusReg
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned UNRUN3 : 1; // (RWC) write 1: bit cleared read 1 main proc underrun error
|
||||
unsigned OVRUN3 : 1; // (RWC) write 1: bit cleared read 1 overrun error
|
||||
unsigned COLL3 : 1; // (RWC) write 1: bit cleared read 1 collision error
|
||||
unsigned NOREP3 : 1; // (RWC) write 1: bit cleared read 1 response error
|
||||
unsigned WRST3 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST3 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 7:6
|
||||
unsigned UNRUN2 : 1; // (RWC) write 1: bit cleared read 1 main proc underrun error
|
||||
unsigned OVRUN2 : 1; // (RWC) write 1: bit cleared read 1 overrun error
|
||||
unsigned COLL2 : 1; // (RWC) write 1: bit cleared read 1 collision error
|
||||
unsigned NOREP2 : 1; // (RWC) write 1: bit cleared read 1 response error
|
||||
unsigned WRST2 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST2 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 15:14
|
||||
unsigned UNRUN1 : 1; // (RWC) write 1: bit cleared read 1 main proc underrun error
|
||||
unsigned OVRUN1 : 1; // (RWC) write 1: bit cleared read 1 overrun error
|
||||
unsigned COLL1 : 1; // (RWC) write 1: bit cleared read 1 collision error
|
||||
unsigned NOREP1 : 1; // (RWC) write 1: bit cleared read 1 response error
|
||||
unsigned WRST1 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST1 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 23:22
|
||||
unsigned UNRUN0 : 1; // (RWC) write 1: bit cleared read 1 main proc underrun error
|
||||
unsigned OVRUN0 : 1; // (RWC) write 1: bit cleared read 1 overrun error
|
||||
unsigned COLL0 : 1; // (RWC) write 1: bit cleared read 1 collision error
|
||||
unsigned NOREP0 : 1; // (RWC) write 1: bit cleared read 1 response error
|
||||
unsigned WRST0 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST0 : 1; // (R) 1: new Data available
|
||||
unsigned UNRUN3 : 1; // (RWC) write 1: bit cleared read 1: main proc underrun error
|
||||
unsigned OVRUN3 : 1; // (RWC) write 1: bit cleared read 1: overrun error
|
||||
unsigned COLL3 : 1; // (RWC) write 1: bit cleared read 1: collision error
|
||||
unsigned NOREP3 : 1; // (RWC) write 1: bit cleared read 1: response error
|
||||
unsigned WRST3 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST3 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 7:6
|
||||
unsigned UNRUN2 : 1; // (RWC) write 1: bit cleared read 1: main proc underrun error
|
||||
unsigned OVRUN2 : 1; // (RWC) write 1: bit cleared read 1: overrun error
|
||||
unsigned COLL2 : 1; // (RWC) write 1: bit cleared read 1: collision error
|
||||
unsigned NOREP2 : 1; // (RWC) write 1: bit cleared read 1: response error
|
||||
unsigned WRST2 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST2 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 15:14
|
||||
unsigned UNRUN1 : 1; // (RWC) write 1: bit cleared read 1: main proc underrun error
|
||||
unsigned OVRUN1 : 1; // (RWC) write 1: bit cleared read 1: overrun error
|
||||
unsigned COLL1 : 1; // (RWC) write 1: bit cleared read 1: collision error
|
||||
unsigned NOREP1 : 1; // (RWC) write 1: bit cleared read 1: response error
|
||||
unsigned WRST1 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST1 : 1; // (R) 1: new Data available
|
||||
unsigned : 2; // 23:22
|
||||
unsigned UNRUN0 : 1; // (RWC) write 1: bit cleared read 1: main proc underrun error
|
||||
unsigned OVRUN0 : 1; // (RWC) write 1: bit cleared read 1: overrun error
|
||||
unsigned COLL0 : 1; // (RWC) write 1: bit cleared read 1: collision error
|
||||
unsigned NOREP0 : 1; // (RWC) write 1: bit cleared read 1: response error
|
||||
unsigned WRST0 : 1; // (R) 1: buffer channel0 not copied
|
||||
unsigned RDST0 : 1; // (R) 1: new Data available
|
||||
unsigned : 1;
|
||||
unsigned WR : 1; // (RW) write 1 start copy, read 0 copy done
|
||||
unsigned WR : 1; // (RW) write 1 start copy, read 0 copy done
|
||||
};
|
||||
USIStatusReg() {Hex = 0;}
|
||||
USIStatusReg(u32 _hex) {Hex = _hex;}
|
||||
|
@ -223,12 +136,40 @@ union USIEXIClockCount
|
|||
};
|
||||
|
||||
// STATE_TO_SAVE
|
||||
static SSIChannel g_Channel[NUMBER_OF_CHANNELS];
|
||||
static USIPoll g_Poll;
|
||||
static USIComCSR g_ComCSR;
|
||||
static USIStatusReg g_StatusReg;
|
||||
static USIEXIClockCount g_EXIClockCount;
|
||||
static u8 g_SIBuffer[128];
|
||||
CSIChannel *g_Channel; // Save the channel state here?
|
||||
static USIPoll g_Poll;
|
||||
static USIComCSR g_ComCSR;
|
||||
static USIStatusReg g_StatusReg;
|
||||
static USIEXIClockCount g_EXIClockCount;
|
||||
static u8 g_SIBuffer[128];
|
||||
|
||||
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
|
||||
void RunSIBuffer();
|
||||
void UpdateInterrupts();
|
||||
|
||||
|
||||
void Init()
|
||||
{
|
||||
g_Channel = new CSIChannel[NUMBER_OF_CHANNELS];
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_CHANNELS; i++)
|
||||
{
|
||||
g_Channel[i].m_ChannelId = i;
|
||||
g_Channel[i].AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
|
||||
}
|
||||
|
||||
g_Poll.Hex = 0;
|
||||
g_ComCSR.Hex = 0;
|
||||
g_StatusReg.Hex = 0;
|
||||
g_EXIClockCount.Hex = 0;
|
||||
memset(g_SIBuffer, 0xce, 128);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
delete [] g_Channel;
|
||||
g_Channel = 0;
|
||||
}
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
|
@ -238,48 +179,6 @@ void DoState(PointerWrap &p)
|
|||
p.Do(g_StatusReg);
|
||||
p.Do(g_EXIClockCount);
|
||||
p.Do(g_SIBuffer);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize the Serial Interface
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
void Init()
|
||||
{
|
||||
// TODO: allow dynamic attaching/detaching of plugins
|
||||
// maybe this code should be in the pad plugin loader at all?
|
||||
for (int i = 0; i < NUMBER_OF_CHANNELS; i++)
|
||||
{
|
||||
g_Channel[i].m_Out.Hex = 0;
|
||||
g_Channel[i].m_InHi.Hex = 0;
|
||||
g_Channel[i].m_InLo.Hex = 0;
|
||||
|
||||
// Access the pad and check the MAXPADS limit
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(i);
|
||||
|
||||
// Check if this pad is attached for the current plugin
|
||||
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
||||
g_Channel[i].m_pDevice = new CSIDevice_GCController(i);
|
||||
else
|
||||
g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
|
||||
}
|
||||
|
||||
g_Poll.Hex = 0;
|
||||
g_ComCSR.Hex = 0;
|
||||
g_StatusReg.Hex = 0;
|
||||
g_EXIClockCount.Hex = 0;
|
||||
memset(g_SIBuffer, 0xce, 128);
|
||||
}
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
for (int i = 0; i < NUMBER_OF_CHANNELS; i++)
|
||||
{
|
||||
delete g_Channel[i].m_pDevice;
|
||||
g_Channel[i].m_pDevice = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
|
@ -294,104 +193,19 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
|||
return;
|
||||
}
|
||||
|
||||
// registers
|
||||
switch (_iAddress & 0x3FF)
|
||||
{
|
||||
//===================================================================================================
|
||||
// Channel 0
|
||||
//===================================================================================================
|
||||
case SI_CHANNEL_0_OUT:
|
||||
_uReturnValue = g_Channel[0].m_Out.Hex;
|
||||
return;
|
||||
// (shuffle2) these assignments are taken from EXI,
|
||||
// the iAddr amounted to the same, so I'm guessing the rest are too :D
|
||||
unsigned int iAddr = _iAddress & 0x3FF;
|
||||
unsigned int iRegister = (iAddr >> 2) % 5;
|
||||
unsigned int iChannel = (iAddr >> 2) / 5;
|
||||
|
||||
case SI_CHANNEL_0_IN_HI:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[0].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_0_IN_LO:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[0].m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//===================================================================================================
|
||||
// Channel 1
|
||||
//===================================================================================================
|
||||
case SI_CHANNEL_1_OUT:
|
||||
_uReturnValue = g_Channel[1].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_HI:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[1].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_LO:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[1].m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//===================================================================================================
|
||||
// Channel 2
|
||||
//===================================================================================================
|
||||
case SI_CHANNEL_2_OUT:
|
||||
_uReturnValue = g_Channel[2].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_HI:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[2].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_LO:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[2].m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//===================================================================================================
|
||||
// Channel 3
|
||||
//===================================================================================================
|
||||
case SI_CHANNEL_3_OUT:
|
||||
_uReturnValue = g_Channel[3].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_3_IN_HI:
|
||||
g_StatusReg.RDST3 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[3].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_3_IN_LO:
|
||||
g_StatusReg.RDST3 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[3].m_InLo.Hex;
|
||||
return;
|
||||
|
||||
case SI_POLL: _uReturnValue = g_Poll.Hex; return;
|
||||
case SI_COM_CSR: _uReturnValue = g_ComCSR.Hex; return;
|
||||
case SI_STATUS_REG: _uReturnValue = g_StatusReg.Hex; return;
|
||||
|
||||
case SI_EXI_CLOCK_COUNT: _uReturnValue = g_EXIClockCount.Hex; return;
|
||||
|
||||
default:
|
||||
LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
|
||||
_dbg_assert_(SERIALINTERFACE,0);
|
||||
break;
|
||||
}
|
||||
|
||||
// error
|
||||
_uReturnValue = 0xdeadbeef;
|
||||
if (iChannel < NUMBER_OF_CHANNELS)
|
||||
g_Channel[iChannel].Read32(_uReturnValue, iAddr);
|
||||
}
|
||||
|
||||
void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
{
|
||||
LOGV(SERIALINTERFACE, 3, "(w32): 0x%08x 0x%08x", _iValue,_iAddress);
|
||||
LOGV(SERIALINTERFACE, 3, "(w32): 0x%08x 0x%08x", _iValue, _iAddress);
|
||||
|
||||
// SIBuffer
|
||||
if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
|
||||
|
@ -401,101 +215,12 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
|||
return;
|
||||
}
|
||||
|
||||
// registers
|
||||
switch (_iAddress & 0x3FF)
|
||||
{
|
||||
case SI_CHANNEL_0_OUT: g_Channel[0].m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_0_IN_HI: g_Channel[0].m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_0_IN_LO: g_Channel[0].m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_OUT: g_Channel[1].m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_IN_HI: g_Channel[1].m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_IN_LO: g_Channel[1].m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_OUT: g_Channel[2].m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_IN_HI: g_Channel[2].m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_IN_LO: g_Channel[2].m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_OUT: g_Channel[3].m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_IN_HI: g_Channel[3].m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break;
|
||||
int iAddr = _iAddress & 0x3FF;
|
||||
int iRegister = (iAddr >> 2) % 5;
|
||||
int iChannel = (iAddr >> 2) / 5;
|
||||
|
||||
case SI_POLL:
|
||||
g_Poll.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case SI_COM_CSR:
|
||||
{
|
||||
USIComCSR tmpComCSR(_iValue);
|
||||
|
||||
g_ComCSR.CHANNEL = tmpComCSR.CHANNEL;
|
||||
g_ComCSR.INLNGTH = tmpComCSR.INLNGTH;
|
||||
g_ComCSR.OUTLNGTH = tmpComCSR.OUTLNGTH;
|
||||
g_ComCSR.RDSTINTMSK = tmpComCSR.RDSTINTMSK;
|
||||
g_ComCSR.TCINTMSK = tmpComCSR.TCINTMSK;
|
||||
|
||||
g_ComCSR.COMERR = 0;
|
||||
|
||||
if (tmpComCSR.RDSTINT) g_ComCSR.RDSTINT = 0;
|
||||
if (tmpComCSR.TCINT) g_ComCSR.TCINT = 0;
|
||||
|
||||
// be careful: runsi-buffer after updating the INT flags
|
||||
if (tmpComCSR.TSTART) RunSIBuffer();
|
||||
UpdateInterrupts();
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_STATUS_REG:
|
||||
{
|
||||
USIStatusReg tmpStatus(_iValue);
|
||||
|
||||
// just update the writable bits
|
||||
g_StatusReg.NOREP0 = tmpStatus.NOREP0 ? 1 : 0;
|
||||
g_StatusReg.COLL0 = tmpStatus.COLL0 ? 1 : 0;
|
||||
g_StatusReg.OVRUN0 = tmpStatus.OVRUN0 ? 1 : 0;
|
||||
g_StatusReg.UNRUN0 = tmpStatus.UNRUN0 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP1 = tmpStatus.NOREP1 ? 1 : 0;
|
||||
g_StatusReg.COLL1 = tmpStatus.COLL1 ? 1 : 0;
|
||||
g_StatusReg.OVRUN1 = tmpStatus.OVRUN1 ? 1 : 0;
|
||||
g_StatusReg.UNRUN1 = tmpStatus.UNRUN1 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP2 = tmpStatus.NOREP2 ? 1 : 0;
|
||||
g_StatusReg.COLL2 = tmpStatus.COLL2 ? 1 : 0;
|
||||
g_StatusReg.OVRUN2 = tmpStatus.OVRUN2 ? 1 : 0;
|
||||
g_StatusReg.UNRUN2 = tmpStatus.UNRUN2 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP3 = tmpStatus.NOREP3 ? 1 : 0;
|
||||
g_StatusReg.COLL3 = tmpStatus.COLL3 ? 1 : 0;
|
||||
g_StatusReg.OVRUN3 = tmpStatus.OVRUN3 ? 1 : 0;
|
||||
g_StatusReg.UNRUN3 = tmpStatus.UNRUN3 ? 1 : 0;
|
||||
|
||||
// send command to devices
|
||||
if (tmpStatus.WR)
|
||||
{
|
||||
g_StatusReg.WR = 0;
|
||||
g_Channel[0].m_pDevice->SendCommand(g_Channel[0].m_Out.Hex);
|
||||
g_Channel[1].m_pDevice->SendCommand(g_Channel[1].m_Out.Hex);
|
||||
g_Channel[2].m_pDevice->SendCommand(g_Channel[2].m_Out.Hex);
|
||||
g_Channel[3].m_pDevice->SendCommand(g_Channel[3].m_Out.Hex);
|
||||
|
||||
g_StatusReg.WRST0 = 0;
|
||||
g_StatusReg.WRST1 = 0;
|
||||
g_StatusReg.WRST2 = 0;
|
||||
g_StatusReg.WRST3 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_EXI_CLOCK_COUNT:
|
||||
g_EXIClockCount.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
LOG(SERIALINTERFACE, "WII something at 0xCD006480");
|
||||
break;
|
||||
|
||||
default:
|
||||
_dbg_assert_(SERIALINTERFACE,0);
|
||||
break;
|
||||
}
|
||||
if (iChannel < NUMBER_OF_CHANNELS)
|
||||
g_Channel[iChannel].Write32(_iValue, iAddr);
|
||||
}
|
||||
|
||||
void UpdateInterrupts()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,4 +33,5 @@ void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
|
|||
void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
|
||||
|
||||
}; // end of namespace SerialInterface
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,257 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "SI_Channel.h"
|
||||
#include "SI.h"
|
||||
#include "PeripheralInterface.h"
|
||||
#include "../PowerPC/PowerPC.h"
|
||||
|
||||
#include "SI.cpp"
|
||||
using namespace SerialInterface;
|
||||
|
||||
CSIChannel::CSIChannel()
|
||||
{
|
||||
m_Out.Hex = 0;
|
||||
m_InHi.Hex = 0;
|
||||
m_InLo.Hex = 0;
|
||||
|
||||
m_pDevice = SIDevice_Create(SI_DUMMY, m_ChannelId);
|
||||
_dbg_assert_(SERIALINTERFACE, m_pDevice != NULL);
|
||||
}
|
||||
|
||||
CSIChannel::~CSIChannel()
|
||||
{
|
||||
RemoveDevice();
|
||||
}
|
||||
|
||||
void CSIChannel::AddDevice(const TSIDevices _device, int _iDeviceNumber)
|
||||
{
|
||||
//_dbg_assert_(SERIALINTERFACE, _iSlot < NUM_DEVICES);
|
||||
|
||||
// delete the old device
|
||||
RemoveDevice();
|
||||
|
||||
// create the new one
|
||||
m_pDevice = SIDevice_Create(_device, _iDeviceNumber);
|
||||
_dbg_assert_(SERIALINTERFACE, m_pDevice != NULL);
|
||||
}
|
||||
|
||||
void CSIChannel::RemoveDevice()
|
||||
{
|
||||
if (m_pDevice != NULL)
|
||||
{
|
||||
delete m_pDevice;
|
||||
m_pDevice = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSIChannel::Read32(u32& _uReturnValue, const u32 _iAddr)
|
||||
{
|
||||
// registers
|
||||
switch (_iAddr)
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Channel 0
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case SI_CHANNEL_0_OUT:
|
||||
_uReturnValue = m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_0_IN_HI:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_0_IN_LO:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Channel 1
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case SI_CHANNEL_1_OUT:
|
||||
_uReturnValue = m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_HI:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_LO:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Channel 2
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case SI_CHANNEL_2_OUT:
|
||||
_uReturnValue = m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_HI:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_LO:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InLo.Hex;
|
||||
return;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Channel 3
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case SI_CHANNEL_3_OUT:
|
||||
_uReturnValue = m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_3_IN_HI:
|
||||
g_StatusReg.RDST3 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_3_IN_LO:
|
||||
g_StatusReg.RDST3 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = m_InLo.Hex;
|
||||
return;
|
||||
|
||||
case SI_POLL: _uReturnValue = g_Poll.Hex; return;
|
||||
case SI_COM_CSR: _uReturnValue = g_ComCSR.Hex; return;
|
||||
case SI_STATUS_REG: _uReturnValue = g_StatusReg.Hex; return;
|
||||
|
||||
case SI_EXI_CLOCK_COUNT: _uReturnValue = g_EXIClockCount.Hex; return;
|
||||
|
||||
default:
|
||||
// (shuffle2) FIX!
|
||||
//LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
|
||||
_dbg_assert_(SERIALINTERFACE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// error
|
||||
_uReturnValue = 0xdeadbeef;
|
||||
}
|
||||
|
||||
void CSIChannel::Write32(const u32 _iValue, const u32 iAddr)
|
||||
{
|
||||
// registers
|
||||
switch (iAddr)
|
||||
{
|
||||
case SI_CHANNEL_0_OUT: m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_0_IN_HI: m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_0_IN_LO: m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_OUT: m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_IN_HI: m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_1_IN_LO: m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_OUT: m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_IN_HI: m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_2_IN_LO: m_InLo.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_OUT: m_Out.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_IN_HI: m_InHi.Hex = _iValue; break;
|
||||
case SI_CHANNEL_3_IN_LO: m_InLo.Hex = _iValue; break;
|
||||
|
||||
case SI_POLL:
|
||||
g_Poll.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case SI_COM_CSR:
|
||||
{
|
||||
USIComCSR tmpComCSR(_iValue);
|
||||
|
||||
g_ComCSR.CHANNEL = tmpComCSR.CHANNEL;
|
||||
g_ComCSR.INLNGTH = tmpComCSR.INLNGTH;
|
||||
g_ComCSR.OUTLNGTH = tmpComCSR.OUTLNGTH;
|
||||
g_ComCSR.RDSTINTMSK = tmpComCSR.RDSTINTMSK;
|
||||
g_ComCSR.TCINTMSK = tmpComCSR.TCINTMSK;
|
||||
|
||||
g_ComCSR.COMERR = 0;
|
||||
|
||||
if (tmpComCSR.RDSTINT) g_ComCSR.RDSTINT = 0;
|
||||
if (tmpComCSR.TCINT) g_ComCSR.TCINT = 0;
|
||||
|
||||
// be careful: RunSIBuffer after updating the INT flags
|
||||
if (tmpComCSR.TSTART) RunSIBuffer();
|
||||
UpdateInterrupts();
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_STATUS_REG:
|
||||
{
|
||||
USIStatusReg tmpStatus(_iValue);
|
||||
|
||||
// just update the writable bits
|
||||
g_StatusReg.NOREP0 = tmpStatus.NOREP0 ? 1 : 0;
|
||||
g_StatusReg.COLL0 = tmpStatus.COLL0 ? 1 : 0;
|
||||
g_StatusReg.OVRUN0 = tmpStatus.OVRUN0 ? 1 : 0;
|
||||
g_StatusReg.UNRUN0 = tmpStatus.UNRUN0 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP1 = tmpStatus.NOREP1 ? 1 : 0;
|
||||
g_StatusReg.COLL1 = tmpStatus.COLL1 ? 1 : 0;
|
||||
g_StatusReg.OVRUN1 = tmpStatus.OVRUN1 ? 1 : 0;
|
||||
g_StatusReg.UNRUN1 = tmpStatus.UNRUN1 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP2 = tmpStatus.NOREP2 ? 1 : 0;
|
||||
g_StatusReg.COLL2 = tmpStatus.COLL2 ? 1 : 0;
|
||||
g_StatusReg.OVRUN2 = tmpStatus.OVRUN2 ? 1 : 0;
|
||||
g_StatusReg.UNRUN2 = tmpStatus.UNRUN2 ? 1 : 0;
|
||||
|
||||
g_StatusReg.NOREP3 = tmpStatus.NOREP3 ? 1 : 0;
|
||||
g_StatusReg.COLL3 = tmpStatus.COLL3 ? 1 : 0;
|
||||
g_StatusReg.OVRUN3 = tmpStatus.OVRUN3 ? 1 : 0;
|
||||
g_StatusReg.UNRUN3 = tmpStatus.UNRUN3 ? 1 : 0;
|
||||
|
||||
// send command to devices
|
||||
if (tmpStatus.WR)
|
||||
{
|
||||
g_StatusReg.WR = 0;
|
||||
m_pDevice->SendCommand(m_Out.Hex);
|
||||
m_pDevice->SendCommand(m_Out.Hex);
|
||||
m_pDevice->SendCommand(m_Out.Hex);
|
||||
m_pDevice->SendCommand(m_Out.Hex);
|
||||
|
||||
g_StatusReg.WRST0 = 0;
|
||||
g_StatusReg.WRST1 = 0;
|
||||
g_StatusReg.WRST2 = 0;
|
||||
g_StatusReg.WRST3 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_EXI_CLOCK_COUNT:
|
||||
g_EXIClockCount.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
LOG(SERIALINTERFACE, "WII something at 0xCD006480");
|
||||
break;
|
||||
|
||||
default:
|
||||
_dbg_assert_(SERIALINTERFACE,0);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#ifndef _SICHANNEL_H
|
||||
#define _SICHANNEL_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include "SI_Device.h"
|
||||
|
||||
class CSIChannel
|
||||
{
|
||||
private:
|
||||
// SI Internal Hardware Addresses
|
||||
enum
|
||||
{
|
||||
SI_CHANNEL_0_OUT = 0x00,
|
||||
SI_CHANNEL_0_IN_HI = 0x04,
|
||||
SI_CHANNEL_0_IN_LO = 0x08,
|
||||
SI_CHANNEL_1_OUT = 0x0C,
|
||||
SI_CHANNEL_1_IN_HI = 0x10,
|
||||
SI_CHANNEL_1_IN_LO = 0x14,
|
||||
SI_CHANNEL_2_OUT = 0x18,
|
||||
SI_CHANNEL_2_IN_HI = 0x1C,
|
||||
SI_CHANNEL_2_IN_LO = 0x20,
|
||||
SI_CHANNEL_3_OUT = 0x24,
|
||||
SI_CHANNEL_3_IN_HI = 0x28,
|
||||
SI_CHANNEL_3_IN_LO = 0x2C,
|
||||
SI_POLL = 0x30,
|
||||
SI_COM_CSR = 0x34,
|
||||
SI_STATUS_REG = 0x38,
|
||||
SI_EXI_CLOCK_COUNT = 0x3C,
|
||||
};
|
||||
|
||||
// SI Channel Output
|
||||
union USIChannelOut
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned OUTPUT1 : 8;
|
||||
unsigned OUTPUT0 : 8;
|
||||
unsigned CMD : 8;
|
||||
unsigned : 8;
|
||||
};
|
||||
};
|
||||
|
||||
// SI Channel Input High u32
|
||||
union USIChannelIn_Hi
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned INPUT3 : 8;
|
||||
unsigned INPUT2 : 8;
|
||||
unsigned INPUT1 : 8;
|
||||
unsigned INPUT0 : 6;
|
||||
unsigned ERRLATCH : 1; // 0: no error 1: Error latched. Check SISR.
|
||||
unsigned ERRSTAT : 1; // 0: no error 1: error on last transfer
|
||||
};
|
||||
};
|
||||
|
||||
// SI Channel Input Low u32
|
||||
union USIChannelIn_Lo
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned INPUT7 : 8;
|
||||
unsigned INPUT6 : 8;
|
||||
unsigned INPUT5 : 8;
|
||||
unsigned INPUT4 : 8;
|
||||
};
|
||||
};
|
||||
public: // HAX
|
||||
// SI Channel
|
||||
USIChannelOut m_Out;
|
||||
USIChannelIn_Hi m_InHi;
|
||||
USIChannelIn_Lo m_InLo;
|
||||
ISIDevice* m_pDevice;
|
||||
|
||||
//public:
|
||||
// ChannelId for debugging
|
||||
u32 m_ChannelId;
|
||||
|
||||
CSIChannel();
|
||||
~CSIChannel();
|
||||
|
||||
void AddDevice(const TSIDevices _device, int _iSlot);
|
||||
|
||||
// Remove the device
|
||||
void RemoveDevice();
|
||||
|
||||
void Read32(u32& _uReturnValue, const u32 _iRegister);
|
||||
void Write32(const u32 _iValue, const u32 _iRegister);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,11 +16,12 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "SI_Device.h"
|
||||
#include "SI_DeviceGCController.h"
|
||||
#include "SI_DeviceGBA.h"
|
||||
|
||||
// =====================================================================================================
|
||||
// --- base class ---
|
||||
// =====================================================================================================
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- interface ISIDevice ---
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -29,7 +30,7 @@ int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
|
|||
char szTemp[256] = "";
|
||||
int num = 0;
|
||||
while(num < _iLength)
|
||||
{
|
||||
{
|
||||
char szTemp2[128] = "";
|
||||
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]);
|
||||
strcat(szTemp, szTemp2);
|
||||
|
@ -39,32 +40,58 @@ int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
|
|||
{
|
||||
LOG(SERIALINTERFACE, szTemp);
|
||||
szTemp[0] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG(SERIALINTERFACE, szTemp);
|
||||
LOG(SERIALINTERFACE, szTemp);
|
||||
#endif
|
||||
return 0;
|
||||
};
|
||||
|
||||
// =====================================================================================================
|
||||
// --- dummy device ---
|
||||
// =====================================================================================================
|
||||
|
||||
CSIDevice_Dummy::CSIDevice_Dummy(int _iDeviceNumber) :
|
||||
ISIDevice(_iDeviceNumber)
|
||||
{}
|
||||
|
||||
int CSIDevice_Dummy::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- class CSIDummy ---
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Just a dummy that logs reads and writes
|
||||
// to be used for SI devices we haven't emulated
|
||||
class CSIDevice_Dummy : public ISIDevice
|
||||
{
|
||||
reinterpret_cast<u32*>(_pBuffer)[0] = 0x00000000; // no device
|
||||
return 4;
|
||||
}
|
||||
public:
|
||||
CSIDevice_Dummy(int _iDeviceNumber) :
|
||||
ISIDevice(_iDeviceNumber)
|
||||
{}
|
||||
|
||||
bool CSIDevice_Dummy::GetData(u32& _Hi, u32& _Low)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual ~CSIDevice_Dummy(){}
|
||||
|
||||
void CSIDevice_Dummy::SendCommand(u32 _Cmd)
|
||||
int RunBuffer(u8* _pBuffer, int _iLength)
|
||||
{
|
||||
// (shuffle2) Logging of this function will be done above, in ISIDevice::RunBuffer
|
||||
// No device. (shuffle2) Maybe this should be SI_ERROR_NO_RESPONSE?
|
||||
reinterpret_cast<u32*>(_pBuffer)[0] = 0x00000000;
|
||||
return 4;
|
||||
}
|
||||
|
||||
bool GetData(u32& _Hi, u32& _Low) {LOG(SERIALINTERFACE, "SI DUMMY %i GetData", this->m_iDeviceNumber); return false;}
|
||||
void SendCommand(u32 _Cmd) {LOG(SERIALINTERFACE, "SI DUMMY %i SendCommand: %08x", this->m_iDeviceNumber, _Cmd);}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// F A C T O R Y /////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ISIDevice* SIDevice_Create(TSIDevices _SIDevice, int _iDeviceNumber)
|
||||
{
|
||||
switch(_SIDevice)
|
||||
{
|
||||
case SI_DUMMY:
|
||||
return new CSIDevice_Dummy(_iDeviceNumber);
|
||||
break;
|
||||
|
||||
case SI_GC_CONTROLLER:
|
||||
return new CSIDevice_GCController(_iDeviceNumber);
|
||||
break;
|
||||
|
||||
case SI_GBA:
|
||||
return new CSIDevice_GBA(_iDeviceNumber);
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,89 +20,57 @@
|
|||
|
||||
#include "Common.h"
|
||||
|
||||
#define SI_ERROR_NO_RESPONSE 0x0008 // nothing is attached
|
||||
#define SI_ERROR_UNKNOWN 0x0040 // unknown device is attached
|
||||
#define SI_ERROR_BUSY 0x0080 // still detecting
|
||||
// Devices can reply with these, but idk if we'll ever use them...
|
||||
#define SI_ERROR_NO_RESPONSE 0x0008 // Nothing is attached
|
||||
#define SI_ERROR_UNKNOWN 0x0040 // Unknown device is attached
|
||||
#define SI_ERROR_BUSY 0x0080 // Still detecting
|
||||
|
||||
// Device types
|
||||
#define SI_TYPE_MASK 0x18000000u
|
||||
#define SI_TYPE_N64 0x00000000u
|
||||
#define SI_TYPE_MASK 0x18000000u // ???
|
||||
#define SI_TYPE_GC 0x08000000u
|
||||
|
||||
// GameCube
|
||||
#define SI_GC_WIRELESS 0x80000000u
|
||||
#define SI_GC_NOMOTOR 0x20000000u // no rumble motor
|
||||
// GC Controller types
|
||||
#define SI_GC_NOMOTOR 0x20000000u // No rumble motor
|
||||
#define SI_GC_STANDARD 0x01000000u
|
||||
|
||||
// WaveBird
|
||||
#define SI_WIRELESS_RECEIVED 0x40000000u // 0: no wireless unit
|
||||
#define SI_WIRELESS_IR 0x04000000u // 0: IR 1: RF
|
||||
#define SI_WIRELESS_STATE 0x02000000u // 0: variable 1: fixed
|
||||
#define SI_WIRELESS_ORIGIN 0x00200000u // 0: invalid 1: valid
|
||||
#define SI_WIRELESS_FIX_ID 0x00100000u // 0: not fixed 1: fixed
|
||||
#define SI_WIRELESS_TYPE 0x000f0000u
|
||||
#define SI_WIRELESS_LITE_MASK 0x000c0000u // 0: normal 1: lite controller
|
||||
#define SI_WIRELESS_LITE 0x00040000u // 0: normal 1: lite controller
|
||||
#define SI_WIRELESS_CONT_MASK 0x00080000u // 0: non-controller 1: non-controller
|
||||
#define SI_WIRELESS_CONT 0x00000000u
|
||||
#define SI_WIRELESS_ID 0x00c0ff00u
|
||||
#define SI_WIRELESS_TYPE_ID (SI_WIRELESS_TYPE | SI_WIRELESS_ID)
|
||||
|
||||
// "Complete" IDs
|
||||
#define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000)
|
||||
#define SI_N64_MIC (SI_TYPE_N64 | 0x00010000)
|
||||
#define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000)
|
||||
#define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000)
|
||||
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
|
||||
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
|
||||
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
|
||||
#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
|
||||
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
|
||||
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
|
||||
|
||||
|
||||
class ISIDevice
|
||||
{
|
||||
protected:
|
||||
int m_iDeviceNumber;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
ISIDevice(int _iDeviceNumber) :
|
||||
m_iDeviceNumber(_iDeviceNumber)
|
||||
{}
|
||||
|
||||
// constructor
|
||||
ISIDevice(int _iDeviceNumber) :
|
||||
m_iDeviceNumber(_iDeviceNumber)
|
||||
{ }
|
||||
virtual ~ISIDevice() { }
|
||||
// Destructor
|
||||
virtual ~ISIDevice() {}
|
||||
|
||||
// run the SI Buffer
|
||||
// Run the SI Buffer
|
||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||
|
||||
// return true on new data
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low) = 0;
|
||||
|
||||
// send a command directly (no detour per buffer)
|
||||
// Send a command directly (no detour per buffer)
|
||||
virtual void SendCommand(u32 _Cmd) = 0;
|
||||
};
|
||||
|
||||
// =====================================================================================================
|
||||
// dummy - no device attached
|
||||
// =====================================================================================================
|
||||
|
||||
class CSIDevice_Dummy : public ISIDevice
|
||||
// SI Device IDs
|
||||
enum TSIDevices
|
||||
{
|
||||
public:
|
||||
|
||||
// constructor
|
||||
CSIDevice_Dummy(int _iDeviceNumber);
|
||||
|
||||
// run the SI Buffer
|
||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||
|
||||
// return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
||||
// send a command directly
|
||||
virtual void SendCommand(u32 _Cmd);
|
||||
SI_DUMMY = 0,
|
||||
SI_N64_MIC = 0x00010000,
|
||||
SI_N64_KEYBOARD = 0x00020000,
|
||||
SI_N64_MOUSE = 0x02000000,
|
||||
SI_N64_CONTROLLER = 0x05000000,
|
||||
SI_GBA = 0x00040000,
|
||||
SI_GC_CONTROLLER = (SI_TYPE_GC | SI_GC_STANDARD),
|
||||
SI_GC_KEYBOARD = (SI_TYPE_GC | 0x00200000),
|
||||
SI_GC_STEERING = SI_TYPE_GC, // (shuffle2)I think the "chainsaw" is the same (Or else it's just standard)
|
||||
};
|
||||
|
||||
extern ISIDevice* SIDevice_Create(TSIDevices _SIDevice, int _iDeviceNumber);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "SI_Device.h"
|
||||
#include "SI_DeviceGBA.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- GameBoy Advance ---
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSIDevice_GBA::CSIDevice_GBA(int _iDeviceNumber) :
|
||||
ISIDevice(_iDeviceNumber)
|
||||
{
|
||||
}
|
||||
|
||||
int CSIDevice_GBA::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
{
|
||||
// for debug logging only
|
||||
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
||||
|
||||
int iPosition = 0;
|
||||
while(iPosition < _iLength)
|
||||
{
|
||||
// read the command
|
||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
||||
iPosition++;
|
||||
|
||||
// handle it
|
||||
switch(command)
|
||||
{
|
||||
// NOTE: All "Send/Recieve" mentioned here is from dolphin's perspective,
|
||||
// NOT the GBA's
|
||||
// This means "Send"s are seen as CMDs to the GBA, and are therefor IMPORTANT :p
|
||||
// Also this means that we can randomly fill recieve bits and try for a fake gba...
|
||||
// for example, the ORd bits in RESET and STATUS are just some values to play with
|
||||
case CMD_RESET:
|
||||
{
|
||||
//Device Reset
|
||||
//Send 0xFF
|
||||
//Recieve 0x00
|
||||
//Recieve 0x04
|
||||
//Recieve from lower 8bits of SIOSTAT register
|
||||
|
||||
*(u32*)&_pBuffer[0] = SI_GBA|2;
|
||||
iPosition = _iLength; // break the while loop
|
||||
LOG(SERIALINTERFACE, "GBA CMD_RESET");
|
||||
}
|
||||
break;
|
||||
case CMD_STATUS:
|
||||
{
|
||||
//Type/Status Data Request
|
||||
//Send 0x00
|
||||
//Recieve 0x00
|
||||
//Recieve 0x04
|
||||
//Recieve from lower 8bits of SIOSTAT register
|
||||
|
||||
*(u32*)&_pBuffer[0] = SI_GBA|8;
|
||||
iPosition = _iLength; // break the while loop
|
||||
LOG(SERIALINTERFACE, "GBA CMD_STATUS");
|
||||
}
|
||||
break;
|
||||
case CMD_WRITE:
|
||||
{
|
||||
//GBA Data Write (to GBA)
|
||||
//Send 0x15
|
||||
//Send to Lower 8bits of JOY_RECV_L
|
||||
//Send to Upper 8bits of JOY_RECV_L
|
||||
//Send to Lower 8bits of JOY_RECV_H
|
||||
//Send to Upper 8bits of JOY_RECV_H
|
||||
//Receive from lower 8bits of SIOSTAT register
|
||||
|
||||
LOG(SERIALINTERFACE, "GBA CMD_WRITE");
|
||||
}
|
||||
break;
|
||||
case CMD_READ:
|
||||
{
|
||||
//GBA Data Read (from GBA)
|
||||
//Send 0x14
|
||||
//Receive from Lower 8bits of JOY_TRANS_L
|
||||
//Receive from Upper 8bits of JOY_TRANS_L
|
||||
//Receive from Lower 8bits of JOY_TRANS_H
|
||||
//Receive from Upper 8bits of JOY_TRANS_H
|
||||
//Receive from lower 8bits of SIOSTAT register
|
||||
|
||||
LOG(SERIALINTERFACE, "GBA CMD_READ");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG(SERIALINTERFACE, "unknown GBA command (0x%x)", command);
|
||||
iPosition = _iLength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return iPosition;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GetData
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool
|
||||
CSIDevice_GBA::GetData(u32& _Hi, u32& _Low)
|
||||
{
|
||||
LOG(SERIALINTERFACE, "GBA GetData Hi: 0x%x Low: 0x%x", _Hi, _Low);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SendCommand
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CSIDevice_GBA::SendCommand(u32 _Cmd)
|
||||
{
|
||||
LOG(SERIALINTERFACE, "GBA SendCommand: (0x%x)", _Cmd);
|
||||
}
|
|
@ -1,62 +1,78 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// =====================================================================================================
|
||||
// GameBoy Advance
|
||||
// =====================================================================================================
|
||||
|
||||
class CSIDevice_GBA : public ISIDevice
|
||||
{
|
||||
private:
|
||||
|
||||
// commands
|
||||
enum EBufferCommands
|
||||
{
|
||||
CMD_RESET = 0xFF,
|
||||
CMD_STATUS = 0x00,
|
||||
CMD_WRITE = 0x15,
|
||||
CMD_READ = 0x14
|
||||
};
|
||||
|
||||
//0x4000158 - JOYSTAT - Receive Status Register (R/W) (ON THE GBA)
|
||||
//Bit Explanation
|
||||
//0 Not used
|
||||
//1 Receive Status Flag (0=Remote GBA is/was receiving) (Read Only?)
|
||||
//2 Not used
|
||||
//3 Send Status Flag (1=Remote GBA is/was sending) (Read Only?)
|
||||
//4-5 General Purpose Flag (Not assigned, may be used for whatever purpose)
|
||||
//6-15 Not used
|
||||
//--------------------------------------
|
||||
//Bit 1 is automatically set when writing to local JOY_TRANS.
|
||||
//Bit 3 is automatically reset when reading from local JOY_RECV.
|
||||
|
||||
int DeviceNum;
|
||||
|
||||
public:
|
||||
|
||||
// constructor
|
||||
CSIDevice_GBA(int _iDeviceNumber);
|
||||
|
||||
// run the SI Buffer
|
||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||
|
||||
// return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
||||
// send a command directly
|
||||
virtual void SendCommand(u32 _Cmd);
|
||||
};
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _SI_DEVICEGBA_H
|
||||
#define _SI_DEVICEGBA_H
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GameBoy Advance
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CSIDevice_GBA : public ISIDevice
|
||||
{
|
||||
private:
|
||||
|
||||
// Commands
|
||||
enum EBufferCommands
|
||||
{
|
||||
CMD_RESET = 0xFF,
|
||||
CMD_STATUS = 0x00,
|
||||
CMD_WRITE = 0x15,
|
||||
CMD_READ = 0x14
|
||||
};
|
||||
|
||||
struct FAKE_JOYSTAT
|
||||
{
|
||||
unsigned unused : 1;
|
||||
unsigned stat_rec : 1;
|
||||
unsigned unused2 : 1;
|
||||
unsigned stat_send : 1;
|
||||
unsigned genpurpose : 2;
|
||||
unsigned unused3 :10;
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//0x4000158 - JOYSTAT - Receive Status Register (R/W) (ON THE GBA)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// NOTE: I am guessing that JOYSTAT == SIOSTAT, may be wrong
|
||||
//Bit Expl.
|
||||
//0 Not used
|
||||
//1 Receive Status Flag (0=Remote GBA is/was receiving) (Read Only?)
|
||||
//2 Not used
|
||||
//3 Send Status Flag (1=Remote GBA is/was sending) (Read Only?)
|
||||
//4-5 General Purpose Flag (Not assigned, may be used for whatever purpose)
|
||||
//6-15 Not used
|
||||
//--------------------------------------
|
||||
//0b0000000000 00 0 0 0 0
|
||||
//______________________________________
|
||||
//Bit 1 is automatically set when writing to local JOY_TRANS.
|
||||
//Bit 3 is automatically reset when reading from local JOY_RECV.
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
CSIDevice_GBA(int _iDeviceNumber);
|
||||
|
||||
// Run the SI Buffer
|
||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
||||
// Send a command directly
|
||||
virtual void SendCommand(u32 _Cmd);
|
||||
};
|
||||
#endif
|
|
@ -1,99 +0,0 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "SI_Device.h"
|
||||
#include "SI_DeviceGBAController.h"
|
||||
#include "../PluginManager.h"
|
||||
|
||||
#include "EXI_Device.h"
|
||||
|
||||
CSIDevice_GBA::CSIDevice_GBA(int _iDeviceNumber) :
|
||||
ISIDevice(_iDeviceNumber)
|
||||
{
|
||||
}
|
||||
|
||||
int CSIDevice_GBA::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
{
|
||||
// for debug logging only
|
||||
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
||||
|
||||
int iPosition = 0;
|
||||
while(iPosition < _iLength)
|
||||
{
|
||||
// read the command
|
||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
||||
iPosition++;
|
||||
|
||||
// handle it
|
||||
switch(command)
|
||||
{
|
||||
case CMD_RESET:
|
||||
{
|
||||
*(u32*)&_pBuffer[0] = SI_GBA;
|
||||
iPosition = _iLength; // break the while loop
|
||||
LOG(SERIALINTERFACE, "SI-GBA CMD_RESET");
|
||||
}
|
||||
break;
|
||||
case CMD_STATUS: //Same behavior as CMD_RESET: send 0x0004, then lower 8 bits of SIOSTAT
|
||||
{
|
||||
*(u32*)&_pBuffer[0] = SI_GBA;
|
||||
iPosition = _iLength; // break the while loop
|
||||
LOG(SERIALINTERFACE, "SI-GBA CMD_STATUS");
|
||||
}
|
||||
break;
|
||||
case CMD_WRITE:
|
||||
{
|
||||
LOG(SERIALINTERFACE, "SI-GBA CMD_WRITE");
|
||||
}
|
||||
break;
|
||||
case CMD_READ:
|
||||
{
|
||||
LOG(SERIALINTERFACE, "SI-GBA CMD_READ");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG(SERIALINTERFACE, "unknown SI-GBA command (0x%x)", command);
|
||||
//PanicAlert("SI: Unknown command");
|
||||
iPosition = _iLength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return iPosition;
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// GetData
|
||||
//
|
||||
bool
|
||||
CSIDevice_GBA::GetData(u32& _Hi, u32& _Low)
|
||||
{
|
||||
LOG(SERIALINTERFACE, "SI-GBA GetData Hi: (0x%x) Low: (0x%x)", _Hi, _Low);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// SendCommand
|
||||
//
|
||||
void
|
||||
CSIDevice_GBA::SendCommand(u32 _Cmd)
|
||||
{
|
||||
LOG(SERIALINTERFACE, "SI-GBA SendCommand: (0x%x)", _Cmd);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,9 +25,9 @@
|
|||
#include "EXI_Device.h"
|
||||
#include "EXI_DeviceMic.h"
|
||||
|
||||
// =====================================================================================================
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// --- standard gamecube controller ---
|
||||
// =====================================================================================================
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) :
|
||||
ISIDevice(_iDeviceNumber)
|
||||
|
@ -45,23 +45,23 @@ CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) :
|
|||
|
||||
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
{
|
||||
// for debug logging only
|
||||
// For debug logging only
|
||||
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
||||
|
||||
int iPosition = 0;
|
||||
while(iPosition < _iLength)
|
||||
{
|
||||
// read the command
|
||||
// Read the command
|
||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
||||
iPosition++;
|
||||
|
||||
// handle it
|
||||
// Handle it
|
||||
switch(command)
|
||||
{
|
||||
case CMD_RESET:
|
||||
{
|
||||
*(u32*)&_pBuffer[0] = SI_GC_CONTROLLER; // | SI_GC_NOMOTOR;
|
||||
iPosition = _iLength; // break the while loop
|
||||
iPosition = _iLength; // Break the while loop
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -109,11 +109,10 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
|
|||
return iPosition;
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GetData
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Return true on new data (max 7 Bytes and 6 bits ;)
|
||||
//
|
||||
bool
|
||||
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||
{
|
||||
|
@ -131,7 +130,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
_Low |= (u32)((u8)PadStatus.triggerLeft << 8);
|
||||
_Low |= (u32)((u8)PadStatus.substickY << 16);
|
||||
_Low |= (u32)((u8)PadStatus.substickX << 24);
|
||||
SetMic(PadStatus.MicButton);
|
||||
SetMic(PadStatus.MicButton); // This is dumb and should not be here
|
||||
|
||||
// F|RES:
|
||||
// i dunno if i should force it here
|
||||
|
@ -141,9 +140,9 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
return true;
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SendCommand
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CSIDevice_GCController::SendCommand(u32 _Cmd)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,15 +18,15 @@
|
|||
#ifndef _SI_DEVICEGCCONTROLLER_H
|
||||
#define _SI_DEVICEGCCONTROLLER_H
|
||||
|
||||
// =====================================================================================================
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// standard gamecube controller
|
||||
// =====================================================================================================
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CSIDevice_GCController : public ISIDevice
|
||||
{
|
||||
private:
|
||||
|
||||
// commands
|
||||
// Commands
|
||||
enum EBufferCommands
|
||||
{
|
||||
CMD_INVALID = 0xFFFFFFFF,
|
||||
|
@ -41,10 +41,10 @@ private:
|
|||
u8 unk_1;
|
||||
u8 uOriginStickX;
|
||||
u8 uOriginStickY;
|
||||
u8 uSubStickStickX; // ???
|
||||
u8 uSubStickStickY; // ???
|
||||
u8 uTrigger_L; // ???
|
||||
u8 uTrigger_R; // ???
|
||||
u8 uSubStickStickX; // ???
|
||||
u8 uSubStickStickY; // ???
|
||||
u8 uTrigger_L; // ???
|
||||
u8 uTrigger_R; // ???
|
||||
u8 unk_4;
|
||||
u8 unk_5;
|
||||
u8 unk_6;
|
||||
|
@ -75,16 +75,16 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
// constructor
|
||||
// Constructor
|
||||
CSIDevice_GCController(int _iDeviceNumber);
|
||||
|
||||
// run the SI Buffer
|
||||
// Run the SI Buffer
|
||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||
|
||||
// return true on new data
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
||||
// send a command directly
|
||||
// Send a command directly
|
||||
virtual void SendCommand(u32 _Cmd);
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// Include
|
||||
#include <string> // System
|
||||
#include <vector>
|
||||
|
||||
|
@ -28,14 +27,14 @@
|
|||
#include "ConfigManager.h"
|
||||
#include "Frame.h"
|
||||
|
||||
// Declarations and definitions
|
||||
|
||||
extern CFrame* main_frame;
|
||||
|
||||
// Event table
|
||||
|
||||
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
|
||||
|
||||
EVT_CLOSE(CConfigMain::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE, CConfigMain::CloseClick)
|
||||
EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick)
|
||||
|
||||
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
|
@ -43,8 +42,7 @@ EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged)
|
|||
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged)
|
||||
|
||||
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::InterfaceLanguageChanged)
|
||||
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
|
||||
|
||||
EVT_CHECKBOX(ID_ALLWAYS_HLEBIOS, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_USEDYNAREC, CConfigMain::CoreSettingsChanged)
|
||||
|
@ -55,6 +53,15 @@ EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
|
|||
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
|
||||
|
||||
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
|
||||
EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
|
||||
EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
|
||||
|
||||
EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
|
||||
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
|
||||
|
@ -80,7 +87,6 @@ EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
|
|||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Window class
|
||||
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
|
@ -116,8 +122,8 @@ CConfigMain::~CConfigMain()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
// Enable or disable objects
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Used to restrict changing of some options while emulator is running
|
||||
void CConfigMain::UpdateGUI()
|
||||
{
|
||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
|
@ -130,14 +136,16 @@ void CConfigMain::UpdateGUI()
|
|||
OptimizeQuantizers->Disable();
|
||||
SkipIdle->Disable();
|
||||
EnableCheats->Disable();
|
||||
|
||||
GamecubePage->Disable();
|
||||
// Disable GC Stuff, but devices should be dynamic soon
|
||||
GCSystemLang->Disable();
|
||||
GCEXIDevice[0]->Disable(); GCEXIDevice[1]->Disable(); GCEXIDevice[2]->Disable();
|
||||
GCMemcardPath[0]->Disable(); GCMemcardPath[1]->Disable();
|
||||
GCSIDevice[0]->Disable(); GCSIDevice[1]->Disable(); GCSIDevice[2]->Disable(); GCSIDevice[3]->Disable();
|
||||
WiiPage->Disable();
|
||||
PathsPage->Disable();
|
||||
PluginPage->Disable();
|
||||
}
|
||||
}
|
||||
// ==========================
|
||||
|
||||
void CConfigMain::CreateGUIControls()
|
||||
{
|
||||
|
@ -170,17 +178,17 @@ void CConfigMain::CreateGUIControls()
|
|||
Notebook->AddPage(PluginPage, wxT("Plugins"));
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// General page
|
||||
|
||||
// Core Settings
|
||||
// Basic Settings
|
||||
// Core Settings - Basic
|
||||
UseDualCore = new wxCheckBox(GeneralPage, ID_USEDUALCORE, wxT("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
UseDualCore->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
|
||||
SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
|
||||
EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
|
||||
// Advanced Settings
|
||||
// Core Settings - Advanced
|
||||
AllwaysHLEBIOS = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLEBIOS, wxT("HLE the BIOS all the time"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
AllwaysHLEBIOS->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios);
|
||||
UseDynaRec = new wxCheckBox(GeneralPage, ID_USEDYNAREC, wxT("Enable the JIT dynarec"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
@ -286,19 +294,62 @@ void CConfigMain::CreateGUIControls()
|
|||
sGeneralPage->Layout();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Gamecube page
|
||||
// IPL settings
|
||||
sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
|
||||
/*
|
||||
arrayStringFor_GCSystemLang.Add(wxT("English"));
|
||||
arrayStringFor_GCSystemLang.Add(wxT("German"));
|
||||
arrayStringFor_GCSystemLang.Add(wxT("French"));
|
||||
arrayStringFor_GCSystemLang.Add(wxT("Spanish"));
|
||||
arrayStringFor_GCSystemLang.Add(wxT("Italian"));
|
||||
arrayStringFor_GCSystemLang.Add(wxT("Dutch"));
|
||||
*/
|
||||
GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
|
||||
GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator);
|
||||
GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
// Devices
|
||||
wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings"));
|
||||
// EXI Devices
|
||||
wxStaticText *GCEXIDeviceText[3];
|
||||
GCEXIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTA_TEXT, wxT("Slot A"), wxDefaultPosition, wxDefaultSize);
|
||||
GCEXIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTB_TEXT, wxT("Slot B"), wxDefaultPosition, wxDefaultSize);
|
||||
GCEXIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SP1_TEXT, wxT("SP1 "), wxDefaultPosition, wxDefaultSize);
|
||||
GCEXIDeviceText[2]->SetToolTip(wxT("Serial Port 1 - This is the port the network adapter uses"));
|
||||
const wxString SlotDevices[] = {"null","Memory Card", "Mic"};
|
||||
const wxString SP1Devices[] = {"null","BBA"};
|
||||
GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, wxDefaultSize, 3, SlotDevices, 0, wxDefaultValidator);
|
||||
GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, wxDefaultSize, 3, SlotDevices, 0, wxDefaultValidator);
|
||||
GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, wxDefaultSize, 2, SP1Devices, 0, wxDefaultValidator);
|
||||
GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
|
||||
GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
bool isMemcard = false;
|
||||
if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_MEMORYCARD_A)
|
||||
isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[1]);
|
||||
else if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_MEMORYCARD_B)
|
||||
isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[1]);
|
||||
else if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_MIC)
|
||||
GCEXIDevice[i]->SetStringSelection(SlotDevices[2]);
|
||||
else if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_ETH)
|
||||
GCEXIDevice[i]->SetStringSelection(SP1Devices[1]);
|
||||
else
|
||||
GCEXIDevice[i]->SetStringSelection(wxT("null"));
|
||||
if (!isMemcard && i < 2)
|
||||
GCMemcardPath[i]->Disable();
|
||||
}
|
||||
//SI Devices
|
||||
wxStaticText *GCSIDeviceText[4];
|
||||
GCSIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 1"), wxDefaultPosition, wxDefaultSize);
|
||||
GCSIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 2"), wxDefaultPosition, wxDefaultSize);
|
||||
GCSIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 3"), wxDefaultPosition, wxDefaultSize);
|
||||
GCSIDeviceText[3] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 4"), wxDefaultPosition, wxDefaultSize);
|
||||
const wxString SIDevices[] = {"null","Standard Controller"};
|
||||
GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0, wxDefaultPosition, wxDefaultSize, 2, SIDevices, 0, wxDefaultValidator);
|
||||
GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1, wxDefaultPosition, wxDefaultSize, 2, SIDevices, 0, wxDefaultValidator);
|
||||
GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2, wxDefaultPosition, wxDefaultSize, 2, SIDevices, 0, wxDefaultValidator);
|
||||
GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3, wxDefaultPosition, wxDefaultSize, 2, SIDevices, 0, wxDefaultValidator);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (SConfig::GetInstance().m_SIDevice[i] == SI_GC_CONTROLLER)
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[1]);
|
||||
else
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[0]);
|
||||
}
|
||||
|
||||
sGamecube = new wxBoxSizer(wxVERTICAL);
|
||||
sGamecubeIPLSettings = new wxGridBagSizer(0, 0);
|
||||
|
@ -306,10 +357,30 @@ void CConfigMain::CreateGUIControls()
|
|||
sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
|
||||
sGamecube->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
|
||||
wxBoxSizer *sEXIDevices[4];
|
||||
wxBoxSizer *sSIDevices[4];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
sEXIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
sEXIDevices[i]->Add(GCEXIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sEXIDevices[i]->Add(GCEXIDevice[i], 0, wxALL, 5);
|
||||
if (i < 2)
|
||||
sEXIDevices[i]->Add(GCMemcardPath[i], 0, wxALL, 5);
|
||||
sbGamecubeDeviceSettings->Add(sEXIDevices[i]);
|
||||
}
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
sSIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
sSIDevices[i]->Add(GCSIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5);
|
||||
sbGamecubeDeviceSettings->Add(sSIDevices[i]);
|
||||
}
|
||||
sGamecube->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
|
||||
GamecubePage->SetSizer(sGamecube);
|
||||
sGamecube->Layout();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Wii page
|
||||
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
||||
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
|
||||
|
@ -328,10 +399,6 @@ void CConfigMain::CreateGUIControls()
|
|||
WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize);
|
||||
WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator);
|
||||
WiiAspectRatio->SetSelection(m_SYSCONF[IPL_AR]);
|
||||
/*
|
||||
arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang;
|
||||
arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0);
|
||||
*/
|
||||
WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
|
||||
WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
|
||||
WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]);
|
||||
|
@ -358,6 +425,7 @@ void CConfigMain::CreateGUIControls()
|
|||
sWii->Layout();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Paths page
|
||||
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
|
||||
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
|
||||
|
@ -396,6 +464,7 @@ void CConfigMain::CreateGUIControls()
|
|||
PathsPage->SetSizer(sPaths);
|
||||
sPaths->Layout();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Plugins page
|
||||
sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics"));
|
||||
GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
|
||||
|
@ -442,7 +511,7 @@ void CConfigMain::CreateGUIControls()
|
|||
|
||||
|
||||
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Close = new wxButton(this, wxID_CLOSE);
|
||||
|
||||
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
|
@ -463,10 +532,10 @@ void CConfigMain::CreateGUIControls()
|
|||
|
||||
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
EndModal((bRefreshList || bRefreshCache) ? wxID_OK : wxID_CLOSE);
|
||||
|
||||
/* First check that we did successfully populate m_SYSCONF earlier, otherwise don't
|
||||
save anything, it will be a corrupted file */
|
||||
// First check that we did successfully populate m_SYSCONF earlier, otherwise don't
|
||||
// save anything, it will be a corrupted file
|
||||
if(m_bSysconfOK)
|
||||
{
|
||||
// Save SYSCONF with the new settings
|
||||
|
@ -491,9 +560,8 @@ void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
|
|||
Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Core settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Core AND Interface settings
|
||||
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
|
@ -521,6 +589,11 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
|||
case ID_INTERFACE_WIIMOTE_SPEAKERS:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers = WiimoteStatusSpeakers->IsChecked();
|
||||
break;
|
||||
case ID_INTERFACE_LANG:
|
||||
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
|
||||
bRefreshList = true;
|
||||
bRefreshCache = true;
|
||||
break;
|
||||
|
||||
case ID_ALLWAYS_HLEBIOS: // Core
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AllwaysHLEBIOS->IsChecked();
|
||||
|
@ -546,18 +619,90 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GC settings
|
||||
void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
int sidevice = 0;
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_GC_SRAM_LNG:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = GCSystemLang->GetSelection();
|
||||
break;
|
||||
|
||||
case ID_GC_EXIDEVICE_SLOTA:
|
||||
switch (event.GetSelection())
|
||||
{
|
||||
case 1: // memcard
|
||||
SConfig::GetInstance().m_EXIDevice[0] = EXIDEVICE_MEMORYCARD_A;
|
||||
break;
|
||||
case 2: // mic
|
||||
SConfig::GetInstance().m_EXIDevice[0] = EXIDEVICE_MIC;
|
||||
break;
|
||||
default:
|
||||
SConfig::GetInstance().m_EXIDevice[0] = EXIDEVICE_DUMMY;
|
||||
break;
|
||||
}
|
||||
GCMemcardPath[0]->Enable(event.GetSelection() == 1);
|
||||
break;
|
||||
case ID_GC_EXIDEVICE_SLOTA_PATH:
|
||||
ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true);
|
||||
break;
|
||||
case ID_GC_EXIDEVICE_SLOTB:
|
||||
switch (event.GetSelection())
|
||||
{
|
||||
case 1: // memcard
|
||||
SConfig::GetInstance().m_EXIDevice[1] = EXIDEVICE_MEMORYCARD_B;
|
||||
break;
|
||||
case 2: // mic
|
||||
SConfig::GetInstance().m_EXIDevice[1] = EXIDEVICE_MIC;
|
||||
break;
|
||||
default:
|
||||
SConfig::GetInstance().m_EXIDevice[1] = EXIDEVICE_DUMMY;
|
||||
break;
|
||||
}
|
||||
GCMemcardPath[1]->Enable(event.GetSelection() == 1);
|
||||
break;
|
||||
case ID_GC_EXIDEVICE_SLOTB_PATH:
|
||||
ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
|
||||
break;
|
||||
case ID_GC_EXIDEVICE_SP1: // The only thing we emulate on SP1 is the BBA
|
||||
SConfig::GetInstance().m_EXIDevice[2] = event.GetSelection() ? EXIDEVICE_ETH : EXIDEVICE_DUMMY;
|
||||
break;
|
||||
|
||||
case ID_GC_SIDEVICE3:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE2:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE1:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE0:
|
||||
ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
|
||||
{
|
||||
std::string filename = std::string(wxFileSelector(wxT("Choose a file to open"),
|
||||
wxT(FULL_GC_USER_DIR), wxT(isSlotA ? GC_MEMCARDA:GC_MEMCARDB), wxEmptyString,
|
||||
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());
|
||||
if (!filename.empty())
|
||||
strMemcard = filename;
|
||||
}
|
||||
|
||||
void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
|
||||
{
|
||||
TSIDevices tempType;
|
||||
if (deviceName.compare("Standard Controller") == 0)
|
||||
tempType = SI_GC_CONTROLLER;
|
||||
else
|
||||
tempType = SI_DUMMY;
|
||||
|
||||
SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Wii settings
|
||||
void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
|
@ -585,8 +730,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Paths settings
|
||||
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
|
@ -645,12 +789,11 @@ void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
|
|||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().ToAscii();
|
||||
}
|
||||
|
||||
|
||||
// Plugins settings
|
||||
|
||||
// Update plugin filenames
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Plugin settings
|
||||
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
// Update plugin filenames
|
||||
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
|
@ -739,15 +882,3 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
|||
|
||||
return(false);
|
||||
}
|
||||
|
||||
void CConfigMain::InterfaceLanguageChanged( wxCommandEvent& event )
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_INTERFACE_LANG:
|
||||
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
|
||||
break;
|
||||
}
|
||||
bRefreshList = true;
|
||||
bRefreshCache = true;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ class CConfigMain
|
|||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE);
|
||||
virtual ~CConfigMain();
|
||||
|
||||
void OnClick(wxMouseEvent& event);
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
void OnSelectionChanged(wxCommandEvent& event);
|
||||
|
@ -72,7 +73,10 @@ class CConfigMain
|
|||
wxGridBagSizer* sGamecubeIPLSettings;
|
||||
wxArrayString arrayStringFor_GCSystemLang;
|
||||
wxStaticText* GCSystemLangText;
|
||||
wxChoice* GCSystemLang;
|
||||
wxChoice* GCSystemLang;
|
||||
wxChoice *GCEXIDevice[3];
|
||||
wxButton *GCMemcardPath[2];
|
||||
wxChoice *GCSIDevice[4];
|
||||
|
||||
wxBoxSizer* sWii; // Wii settings
|
||||
wxStaticBoxSizer* sbWiimoteSettings;
|
||||
|
@ -205,7 +209,7 @@ class CConfigMain
|
|||
ID_WIIPAGE,
|
||||
ID_PATHSPAGE,
|
||||
ID_PLUGINPAGE,
|
||||
ID_CLOSE,
|
||||
|
||||
ID_ALLWAYS_HLEBIOS,
|
||||
ID_USEDYNAREC,
|
||||
ID_USEDUALCORE,
|
||||
|
@ -213,9 +217,6 @@ class CConfigMain
|
|||
ID_OPTIMIZEQUANTIZERS,
|
||||
ID_IDLESKIP,
|
||||
ID_ENABLECHEATS,
|
||||
ID_ENABLEISOCACHE,
|
||||
ID_GC_SRAM_LNG_TEXT,
|
||||
ID_GC_SRAM_LNG,
|
||||
|
||||
ID_INTERFACE_CONFIRMSTOP, // Interface settings
|
||||
ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
|
||||
|
@ -223,9 +224,24 @@ class CConfigMain
|
|||
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
|
||||
ID_INTERFACE_THEME,
|
||||
|
||||
ID_GC_SRAM_LNG_TEXT,
|
||||
ID_GC_SRAM_LNG,
|
||||
ID_GC_EXIDEVICE_SLOTA_TEXT,
|
||||
ID_GC_EXIDEVICE_SLOTA,
|
||||
ID_GC_EXIDEVICE_SLOTA_PATH,
|
||||
ID_GC_EXIDEVICE_SLOTB_TEXT,
|
||||
ID_GC_EXIDEVICE_SLOTB,
|
||||
ID_GC_EXIDEVICE_SLOTB_PATH,
|
||||
ID_GC_EXIDEVICE_SP1_TEXT,
|
||||
ID_GC_EXIDEVICE_SP1,
|
||||
ID_GC_SIDEVICE_TEXT,
|
||||
ID_GC_SIDEVICE0,
|
||||
ID_GC_SIDEVICE1,
|
||||
ID_GC_SIDEVICE2,
|
||||
ID_GC_SIDEVICE3,
|
||||
|
||||
ID_WII_BT_BAR_TEXT,
|
||||
ID_WII_BT_BAR,
|
||||
|
||||
ID_WII_IPL_SSV,
|
||||
ID_WII_IPL_PGS,
|
||||
ID_WII_IPL_E60,
|
||||
|
@ -233,6 +249,7 @@ class CConfigMain
|
|||
ID_WII_IPL_AR,
|
||||
ID_WII_IPL_LNG_TEXT,
|
||||
ID_WII_IPL_LNG,
|
||||
|
||||
ID_ISOPATHS,
|
||||
ID_ADDISOPATH,
|
||||
ID_REMOVEISOPATH,
|
||||
|
@ -240,6 +257,7 @@ class CConfigMain
|
|||
ID_DEFAULTISO,
|
||||
ID_DVDROOT_TEXT,
|
||||
ID_DVDROOT,
|
||||
|
||||
ID_WIIMOTE_ABOUT,
|
||||
ID_WIIMOTE_CONFIG,
|
||||
ID_WIIMOTE_TEXT,
|
||||
|
@ -258,11 +276,13 @@ class CConfigMain
|
|||
ID_GRAPHIC_CB
|
||||
};
|
||||
|
||||
void CreateGUIControls(); void UpdateGUI();
|
||||
void CreateGUIControls();
|
||||
void UpdateGUI();
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CoreSettingsChanged(wxCommandEvent& event);
|
||||
void InterfaceLanguageChanged(wxCommandEvent& event);
|
||||
void GCSettingsChanged(wxCommandEvent& event);
|
||||
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
|
||||
void ChooseSIDevice(std::string deviceName, int deviceNum);
|
||||
void WiiSettingsChanged(wxCommandEvent& event);
|
||||
void ISOPathsSelectionChanged(wxCommandEvent& event);
|
||||
void AddRemoveISOPaths(wxCommandEvent& event);
|
||||
|
@ -270,9 +290,7 @@ class CConfigMain
|
|||
void DVDRootChanged(wxFileDirPickerEvent& event);
|
||||
|
||||
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
|
||||
|
||||
void CallConfig(wxChoice* _pChoice);
|
||||
|
||||
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
|
||||
};
|
||||
|
||||
|
|
|
@ -510,8 +510,7 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
|||
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
CConfigMain ConfigMain(this);
|
||||
ConfigMain.ShowModal();
|
||||
if (ConfigMain.bRefreshList)
|
||||
if (ConfigMain.ShowModal() == wxID_OK)
|
||||
m_GameListCtrl->Update(ConfigMain.bRefreshCache);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue