move platform specific config to platform specif ffile ayyyyyyyyyyygfghj;,gnxbf
This commit is contained in:
parent
5edf40f665
commit
4de4631c15
|
@ -34,6 +34,7 @@
|
|||
<Add library="uxtheme" />
|
||||
<Add library="iphlpapi" />
|
||||
<Add library="user32" />
|
||||
<Add library="ws2_32" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release Windows">
|
||||
|
@ -65,6 +66,7 @@
|
|||
<Add library="uxtheme" />
|
||||
<Add library="iphlpapi" />
|
||||
<Add library="user32" />
|
||||
<Add library="ws2_32" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="DebugFast Windows">
|
||||
|
@ -95,6 +97,7 @@
|
|||
<Add library="uxtheme" />
|
||||
<Add library="iphlpapi" />
|
||||
<Add library="user32" />
|
||||
<Add library="ws2_32" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
|
@ -163,6 +166,8 @@
|
|||
<Unit filename="src/libui_sdl/LAN_Socket.cpp" />
|
||||
<Unit filename="src/libui_sdl/LAN_Socket.h" />
|
||||
<Unit filename="src/libui_sdl/Platform.cpp" />
|
||||
<Unit filename="src/libui_sdl/PlatformConfig.cpp" />
|
||||
<Unit filename="src/libui_sdl/PlatformConfig.h" />
|
||||
<Unit filename="src/libui_sdl/libui/common/areaevents.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
17
src/ARM.cpp
17
src/ARM.cpp
|
@ -180,9 +180,6 @@ void ARMv5::JumpTo(u32 addr, bool restorecpsr)
|
|||
if (R[15]==0x0204BE5E) printf("recvfrom() ret:%d errno:%d %08X\n", R[0], NDS::ARM9Read32(0x217F398), addr);
|
||||
if (R[15]==0x0205038A) printf("sgrecvfrom() ret:%d errno:%d %08X\n", R[0], NDS::ARM9Read32(0x217F398), addr);
|
||||
if (addr==0x02050379 || addr==0x0205036D) printf("morp %08X->%08X, %d\n", R[15], addr, R[7]);*/
|
||||
if (R[15]==0x02050542) printf("calc UDP checksum: %04X\n", R[0]);
|
||||
if (addr==0x0204FC2D) printf("calcchk %08X\n", R[15]);
|
||||
if (addr==0x0204B521) printf("zog check %08X\n", R[15]);
|
||||
|
||||
u32 oldregion = R[15] >> 24;
|
||||
u32 newregion = addr >> 24;
|
||||
|
@ -454,7 +451,7 @@ void ARMv5::DataAbort()
|
|||
R[14] = R[15] + (oldcpsr & 0x20 ? 6 : 4);
|
||||
JumpTo(ExceptionBase + 0x10);
|
||||
}
|
||||
namespace LAN{extern u32 zarp;}
|
||||
|
||||
void ARMv5::Execute()
|
||||
{
|
||||
if (Halted)
|
||||
|
@ -512,18 +509,6 @@ void ARMv5::Execute()
|
|||
else
|
||||
AddCycles_C();
|
||||
}
|
||||
/*if (R[15]>=0x0204E07C && R[15]<=0x0204E388)
|
||||
{
|
||||
printf("TACHYCARDIE. %08X\n", R[15]-4);
|
||||
}
|
||||
if (LAN::zarp!=0)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
if (R[i]==LAN::zarp)
|
||||
printf("!! TRANSID IN R%d AT %08X\n", i, R[15]);
|
||||
}
|
||||
}*/
|
||||
|
||||
// TODO optimize this shit!!!
|
||||
if (Halted)
|
||||
|
|
128
src/Config.cpp
128
src/Config.cpp
|
@ -31,123 +31,30 @@ namespace Config
|
|||
|
||||
const char* kConfigFile = "melonDS.ini";
|
||||
|
||||
int KeyMapping[12];
|
||||
int JoyMapping[12];
|
||||
|
||||
int HKKeyMapping[HK_MAX];
|
||||
int HKJoyMapping[HK_MAX];
|
||||
|
||||
int WindowWidth;
|
||||
int WindowHeight;
|
||||
int WindowMaximized;
|
||||
|
||||
int ScreenRotation;
|
||||
int ScreenGap;
|
||||
int ScreenLayout;
|
||||
int ScreenSizing;
|
||||
int ScreenFilter;
|
||||
|
||||
int LimitFPS;
|
||||
|
||||
int DirectBoot;
|
||||
|
||||
int Threaded3D;
|
||||
|
||||
int SocketBindAnyAddr;
|
||||
char LANDevice[128];
|
||||
int DirectLAN;
|
||||
|
||||
int SavestateRelocSRAM;
|
||||
|
||||
int AudioVolume;
|
||||
int MicInputType;
|
||||
char MicWavPath[512];
|
||||
|
||||
char LastROMFolder[512];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Name[16];
|
||||
int Type;
|
||||
void* Value;
|
||||
int DefaultInt;
|
||||
char* DefaultStr;
|
||||
int StrLength; // should be set to actual array length minus one
|
||||
|
||||
} ConfigEntry;
|
||||
|
||||
ConfigEntry ConfigFile[] =
|
||||
{
|
||||
{"Key_A", 0, &KeyMapping[0], 32, NULL, 0},
|
||||
{"Key_B", 0, &KeyMapping[1], 31, NULL, 0},
|
||||
{"Key_Select", 0, &KeyMapping[2], 57, NULL, 0},
|
||||
{"Key_Start", 0, &KeyMapping[3], 28, NULL, 0},
|
||||
{"Key_Right", 0, &KeyMapping[4], 333, NULL, 0},
|
||||
{"Key_Left", 0, &KeyMapping[5], 331, NULL, 0},
|
||||
{"Key_Up", 0, &KeyMapping[6], 328, NULL, 0},
|
||||
{"Key_Down", 0, &KeyMapping[7], 336, NULL, 0},
|
||||
{"Key_R", 0, &KeyMapping[8], 54, NULL, 0},
|
||||
{"Key_L", 0, &KeyMapping[9], 86, NULL, 0},
|
||||
{"Key_X", 0, &KeyMapping[10], 17, NULL, 0},
|
||||
{"Key_Y", 0, &KeyMapping[11], 30, NULL, 0},
|
||||
|
||||
{"Joy_A", 0, &JoyMapping[0], -1, NULL, 0},
|
||||
{"Joy_B", 0, &JoyMapping[1], -1, NULL, 0},
|
||||
{"Joy_Select", 0, &JoyMapping[2], -1, NULL, 0},
|
||||
{"Joy_Start", 0, &JoyMapping[3], -1, NULL, 0},
|
||||
{"Joy_Right", 0, &JoyMapping[4], -1, NULL, 0},
|
||||
{"Joy_Left", 0, &JoyMapping[5], -1, NULL, 0},
|
||||
{"Joy_Up", 0, &JoyMapping[6], -1, NULL, 0},
|
||||
{"Joy_Down", 0, &JoyMapping[7], -1, NULL, 0},
|
||||
{"Joy_R", 0, &JoyMapping[8], -1, NULL, 0},
|
||||
{"Joy_L", 0, &JoyMapping[9], -1, NULL, 0},
|
||||
{"Joy_X", 0, &JoyMapping[10], -1, NULL, 0},
|
||||
{"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0},
|
||||
|
||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0E, NULL, 0},
|
||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
||||
|
||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||
|
||||
{"WindowWidth", 0, &WindowWidth, 256, NULL, 0},
|
||||
{"WindowHeight", 0, &WindowHeight, 384, NULL, 0},
|
||||
{"WindowMax", 0, &WindowMaximized, 0, NULL, 0},
|
||||
|
||||
{"ScreenRotation", 0, &ScreenRotation, 0, NULL, 0},
|
||||
{"ScreenGap", 0, &ScreenGap, 0, NULL, 0},
|
||||
{"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0},
|
||||
{"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0},
|
||||
{"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0},
|
||||
|
||||
{"LimitFPS", 0, &LimitFPS, 1, NULL, 0},
|
||||
|
||||
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0},
|
||||
|
||||
{"Threaded3D", 0, &Threaded3D, 1, NULL, 0},
|
||||
|
||||
{"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0},
|
||||
{"LANDevice", 1, LANDevice, 0, "", 127},
|
||||
{"DirectLAN", 0, &DirectLAN, 0, NULL, 0},
|
||||
|
||||
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0},
|
||||
|
||||
{"AudioVolume", 0, &AudioVolume, 256, NULL, 0},
|
||||
{"MicInputType", 0, &MicInputType, 1, NULL, 0},
|
||||
{"MicWavPath", 1, MicWavPath, 0, "", 511},
|
||||
|
||||
{"LastROMFolder", 1, LastROMFolder, 0, "", 511},
|
||||
|
||||
{"", -1, NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
extern ConfigEntry PlatformConfigFile[];
|
||||
|
||||
|
||||
void Load()
|
||||
{
|
||||
ConfigEntry* entry = &ConfigFile[0];
|
||||
int c = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (!entry->Value) break;
|
||||
if (!entry->Value)
|
||||
{
|
||||
if (c > 0) break;
|
||||
entry = &PlatformConfigFile[0];
|
||||
c++;
|
||||
}
|
||||
|
||||
if (entry->Type == 0)
|
||||
*(int*)entry->Value = entry->DefaultInt;
|
||||
|
@ -173,9 +80,15 @@ void Load()
|
|||
if (ret < 2) continue;
|
||||
|
||||
ConfigEntry* entry = &ConfigFile[0];
|
||||
c = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (!entry->Value) break;
|
||||
if (!entry->Value)
|
||||
{
|
||||
if (c > 0) break;
|
||||
entry = &PlatformConfigFile[0];
|
||||
c++;
|
||||
}
|
||||
|
||||
if (!strncmp(entry->Name, entryname, 15))
|
||||
{
|
||||
|
@ -196,6 +109,7 @@ void Load()
|
|||
|
||||
void Save()
|
||||
{
|
||||
// TODO not make path search shit tself and pick the wrong ath every damn tiem!!!!!
|
||||
FILE* f;
|
||||
if (LocalFileExists(kConfigFile))
|
||||
{
|
||||
|
@ -218,9 +132,15 @@ void Save()
|
|||
}
|
||||
|
||||
ConfigEntry* entry = &ConfigFile[0];
|
||||
int c = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (!entry->Value) break;
|
||||
if (!entry->Value)
|
||||
{
|
||||
if (c > 0) break;
|
||||
entry = &PlatformConfigFile[0];
|
||||
c++;
|
||||
}
|
||||
|
||||
if (entry->Type == 0)
|
||||
fprintf(f, "%s=%d\n", entry->Name, *(int*)entry->Value);
|
||||
|
|
52
src/Config.h
52
src/Config.h
|
@ -21,55 +21,27 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HK_Lid = 0,
|
||||
HK_Mic,
|
||||
|
||||
HK_MAX
|
||||
};
|
||||
|
||||
namespace Config
|
||||
{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Name[16];
|
||||
int Type;
|
||||
void* Value;
|
||||
int DefaultInt;
|
||||
char* DefaultStr;
|
||||
int StrLength; // should be set to actual array length minus one
|
||||
|
||||
} ConfigEntry;
|
||||
|
||||
FILE* GetConfigFile(const char* fileName, const char* permissions);
|
||||
bool HasConfigFile(const char* fileName);
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
extern int KeyMapping[12];
|
||||
extern int JoyMapping[12];
|
||||
|
||||
extern int HKKeyMapping[HK_MAX];
|
||||
extern int HKJoyMapping[HK_MAX];
|
||||
|
||||
extern int WindowWidth;
|
||||
extern int WindowHeight;
|
||||
extern int WindowMaximized;
|
||||
|
||||
extern int ScreenRotation;
|
||||
extern int ScreenGap;
|
||||
extern int ScreenLayout;
|
||||
extern int ScreenSizing;
|
||||
extern int ScreenFilter;
|
||||
|
||||
extern int LimitFPS;
|
||||
|
||||
extern int DirectBoot;
|
||||
|
||||
extern int Threaded3D;
|
||||
|
||||
extern int SocketBindAnyAddr;
|
||||
extern char LANDevice[128];
|
||||
extern int DirectLAN;
|
||||
|
||||
extern int SavestateRelocSRAM;
|
||||
|
||||
extern int AudioVolume;
|
||||
extern int MicInputType;
|
||||
extern char MicWavPath[512];
|
||||
|
||||
extern char LastROMFolder[512];
|
||||
|
||||
}
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "libui/ui.h"
|
||||
|
||||
#include "../types.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "DlgAudioSettings.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "libui/ui.h"
|
||||
|
||||
#include "../types.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "DlgEmuSettings.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "libui/ui.h"
|
||||
|
||||
#include "../types.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "DlgInputConfig.h"
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "libui/ui.h"
|
||||
|
||||
#include "../types.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "LAN_Socket.h"
|
||||
#include "LAN_PCap.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <pcap/pcap.h>
|
||||
#include "Wifi.h"
|
||||
#include "LAN_PCap.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include <iphlpapi.h>
|
||||
|
|
|
@ -621,6 +621,8 @@ void TCP_SYNACK(TCPSocket* sock, u8* data, int len)
|
|||
seqnum++;
|
||||
sock->AckNum = seqnum;
|
||||
|
||||
printf("SYNACK SEQ=%08X|%08X\n", sock->SeqNum, sock->AckNum);
|
||||
|
||||
// ethernet
|
||||
memcpy(out, &data[6], 6); out += 6;
|
||||
memcpy(out, kServerMAC, 6); out += 6;
|
||||
|
@ -674,16 +676,18 @@ void TCP_SYNACK(TCPSocket* sock, u8* data, int len)
|
|||
RXNum = 1;
|
||||
}
|
||||
|
||||
void TCP_ACK(TCPSocket* sock, u8* data, int len)
|
||||
void TCP_ACK(TCPSocket* sock, bool fin)
|
||||
{
|
||||
u8 resp[64];
|
||||
u8* out = &resp[0];
|
||||
|
||||
u8* ipheader = &data[0xE];
|
||||
u8* tcpheader = &data[0x22];
|
||||
u16 flags = 0x5010;
|
||||
if (fin) flags |= 0x0001;
|
||||
|
||||
printf("%sACK SEQ=%08X|%08X\n", fin?"FIN":" ", sock->SeqNum, sock->AckNum);
|
||||
|
||||
// ethernet
|
||||
memcpy(out, &data[6], 6); out += 6;
|
||||
memcpy(out, Wifi::GetMAC(), 6); out += 6;
|
||||
memcpy(out, kServerMAC, 6); out += 6;
|
||||
*(u16*)out = htons(0x0800); out += 2;
|
||||
|
||||
|
@ -698,16 +702,16 @@ void TCP_ACK(TCPSocket* sock, u8* data, int len)
|
|||
*out++ = 0x80; // TTL
|
||||
*out++ = 0x06; // protocol (TCP)
|
||||
*(u16*)out = 0; out += 2; // checksum
|
||||
*(u32*)out = *(u32*)&ipheader[16]; out += 4; // source IP
|
||||
*(u32*)out = *(u32*)&ipheader[12]; out += 4; // destination IP
|
||||
*(u32*)out = *(u32*)&sock->DestIP; out += 4; // source IP
|
||||
*(u32*)out = htonl(kClientIP); out += 4; // destination IP
|
||||
|
||||
// TCP
|
||||
u8* resp_tcpheader = out;
|
||||
*(u16*)out = *(u16*)&tcpheader[2]; out += 2; // source port
|
||||
*(u16*)out = *(u16*)&tcpheader[0]; out += 2; // destination port
|
||||
*(u16*)out = htonl(sock->DestPort); out += 2; // source port
|
||||
*(u16*)out = htonl(sock->SourcePort); out += 2; // destination port
|
||||
*(u32*)out = htonl(sock->SeqNum); out += 4; // seq number
|
||||
*(u32*)out = htonl(sock->AckNum); out += 4; // ack seq number
|
||||
*(u16*)out = htons(0x5010); out += 2; // flags (ACK)
|
||||
*(u16*)out = htons(flags); out += 2; // flags
|
||||
*(u16*)out = htons(0x7000); out += 2; // window size (uuuh)
|
||||
*(u16*)out = 0; out += 2; // checksum
|
||||
*(u16*)out = 0; out += 2; // urgent pointer
|
||||
|
@ -731,7 +735,7 @@ void TCP_BuildIncomingFrame(TCPSocket* sock, u8* data, int len)
|
|||
u8* out = &resp[0];
|
||||
|
||||
if (len > 1536) return;
|
||||
|
||||
printf("INCOMING SEQ=%08X|%08X\n", sock->SeqNum, sock->AckNum);
|
||||
// ethernet
|
||||
memcpy(out, Wifi::GetMAC(), 6); out += 6; // hurf
|
||||
memcpy(out, kServerMAC, 6); out += 6;
|
||||
|
@ -774,6 +778,8 @@ void TCP_BuildIncomingFrame(TCPSocket* sock, u8* data, int len)
|
|||
PacketLen = framelen;
|
||||
memcpy(PacketBuffer, resp, PacketLen);
|
||||
RXNum = 1;
|
||||
|
||||
sock->SeqNum += len;
|
||||
}
|
||||
|
||||
void HandleTCPFrame(u8* data, int len)
|
||||
|
@ -789,6 +795,11 @@ void HandleTCPFrame(u8* data, int len)
|
|||
u32 tcplen = ntohs(*(u16*)&ipheader[2]) - 0x14;
|
||||
u32 tcpdatalen = tcplen - tcpheaderlen;
|
||||
|
||||
printf("tcpflags=%04X header=%d data=%d seq=%08X|%08X\n",
|
||||
flags, tcpheaderlen, tcpdatalen,
|
||||
ntohl(*(u32*)&tcpheader[4]),
|
||||
ntohl(*(u32*)&tcpheader[8]));
|
||||
|
||||
if (flags & 0x002) // SYN
|
||||
{
|
||||
int sockid = -1;
|
||||
|
@ -796,7 +807,7 @@ void HandleTCPFrame(u8* data, int len)
|
|||
for (int i = 0; i < (sizeof(TCPSocketList)/sizeof(TCPSocket)); i++)
|
||||
{
|
||||
sock = &TCPSocketList[i];
|
||||
if (sock->Status == 1 && !memcmp(&sock->DestIP, &ipheader[16], 4) &&
|
||||
if (sock->Status != 0 && !memcmp(&sock->DestIP, &ipheader[16], 4) &&
|
||||
sock->SourcePort == srcport && sock->DestPort == dstport)
|
||||
{
|
||||
printf("LANMAGIC: duplicate TCP socket\n");
|
||||
|
@ -846,7 +857,6 @@ void HandleTCPFrame(u8* data, int len)
|
|||
struct sockaddr_in conn_addr;
|
||||
memset(&conn_addr, 0, sizeof(conn_addr));
|
||||
conn_addr.sin_family = AF_INET;
|
||||
//conn_addr.sin_addr.S_un.S_addr = *(u32*)&ipheader[16];
|
||||
memcpy(&conn_addr.sin_addr, &ipheader[16], 4);
|
||||
conn_addr.sin_port = htons(dstport);
|
||||
if (connect(sock->Backend, (sockaddr*)&conn_addr, sizeof(conn_addr)) == SOCKET_ERROR)
|
||||
|
@ -866,7 +876,7 @@ void HandleTCPFrame(u8* data, int len)
|
|||
for (int i = 0; i < (sizeof(TCPSocketList)/sizeof(TCPSocket)); i++)
|
||||
{
|
||||
sock = &TCPSocketList[i];
|
||||
if (sock->Status == 1 && !memcmp(&sock->DestIP, &ipheader[16], 4) &&
|
||||
if (sock->Status != 0 && !memcmp(&sock->DestIP, &ipheader[16], 4) &&
|
||||
sock->SourcePort == srcport && sock->DestPort == dstport)
|
||||
{
|
||||
sockid = i;
|
||||
|
@ -895,7 +905,7 @@ void HandleTCPFrame(u8* data, int len)
|
|||
send(sock->Backend, (char*)tcpdata, tcpdatalen, 0);
|
||||
|
||||
// kind of a hack, there
|
||||
TCP_ACK(sock, data, len);
|
||||
TCP_ACK(sock, false);
|
||||
}
|
||||
|
||||
if (flags & 0x001) // FIN
|
||||
|
@ -1052,10 +1062,35 @@ int RecvPacket(u8* data)
|
|||
|
||||
u8 recvbuf[1024];
|
||||
int recvlen = recv(sock->Backend, (char*)recvbuf, 1024, 0);
|
||||
if (recvlen < 1) continue;
|
||||
if (recvlen < 1)
|
||||
{
|
||||
if (recvlen == 0)
|
||||
{
|
||||
// socket has closed from the other side
|
||||
printf("TCP: socket %d closed from other side\n", i);
|
||||
sock->Status = 2;
|
||||
TCP_ACK(sock, true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("TCP: socket %d receiving %d bytes\n", i, recvlen);
|
||||
TCP_BuildIncomingFrame(sock, recvbuf, recvlen);
|
||||
|
||||
// debug
|
||||
for (int j = 0; j < recvlen; j += 16)
|
||||
{
|
||||
int rem = recvlen - j;
|
||||
if (rem > 16) rem = 16;
|
||||
for (int k = 0; k < rem; k++)
|
||||
{
|
||||
printf("%02X ", recvbuf[k+j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
//recvlen = recv(sock->Backend, (char*)recvbuf, 1024, 0);
|
||||
//if (recvlen == 0) printf("it closed immediately after\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < (sizeof(UDPSocketList)/sizeof(UDPSocket)); i++)
|
||||
|
@ -1077,7 +1112,6 @@ int RecvPacket(u8* data)
|
|||
}
|
||||
|
||||
u8 recvbuf[1024];
|
||||
//int recvlen = recv(sock->Backend, (char*)recvbuf, 1024, 0);
|
||||
sockaddr_t fromAddr;
|
||||
socklen_t fromLen = sizeof(sockaddr_t);
|
||||
int recvlen = recvfrom(sock->Backend, (char*)recvbuf, 1024, 0, &fromAddr, &fromLen);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <string.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../Platform.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
#include "LAN_Socket.h"
|
||||
#include "LAN_PCap.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
Copyright 2016-2019 Arisotura
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS 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, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
|
||||
int KeyMapping[12];
|
||||
int JoyMapping[12];
|
||||
|
||||
int HKKeyMapping[HK_MAX];
|
||||
int HKJoyMapping[HK_MAX];
|
||||
|
||||
int WindowWidth;
|
||||
int WindowHeight;
|
||||
int WindowMaximized;
|
||||
|
||||
int ScreenRotation;
|
||||
int ScreenGap;
|
||||
int ScreenLayout;
|
||||
int ScreenSizing;
|
||||
int ScreenFilter;
|
||||
|
||||
int LimitFPS;
|
||||
|
||||
int DirectBoot;
|
||||
|
||||
int SocketBindAnyAddr;
|
||||
char LANDevice[128];
|
||||
int DirectLAN;
|
||||
|
||||
int SavestateRelocSRAM;
|
||||
|
||||
int AudioVolume;
|
||||
int MicInputType;
|
||||
char MicWavPath[512];
|
||||
|
||||
char LastROMFolder[512];
|
||||
|
||||
|
||||
ConfigEntry PlatformConfigFile[] =
|
||||
{
|
||||
{"Key_A", 0, &KeyMapping[0], 32, NULL, 0},
|
||||
{"Key_B", 0, &KeyMapping[1], 31, NULL, 0},
|
||||
{"Key_Select", 0, &KeyMapping[2], 57, NULL, 0},
|
||||
{"Key_Start", 0, &KeyMapping[3], 28, NULL, 0},
|
||||
{"Key_Right", 0, &KeyMapping[4], 333, NULL, 0},
|
||||
{"Key_Left", 0, &KeyMapping[5], 331, NULL, 0},
|
||||
{"Key_Up", 0, &KeyMapping[6], 328, NULL, 0},
|
||||
{"Key_Down", 0, &KeyMapping[7], 336, NULL, 0},
|
||||
{"Key_R", 0, &KeyMapping[8], 54, NULL, 0},
|
||||
{"Key_L", 0, &KeyMapping[9], 86, NULL, 0},
|
||||
{"Key_X", 0, &KeyMapping[10], 17, NULL, 0},
|
||||
{"Key_Y", 0, &KeyMapping[11], 30, NULL, 0},
|
||||
|
||||
{"Joy_A", 0, &JoyMapping[0], -1, NULL, 0},
|
||||
{"Joy_B", 0, &JoyMapping[1], -1, NULL, 0},
|
||||
{"Joy_Select", 0, &JoyMapping[2], -1, NULL, 0},
|
||||
{"Joy_Start", 0, &JoyMapping[3], -1, NULL, 0},
|
||||
{"Joy_Right", 0, &JoyMapping[4], -1, NULL, 0},
|
||||
{"Joy_Left", 0, &JoyMapping[5], -1, NULL, 0},
|
||||
{"Joy_Up", 0, &JoyMapping[6], -1, NULL, 0},
|
||||
{"Joy_Down", 0, &JoyMapping[7], -1, NULL, 0},
|
||||
{"Joy_R", 0, &JoyMapping[8], -1, NULL, 0},
|
||||
{"Joy_L", 0, &JoyMapping[9], -1, NULL, 0},
|
||||
{"Joy_X", 0, &JoyMapping[10], -1, NULL, 0},
|
||||
{"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0},
|
||||
|
||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0E, NULL, 0},
|
||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
||||
|
||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||
|
||||
{"WindowWidth", 0, &WindowWidth, 256, NULL, 0},
|
||||
{"WindowHeight", 0, &WindowHeight, 384, NULL, 0},
|
||||
{"WindowMax", 0, &WindowMaximized, 0, NULL, 0},
|
||||
|
||||
{"ScreenRotation", 0, &ScreenRotation, 0, NULL, 0},
|
||||
{"ScreenGap", 0, &ScreenGap, 0, NULL, 0},
|
||||
{"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0},
|
||||
{"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0},
|
||||
{"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0},
|
||||
|
||||
{"LimitFPS", 0, &LimitFPS, 1, NULL, 0},
|
||||
|
||||
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0},
|
||||
|
||||
{"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0},
|
||||
{"LANDevice", 1, LANDevice, 0, "", 127},
|
||||
{"DirectLAN", 0, &DirectLAN, 0, NULL, 0},
|
||||
|
||||
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0},
|
||||
|
||||
{"AudioVolume", 0, &AudioVolume, 256, NULL, 0},
|
||||
{"MicInputType", 0, &MicInputType, 1, NULL, 0},
|
||||
{"MicWavPath", 1, MicWavPath, 0, "", 511},
|
||||
|
||||
{"LastROMFolder", 1, LastROMFolder, 0, "", 511},
|
||||
|
||||
{"", -1, NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Copyright 2016-2019 Arisotura
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS 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, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#ifndef PLATFORMCONFIG_H
|
||||
#define PLATFORMCONFIG_H
|
||||
|
||||
#include "../Config.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HK_Lid = 0,
|
||||
HK_Mic,
|
||||
|
||||
HK_MAX
|
||||
};
|
||||
|
||||
namespace Config
|
||||
{
|
||||
|
||||
extern int KeyMapping[12];
|
||||
extern int JoyMapping[12];
|
||||
|
||||
extern int HKKeyMapping[HK_MAX];
|
||||
extern int HKJoyMapping[HK_MAX];
|
||||
|
||||
extern int WindowWidth;
|
||||
extern int WindowHeight;
|
||||
extern int WindowMaximized;
|
||||
|
||||
extern int ScreenRotation;
|
||||
extern int ScreenGap;
|
||||
extern int ScreenLayout;
|
||||
extern int ScreenSizing;
|
||||
extern int ScreenFilter;
|
||||
|
||||
extern int LimitFPS;
|
||||
|
||||
extern int DirectBoot;
|
||||
|
||||
extern int SocketBindAnyAddr;
|
||||
extern char LANDevice[128];
|
||||
extern int DirectLAN;
|
||||
|
||||
extern int SavestateRelocSRAM;
|
||||
|
||||
extern int AudioVolume;
|
||||
extern int MicInputType;
|
||||
extern char MicWavPath[512];
|
||||
|
||||
extern char LastROMFolder[512];
|
||||
|
||||
}
|
||||
|
||||
#endif // PLATFORMCONFIG_H
|
|
@ -27,7 +27,7 @@
|
|||
#include "../types.h"
|
||||
#include "../melon_fopen.h"
|
||||
#include "../version.h"
|
||||
#include "../Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "DlgEmuSettings.h"
|
||||
#include "DlgInputConfig.h"
|
||||
|
|
Loading…
Reference in New Issue