Fixed unable to see game room issue on Air Conflicts - Aces Of World War 2, should also fix other games with similar issue (due to invalid group mode)

This commit is contained in:
ANR2ME
2020-10-29 06:00:16 +07:00
parent 1bfe089785
commit bff18c07d0
3 changed files with 13 additions and 7 deletions
+6 -1
View File
@@ -21,6 +21,10 @@
// This is a direct port of Coldbird's code from http://code.google.com/p/aemu/
// All credit goes to him!
#if defined(_WIN32)
#include "Common/CommonWindows.h"
#endif
#if !defined(_WIN32)
#include <unistd.h>
#include <netinet/tcp.h>
@@ -1635,7 +1639,8 @@ int friendFinder(){
// Set group parameters
// Since 0 is not a valid active channel we fake the channel for Automatic Channel (JPCSP use 11 as default). Ridge Racer 2 will ignore any groups with channel 0 or that doesn't matched with channel value returned from sceUtilityGetSystemParamInt (which mean sceUtilityGetSystemParamInt must not return channel 0 when connected to a network?)
group->channel = parameter.channel; //(parameter.channel == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) ? defaultWlanChannel : parameter.channel;
group->mode = adhocctlCurrentMode;
// This Mode should be a valid mode (>=0), probably should be sent by AdhocServer since there are 2 possibilities (Normal and GameMode). Air Conflicts - Aces Of World War 2 (which use GameMode) seems to relies on this Mode value.
group->mode = std::max(ADHOCCTL_MODE_NORMAL, adhocctlCurrentMode); // default to ADHOCCTL_MODE_NORMAL
// Link into Group List
newnetworks = group;
+4 -4
View File
@@ -116,7 +116,7 @@ inline bool isDisconnected(int errcode) { return (errcode == EPIPE || errcode ==
#define GAMEMODE_INIT_DELAY 10000
// psp strutcs and definitions
#define ADHOCCTL_MODE_NONE -1
#define ADHOCCTL_MODE_NONE -1 // We only use this internally as initial value before attempting to create/connect/join/scan any group
#define ADHOCCTL_MODE_NORMAL 0 // ADHOCCTL_MODE_ADHOC
#define ADHOCCTL_MODE_GAMEMODE 1
@@ -141,7 +141,7 @@ inline bool isDisconnected(int errcode) { return (errcode == EPIPE || errcode ==
// ProductType ( extracted from SSID along with ProductId & GroupName, Pattern = "PSP_([AXS])(.........)_([LG])_(.*)" )
#define PSP_ADHOCCTL_TYPE_COMMERCIAL 0
#define PSP_ADHOCCTL_TYPE_DEBUG 1
#define PSP_ADHOCCTL_TYPE_SYSTEM 2
#define PSP_ADHOCCTL_TYPE_SYSTEM 2 // Used for GameSharing?
// Kernel Utility Netconf Adhoc Types
#define UTILITY_NETCONF_TYPE_CONNECT_ADHOC 2
@@ -393,8 +393,8 @@ typedef struct SceNetAdhocGameModeBufferStat {
// Adhoc ID (Game Product Key)
#define ADHOCCTL_ADHOCID_LEN 9
typedef struct SceNetAdhocctlAdhocId {
s32_le type;
uint8_t data[ADHOCCTL_ADHOCID_LEN];
s32_le type; // Air Conflicts - Aces Of World War 2 is using 2 for GameSharing?
uint8_t data[ADHOCCTL_ADHOCID_LEN]; // Air Conflicts - Aces Of World War 2 is using "000000001" for GameSharing?
uint8_t padding[3];
} PACK SceNetAdhocctlAdhocId; // should this be packed?
#ifdef _MSC_VER
+3 -2
View File
@@ -1959,6 +1959,7 @@ int sceNetAdhocctlScan() {
// Only scan when in Disconnected state, otherwise AdhocServer will kick you out
if (adhocctlState == ADHOCCTL_STATE_DISCONNECTED) {
adhocctlState = ADHOCCTL_STATE_SCANNING;
adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL;
// Reset Networks/Group list to prevent other threads from using these soon to be replaced networks
peerlock.lock();
@@ -2013,7 +2014,7 @@ int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) {
SceNetAdhocctlScanInfoEmu *buf = NULL;
if (Memory::IsValidAddress(bufAddr)) buf = (SceNetAdhocctlScanInfoEmu *)Memory::GetPointer(bufAddr);
INFO_LOG(SCENET, "sceNetAdhocctlGetScanInfo([%08x]=%i, %08x)", sizeAddr, Memory::Read_U32(sizeAddr), bufAddr);
INFO_LOG(SCENET, "sceNetAdhocctlGetScanInfo([%08x]=%i, %08x) at %08x", sizeAddr, Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc);
if (!g_Config.bEnableWlan) {
return 0;
}
@@ -2484,7 +2485,7 @@ int NetAdhocctl_Create(const char* groupName) {
// Wait for Status to be connected to prevent Ford Street Racing from Failed to create game session
int us = adhocDefaultDelay;
if (adhocctlState != ADHOCCTL_STATE_CONNECTED && iResult == SOCKET_ERROR && friendFinderRunning) {
if (adhocctlState != ADHOCCTL_STATE_CONNECTED && adhocctlState != ADHOCCTL_STATE_GAMEMODE && iResult == SOCKET_ERROR && friendFinderRunning) {
AdhocctlRequest req = { OPCODE_CONNECT, {0} };
if (groupNameStruct != NULL) req.group = *groupNameStruct;
return WaitBlockingAdhocctlSocket(req, us, "adhocctl connect");