Skip to content

Commit

Permalink
DEV9: windows support mostly done, unicode thingies to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GovanifY authored and refractionpcsx2 committed Oct 31, 2020
1 parent 149bcea commit eea4e38
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 292 deletions.
2 changes: 1 addition & 1 deletion pcsx2/CDVD/GzippedFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class GzippedFileReader : public AsyncFileReader
HANDLE hOverlappedFile;
OVERLAPPED asyncOperationContext;
bool asyncInProgress;
byte mDummyAsyncPrefetchTarget[GZFILE_READ_CHUNK_SIZE];
char mDummyAsyncPrefetchTarget[GZFILE_READ_CHUNK_SIZE];
#endif

void AsyncPrefetchReset();
Expand Down
5 changes: 3 additions & 2 deletions pcsx2/DEV9/DEV9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "PrecompiledHeader.h"
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600

#ifdef _WIN32
#include <winsock2.h>
//#include <winsock2.h>
#include <Winioctl.h>
#include <windows.h>
#elif defined(__linux__)
Expand Down Expand Up @@ -206,7 +207,7 @@ s32 DEV9init()

#ifdef _WIN32
hEeprom = CreateFile(
"eeprom.dat",
L"eeprom.dat",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
Expand Down
23 changes: 12 additions & 11 deletions pcsx2/DEV9/Win32/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,31 @@
*/


#include "PrecompiledHeader.h"
#include <stdlib.h>

#include <winsock2.h>
//#include <winsock2.h>
#include "..\DEV9.h"
#include "AppConfig.h"

BOOL WritePrivateProfileInt(LPCSTR lpAppName, LPCSTR lpKeyName, int intvar, LPCSTR lpFileName)
{
return WritePrivateProfileString(lpAppName, lpKeyName, std::to_string(intvar).c_str(), lpFileName);
return WritePrivateProfileStringA(lpAppName, lpKeyName, std::to_string(intvar).c_str(), lpFileName);
}
bool FileExists(std::string szPath)
{
DWORD dwAttrib = GetFileAttributes(szPath.c_str());
DWORD dwAttrib = GetFileAttributesA(szPath.c_str());
return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
!(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}

void SaveConf()
{
const std::string file(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
DeleteFile(file.c_str());
DeleteFileA(file.c_str());

WritePrivateProfileString("DEV9", "Eth", config.Eth, file.c_str());
WritePrivateProfileString("DEV9", "Hdd", config.Hdd, file.c_str());
WritePrivateProfileStringA("DEV9", "Eth", config.Eth, file.c_str());
WritePrivateProfileStringA("DEV9", "Hdd", config.Hdd, file.c_str());
WritePrivateProfileInt("DEV9", "HddSize", config.HddSize, file.c_str());
WritePrivateProfileInt("DEV9", "ethEnable", config.ethEnable, file.c_str());
WritePrivateProfileInt("DEV9", "hddEnable", config.hddEnable, file.c_str());
Expand All @@ -49,9 +50,9 @@ void LoadConf()
if (FileExists(file.c_str()) == false)
return;

GetPrivateProfileString("DEV9", "Eth", ETH_DEF, config.Eth, sizeof(config.Eth), file.c_str());
GetPrivateProfileString("DEV9", "Hdd", HDD_DEF, config.Hdd, sizeof(config.Hdd), file.c_str());
config.HddSize = GetPrivateProfileInt("DEV9", "HddSize", config.HddSize, file.c_str());
config.ethEnable = GetPrivateProfileInt("DEV9", "ethEnable", config.ethEnable, file.c_str());
config.hddEnable = GetPrivateProfileInt("DEV9", "hddEnable", config.hddEnable, file.c_str());
GetPrivateProfileStringA("DEV9", "Eth", ETH_DEF, config.Eth, sizeof(config.Eth), file.c_str());
GetPrivateProfileStringA("DEV9", "Hdd", HDD_DEF, config.Hdd, sizeof(config.Hdd), file.c_str());
config.HddSize = GetPrivateProfileIntA("DEV9", "HddSize", config.HddSize, file.c_str());
config.ethEnable = GetPrivateProfileIntA("DEV9", "ethEnable", config.ethEnable, file.c_str());
config.hddEnable = GetPrivateProfileIntA("DEV9", "hddEnable", config.hddEnable, file.c_str());
}
19 changes: 6 additions & 13 deletions pcsx2/DEV9/Win32/Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "PrecompiledHeader.h"
#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <windowsx.h>
//#include <windows.h>
//#include <windowsx.h>

#include "..\Config.h"
#include "resource.h"
Expand All @@ -38,7 +38,7 @@ void SysMessage(char* fmt, ...)
va_start(list, fmt);
vsprintf(tmp, fmt, list);
va_end(list);
MessageBox(0, tmp, "Dev9 Msg", 0);
MessageBoxA(0, tmp, "Dev9 Msg", 0);
}

void OnInitDialog(HWND hW)
Expand Down Expand Up @@ -71,7 +71,7 @@ void OnInitDialog(HWND hW)
}
}

Edit_SetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd);
SetWindowTextA(GetDlgItem(hW, IDC_HDDFILE), config.Hdd);

Button_SetCheck(GetDlgItem(hW, IDC_ETHENABLED), config.ethEnable);
Button_SetCheck(GetDlgItem(hW, IDC_HDDENABLED), config.hddEnable);
Expand Down Expand Up @@ -104,7 +104,7 @@ void OnOk(HWND hW)
strcpy(config.Eth, ptr);
}

Edit_GetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd, 256);
GetWindowTextA(GetDlgItem(hW, IDC_HDDFILE), config.Hdd, 256);

config.ethEnable = Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED));
config.hddEnable = Button_GetCheck(GetDlgItem(hW, IDC_HDDENABLED));
Expand Down Expand Up @@ -175,13 +175,6 @@ DEV9about()
(DLGPROC)AboutDlgProc);
}

BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
DWORD dwReason,
LPVOID lpReserved)
{
hInst = (HINSTANCE)hModule;
return TRUE; // very quick :)
}
/*
UINT DEV9ThreadProc() {
DEV9thread();
Expand Down
1 change: 1 addition & 0 deletions pcsx2/DEV9/Win32/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "PrecompiledHeader.h"
#include "..\net.h"
#include "..\Dev9.h"

Expand Down
206 changes: 0 additions & 206 deletions pcsx2/DEV9/Win32/socks.c

This file was deleted.

27 changes: 0 additions & 27 deletions pcsx2/DEV9/Win32/socks.h

This file was deleted.

Loading

0 comments on commit eea4e38

Please sign in to comment.