Implement basic support for multiple WiFi emulation levels
This commit is contained in:
parent
09a545902d
commit
259ca8579f
|
@ -102,6 +102,8 @@ int TotalLagFrames;
|
||||||
|
|
||||||
TSCalInfo TSCal;
|
TSCalInfo TSCal;
|
||||||
|
|
||||||
|
WifiEmulationLevel wifiEmulationLevel;
|
||||||
|
|
||||||
namespace DLDI
|
namespace DLDI
|
||||||
{
|
{
|
||||||
bool tryPatch(void* data, size_t size, unsigned int device);
|
bool tryPatch(void* data, size_t size, unsigned int device);
|
||||||
|
@ -1334,7 +1336,7 @@ void Sequencer::init()
|
||||||
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||||
if(CommonSettings.wifi.emulated)
|
if(wifiEmulationLevel > WifiEmulationLevel::Off)
|
||||||
{
|
{
|
||||||
wifi.enabled = true;
|
wifi.enabled = true;
|
||||||
wifi.timestamp = kWifiCycles;
|
wifi.timestamp = kWifiCycles;
|
||||||
|
@ -1670,7 +1672,7 @@ u64 Sequencer::findNext()
|
||||||
if(readslot1.isEnabled()) next = _fast_min(next,readslot1.next());
|
if(readslot1.isEnabled()) next = _fast_min(next,readslot1.next());
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||||
if (CommonSettings.wifi.emulated) next = _fast_min(next,wifi.next());
|
if (wifiEmulationLevel > WifiEmulationLevel::Off) next = _fast_min(next,wifi.next());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define test(X,Y) if(dma_##X##_##Y .isEnabled()) next = _fast_min(next,dma_##X##_##Y .next());
|
#define test(X,Y) if(dma_##X##_##Y .isEnabled()) next = _fast_min(next,dma_##X##_##Y .next());
|
||||||
|
@ -1728,7 +1730,7 @@ void Sequencer::execHardware()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||||
if(CommonSettings.wifi.emulated)
|
if(wifiEmulationLevel > WifiEmulationLevel::Off)
|
||||||
{
|
{
|
||||||
if(wifi.isTriggered())
|
if(wifi.isTriggered())
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,6 +217,14 @@ enum NDS_CONSOLE_TYPE
|
||||||
NDS_CONSOLE_TYPE_DSI = 0xFE
|
NDS_CONSOLE_TYPE_DSI = 0xFE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class WifiEmulationLevel
|
||||||
|
{
|
||||||
|
Off = 0,
|
||||||
|
Normal = 10000,
|
||||||
|
Compatibility = 65535,
|
||||||
|
};
|
||||||
|
extern WifiEmulationLevel wifiEmulationLevel;
|
||||||
|
|
||||||
struct NDSSystem
|
struct NDSSystem
|
||||||
{
|
{
|
||||||
s32 wifiCycle;
|
s32 wifiCycle;
|
||||||
|
@ -565,7 +573,6 @@ extern struct TCommonSettings
|
||||||
strcpy(ARM7BIOS, "biosnds7.bin");
|
strcpy(ARM7BIOS, "biosnds7.bin");
|
||||||
strcpy(Firmware, "firmware.bin");
|
strcpy(Firmware, "firmware.bin");
|
||||||
|
|
||||||
wifi.emulated = false;
|
|
||||||
/* WIFI mode: adhoc = 0, infrastructure = 1 */
|
/* WIFI mode: adhoc = 0, infrastructure = 1 */
|
||||||
wifi.mode = 1;
|
wifi.mode = 1;
|
||||||
wifi.infraBridgeAdapter = 0;
|
wifi.infraBridgeAdapter = 0;
|
||||||
|
@ -649,7 +656,6 @@ extern struct TCommonSettings
|
||||||
u32 jit_max_block_size;
|
u32 jit_max_block_size;
|
||||||
|
|
||||||
struct _Wifi {
|
struct _Wifi {
|
||||||
bool emulated;
|
|
||||||
int mode;
|
int mode;
|
||||||
int infraBridgeAdapter;
|
int infraBridgeAdapter;
|
||||||
} wifi;
|
} wifi;
|
||||||
|
@ -703,7 +709,8 @@ extern struct TCommonSettings
|
||||||
|
|
||||||
std::string run_advanscene_import;
|
std::string run_advanscene_import;
|
||||||
|
|
||||||
} CommonSettings;
|
};
|
||||||
|
extern TCommonSettings CommonSettings;
|
||||||
|
|
||||||
void NDS_RunAdvansceneAutoImport();
|
void NDS_RunAdvansceneAutoImport();
|
||||||
|
|
||||||
|
|
|
@ -3328,7 +3328,16 @@ int _main()
|
||||||
Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false;
|
Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false;
|
||||||
Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false;
|
Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false;
|
||||||
|
|
||||||
CommonSettings.wifi.emulated = GetPrivateProfileBool("Wifi", "Emulated", false, IniName);
|
if (GetPrivateProfileBool("Wifi", "Enabled", false, IniName))
|
||||||
|
{
|
||||||
|
if (GetPrivateProfileBool("Wifi", "Compatibility Mode", false, IniName))
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Compatibility;
|
||||||
|
else
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Normal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Off;
|
||||||
|
|
||||||
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
|
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
|
||||||
CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
|
CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
|
||||||
|
|
||||||
|
@ -7067,7 +7076,16 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
int i;
|
int i;
|
||||||
HWND cur;
|
HWND cur;
|
||||||
|
|
||||||
CheckDlgItem(hDlg, IDC_WIFI_EMULATED, CommonSettings.wifi.emulated);
|
if (wifiEmulationLevel > WifiEmulationLevel::Off)
|
||||||
|
{
|
||||||
|
CheckDlgItem(hDlg, IDC_WIFI_ENABLED, true);
|
||||||
|
CheckDlgItem(hDlg, IDC_WIFI_COMPAT, wifiEmulationLevel == WifiEmulationLevel::Compatibility);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CheckDlgItem(hDlg, IDC_WIFI_ENABLED, false);
|
||||||
|
CheckDlgItem(hDlg, IDC_WIFI_COMPAT, GetPrivateProfileBool("Wifi", "Compatibility Mode", false, IniName));
|
||||||
|
}
|
||||||
|
|
||||||
if (bSocketsAvailable && bWinPCapAvailable)
|
if (bSocketsAvailable && bWinPCapAvailable)
|
||||||
CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE0 + CommonSettings.wifi.mode);
|
CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE0 + CommonSettings.wifi.mode);
|
||||||
|
@ -7122,8 +7140,18 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
if(romloaded)
|
if(romloaded)
|
||||||
val = MessageBox(hDlg, "The current ROM needs to be reset to apply changes.\nReset now ?", "DeSmuME", (MB_YESNO | MB_ICONQUESTION));
|
val = MessageBox(hDlg, "The current ROM needs to be reset to apply changes.\nReset now ?", "DeSmuME", (MB_YESNO | MB_ICONQUESTION));
|
||||||
|
|
||||||
CommonSettings.wifi.emulated = IsDlgCheckboxChecked(hDlg, IDC_WIFI_EMULATED);
|
if (IsDlgCheckboxChecked(hDlg, IDC_WIFI_ENABLED))
|
||||||
WritePrivateProfileBool("Wifi", "Emulated", CommonSettings.wifi.emulated, IniName);
|
{
|
||||||
|
if (IsDlgCheckboxChecked(hDlg, IDC_WIFI_COMPAT))
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Compatibility;
|
||||||
|
else
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Normal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wifiEmulationLevel = WifiEmulationLevel::Off;
|
||||||
|
|
||||||
|
WritePrivateProfileBool("Wifi", "Enabled", IsDlgCheckboxChecked(hDlg, IDC_WIFI_ENABLED), IniName);
|
||||||
|
WritePrivateProfileBool("Wifi", "Compatibility Mode", IsDlgCheckboxChecked(hDlg, IDC_WIFI_COMPAT), IniName);
|
||||||
|
|
||||||
if (IsDlgButtonChecked(hDlg, IDC_WIFIMODE0))
|
if (IsDlgButtonChecked(hDlg, IDC_WIFIMODE0))
|
||||||
CommonSettings.wifi.mode = 0;
|
CommonSettings.wifi.mode = 0;
|
||||||
|
|
|
@ -466,9 +466,10 @@
|
||||||
#define IDC_EVALUE 1065
|
#define IDC_EVALUE 1065
|
||||||
#define IDC_TEX_DEPOSTERIZE2 1065
|
#define IDC_TEX_DEPOSTERIZE2 1065
|
||||||
#define IDC_TEX_SMOOTH 1065
|
#define IDC_TEX_SMOOTH 1065
|
||||||
#define IDC_WIFI_EMULATED 1065
|
#define IDC_WIFI_ENABLED 1065
|
||||||
#define IDC_STATIC_RANGE 1066
|
#define IDC_STATIC_RANGE 1066
|
||||||
#define IDC_TEXSCALE_1 1066
|
#define IDC_TEXSCALE_1 1066
|
||||||
|
#define IDC_WIFI_COMPAT 1066
|
||||||
#define IDC_TEXSCALE_2 1067
|
#define IDC_TEXSCALE_2 1067
|
||||||
#define IDC_BADD 1068
|
#define IDC_BADD 1068
|
||||||
#define IDC_LIST 1069
|
#define IDC_LIST 1069
|
||||||
|
|
|
@ -1249,7 +1249,8 @@ BEGIN
|
||||||
GROUPBOX "Wifi mode",IDC_STATIC,6,22,318,48
|
GROUPBOX "Wifi mode",IDC_STATIC,6,22,318,48
|
||||||
CONTROL "Ad-hoc",IDC_WIFIMODE0,"Button",BS_AUTORADIOBUTTON,12,40,306,10
|
CONTROL "Ad-hoc",IDC_WIFIMODE0,"Button",BS_AUTORADIOBUTTON,12,40,306,10
|
||||||
CONTROL "Infrastructure",IDC_WIFIMODE1,"Button",BS_AUTORADIOBUTTON,12,52,306,10
|
CONTROL "Infrastructure",IDC_WIFIMODE1,"Button",BS_AUTORADIOBUTTON,12,52,306,10
|
||||||
CONTROL "Enable WiFi Emulation",IDC_WIFI_EMULATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,319,10
|
CONTROL "Enable WiFi Emulation",IDC_WIFI_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,150,10
|
||||||
|
CONTROL "Compatibility Mode",IDC_WIFI_COMPAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,6,150,10
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_INPUTCONFIG DIALOGEX 0, 0, 339, 148
|
IDD_INPUTCONFIG DIALOGEX 0, 0, 339, 148
|
||||||
|
|
Loading…
Reference in New Issue