Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43fb49b3de | ||
|
|
2840b7620b | ||
|
|
5451249347 | ||
|
|
de8bf25fbe | ||
|
|
b67d9d2094 | ||
|
|
83a62db82a | ||
|
|
42b9349755 | ||
|
|
aca9560079 | ||
|
|
d06e2e5eba | ||
|
|
64e95393c8 | ||
|
|
ea3621971f | ||
|
|
ada85f871e | ||
|
|
05e8ed3c66 | ||
|
|
930a104e50 | ||
|
|
ce3e83039d | ||
|
|
42f09f93e5 | ||
|
|
9f8dab8ebb | ||
|
|
5ebaab0ac9 | ||
|
|
92209cf909 | ||
|
|
94f1cefcf9 | ||
|
|
e254228cf5 | ||
|
|
b87d044cf0 | ||
|
|
01abe05b18 | ||
|
|
2170209e26 | ||
|
|
991369547a | ||
|
|
dbd90a75c9 |
@@ -1,114 +0,0 @@
|
||||
name: Build & Release Windows64
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version tag for release (e.g. v1.0.0).'
|
||||
required: true
|
||||
default: ''
|
||||
notes:
|
||||
description: 'URL to notes for release.'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Validate version format
|
||||
run: |
|
||||
if (-not ("${{ inputs.version }}" -match '^v\d+\.\d+\.\d+[a-zA-Z0-9.-]*$')) {
|
||||
Write-Error "Version '${{ inputs.version }}' doesn't match expected format (e.g. v1.0.0)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
build:
|
||||
needs: validate
|
||||
strategy:
|
||||
matrix:
|
||||
configuration: [ContentPackage]
|
||||
platform: [Windows64]
|
||||
include:
|
||||
- platform: Windows64
|
||||
sdk_label: windows-2022 # str1k3r - can run on any runner
|
||||
|
||||
runs-on: [windows-2022, "${{ matrix.sdk_label }}"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
clean: false
|
||||
lfs: false
|
||||
submodules: true
|
||||
|
||||
- name: Build Cafeberry
|
||||
run: |
|
||||
& "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" MinecraftConsoles.sln `
|
||||
/p:Configuration=${{ matrix.configuration }} `
|
||||
/p:Platform=${{ matrix.platform }} `
|
||||
/m
|
||||
|
||||
- name: Zip Build
|
||||
run: |
|
||||
7z a -r "LCEWindows64.zip" "./x64/${{ matrix.configuration }}/*" "-x!*.pdb" "-x!*.pch" "-x!*.ilk" "-x!*.lib" "-x!*.exp"
|
||||
|
||||
- name: Stage artifacts
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path staging
|
||||
Copy-Item "LCE${{ matrix.platform }}.zip" staging/
|
||||
Copy-Item "./x64/${{ matrix.configuration }}/Minecraft.Client.exe" staging/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.platform }}
|
||||
path: staging/*
|
||||
compression-level: 0
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Download all build artifacts
|
||||
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
path: downloaded
|
||||
|
||||
- name: Fetch release notes
|
||||
id: notes
|
||||
run: |
|
||||
$notesSource = "${{ inputs.notes }}"
|
||||
$fallback = "## Cafeberry`n`n### Whoever made this release forgot to put notes, sorry!"
|
||||
|
||||
if ($notesSource -match '^https?://') {
|
||||
try {
|
||||
$body = (Invoke-WebRequest -Uri $notesSource -UseBasicParsing).Content
|
||||
if ([string]::IsNullOrWhiteSpace($body)) { $body = $fallback }
|
||||
} catch {
|
||||
$body = $fallback
|
||||
}
|
||||
} else {
|
||||
$body = $fallback
|
||||
}
|
||||
|
||||
$delimiter = "EOF_$([System.Guid]::NewGuid().ToString('N'))"
|
||||
$content = "description<<$delimiter`n$body`n$delimiter`n"
|
||||
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, $content, $utf8NoBom)
|
||||
|
||||
- name: Publish Release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
name: ${{ inputs.version }}
|
||||
server_url: ${{ gitea.server_url }}
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ gitea.token }}
|
||||
tag_name: ${{ inputs.version }}
|
||||
prerelease: false
|
||||
verbose: true
|
||||
files: downloaded/**/*
|
||||
body: ${{ steps.notes.outputs.description }}
|
||||
@@ -45,12 +45,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v6
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
clean: false
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
|
||||
- name: Build Cafeberry
|
||||
run: |
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
/Minecraft.Client/PS3/SPU_Tasks/*/Release
|
||||
/Minecraft.Client/PS3/SPU_Tasks/*/ContentPackage
|
||||
|
||||
# Xbox 360 XZP & XURs
|
||||
Minecraft.Client/XboxMedia/XZP
|
||||
Minecraft.Client/Common/Media/XURs
|
||||
|
||||
# Misc
|
||||
*.ppu.o
|
||||
*.pkg
|
||||
@@ -42,5 +38,4 @@ Minecraft.Client/Common/Media/XURs
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.v11.suo
|
||||
*.vcxproj.user
|
||||
*.aps
|
||||
*.vcxproj.user
|
||||
@@ -1,5 +0,0 @@
|
||||
[submodule "Minecraft.Client/Windows64/4JLibs"]
|
||||
path = Minecraft.Client/Windows64/4JLibs
|
||||
url = https://gitea.str1k3r.xyz/cafeberry/4JLibs.git
|
||||
ignore = untracked
|
||||
branch = main
|
||||
@@ -50,11 +50,16 @@
|
||||
#else
|
||||
#include "Common\UI\UI.h"
|
||||
#endif
|
||||
#ifdef __PS3__
|
||||
#if defined __PS3__ && !defined DISABLE_PSN
|
||||
#include "PS3/Network/SonyVoiceChat.h"
|
||||
#endif
|
||||
#include "DLCTexturePack.h"
|
||||
|
||||
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
|
||||
#include "Xbox\Network\NetworkPlayerXbox.h"
|
||||
#include "Common\Network\PlatformNetworkManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef _DURANGO
|
||||
#include "..\Minecraft.World\DurangoStats.h"
|
||||
#include "..\Minecraft.World\GenericStats.h"
|
||||
@@ -781,6 +786,32 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||
player->m_displayName = player->name;
|
||||
#endif
|
||||
|
||||
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
|
||||
{
|
||||
PlayerUID pktXuid = player->getXuid();
|
||||
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e;
|
||||
if (pktXuid >= WIN64_XUID_BASE && pktXuid < WIN64_XUID_BASE + MINECRAFT_NET_MAX_PLAYERS)
|
||||
{
|
||||
BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE);
|
||||
INetworkPlayer *np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||
if (np != NULL)
|
||||
{
|
||||
NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np;
|
||||
IQNetPlayer *qp = npx->GetQNetPlayer();
|
||||
if (qp != NULL)
|
||||
{
|
||||
wcsncpy(qp->m_gamertag, packet->name.c_str(), 31);
|
||||
qp->m_gamertag[31] = L'\0';
|
||||
if (g_NetworkManager.IsHost())
|
||||
{
|
||||
g_NetworkManager.UpdateAndSetGameSessionData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// printf("\t\t\t\t%d: Add player\n",packet->id,packet->yRot);
|
||||
|
||||
int item = packet->carriedItem;
|
||||
@@ -923,6 +954,39 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> p
|
||||
|
||||
void ClientConnection::handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet)
|
||||
{
|
||||
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
|
||||
if (!g_NetworkManager.IsHost())
|
||||
{
|
||||
for (int i = 0; i < packet->ids.length; i++)
|
||||
{
|
||||
shared_ptr<Entity> entity = getEntity(packet->ids[i]);
|
||||
if (entity != NULL && entity->GetType() == eTYPE_PLAYER)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||
if (player != NULL)
|
||||
{
|
||||
PlayerUID xuid = player->getXuid();
|
||||
INetworkPlayer *np = g_NetworkManager.GetPlayerByXuid(xuid);
|
||||
if (np != NULL)
|
||||
{
|
||||
NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np;
|
||||
IQNetPlayer *qp = npx->GetQNetPlayer();
|
||||
if (qp != NULL)
|
||||
{
|
||||
extern CPlatformNetworkManagerStub *g_pPlatformNetworkManager;
|
||||
g_pPlatformNetworkManager->NotifyPlayerLeaving(qp);
|
||||
qp->m_smallId = 0;
|
||||
qp->m_isRemote = false;
|
||||
qp->m_isHostPlayer = false;
|
||||
qp->m_gamertag[0] = 0;
|
||||
qp->SetCustomDataValue(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int i = 0; i < packet->ids.length; i++)
|
||||
{
|
||||
level->removeEntity(packet->ids[i]);
|
||||
@@ -1784,13 +1848,10 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||
app.SetGameHostOption(eGameHostOption_All,packet->m_serverSettings);
|
||||
|
||||
// 4J-PB - if we go straight in from the menus via an invite, we won't have the DLC info
|
||||
//str1k3r - TMS only exists on Xbox platforms therefore, we only need this on Xbox platforms.
|
||||
#if defined(_DURANGO) || defined(_XBOX)
|
||||
if(app.GetTMSGlobalFileListRead()==false)
|
||||
{
|
||||
app.SetTMSAction(ProfileManager.GetPrimaryPad(),eTMSAction_TMSPP_RetrieveFiles_RunPlayGame);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _XBOX
|
||||
@@ -1944,7 +2005,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||
isAtLeastOneFriend = TRUE;
|
||||
cantPlayContentRestricted= FALSE;
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
#if !defined DISABLE_PSN && ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
|
||||
if(!g_NetworkManager.IsHost() && !app.GetGameHostOption(eGameHostOption_FriendsOfFriends))
|
||||
{
|
||||
@@ -3617,7 +3678,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
// Give the player the option to save their game
|
||||
// does the save exist?
|
||||
bool bSaveExists;
|
||||
@@ -3649,7 +3710,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
MinecraftServer::getInstance()->setSaveOnExit( true );
|
||||
@@ -3668,7 +3729,7 @@ int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::
|
||||
//INT saveOrCheckpointId = 0;
|
||||
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
||||
//SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId);
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
MinecraftServer::getInstance()->setSaveOnExit( true );
|
||||
|
||||
@@ -875,8 +875,7 @@ enum EControllerActions
|
||||
MINECRAFT_ACTION_SPAWN_CREEPER,
|
||||
MINECRAFT_ACTION_CHANGE_SKIN,
|
||||
MINECRAFT_ACTION_FLY_TOGGLE,
|
||||
MINECRAFT_ACTION_RENDER_DEBUG,
|
||||
MINECRAFT_ACTION_RENDER_DEBUG_SCREEN
|
||||
MINECRAFT_ACTION_RENDER_DEBUG
|
||||
};
|
||||
|
||||
enum eMCLang
|
||||
|
||||
@@ -162,7 +162,7 @@ MOJANG_DATA;
|
||||
typedef struct
|
||||
{
|
||||
eDLCContentType eDLCType;
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
char chImageURL[256];//SCE_NP_COMMERCE2_URL_LEN
|
||||
#else
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void SoundEngine::playMusicTick() {};
|
||||
#ifdef _WINDOWS64
|
||||
char SoundEngine::m_szSoundPath[]={"Windows64Media\\Sound\\"};
|
||||
char SoundEngine::m_szMusicPath[]={"music\\"};
|
||||
char SoundEngine::m_szRedistName[]={"Windows64\\redist64"}; //str1k3r - moved this to a the Windows64 dir so its out of plain view
|
||||
char SoundEngine::m_szRedistName[]={"redist64"};
|
||||
#elif defined _DURANGO
|
||||
char SoundEngine::m_szSoundPath[]={"Sound\\"};
|
||||
char SoundEngine::m_szMusicPath[]={"music\\"};
|
||||
@@ -791,9 +791,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
char *SoundName = (char *)ConvertSoundPathToName(name);
|
||||
strcat((char *)szSoundName,SoundName);
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf(6,"PlaySound - %d - %s - %s (%f %f %f, vol %f, pitch %f)\n",iSound, SoundName, szSoundName,x,y,z,volume,pitch);
|
||||
#endif
|
||||
// app.DebugPrintf(6,"PlaySound - %d - %s - %s (%f %f %f, vol %f, pitch %f)\n",iSound, SoundName, szSoundName,x,y,z,volume,pitch);
|
||||
|
||||
AUDIO_INFO AudioInfo;
|
||||
AudioInfo.x=x;
|
||||
@@ -848,11 +846,9 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||
|
||||
char *SoundName = (char *)ConvertSoundPathToName(name);
|
||||
strcat((char *)szSoundName,SoundName);
|
||||
// app.DebugPrintf("UI: Playing %s, volume %f, pitch %f\n",SoundName,volume,pitch);
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("UI: Playing %s, volume %f, pitch %f\n",SoundName,volume,pitch);
|
||||
app.DebugPrintf("PlaySound - %d - %s\n",iSound, SoundName);
|
||||
#endif
|
||||
//app.DebugPrintf("PlaySound - %d - %s\n",iSound, SoundName);
|
||||
|
||||
AUDIO_INFO AudioInfo;
|
||||
memset(&AudioInfo,0,sizeof(AUDIO_INFO));
|
||||
@@ -1140,12 +1136,10 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter )
|
||||
SoundEngine *soundEngine = (SoundEngine *)lpParameter;
|
||||
soundEngine->m_hStream = AIL_open_stream(soundEngine->m_hDriver,soundEngine->m_szStreamName,0);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(soundEngine->m_hStream==0)
|
||||
{
|
||||
app.DebugPrintf("SoundEngine::OpenStreamThreadProc - Could not open - %s\n",soundEngine->m_szStreamName);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
param(
|
||||
[string]$ProjectDir,
|
||||
[string]$Platform,
|
||||
[string]$Configuration
|
||||
)
|
||||
|
||||
if ($ProjectDir -match "Minecraft.World") {
|
||||
$BaseDir = "$ProjectDir..\Minecraft.Client\"
|
||||
} elseif ($ProjectDir -match "Minecraft.Client") {
|
||||
$BaseDir = $ProjectDir
|
||||
} else {
|
||||
Write-Host "4JLibs: Unknown project directory: '$ProjectDir'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
switch ($Platform) {
|
||||
"x64" { $LibsDir = Join-Path $BaseDir "Windows64\4JLibs\"; $ExpectedCount = 4; $PlatformName = "Windows64" }
|
||||
"Durango" { $LibsDir = Join-Path $BaseDir "Durango\4JLibs\"; $ExpectedCount = 4; $PlatformName = "Durango" }
|
||||
"Xbox 360" { $LibsDir = Join-Path $BaseDir "Xbox\4JLibs\"; $ExpectedCount = 5; $PlatformName = "Xbox" }
|
||||
"PS3" { $LibsDir = Join-Path $BaseDir "PS3\4JLibs\"; $ExpectedCount = 4; $PlatformName = "PS3" }
|
||||
"Orbis" { $LibsDir = Join-Path $BaseDir "Orbis\4JLibs\"; $ExpectedCount = 4; $PlatformName = "Orbis" }
|
||||
"PSVita" { $LibsDir = Join-Path $BaseDir "PSVita\4JLibs\"; $ExpectedCount = 4; $PlatformName = "PSVita" }
|
||||
default { Write-Host "4JLibs: Unknown platform: '$Platform'"; exit 1 }
|
||||
}
|
||||
|
||||
if ($Configuration -match "ContentPackage" -or $Configuration -match "Release") {
|
||||
$BuildConfig = "Release"
|
||||
} elseif ($Configuration -match "Debug") {
|
||||
$BuildConfig = "Debug"
|
||||
} else {
|
||||
Write-Host "4JLibs: Configuration did not match any known patterns, defaulting to Debug"
|
||||
$BuildConfig = "Debug"
|
||||
}
|
||||
|
||||
if (-not (Test-Path $LibsDir)) {
|
||||
Write-Host "4JLibs: $PlatformName 4JLibs directory not found"
|
||||
exit 1
|
||||
} elseif (-not (Test-Path "$LibsDir\Headers\$PlatformName")) {
|
||||
Write-Host "4JLibs: $PlatformName 4JLibs Headers directory not found"
|
||||
exit 1
|
||||
} elseif (-not (Test-Path "$LibsDir\Headers")) {
|
||||
Write-Host "4JLibs: Headers directory not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$incPath = Join-Path $LibsDir "inc"
|
||||
$libsPath = Join-Path $LibsDir "libs"
|
||||
|
||||
$incCount = (Get-ChildItem -Path $incPath -Filter "*.h" -ErrorAction SilentlyContinue).Count
|
||||
|
||||
if ($BuildConfig -eq "Release") {
|
||||
$libCount = (Get-ChildItem -Path $libsPath -Filter "*_r.lib" -ErrorAction SilentlyContinue).Count
|
||||
} else {
|
||||
$libCount = (Get-ChildItem -Path $libsPath -Filter "*_d.lib" -ErrorAction SilentlyContinue).Count
|
||||
}
|
||||
|
||||
if ($incCount -lt $ExpectedCount) {
|
||||
Write-Host "4JLibs: Copying header files for $PlatformName"
|
||||
xcopy "$LibsDir\Headers\$PlatformName\*" "$incPath" /E /I /Y
|
||||
} else {
|
||||
Write-Host "4JLibs: inc files already present, skipping copy."
|
||||
}
|
||||
|
||||
if ($libCount -lt $ExpectedCount) {
|
||||
Write-Host "4JLibs: Building 4JLibs for $PlatformName in $BuildConfig"
|
||||
|
||||
& "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" `
|
||||
(Join-Path $LibsDir "4JLibs.sln") `
|
||||
/p:Configuration=$BuildConfig `
|
||||
/p:Platform=$PlatformName `
|
||||
/v:minimal `
|
||||
/m
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "4JLibs: Build failed with exit code: $LASTEXITCODE"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
} else {
|
||||
Write-Host "4JLibs: libs already present, skipping build."
|
||||
}
|
||||
@@ -766,8 +766,6 @@ void CMinecraftApp::InitGameSettings()
|
||||
// 4J-PB - adding in for Windows & PS3 to set the defaults for the joypad
|
||||
#if defined _WINDOWS64// || defined __PSVITA__
|
||||
C_4JProfile::PROFILESETTINGS *pProfileSettings=ProfileManager.GetDashboardProfileSettings(i);
|
||||
//str1k3r - Temporary
|
||||
app.SetGameHostOption(eGameHostOption_DisableSaving, 0);
|
||||
// clear this for now - it will come from reading the system values
|
||||
memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS));
|
||||
SetDefaultOptions(pProfileSettings,i);
|
||||
@@ -2388,7 +2386,7 @@ void CMinecraftApp::ClearGameSettingsChangedFlag(int iPad)
|
||||
// Remove the debug settings in the content package build
|
||||
//
|
||||
////////////////////////////
|
||||
#ifndef _DEBUG_MENUS_ENABLED
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options
|
||||
{
|
||||
return 0;
|
||||
@@ -2401,7 +2399,9 @@ void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal)
|
||||
void CMinecraftApp::ActionDebugMask(int iPad,bool bSetAllClear)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options
|
||||
{
|
||||
if(iPad==-1)
|
||||
@@ -2780,7 +2780,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||
app.SetAutosaveTimerTime();
|
||||
SetAction(i,eAppAction_Idle);
|
||||
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame);
|
||||
|
||||
if(app.GetGameHostOption(eGameHostOption_DisableSaving)) StorageManager.SetSaveDisabled(true);
|
||||
@@ -3567,7 +3567,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||
SetAction(i,eAppAction_Idle);
|
||||
// Check the player really wants to do this
|
||||
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
// Show save option is saves ARE disabled
|
||||
if(ProfileManager.IsFullVersion() && StorageManager.GetSaveDisabled() && i==ProfileManager.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted() )
|
||||
{
|
||||
@@ -3844,9 +3844,9 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||
case eAppAction_SetDefaultOptions:
|
||||
SetAction(i,eAppAction_Idle);
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
|
||||
SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i);
|
||||
SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i);
|
||||
#else
|
||||
SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i);
|
||||
SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i);
|
||||
#endif
|
||||
|
||||
// if the profile data has been changed, then force a profile write
|
||||
@@ -4419,7 +4419,7 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto
|
||||
// 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceHidePsStoreIcon();
|
||||
#elif defined __PSVITA__
|
||||
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
app.SetAction(iPad,eAppAction_EthernetDisconnectedReturned_Menus);
|
||||
@@ -5094,6 +5094,9 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
int CMinecraftApp::MustSignInFullVersionPurchaseReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
@@ -5106,11 +5109,15 @@ int CMinecraftApp::MustSignInFullVersionPurchaseReturned(void *pParam,int iPad,C
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
int CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
@@ -5126,6 +5133,7 @@ int CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial(void *pParam,i
|
||||
app.SetAction(iPad,eAppAction_ExitWorldTrial);
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5936,7 +5944,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
MinecraftServer::getInstance()->setSaveOnExit( true );
|
||||
@@ -6139,7 +6147,7 @@ int CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned(void *pParam,int iPa
|
||||
// results switched for this dialog
|
||||
if(result==C4JStorage::EMessage_ResultDecline)
|
||||
{
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
MinecraftServer::getInstance()->setSaveOnExit( false );
|
||||
@@ -6455,7 +6463,7 @@ wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shado
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_DOWN ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_RIGHT ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_LEFT ) );
|
||||
#if defined _XBOX_ONE || defined __PSVITA__ || defined _WINDOWS64
|
||||
#if defined _XBOX_ONE || defined __PSVITA__
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_START*}", GetVKReplacement(VK_PAD_START ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_BACK*}", GetVKReplacement(VK_PAD_BACK ) );
|
||||
#endif
|
||||
@@ -6578,16 +6586,8 @@ wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction)
|
||||
#ifdef __PS3__
|
||||
int size = 30;
|
||||
#elif defined _WIN64
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
size = 45;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 30;
|
||||
}
|
||||
int size = 45;
|
||||
if(ui.getScreenWidth() < 1920) size = 30;
|
||||
#else
|
||||
int size = 45;
|
||||
#endif
|
||||
@@ -6699,7 +6699,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
|
||||
case VK_PAD_RTHUMB_DOWNLEFT :
|
||||
replacement = L"ButtonRightStick";
|
||||
break;
|
||||
#if defined _XBOX_ONE || defined __PSVITA__ || defined _WINDOWS64
|
||||
#if defined _XBOX_ONE || defined __PSVITA__
|
||||
case VK_PAD_START:
|
||||
replacement = L"ButtonStart";
|
||||
break;
|
||||
@@ -6715,16 +6715,8 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
|
||||
#ifdef __PS3__
|
||||
int size = 30;
|
||||
#elif defined _WIN64
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
size = 45;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 30;
|
||||
}
|
||||
int size = 45;
|
||||
if(ui.getScreenWidth() < 1920) size = 30;
|
||||
#else
|
||||
int size = 45;
|
||||
#endif
|
||||
@@ -6754,16 +6746,8 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon)
|
||||
#ifdef __PS3__
|
||||
int size = 22;
|
||||
#elif defined _WIN64
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
int size = 33;
|
||||
}
|
||||
else
|
||||
{
|
||||
int size = 22;
|
||||
}
|
||||
int size = 33;
|
||||
if(ui.getScreenWidth() < 1920) size = 22;
|
||||
#else
|
||||
int size = 33;
|
||||
#endif
|
||||
@@ -6785,7 +6769,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
unordered_map<PlayerUID, MOJANG_DATA *, PlayerUID::Hash> CMinecraftApp::MojangData;
|
||||
unordered_map<int, char * > CMinecraftApp::DLCTextures_PackID;
|
||||
unordered_map<string, DLC_INFO * > CMinecraftApp::DLCInfo;
|
||||
@@ -6796,6 +6780,12 @@ unordered_map<int, wstring > CMinecraftApp::DLCTextures_PackID; // for mash-up
|
||||
//unordered_map<ULONGLONG,DLC_INFO * > CMinecraftApp::DLCInfo_Trial; // full offerid, dlc_info
|
||||
unordered_map<wstring,DLC_INFO * > CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info
|
||||
unordered_map<wstring, wstring > CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id
|
||||
#elif defined(DISABLE_PSN)
|
||||
unordered_map<PlayerUID, MOJANG_DATA *, PlayerUID::Hash> CMinecraftApp::MojangData;
|
||||
unordered_map<int, ULONGLONG > CMinecraftApp::DLCTextures_PackID;
|
||||
unordered_map<ULONGLONG, DLC_INFO * > CMinecraftApp::DLCInfo_Trial;
|
||||
unordered_map<ULONGLONG, DLC_INFO * > CMinecraftApp::DLCInfo_Full;
|
||||
unordered_map<wstring, ULONGLONG > CMinecraftApp::DLCInfo_SkinName;
|
||||
#else
|
||||
unordered_map<PlayerUID, MOJANG_DATA *> CMinecraftApp::MojangData;
|
||||
unordered_map<int, ULONGLONG > CMinecraftApp::DLCTextures_PackID;
|
||||
@@ -6878,7 +6868,7 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue)
|
||||
return hr;
|
||||
}
|
||||
|
||||
#if (defined _XBOX || defined _WINDOWS64)
|
||||
#if (defined _XBOX || defined _WINDOWS64 || defined DISABLE_PSN)
|
||||
HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, __uint64 ullOfferID_Full, __uint64 ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
@@ -6895,12 +6885,20 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe
|
||||
// ignore the names if we don't recognize them
|
||||
if(pBannerName!=L"")
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
wcsncpy_s( pDLCData->wchBanner, MAX_BANNERNAME_SIZE, pBannerName, MAX_BANNERNAME_SIZE);
|
||||
#else
|
||||
wcsncpy_s( pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(pDataFile[0]!=0)
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
wcsncpy_s( pDLCData->wchDataFile, MAX_BANNERNAME_SIZE, pDataFile, MAX_BANNERNAME_SIZE);
|
||||
#else
|
||||
wcsncpy_s( pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7070,7 +7068,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde
|
||||
|
||||
|
||||
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__))
|
||||
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
|
||||
{
|
||||
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
|
||||
@@ -7338,7 +7336,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#elif !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
#else
|
||||
|
||||
DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
|
||||
@@ -9449,7 +9447,7 @@ byteArray CMinecraftApp::getArchiveFile(const wstring &filename)
|
||||
|
||||
// DLC
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
int CMinecraftApp::GetDLCInfoCount()
|
||||
{
|
||||
return (int)DLCInfo.size();
|
||||
@@ -9484,7 +9482,7 @@ int CMinecraftApp::GetDLCInfoTexturesOffersCount()
|
||||
// AUTOSAVE
|
||||
void CMinecraftApp::SetAutosaveTimerTime(void)
|
||||
{
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64)
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
m_uiAutosaveTimer= GetTickCount()+1000*60;
|
||||
#else
|
||||
m_uiAutosaveTimer= GetTickCount()+GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Autosave)*1000*60*15;
|
||||
@@ -10058,11 +10056,11 @@ enum ETitleUpdateTexturePacks
|
||||
#ifdef _WINDOWS64
|
||||
wstring titleUpdateTexturePackRoot = L"Windows64\\DLC\\";
|
||||
#elif defined(__ORBIS__)
|
||||
wstring titleUpdateTexturePackRoot = L"app0/Orbis/DLC/";
|
||||
wstring titleUpdateTexturePackRoot = L"/app0/orbis/CU/DLC/";
|
||||
#elif defined(__PSVITA__)
|
||||
wstring titleUpdateTexturePackRoot = L"PSVita/DLC/";
|
||||
wstring titleUpdateTexturePackRoot = L"PSVita/CU/DLC/";
|
||||
#elif defined(__PS3__)
|
||||
wstring titleUpdateTexturePackRoot = L"PS3/DLC/";
|
||||
wstring titleUpdateTexturePackRoot = L"PS3/CU/DLC/";
|
||||
#else
|
||||
wstring titleUpdateTexturePackRoot = L"CU\\DLC\\";
|
||||
#endif
|
||||
|
||||
@@ -594,7 +594,7 @@ public:
|
||||
MOJANG_DATA *GetMojangDataForXuid(PlayerUID xuid);
|
||||
static HRESULT RegisterConfigValues(WCHAR *pType, int iValue);
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__))
|
||||
HRESULT RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex, char *pchImageURL);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
|
||||
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
|
||||
@@ -631,7 +631,7 @@ private:
|
||||
|
||||
std::vector <SCreditTextItemDef *> vDLCCredits;
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
static unordered_map<string,DLC_INFO * > DLCInfo;
|
||||
@@ -642,6 +642,12 @@ private:
|
||||
//static unordered_map<wstring,DLC_INFO * > DLCInfo_Trial; // full offerid, dlc_info
|
||||
static unordered_map<wstring,DLC_INFO * > DLCInfo_Full; // full offerid, dlc_info
|
||||
static unordered_map<wstring, wstring > DLCInfo_SkinName; // skin name, full offer id
|
||||
#elif defined(DISABLE_PSN)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
static unordered_map<int, ULONGLONG > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
static unordered_map<ULONGLONG,DLC_INFO * > DLCInfo_Trial; // full offerid, dlc_info
|
||||
static unordered_map<ULONGLONG,DLC_INFO * > DLCInfo_Full; // full offerid, dlc_info
|
||||
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
|
||||
#else
|
||||
static unordered_map<PlayerUID,MOJANG_DATA * > MojangData;
|
||||
static unordered_map<int, ULONGLONG > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
@@ -772,7 +778,7 @@ public:
|
||||
void ClearTMSPPFilesRetrieved();
|
||||
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
|
||||
int GetDLCInfoTexturesOffersCount();
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__))
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(char *);
|
||||
DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
|
||||
@@ -851,6 +857,15 @@ public:
|
||||
static DWORD getSkinIdFromPath(const wstring &skin);
|
||||
static wstring getSkinPathFromId(DWORD skinId);
|
||||
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0;
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0;
|
||||
virtual void FreeLocalTMSFiles(eTMSFileType eType)=0;
|
||||
virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)=0;
|
||||
|
||||
virtual bool GetTMSGlobalFileListRead() { return true;}
|
||||
virtual bool GetTMSDLCInfoRead() { return true;}
|
||||
virtual bool GetTMSXUIDsFileRead() { return true;}
|
||||
|
||||
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
|
||||
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
|
||||
|
||||
@@ -406,12 +406,6 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion > CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
app.DebugPrintf("DLC version of %d is newer than this build can read (%d)\n", uiVersion, CURRENT_DLC_VERSION_NUM);
|
||||
return false;
|
||||
}
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
@@ -619,11 +613,6 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion > CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
app.DebugPrintf("DLC version of %d is newer than this build can read (%d)\n", uiVersion, CURRENT_DLC_VERSION_NUM);
|
||||
return 0;
|
||||
}
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||
|
||||
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 115 KiB |
@@ -66,9 +66,9 @@ void CGameNetworkManager::Initialise()
|
||||
ServerStoppedCreate( false );
|
||||
ServerReadyCreate( false );
|
||||
int flagIndexSize = LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column
|
||||
#ifdef _XBOX
|
||||
#if !defined(_DISABLE_XBLIVE) && defined _XBOX
|
||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox();
|
||||
#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
|
||||
#elif !defined(DISABLE_PSN) && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerSony();
|
||||
#elif defined _DURANGO
|
||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango();
|
||||
@@ -167,6 +167,11 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Client needs QNET_STATE_GAME_PLAY so that IsInGameplay() returns true
|
||||
s_pPlatformNetworkManager->SetGamePlayState();
|
||||
}
|
||||
|
||||
if( g_NetworkManager.IsLeavingGame() ) return false;
|
||||
|
||||
@@ -336,10 +341,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
|
||||
// 4J Stu - Wait a while to make sure that DLC is loaded. This is the last point before the network communication starts
|
||||
// so the latest we can check this
|
||||
#ifndef DISABLE_PSN
|
||||
while( !app.DLCInstallProcessCompleted() && app.DLCInstallPending() && !g_NetworkManager.IsLeavingGame() )
|
||||
{
|
||||
Sleep( 10 );
|
||||
}
|
||||
#endif
|
||||
if( g_NetworkManager.IsLeavingGame() )
|
||||
{
|
||||
MinecraftServer::HaltServer();
|
||||
@@ -496,7 +503,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
// The connections should tick at 20 per second
|
||||
Sleep(50);
|
||||
app.DebugPrintf("<***> %d %d %d %d %d\n",IsInSession(), !connection->isStarted(),!connection->isClosed(),ProfileManager.IsSignedIn(idx),!g_NetworkManager.IsLeavingGame());
|
||||
#if defined _XBOX || __PS3__
|
||||
#if defined _XBOX || defined __PS3__ && !defined DISABLE_PSN
|
||||
} while (IsInSession() && !connection->isStarted() && !connection->isClosed() && ProfileManager.IsSignedIn(idx) && !g_NetworkManager.IsLeavingGame() );
|
||||
#else
|
||||
// TODO - This SHOULD be something just like the code above but temporarily changing here so that we don't have to depend on the profilemanager behaviour
|
||||
@@ -794,7 +801,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||
|
||||
// Check if user-created content is allowed, as we cannot play multiplayer if it's not
|
||||
bool noUGC = false;
|
||||
#if defined(__PS3__) || defined(__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__))
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL);
|
||||
#elif defined(__ORBIS__)
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL);
|
||||
@@ -1007,6 +1014,9 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
@@ -1025,10 +1035,14 @@ int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int iPad)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
JoinFromInviteData *inviteData = (JoinFromInviteData *)pParam;
|
||||
|
||||
// If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got
|
||||
@@ -1061,12 +1075,16 @@ int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int i
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// This case happens when we were in the main menus when we got an invite, and weren't signed in... now can proceed with the normal flow of code for this situation
|
||||
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
@@ -1078,10 +1096,14 @@ int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int iPad)
|
||||
{
|
||||
#ifdef DISABLE_PSN
|
||||
return 0;
|
||||
#else
|
||||
INVITE_INFO *inviteInfo = (INVITE_INFO *)pParam;
|
||||
|
||||
// If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got
|
||||
@@ -1109,6 +1131,7 @@ int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int i
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1446,7 +1469,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying)
|
||||
if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) )
|
||||
{
|
||||
app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i );
|
||||
Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
|
||||
//Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1479,7 +1502,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
Socket *socket = NULL;
|
||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = nullptr;
|
||||
int userIdx = pNetworkPlayer->GetUserIndex();
|
||||
if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT)
|
||||
mpPlayer = pMinecraft->localplayers[userIdx];
|
||||
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
||||
{
|
||||
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
||||
@@ -1789,7 +1815,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
#endif
|
||||
if( !g_NetworkManager.IsInSession() )
|
||||
{
|
||||
#if defined (__PS3__) || defined (__PSVITA__)
|
||||
#if !defined(DISABLE_PSN) && (defined (__PS3__) || defined (__PSVITA__))
|
||||
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
|
||||
|
||||
// Determine why they're not "signed in live"
|
||||
@@ -1821,7 +1847,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
// joinData->pInviteInfo = pInviteInfo;
|
||||
|
||||
// tell the app to process this
|
||||
#ifdef __PSVITA__
|
||||
#if !defined(DISABLE_PSN) && defined(__PSVITA__)
|
||||
if(((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->checkValidInviteData(pInviteInfo))
|
||||
#endif
|
||||
{
|
||||
@@ -1939,7 +1965,7 @@ void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly)
|
||||
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
m_bLastDisconnectWasLostRoomOnly = bLostRoomOnly;
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
#if !defined(DISABLE_PSN) && (defined __PS3__ || defined __PSVITA__ || defined __ORBIS__)
|
||||
m_bSignedOutofPSN=bPSNSignout;
|
||||
#endif
|
||||
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
||||
@@ -2064,7 +2090,7 @@ void CGameNetworkManager::FakeLocalPlayerJoined()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if !defined(DISABLE_PSN) && defined(__PSVITA__)
|
||||
bool CGameNetworkManager::usingAdhocMode()
|
||||
{
|
||||
return ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->usingAdhocMode();
|
||||
@@ -2079,5 +2105,17 @@ void CGameNetworkManager::startAdhocMatching()
|
||||
{
|
||||
((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->startAdhocMatching();
|
||||
}
|
||||
#elif defined(__PSVITA__)
|
||||
bool CGameNetworkManager::usingAdhocMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CGameNetworkManager::setAdhocMode(bool bAdhoc)
|
||||
{
|
||||
}
|
||||
|
||||
void CGameNetworkManager::startAdhocMatching()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
#include <qnet.h>
|
||||
#endif
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#ifdef _XBOX
|
||||
#if defined _XBOX && !defined _DISABLE_XBLIVE
|
||||
#include "..\..\Xbox\Network\PlatformNetworkManagerXbox.h"
|
||||
#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
|
||||
#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
#include "..\..\Common\Network\Sony\PlatformNetworkManagerSony.h"
|
||||
#elif defined _DURANGO
|
||||
#include "..\..\Durango\Network\PlatformNetworkManagerDurango.h"
|
||||
#else
|
||||
#include "PlatformNetworkManagerStub.h"
|
||||
#include "PlatformNetworkManager.h"
|
||||
#endif
|
||||
#include "SessionInfo.h"
|
||||
|
||||
@@ -30,9 +32,9 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1;
|
||||
|
||||
class CGameNetworkManager
|
||||
{
|
||||
#ifdef _XBOX
|
||||
#if defined _XBOX && !defined _DISABLE_XBLIVE
|
||||
friend class CPlatformNetworkManagerXbox;
|
||||
#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
|
||||
#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
friend class CPlatformNetworkManagerSony;
|
||||
#elif defined _DURANGO
|
||||
friend class CPlatformNetworkManagerDurango;
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
const int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0;
|
||||
const int QNET_GETSENDQUEUESIZE_MESSAGES = 0;
|
||||
const int QNET_GETSENDQUEUESIZE_BYTES = 0;
|
||||
|
||||
const int QNET_SENDDATA_LOW_PRIORITY = 0;
|
||||
const int QNET_SENDDATA_SECONDARY = 0;
|
||||
|
||||
const int QNET_SENDDATA_RELIABLE = 0;
|
||||
const int QNET_SENDDATA_SEQUENTIAL = 0;
|
||||
|
||||
#define QNET_E_SESSION_FULL 0
|
||||
#define QNET_USER_MASK_USER0 1
|
||||
#define QNET_USER_MASK_USER1 2
|
||||
#define QNET_USER_MASK_USER2 4
|
||||
#define QNET_USER_MASK_USER3 8
|
||||
|
||||
typedef enum _QNET_STATE
|
||||
{
|
||||
QNET_STATE_IDLE,
|
||||
QNET_STATE_SESSION_HOSTING,
|
||||
QNET_STATE_SESSION_JOINING,
|
||||
QNET_STATE_GAME_LOBBY,
|
||||
QNET_STATE_SESSION_REGISTERING,
|
||||
QNET_STATE_SESSION_STARTING,
|
||||
QNET_STATE_GAME_PLAY,
|
||||
QNET_STATE_SESSION_ENDING,
|
||||
QNET_STATE_SESSION_LEAVING,
|
||||
QNET_STATE_SESSION_DELETING
|
||||
} QNET_STATE, * PQNET_STATE;
|
||||
|
||||
class IQNetPlayer
|
||||
{
|
||||
public:
|
||||
BYTE GetSmallId();
|
||||
void SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags);
|
||||
bool IsSameSystem(IQNetPlayer *player);
|
||||
DWORD GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags );
|
||||
DWORD GetCurrentRtt();
|
||||
bool IsHost();
|
||||
bool IsGuest();
|
||||
bool IsLocal();
|
||||
PlayerUID GetXuid();
|
||||
LPCWSTR GetGamertag();
|
||||
int GetSessionIndex();
|
||||
bool IsTalking();
|
||||
bool IsMutedByLocalUser(DWORD dwUserIndex);
|
||||
bool HasVoice();
|
||||
bool HasCamera();
|
||||
int GetUserIndex();
|
||||
void SetCustomDataValue(ULONG_PTR ulpCustomDataValue);
|
||||
ULONG_PTR GetCustomDataValue();
|
||||
|
||||
BYTE m_smallId;
|
||||
bool m_isRemote;
|
||||
bool m_isHostPlayer;
|
||||
wchar_t m_gamertag[32];
|
||||
private:
|
||||
ULONG_PTR m_customData;
|
||||
};
|
||||
|
||||
void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, bool isLocal);
|
||||
|
||||
class IQNetCallbacks
|
||||
{
|
||||
};
|
||||
|
||||
class IQNetGameSearch
|
||||
{
|
||||
};
|
||||
|
||||
class IQNet
|
||||
{
|
||||
public:
|
||||
HRESULT AddLocalPlayerByUserIndex(DWORD dwUserIndex);
|
||||
IQNetPlayer *GetHostPlayer();
|
||||
IQNetPlayer *GetLocalPlayerByUserIndex(DWORD dwUserIndex);
|
||||
IQNetPlayer *GetPlayerByIndex(DWORD dwPlayerIndex);
|
||||
IQNetPlayer *GetPlayerBySmallId(BYTE SmallId);
|
||||
IQNetPlayer *GetPlayerByXuid(PlayerUID xuid);
|
||||
DWORD GetPlayerCount();
|
||||
QNET_STATE GetState();
|
||||
bool IsHost();
|
||||
HRESULT JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo);
|
||||
void HostGame();
|
||||
void ClientJoinGame();
|
||||
void EndGame();
|
||||
|
||||
static IQNetPlayer m_player[MINECRAFT_NET_MAX_PLAYERS];
|
||||
static DWORD s_playerCount;
|
||||
static bool s_isHosting;
|
||||
};
|
||||
@@ -0,0 +1,232 @@
|
||||
#pragma once
|
||||
|
||||
#if defined _WINDOWS64
|
||||
#include <WinSock2.h>
|
||||
#include <WS2tcpip.h>
|
||||
#elif defined _XBOX
|
||||
#include <stdint.h>
|
||||
#include <winsockx.h>
|
||||
#include <xtl.h>
|
||||
#elif defined __PS3__ || defined __ORBIS__
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/select.h>
|
||||
#elif defined __PSVITA__
|
||||
#include <net.h>
|
||||
#endif
|
||||
|
||||
#ifdef __PS3__
|
||||
#include <netex/net.h>
|
||||
#include <netex/errno.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "..\..\Common\Network\NetworkPlayerInterface.h"
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#endif
|
||||
|
||||
#define NETWORK_LAN_DEFAULT_PORT 25565
|
||||
#define NETWORK_LAN_MAX_CLIENTS 7
|
||||
#define NETWORK_LAN_RECV_BUFFER_SIZE 65536
|
||||
#define NETWORK_LAN_MAX_PACKET_SIZE (4 * 1024 * 1024)
|
||||
#define NETWORK_LAN_DISCOVERY_PORT 25566
|
||||
#define NETWORK_LAN_BROADCAST_MAGIC 0x4D434C4E
|
||||
|
||||
#ifdef __PS3__
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET -1
|
||||
#define closesocket socketclose
|
||||
#elif defined(__ORBIS__)
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET -1
|
||||
#define SO_NBIO SCE_NET_SO_NBIO
|
||||
#define sys_net_errno errno
|
||||
#define SYS_NET_EINPROGRESS EINPROGRESS
|
||||
#define socketselect select
|
||||
#define closesocket sceNetSocketClose
|
||||
#define socketclose sceNetSocketClose
|
||||
#elif defined(__PSVITA__)
|
||||
typedef SceNetId SOCKET;
|
||||
typedef SceNetSockaddr sockaddr;
|
||||
typedef SceNetSocklen_t socklen_t;
|
||||
|
||||
#define getsockopt sceNetGetsockopt
|
||||
#define setsockopt sceNetSetsockopt
|
||||
#define recv sceNetRecv
|
||||
#define send sceNetSend
|
||||
#define bind sceNetBind
|
||||
#define sendto sceNetSendto
|
||||
#define recvfrom sceNetRecvfrom
|
||||
#define listen sceNetListen
|
||||
#define connect sceNetConnect
|
||||
#define accept sceNetAccept
|
||||
#define closesocket sceNetSocketClose
|
||||
#define socketclose sceNetSocketClose
|
||||
#define inet_ntop sceNetInetNtop
|
||||
|
||||
#define SOL_SOCKET SCE_NET_SOL_SOCKET
|
||||
#define AF_INET SCE_NET_AF_INET
|
||||
#define SOCK_STREAM SCE_NET_SOCK_STREAM
|
||||
#define sys_net_errno sce_net_errno
|
||||
#define SYS_NET_EINPROGRESS SCE_NET_EINPROGRESS
|
||||
|
||||
#define htonl sceNetHtonl
|
||||
#define htons sceNetHtons
|
||||
#define ntohl sceNetNtohl
|
||||
#define ntohs sceNetNtohs
|
||||
|
||||
#define SO_BROADCAST SCE_NET_SO_BROADCAST
|
||||
#define SO_ERROR SCE_NET_SO_ERROR
|
||||
#define SO_RCVTIMEO SCE_NET_SO_RCVTIMEO
|
||||
#define SO_REUSEADDR SCE_NET_SO_REUSEADDR
|
||||
#define SO_NBIO SCE_NET_SO_NBIO
|
||||
#define SOCK_DGRAM SCE_NET_SOCK_DGRAM
|
||||
|
||||
#define INADDR_ANY SCE_NET_INADDR_ANY
|
||||
#define IPPROTO_TCP SCE_NET_IPPROTO_TCP
|
||||
#define IPPROTO_UDP SCE_NET_IPPROTO_UDP
|
||||
#define TCP_NODELAY SCE_NET_TCP_NODELAY
|
||||
#define INADDR_BROADCAST SCE_NET_INADDR_BROADCAST
|
||||
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
class Socket;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct LANBroadcast
|
||||
{
|
||||
DWORD magic;
|
||||
WORD netVersion;
|
||||
WORD gamePort;
|
||||
char hostName[32];
|
||||
BYTE playerCount;
|
||||
BYTE maxPlayers;
|
||||
DWORD gameHostSettings;
|
||||
DWORD texturePackParentId;
|
||||
BYTE subTexturePackId;
|
||||
BYTE isJoinable;
|
||||
char playerNames[8][XUSER_NAME_SIZE];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct LANSession
|
||||
{
|
||||
char hostIP[64];
|
||||
int hostPort;
|
||||
wchar_t hostName[32];
|
||||
unsigned short netVersion;
|
||||
unsigned char playerCount;
|
||||
unsigned char maxPlayers;
|
||||
unsigned int gameHostSettings;
|
||||
unsigned int texturePackParentId;
|
||||
unsigned char subTexturePackId;
|
||||
bool isJoinable;
|
||||
DWORD lastSeenTick;
|
||||
char playerNames[8][XUSER_NAME_SIZE];
|
||||
};
|
||||
|
||||
struct RemoteConnection
|
||||
{
|
||||
SOCKET tcpSocket;
|
||||
BYTE smallId;
|
||||
C4JThread* recvThread;
|
||||
volatile bool active;
|
||||
};
|
||||
|
||||
class NetworkSocketLayer
|
||||
{
|
||||
public:
|
||||
static bool Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
static bool HostGame(int port);
|
||||
static bool JoinGame(const char *ip, int port);
|
||||
|
||||
static bool SendToSmallId(BYTE targetSmallId, const void *data, int dataSize);
|
||||
static bool SendOnSocket(SOCKET sock, const void *data, int dataSize);
|
||||
|
||||
static bool IsHosting() { return s_isHost; }
|
||||
static bool IsConnected() { return s_connected; }
|
||||
static bool IsActive() { return s_active; }
|
||||
|
||||
static BYTE GetLocalSmallId() { return s_localSmallId; }
|
||||
static BYTE GetHostSmallId() { return s_hostSmallId; }
|
||||
|
||||
static SOCKET GetSocketForSmallId(BYTE smallId);
|
||||
|
||||
static void HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsigned char *data, unsigned int dataSize);
|
||||
|
||||
static bool PopDisconnectedSmallId(BYTE *outSmallId);
|
||||
static void PushFreeSmallId(BYTE smallId);
|
||||
static void CloseConnectionBySmallId(BYTE smallId);
|
||||
|
||||
static bool StartAdvertising(int gamePort, const wchar_t *hostName, unsigned int gameSettings, unsigned int texPackId, unsigned char subTexId, unsigned short netVer);
|
||||
static void StopAdvertising();
|
||||
static void UpdateAdvertisePlayerCount(BYTE count);
|
||||
static void UpdateAdvertiseJoinable(bool joinable);
|
||||
static void UpdateAdvertisePlayerNames(BYTE count, const char playerNames[][XUSER_NAME_SIZE]);
|
||||
|
||||
static bool StartDiscovery();
|
||||
static void StopDiscovery();
|
||||
static vector<LANSession> GetDiscoveredSessions();
|
||||
|
||||
static int GetHostPort() { return s_hostGamePort; }
|
||||
|
||||
private:
|
||||
static int AcceptThreadProc(void* param);
|
||||
static int RecvThreadProc(void* param);
|
||||
static int ClientRecvThreadProc(void* param);
|
||||
static int AdvertiseThreadProc(void* param);
|
||||
static int DiscoveryThreadProc(void* param);
|
||||
|
||||
static SOCKET s_listenSocket;
|
||||
static SOCKET s_hostConnectionSocket;
|
||||
static C4JThread* s_acceptThread;
|
||||
static C4JThread* s_clientRecvThread;
|
||||
|
||||
static bool s_isHost;
|
||||
static bool s_connected;
|
||||
static bool s_active;
|
||||
static bool s_initialized;
|
||||
|
||||
static BYTE s_localSmallId;
|
||||
static BYTE s_hostSmallId;
|
||||
static BYTE s_nextSmallId;
|
||||
|
||||
static CRITICAL_SECTION s_sendLock;
|
||||
static CRITICAL_SECTION s_connectionsLock;
|
||||
|
||||
static std::vector<RemoteConnection> s_connections;
|
||||
|
||||
static SOCKET s_advertiseSock;
|
||||
static C4JThread* s_advertiseThread;
|
||||
static volatile bool s_advertising;
|
||||
static LANBroadcast s_advertiseData;
|
||||
static CRITICAL_SECTION s_advertiseLock;
|
||||
static int s_hostGamePort;
|
||||
|
||||
static SOCKET s_discoverySock;
|
||||
static C4JThread* s_discoveryThread;
|
||||
static volatile bool s_discovering;
|
||||
static CRITICAL_SECTION s_discoveryLock;
|
||||
static std::vector<LANSession> s_discoveredSessions;
|
||||
|
||||
static CRITICAL_SECTION s_disconnectLock;
|
||||
static std::vector<BYTE> s_disconnectedSmallIds;
|
||||
|
||||
static CRITICAL_SECTION s_freeSmallIdLock;
|
||||
static std::vector<BYTE> s_freeSmallIds;
|
||||
};
|
||||
|
||||
extern bool g_MultiplayerHost;
|
||||
extern bool g_MultiplayerJoin;
|
||||
extern int g_MultiplayerPort;
|
||||
extern char g_MultiplayerIP[256];
|
||||
@@ -1,170 +1,171 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#include "PlatformNetworkManagerInterface.h"
|
||||
#include "SessionInfo.h"
|
||||
|
||||
class CPlatformNetworkManagerStub : public CPlatformNetworkManager
|
||||
{
|
||||
friend class CGameNetworkManager;
|
||||
public:
|
||||
virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize);
|
||||
virtual void Terminate();
|
||||
virtual int GetJoiningReadyPercentage();
|
||||
virtual int CorrectErrorIDS(int IDS);
|
||||
|
||||
virtual void DoWork();
|
||||
virtual int GetPlayerCount();
|
||||
virtual int GetOnlinePlayerCount();
|
||||
virtual int GetLocalPlayerMask(int playerIndex);
|
||||
virtual bool AddLocalPlayerByUserIndex( int userIndex );
|
||||
virtual bool RemoveLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetPlayerByIndex(int playerIndex);
|
||||
virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid);
|
||||
virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId);
|
||||
virtual bool ShouldMessageForFullSession();
|
||||
|
||||
virtual INetworkPlayer *GetHostPlayer();
|
||||
virtual bool IsHost();
|
||||
virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
virtual bool LeaveGame(bool bMigrateHost);
|
||||
|
||||
virtual bool IsInSession();
|
||||
virtual bool IsInGameplay();
|
||||
virtual bool IsReadyToPlayOrIdle();
|
||||
virtual bool IsInStatsEnabledSession();
|
||||
virtual bool SessionHasSpace(unsigned int spaceRequired = 1);
|
||||
virtual void SendInviteGUI(int quadrant);
|
||||
virtual bool IsAddingPlayer();
|
||||
|
||||
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex );
|
||||
virtual bool SetLocalGame(bool isLocal);
|
||||
virtual bool IsLocalGame() { return m_bIsOfflineGame; }
|
||||
virtual void SetPrivateGame(bool isPrivate);
|
||||
virtual bool IsPrivateGame() { return m_bIsPrivateGame; }
|
||||
virtual bool IsLeavingGame() { return m_bLeavingGame; }
|
||||
virtual void ResetLeavingGame() { m_bLeavingGame = false; }
|
||||
|
||||
virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
|
||||
virtual void HandleSignInChange();
|
||||
|
||||
virtual bool _RunNetworkGame();
|
||||
|
||||
private:
|
||||
bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer);
|
||||
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom);
|
||||
virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual bool _StartGame();
|
||||
|
||||
IQNet * m_pIQNet; // pointer to QNet interface
|
||||
|
||||
HANDLE m_notificationListener;
|
||||
|
||||
vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system
|
||||
|
||||
bool m_bLeavingGame;
|
||||
bool m_bLeaveGameOnTick;
|
||||
bool m_migrateHostOnLeave;
|
||||
bool m_bHostChanged;
|
||||
|
||||
bool m_bIsOfflineGame;
|
||||
bool m_bIsPrivateGame;
|
||||
int m_flagIndexSize;
|
||||
|
||||
// This is only maintained by the host, and is not valid on client machines
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
void *playerChangedCallbackParam[XUSER_MAX_COUNT];
|
||||
|
||||
static int RemovePlayerOnSocketClosedThreadProc( void* lpParam );
|
||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer );
|
||||
|
||||
// Things for handling per-system flags
|
||||
class PlayerFlags
|
||||
{
|
||||
public:
|
||||
INetworkPlayer *m_pNetworkPlayer;
|
||||
unsigned char *flags;
|
||||
unsigned int count;
|
||||
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
|
||||
~PlayerFlags();
|
||||
};
|
||||
vector<PlayerFlags *> m_playerFlags;
|
||||
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagReset();
|
||||
public:
|
||||
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
||||
// For telemetry
|
||||
private:
|
||||
float m_lastPlayerEventTimeStart;
|
||||
|
||||
public:
|
||||
wstring GatherStats();
|
||||
wstring GatherRTTStats();
|
||||
|
||||
private:
|
||||
vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT];
|
||||
int m_searchResultsCount[XUSER_MAX_COUNT];
|
||||
int m_lastSearchStartTime[XUSER_MAX_COUNT];
|
||||
|
||||
// The results that will be filled in with the current search
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pQoSResult[XUSER_MAX_COUNT];
|
||||
|
||||
// The results from the previous search, which are currently displayed in the game
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT];
|
||||
int m_currentSearchResultsCount[XUSER_MAX_COUNT];
|
||||
|
||||
int m_lastSearchPad;
|
||||
bool m_bSearchResultsReady;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
void TickSearch();
|
||||
void SearchForGames();
|
||||
static int SearchForGamesThreadProc( void* lpParameter );
|
||||
|
||||
void SetSearchResultsReady(int resultCount = 0);
|
||||
|
||||
vector<INetworkPlayer *>currentNetworkPlayers;
|
||||
INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
void removeNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
|
||||
virtual void SetSessionTexturePackParentId( int id );
|
||||
virtual void SetSessionSubTexturePackId( int id );
|
||||
virtual void Notify(int ID, ULONG_PTR Param);
|
||||
|
||||
public:
|
||||
virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
private:
|
||||
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
|
||||
|
||||
#ifndef _XBOX
|
||||
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
|
||||
#endif
|
||||
};
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#include "PlatformNetworkManagerInterface.h"
|
||||
#include "SessionInfo.h"
|
||||
|
||||
class CPlatformNetworkManagerStub : public CPlatformNetworkManager
|
||||
{
|
||||
friend class CGameNetworkManager;
|
||||
public:
|
||||
virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize);
|
||||
virtual void Terminate();
|
||||
virtual int GetJoiningReadyPercentage();
|
||||
virtual int CorrectErrorIDS(int IDS);
|
||||
|
||||
virtual void DoWork();
|
||||
virtual int GetPlayerCount();
|
||||
virtual int GetOnlinePlayerCount();
|
||||
virtual int GetLocalPlayerMask(int playerIndex);
|
||||
virtual bool AddLocalPlayerByUserIndex( int userIndex );
|
||||
virtual bool RemoveLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetPlayerByIndex(int playerIndex);
|
||||
virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid);
|
||||
virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId);
|
||||
virtual bool ShouldMessageForFullSession();
|
||||
|
||||
virtual INetworkPlayer *GetHostPlayer();
|
||||
virtual bool IsHost();
|
||||
virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
virtual bool LeaveGame(bool bMigrateHost);
|
||||
|
||||
virtual bool IsInSession();
|
||||
virtual bool IsInGameplay();
|
||||
virtual bool IsReadyToPlayOrIdle();
|
||||
virtual bool IsInStatsEnabledSession();
|
||||
virtual bool SessionHasSpace(unsigned int spaceRequired = 1);
|
||||
virtual void SendInviteGUI(int quadrant);
|
||||
virtual bool IsAddingPlayer();
|
||||
|
||||
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex );
|
||||
virtual bool SetLocalGame(bool isLocal);
|
||||
virtual bool IsLocalGame() { return m_bIsOfflineGame; }
|
||||
virtual void SetPrivateGame(bool isPrivate);
|
||||
virtual bool IsPrivateGame() { return m_bIsPrivateGame; }
|
||||
virtual bool IsLeavingGame() { return m_bLeavingGame; }
|
||||
virtual void ResetLeavingGame() { m_bLeavingGame = false; }
|
||||
|
||||
virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
|
||||
virtual void HandleSignInChange();
|
||||
|
||||
virtual bool _RunNetworkGame();
|
||||
|
||||
private:
|
||||
bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer);
|
||||
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom);
|
||||
virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual bool _StartGame();
|
||||
|
||||
IQNet * m_pIQNet; // pointer to QNet interface
|
||||
|
||||
HANDLE m_notificationListener;
|
||||
|
||||
vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system
|
||||
|
||||
bool m_bLeavingGame;
|
||||
bool m_bLeaveGameOnTick;
|
||||
bool m_migrateHostOnLeave;
|
||||
bool m_bHostChanged;
|
||||
|
||||
bool m_bIsOfflineGame;
|
||||
bool m_bIsPrivateGame;
|
||||
int m_flagIndexSize;
|
||||
|
||||
// This is only maintained by the host, and is not valid on client machines
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
void *playerChangedCallbackParam[XUSER_MAX_COUNT];
|
||||
|
||||
static int RemovePlayerOnSocketClosedThreadProc( void* lpParam );
|
||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer );
|
||||
|
||||
// Things for handling per-system flags
|
||||
class PlayerFlags
|
||||
{
|
||||
public:
|
||||
INetworkPlayer *m_pNetworkPlayer;
|
||||
unsigned char *flags;
|
||||
unsigned int count;
|
||||
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
|
||||
~PlayerFlags();
|
||||
};
|
||||
vector<PlayerFlags *> m_playerFlags;
|
||||
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagReset();
|
||||
public:
|
||||
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
||||
// For telemetry
|
||||
private:
|
||||
float m_lastPlayerEventTimeStart;
|
||||
|
||||
public:
|
||||
wstring GatherStats();
|
||||
wstring GatherRTTStats();
|
||||
|
||||
private:
|
||||
vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT];
|
||||
int m_searchResultsCount[XUSER_MAX_COUNT];
|
||||
int m_lastSearchStartTime[XUSER_MAX_COUNT];
|
||||
|
||||
// The results that will be filled in with the current search
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pQoSResult[XUSER_MAX_COUNT];
|
||||
|
||||
// The results from the previous search, which are currently displayed in the game
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT];
|
||||
int m_currentSearchResultsCount[XUSER_MAX_COUNT];
|
||||
|
||||
int m_lastSearchPad;
|
||||
bool m_bSearchResultsReady;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
void TickSearch();
|
||||
void SearchForGames();
|
||||
static int SearchForGamesThreadProc( void* lpParameter );
|
||||
|
||||
void SetSearchResultsReady(int resultCount = 0);
|
||||
|
||||
vector<INetworkPlayer *>currentNetworkPlayers;
|
||||
INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
void removeNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
|
||||
virtual void SetSessionTexturePackParentId( int id );
|
||||
virtual void SetSessionSubTexturePackId( int id );
|
||||
virtual void Notify(int ID, ULONG_PTR Param);
|
||||
|
||||
public:
|
||||
virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
public:
|
||||
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
|
||||
void NotifyPlayerLeaving( IQNetPlayer *pQNetPlayer );
|
||||
|
||||
#ifndef _XBOX
|
||||
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
|
||||
#endif
|
||||
};
|
||||
@@ -1,7 +1,11 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
#include <qnet.h>
|
||||
#else
|
||||
#include "IQNet.h"
|
||||
#endif
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#include "SessionInfo.h"
|
||||
@@ -84,7 +88,7 @@ public:
|
||||
virtual void HandleSignInChange() = 0;
|
||||
|
||||
virtual bool _RunNetworkGame() = 0;
|
||||
|
||||
virtual void SetGamePlayState() {}
|
||||
private:
|
||||
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0;
|
||||
virtual void _HostGame(int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0) = 0;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__)
|
||||
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__))
|
||||
#include "..\..\Common\Network\Sony\SQRNetworkManager.h"
|
||||
#endif
|
||||
|
||||
|
||||
// A struct that we store in the QoS data when we are hosting the session. Max size 1020 bytes.
|
||||
#ifdef _XBOX
|
||||
#if defined _XBOX && !defined _DISABLE_XBLIVE
|
||||
typedef struct _GameSessionData
|
||||
{
|
||||
unsigned short netVersion; // 2 bytes
|
||||
@@ -32,7 +32,7 @@ typedef struct _GameSessionData
|
||||
subTexturePackId = 0;
|
||||
}
|
||||
} GameSessionData;
|
||||
#elif defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__)
|
||||
#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__))
|
||||
typedef struct _GameSessionData
|
||||
{
|
||||
unsigned short netVersion; // 2 bytes
|
||||
@@ -47,6 +47,11 @@ typedef struct _GameSessionData
|
||||
unsigned char playerCount; // 1 byte
|
||||
bool isReadyToJoin; // 1 byte
|
||||
|
||||
char hostIP[64]; // 64 bytes
|
||||
int hostPort; // 4 bytes
|
||||
wchar_t hostName[XUSER_NAME_SIZE]; // 64 bytes ( 32*2 )
|
||||
unsigned char maxPlayers; // 1 byte
|
||||
|
||||
_GameSessionData()
|
||||
{
|
||||
netVersion = 0;
|
||||
@@ -57,7 +62,11 @@ typedef struct _GameSessionData
|
||||
subTexturePackId = 0;
|
||||
playerCount = 0;
|
||||
isReadyToJoin = false;
|
||||
|
||||
memset(hostIP, 0, sizeof(hostIP));
|
||||
hostPort = 0;
|
||||
memset(hostName, 0, sizeof(hostName));
|
||||
playerCount = 0;
|
||||
maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
||||
}
|
||||
} GameSessionData;
|
||||
#else
|
||||
@@ -69,6 +78,16 @@ typedef struct _GameSessionData
|
||||
unsigned char subTexturePackId; // 1 byte
|
||||
|
||||
bool isReadyToJoin; // 1 byte
|
||||
bool isJoinable; // 1 byte
|
||||
|
||||
char hostIP[64]; // 64 bytes
|
||||
int hostPort; // 4 bytes
|
||||
wchar_t hostName[XUSER_NAME_SIZE]; // 64 bytes ( 32*2 )
|
||||
unsigned char playerCount; // 1 byte
|
||||
unsigned char maxPlayers; // 1 byte
|
||||
|
||||
GameSessionUID players[MINECRAFT_NET_MAX_PLAYERS];
|
||||
char szPlayers[MINECRAFT_NET_MAX_PLAYERS][XUSER_NAME_SIZE];
|
||||
|
||||
_GameSessionData()
|
||||
{
|
||||
@@ -76,6 +95,15 @@ typedef struct _GameSessionData
|
||||
m_uiGameHostSettings = 0;
|
||||
texturePackParentId = 0;
|
||||
subTexturePackId = 0;
|
||||
isReadyToJoin = false;
|
||||
isJoinable = true;
|
||||
memset(hostIP, 0, sizeof(hostIP));
|
||||
hostPort = 0;
|
||||
memset(hostName, 0, sizeof(hostName));
|
||||
playerCount = 0;
|
||||
maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
||||
memset(players, 0, sizeof(players));
|
||||
memset(szPlayers, 0, sizeof(szPlayers));
|
||||
}
|
||||
} GameSessionData;
|
||||
#endif
|
||||
@@ -86,7 +114,7 @@ public:
|
||||
SessionID sessionId;
|
||||
#ifdef _XBOX
|
||||
XSESSION_SEARCHRESULT searchResult;
|
||||
#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
#elif !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__))
|
||||
SQRNetworkManager::SessionSearchResult searchResult;
|
||||
#elif defined(_DURANGO)
|
||||
DQRNetworkManager::SessionSearchResult searchResult;
|
||||
@@ -108,6 +136,6 @@ public:
|
||||
~FriendSessionInfo()
|
||||
{
|
||||
if(displayLabel!=NULL)
|
||||
delete displayLabel;
|
||||
delete[] displayLabel;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "NetworkPlayerSony.h"
|
||||
#ifndef DISABLE_PSN
|
||||
|
||||
NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer)
|
||||
{
|
||||
@@ -135,3 +136,4 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms()
|
||||
__int64 currentTime = System::currentTimeMillis();
|
||||
return (int)( currentTime - m_lastChunkPacketTime );
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef _DISABLE_PSN
|
||||
#include "..\..\Common\Network\NetworkPlayerInterface.h"
|
||||
#include "SQRNetworkPlayer.h"
|
||||
|
||||
@@ -41,3 +41,4 @@ private:
|
||||
Socket *m_pSocket;
|
||||
__int64 m_lastChunkPacketTime;
|
||||
};
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@ void CPlatformNetworkManagerSony::HandleStateChange(SQRNetworkManager::eSQRNetwo
|
||||
// 4J Stu - We may be accepting an invite from the DLC menu, so hide the icon
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceHidePsStoreIcon();
|
||||
#elif defined __PSVITA__
|
||||
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
m_bLeavingGame = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifndef DISABLE_PSN
|
||||
#include "SQRNetworkManager.h"
|
||||
|
||||
bool SQRNetworkManager::s_safeToRespondToGameBootInvite = false;
|
||||
@@ -80,4 +80,5 @@ void SQRNetworkManager::TickWriteAcks()
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&m_csAckQueue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -80,7 +80,6 @@ public:
|
||||
bool inviteOnly;
|
||||
};
|
||||
|
||||
|
||||
// Externally exposed state. All internal states are mapped to one of these broader states.
|
||||
typedef enum
|
||||
{
|
||||
@@ -324,4 +323,4 @@ public:
|
||||
virtual void HandleAddLocalPlayerFailed(int idx) = 0;
|
||||
virtual void HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut=false) = 0;
|
||||
virtual void HandleInviteReceived( int userIndex, const SQRNetworkManager::PresenceSyncInfo *pInviteInfo) = 0;
|
||||
};
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#ifndef DISABLE_PSN
|
||||
#include "SQRNetworkPlayer.h"
|
||||
|
||||
#ifdef __PS3__
|
||||
@@ -609,3 +610,4 @@ bool SQRNetworkPlayer::IsMutedByLocalUser(int userIndex)
|
||||
return SonyVoiceChat::isMutedPlayer(pMan->m_roomSyncData.players[userIndex].m_roomMemberId);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -124,7 +124,7 @@ class SQRNetworkPlayer
|
||||
int GetTotalSendQueueMessages();
|
||||
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if !defined(DISABLE_PSN) && defined(__PSVITA__)
|
||||
void SendInternal_VitaAdhoc(const void *data, unsigned int dataSize, EAdhocDataTag tag = e_dataTag_Normal);
|
||||
void SendMoreInternal_VitaAdhoc();
|
||||
#endif
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 308 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |