Merge pull request #166 from retr0s4ge/master
Implement basic support for multiple WiFi emulation levels
This commit is contained in:
commit
07d75886bc
|
@ -102,6 +102,8 @@ int TotalLagFrames;
|
|||
|
||||
TSCalInfo TSCal;
|
||||
|
||||
WifiEmulationLevel wifiEmulationLevel;
|
||||
|
||||
namespace DLDI
|
||||
{
|
||||
bool tryPatch(void* data, size_t size, unsigned int device);
|
||||
|
@ -1334,8 +1336,13 @@ void Sequencer::init()
|
|||
|
||||
|
||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||
wifi.enabled = true;
|
||||
wifi.timestamp = kWifiCycles;
|
||||
if(wifiEmulationLevel > WifiEmulationLevel_Off)
|
||||
{
|
||||
wifi.enabled = true;
|
||||
wifi.timestamp = kWifiCycles;
|
||||
}
|
||||
else
|
||||
wifi.enabled = false;
|
||||
#else
|
||||
wifi.enabled = false;
|
||||
#endif
|
||||
|
@ -1665,7 +1672,7 @@ u64 Sequencer::findNext()
|
|||
if(readslot1.isEnabled()) next = _fast_min(next,readslot1.next());
|
||||
|
||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||
next = _fast_min(next,wifi.next());
|
||||
if (wifiEmulationLevel > WifiEmulationLevel_Off) next = _fast_min(next,wifi.next());
|
||||
#endif
|
||||
|
||||
#define test(X,Y) if(dma_##X##_##Y .isEnabled()) next = _fast_min(next,dma_##X##_##Y .next());
|
||||
|
@ -1723,10 +1730,13 @@ void Sequencer::execHardware()
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_WIFI_COMM
|
||||
if(wifi.isTriggered())
|
||||
if(wifiEmulationLevel > WifiEmulationLevel_Off)
|
||||
{
|
||||
WIFI_usTrigger();
|
||||
wifi.timestamp += kWifiCycles;
|
||||
if(wifi.isTriggered())
|
||||
{
|
||||
WIFI_usTrigger();
|
||||
wifi.timestamp += kWifiCycles;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -217,6 +217,14 @@ enum NDS_CONSOLE_TYPE
|
|||
NDS_CONSOLE_TYPE_DSI = 0xFE
|
||||
};
|
||||
|
||||
enum WifiEmulationLevel
|
||||
{
|
||||
WifiEmulationLevel_Off = 0,
|
||||
WifiEmulationLevel_Normal = 10000,
|
||||
WifiEmulationLevel_Compatibility = 65535,
|
||||
};
|
||||
extern WifiEmulationLevel wifiEmulationLevel;
|
||||
|
||||
struct NDSSystem
|
||||
{
|
||||
s32 wifiCycle;
|
||||
|
@ -701,7 +709,8 @@ extern struct TCommonSettings
|
|||
|
||||
std::string run_advanscene_import;
|
||||
|
||||
} CommonSettings;
|
||||
};
|
||||
extern TCommonSettings CommonSettings;
|
||||
|
||||
void NDS_RunAdvansceneAutoImport();
|
||||
|
||||
|
|
|
@ -3328,6 +3328,16 @@ int _main()
|
|||
Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false;
|
||||
Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false;
|
||||
|
||||
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.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
|
||||
|
||||
|
@ -7066,6 +7076,17 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
int i;
|
||||
HWND cur;
|
||||
|
||||
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)
|
||||
CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE0 + CommonSettings.wifi.mode);
|
||||
else if(bSocketsAvailable)
|
||||
|
@ -7119,6 +7140,19 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
if(romloaded)
|
||||
val = MessageBox(hDlg, "The current ROM needs to be reset to apply changes.\nReset now ?", "DeSmuME", (MB_YESNO | MB_ICONQUESTION));
|
||||
|
||||
if (IsDlgCheckboxChecked(hDlg, IDC_WIFI_ENABLED))
|
||||
{
|
||||
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))
|
||||
CommonSettings.wifi.mode = 0;
|
||||
else
|
||||
|
|
|
@ -466,8 +466,10 @@
|
|||
#define IDC_EVALUE 1065
|
||||
#define IDC_TEX_DEPOSTERIZE2 1065
|
||||
#define IDC_TEX_SMOOTH 1065
|
||||
#define IDC_WIFI_ENABLED 1065
|
||||
#define IDC_STATIC_RANGE 1066
|
||||
#define IDC_TEXSCALE_1 1066
|
||||
#define IDC_WIFI_COMPAT 1066
|
||||
#define IDC_TEXSCALE_2 1067
|
||||
#define IDC_BADD 1068
|
||||
#define IDC_LIST 1069
|
||||
|
@ -1080,7 +1082,7 @@
|
|||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 128
|
||||
#define _APS_NEXT_COMMAND_VALUE 40150
|
||||
#define _APS_NEXT_CONTROL_VALUE 1065
|
||||
#define _APS_NEXT_CONTROL_VALUE 1066
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1236,19 +1236,21 @@ BEGIN
|
|||
LTEXT "frames",IDC_STATIC,428,167,16,8
|
||||
END
|
||||
|
||||
IDD_WIFISETTINGS DIALOGEX 0, 0, 331, 142
|
||||
IDD_WIFISETTINGS DIALOGEX 0, 0, 331, 158
|
||||
STYLE DS_SETFONT | DS_CENTER | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Wifi settings"
|
||||
FONT 8, "Ms Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,222,120,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,276,120,50,14
|
||||
GROUPBOX "Infrastructure settings",IDC_STATIC,6,60,319,54
|
||||
LTEXT "Bridge network adapter:",IDC_STATIC,12,78,306,8
|
||||
COMBOBOX IDC_BRIDGEADAPTER,12,90,306,45,CBS_DROPDOWNLIST | CBS_HASSTRINGS
|
||||
GROUPBOX "Wifi mode",IDC_STATIC,6,6,318,48
|
||||
CONTROL "Ad-hoc",IDC_WIFIMODE0,"Button",BS_AUTORADIOBUTTON,12,24,306,10
|
||||
CONTROL "Infrastructure",IDC_WIFIMODE1,"Button",BS_AUTORADIOBUTTON,12,36,306,10
|
||||
DEFPUSHBUTTON "OK",IDOK,222,136,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,276,136,50,14
|
||||
GROUPBOX "Infrastructure settings",IDC_STATIC,6,76,319,54
|
||||
LTEXT "Bridge network adapter:",IDC_STATIC,12,94,306,8
|
||||
COMBOBOX IDC_BRIDGEADAPTER,12,106,306,45,CBS_DROPDOWNLIST | CBS_HASSTRINGS
|
||||
GROUPBOX "Wifi mode",IDC_STATIC,6,22,318,48
|
||||
CONTROL "Ad-hoc",IDC_WIFIMODE0,"Button",BS_AUTORADIOBUTTON,12,40,306,10
|
||||
CONTROL "Infrastructure",IDC_WIFIMODE1,"Button",BS_AUTORADIOBUTTON,12,52,306,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
|
||||
|
||||
IDD_INPUTCONFIG DIALOGEX 0, 0, 339, 148
|
||||
|
@ -1915,7 +1917,7 @@ BEGIN
|
|||
|
||||
IDD_WIFISETTINGS, DIALOG
|
||||
BEGIN
|
||||
BOTTOMMARGIN, 140
|
||||
BOTTOMMARGIN, 156
|
||||
END
|
||||
|
||||
IDD_INPUTCONFIG, DIALOG
|
||||
|
|
Loading…
Reference in New Issue