mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-16 16:00:30 +02:00
Added UI to change WLAN Channel.
Currently Ridge Racer 2 doesn't works with Auto channel (TODO: Making sure sceUtilityGetSystemParamInt doesn't returns channel 0 when connected to a network for Ridge Racer 2 to works with Auto channel)
This commit is contained in:
1 parent
d0045947f1
commit
8daf2ff66e
5 files changed
+20
-7
No files matched your search
@@ -76,6 +76,7 @@ int newChat = 0;
|
||||
bool isLocalServer = false;
|
||||
sockaddr LocalhostIP;
|
||||
sockaddr LocalIP;
|
||||
int defaultWlanChannel = 1;
|
||||
|
||||
bool isLocalMAC(const SceNetEtherAddr * addr) {
|
||||
SceNetEtherAddr saddr;
|
||||
@@ -1239,7 +1240,7 @@ int friendFinder(){
|
||||
}*/
|
||||
|
||||
// Update User BSSID
|
||||
//parameter.bssid.mac_addr = packet->mac; // The MAC address in this packet seems to Always be the First player joining the Group (group Creator?), Shouldn't it be it self?
|
||||
//parameter.bssid.mac_addr = packet->mac; // This packet seems to contains Adhoc Group Creator's BSSID (similar to AP's BSSID) so it shouldn't get mixed up with local MAC address
|
||||
// Notify Event Handlers
|
||||
//notifyAdhocctlHandlers(ADHOCCTL_EVENT_CONNECT, 0);
|
||||
// Change State
|
||||
@@ -1416,7 +1417,8 @@ int friendFinder(){
|
||||
group->bssid.mac_addr = packet->mac;
|
||||
|
||||
// Set group parameters
|
||||
group->channel = parameter.channel;
|
||||
// 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 = ADHOCCTL_MODE_ADHOC; //adhocctlCurrentMode;
|
||||
|
||||
// Link into Group List
|
||||
@@ -1808,8 +1810,9 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){
|
||||
memset(¶meter, 0, sizeof(parameter));
|
||||
strncpy((char *)¶meter.nickname.data, g_Config.sNickName.c_str(), ADHOCCTL_NICKNAME_LEN);
|
||||
parameter.nickname.data[ADHOCCTL_NICKNAME_LEN - 1] = 0;
|
||||
parameter.channel = g_Config.iWlanAdhocChannel; // Fake Channel, 0 = Auto where JPCSP use 11 as default for Auto (Commonly for Auto: 1, 6, 11)
|
||||
if (parameter.channel == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) parameter.channel = 1;
|
||||
parameter.channel = g_Config.iWlanAdhocChannel;
|
||||
// Assign a Valid Channel when connected to AP/AdhocGroup if it's Auto. JPCSP use 11 as default for Auto (Commonly for Auto: 1, 6, 11)
|
||||
if (parameter.channel == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) parameter.channel = defaultWlanChannel; // Faked Active channel to default channel
|
||||
getLocalMac(¶meter.bssid.mac_addr);
|
||||
|
||||
// Default ProductId
|
||||
|
||||
+3
-2
@@ -242,10 +242,10 @@ typedef struct SceNetAdhocctlNickname {
|
||||
uint8_t data[ADHOCCTL_NICKNAME_LEN];
|
||||
} PACK SceNetAdhocctlNickname;
|
||||
|
||||
// Active Virtual Network Information
|
||||
// Active Virtual Network Information (Adhoc Group Host/Creator's device info, similar to AP?)
|
||||
typedef struct SceNetAdhocctlParameter {
|
||||
s32_le channel;
|
||||
SceNetAdhocctlGroupName group_name;
|
||||
SceNetAdhocctlGroupName group_name; // This group name is probably similar to SSID name on AP
|
||||
SceNetAdhocctlBSSId bssid;
|
||||
SceNetAdhocctlNickname nickname;
|
||||
} PACK SceNetAdhocctlParameter;
|
||||
@@ -847,6 +847,7 @@ extern uint32_t minSocketTimeoutUS;
|
||||
extern bool isLocalServer;
|
||||
extern sockaddr LocalhostIP; // Used to differentiate localhost IP on multiple-instance
|
||||
extern sockaddr LocalIP; // IP of Network Adapter used to connect to Adhoc Server (LAN/WAN)
|
||||
extern int defaultWlanChannel; // Default WLAN Channel for Auto, JPCSP uses 11
|
||||
|
||||
extern uint32_t fakePoolSize;
|
||||
extern SceNetAdhocMatchingContext * contexts;
|
||||
|
||||
@@ -112,6 +112,7 @@ static void __ResetInitNetLib() {
|
||||
netInetInited = false;
|
||||
|
||||
memset(&netMallocStat, 0, sizeof(netMallocStat));
|
||||
memset(¶meter, 0, sizeof(parameter));
|
||||
}
|
||||
|
||||
void __NetInit() {
|
||||
@@ -251,6 +252,8 @@ static u32 sceNetTerm() {
|
||||
FreeUser(netThread1Addr);
|
||||
FreeUser(netThread2Addr);
|
||||
|
||||
// Give time to make sure everything are cleaned up
|
||||
hleDelayResult(0, "give time to init/cleanup", adhocEventDelayMS * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,7 +1091,7 @@ static int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) {
|
||||
// Exchange Adhoc Channel
|
||||
// sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL, &buf[discovered].channel);
|
||||
|
||||
// Fake Channel Number 1 on Automatic Channel
|
||||
// Fake Channel Number 1 on 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?)
|
||||
buf[discovered].channel = group->channel; //parameter.channel
|
||||
|
||||
// Increase Discovery Counter
|
||||
|
||||
@@ -692,6 +692,12 @@ void GameSettingsScreen::CreateViews() {
|
||||
networkingSettings->Add(new CheckBox(&g_Config.bEnableAdhocServer, n->T("Enable built-in PRO Adhoc Server", "Enable built-in PRO Adhoc Server")));
|
||||
networkingSettings->Add(new CheckBox(&g_Config.bEnableUPnP, n->T("Enable UPnP", "Enable UPnP (need a few seconds to detect)")));
|
||||
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.sMACAddress, n->T("Change Mac Address"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
|
||||
static const char* wlanChannels[] = { "Auto", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" };
|
||||
auto wlanChannelChoice = networkingSettings->Add(new PopupMultiChoice(&g_Config.iWlanAdhocChannel, gr->T("WLAN Channel"), wlanChannels, 0, ARRAY_SIZE(wlanChannels), gr->GetName(), screenManager()));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
wlanChannelChoice->HideChoice(i+2);
|
||||
wlanChannelChoice->HideChoice(i+7);
|
||||
}
|
||||
networkingSettings->Add(new PopupSliderChoice(&g_Config.iPortOffset, 0, 60000, n->T("Port offset", "Port offset(0 = PSP compatibility)"), 100, screenManager()));
|
||||
networkingSettings->Add(new PopupSliderChoice(&g_Config.iMinTimeout, 1, 15000, n->T("Minimum Timeout", "Minimum Timeout (override low latency communication in milliseconds)"), 100, screenManager()));
|
||||
|
||||
|
||||
Reference in new issue
Block a user