Add optional MOHH2 Adhoc hack,

also just for a test both MOHH games cross region play, might not work:]
This commit is contained in:
LunaMoo committed 2017-11-19 21:49:25 +01:00
1 parent 6c206e4c80
commit edf415be88
6 files changed
+25 -5

No files matched your search

+1
View File
@@ -745,6 +745,7 @@ static ConfigSetting systemParamSettings[] = {
ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "localhost", true, true),
ConfigSetting("MacAddress", &g_Config.sMACAddress, "", true, true),
ConfigSetting("PortOffset", &g_Config.iPortOffset, 0, true, true),
ConfigSetting("MOHH2hack", &g_Config.bMOHH2hack, false, true, true),
ReportedConfigSetting("Language", &g_Config.iLanguage, &DefaultSystemParamLanguage, true, true),
ConfigSetting("TimeFormat", &g_Config.iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR, true, true),
ConfigSetting("DateFormat", &g_Config.iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD, true, true),
+1
View File
@@ -412,6 +412,7 @@ public:
std::string sNickName;
std::string proAdhocServer;
std::string sMACAddress;
bool bMOHH2hack;
int iPortOffset;
int iLanguage;
int iTimeFormat;
+3 -1
View File
@@ -1037,7 +1037,7 @@ int friendFinder(){
//_acquireNetworkLock();
// Ping Server
now = real_time_now()*1000000.0; // should be in microseconds, but it seems real_time_now() returns in seconds
now = CoreTiming::GetGlobalTimeUsScaled(); //real_time_now()*1000000.0; // should be in microseconds, but it seems real_time_now() returns in seconds
if (now - lastping >= PSP_ADHOCCTL_PING_TIMEOUT) { //100 // We need to use lower interval to prevent getting timeout at Pro Adhoc Server through internet
// original code : ((sceKernelGetSystemTimeWide() - lastping) >= ADHOCCTL_PING_TIMEOUT)
// Update Ping Time
@@ -1083,6 +1083,8 @@ int friendFinder(){
if (rx[0] == OPCODE_CONNECT_BSSID) {
INFO_LOG(SCENET, "FriendFinder: Incoming OPCODE_CONNECT_BSSID");
// Enough Data available
if(g_Config.bMOHH2hack) // Really bad, but works around MOHH2 timing issue
sleep_ms(666*10); // Don't hurry, be happy, 5s wasn't enough, let's use a safe number
if (rxpos >= (int)sizeof(SceNetAdhocctlConnectBSSIDPacketS2C)) {
// Cast Packet
SceNetAdhocctlConnectBSSIDPacketS2C * packet = (SceNetAdhocctlConnectBSSIDPacketS2C *)rx;
+15
View File
@@ -148,6 +148,20 @@ static const db_crosslink default_crosslinks[] = {
{ "ULES00566", "ULUS10180" },
{ "ULJM05202", "ULUS10180" },
// Medal of Honor Heroes // untested
{ "ULES00557", "ULUS10141" },
{ "ULJM05213", "ULUS10141" },
{ "NPJH50306", "ULUS10141" },
// Medal of Honor Heroes 2 // untested
{ "ULES00988", "ULUS10310" },
{ "ULAS42120", "ULUS10310" },
{ "ULJM05301", "ULUS10310" },
{ "ULES00955", "ULUS10310" },
{ "ULES00956", "ULUS10310" },
{ "ULJM05430", "ULUS10310" },
{ "NPJH50307", "ULUS10310" },
// Metal Gear Solid - Peace Walker
{ "ULES01372", "NPJH50045" },
{ "ULUS10509", "NPJH50045" },
@@ -368,6 +382,7 @@ static const db_productid default_productids[] = {
{ "ULJS00385", "Mahou Shoujo Nanoha A's Portable - The Gears of Destiny" },
{ "ULUS10408", "Mana Khemia Student Alliance" },
{ "ULUS10141", "Medal Of Honor Heroes" },
{ "ULUS10310", "Medal Of Honor Heroes 2" },
{ "NPJH50045", "Metal Gear Solid - Peace Walker" },
{ "ULUS10202", "Metal Gear Solid - Portable Ops" },
{ "ULUS10290", "Metal Gear Solid - Portable Ops +" },
+4 -4
View File
@@ -1796,10 +1796,10 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int
// Blocking Behaviour
if (!flag && newsocket == -1) {
// Get Start Time
uint32_t starttime = (uint32_t)(real_time_now()*1000000.0);
uint32_t starttime = (uint32_t)(CoreTiming::GetGlobalTimeUsScaled());
// Retry until Timeout hits
while ((timeout == 0 ||((uint32_t)(real_time_now()*1000000.0) - starttime) < (uint32_t)timeout) && newsocket == -1) {
while ((timeout == 0 ||((uint32_t)(CoreTiming::GetGlobalTimeUsScaled()) - starttime) < (uint32_t)timeout) && newsocket == -1) {
// Accept Connection
newsocket = accept(socket->id, (sockaddr *)&peeraddr, &peeraddrlen);
@@ -1995,14 +1995,14 @@ static int sceNetAdhocPtpConnect(int id, int timeout, int flag) {
// Blocking Mode
else {
// Grab Connection Start Time
uint32_t starttime = (uint32_t)(real_time_now()*1000000.0);
uint32_t starttime = (uint32_t)(CoreTiming::GetGlobalTimeUsScaled());
// Peer Information (for Connection-Polling)
sockaddr_in peer;
memset(&peer, 0, sizeof(peer));
socklen_t peerlen = sizeof(peer);
// Wait for Connection
while ((timeout == 0 || ( (uint32_t)(real_time_now()*1000000.0) - starttime) < (uint32_t)timeout) && getpeername(socket->id, (sockaddr *)&peer, &peerlen) != 0) {
while ((timeout == 0 || ( (uint32_t)(CoreTiming::GetGlobalTimeUsScaled()) - starttime) < (uint32_t)timeout) && getpeername(socket->id, (sockaddr *)&peer, &peerlen) != 0) {
// Wait 1ms
sleep_ms(1);
}
+1
View File
@@ -636,6 +636,7 @@ 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 ChoiceWithValueDisplay(&g_Config.sMACAddress, n->T("Change Mac Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
networkingSettings->Add(new PopupSliderChoice(&g_Config.iPortOffset, 0, 60000, n->T("Port offset", "Port offset(0 = PSP compatibility)"), 100, screenManager()));
networkingSettings->Add(new CheckBox(&g_Config.bMOHH2hack, n->T("Medal of Honor Heroes 2 hack", "Medal of Honor Heroes 2 hack")));
ViewGroup *toolsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
toolsScroll->SetTag("GameSettingsTools");