mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Merge upstream
This commit is contained in:
commit
3800fddd04
116
.vscode/settings.json
vendored
Normal file
116
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
{
|
||||
"search.exclude": {
|
||||
"**/Minecraft.Client/Common/DummyTexturePack/res": true,
|
||||
"**/Minecraft.Client/Common/Media": true,
|
||||
"**/Minecraft.Client/Common/res": true,
|
||||
"**/Minecraft.Client/Common/Trial": true,
|
||||
"**/Minecraft.Client/Durango/4JLibs/libs": true,
|
||||
"**/Minecraft.Client/Durango/CU": true,
|
||||
"**/Minecraft.Client/Durango/DLCImages": true,
|
||||
"**/Minecraft.Client/Durango/DurangoExtras/xcompress.dll": true,
|
||||
"**/Minecraft.Client/Durango/DurangoExtras/xcompress.lib": true,
|
||||
"**/Minecraft.Client/Durango/Iggy/lib": true,
|
||||
"**/Minecraft.Client/Durango/Layout": true,
|
||||
"**/Minecraft.Client/Durango/Miles/lib": true,
|
||||
"**/Minecraft.Client/Durango/Network/Windows.Xbox.Networking.RealtimeSession.dll": true,
|
||||
"**/Minecraft.Client/Durango/Network/windows.xbox.networking.realtimesession.pdb": true,
|
||||
"**/Minecraft.Client/Durango/Network/windows.xbox.networking.realtimesession.winmd": true,
|
||||
"**/Minecraft.Client/Durango/ServiceConfig": true,
|
||||
"**/Minecraft.Client/Durango/Sound": true,
|
||||
"**/Minecraft.Client/Durango/DLCXbox1.cmp": true,
|
||||
"**/Minecraft.Client/Durango/*.png": true,
|
||||
"**/Minecraft.Client/DurangoMedia/DLC": true,
|
||||
"**/Minecraft.Client/DurangoMedia/Layout": true,
|
||||
"**/Minecraft.Client/DurangoMedia/loc": true,
|
||||
"**/Minecraft.Client/DurangoMedia/loc/strings.h": false,
|
||||
"**/Minecraft.Client/DurangoMedia/Media": true,
|
||||
"**/Minecraft.Client/DurangoMedia/Sound": true,
|
||||
"**/Minecraft.Client/music": true,
|
||||
"**/Minecraft.Client/Orbis/4JLibs/Libs": true,
|
||||
"**/Minecraft.Client/Orbis/DLCImages": true,
|
||||
"**/Minecraft.Client/Orbis/GameConfig": true,
|
||||
"**/Minecraft.Client/Orbis/GameConfig/Minecraft.spa.h": false,
|
||||
"**/Minecraft.Client/Orbis/Iggy/lib": true,
|
||||
"**/Minecraft.Client/Orbis/Miles/lib": true,
|
||||
"**/Minecraft.Client/Orbis/min/min.sig": true,
|
||||
"**/Minecraft.Client/Orbis/min/pronunciation.sig": true,
|
||||
"**/Minecraft.Client/Orbis/MinecraftPronunciation/MinecraftPronunciation.sig": true,
|
||||
"**/Minecraft.Client/Orbis/MinecraftPronunciation/pronunciation.sig": true,
|
||||
"**/Minecraft.Client/Orbis/PS4ProductCodes.bin": true,
|
||||
"**/Minecraft.Client/Orbis/session_image.jpg": true,
|
||||
"**/Minecraft.Client/Orbis/session_image.png": true,
|
||||
"**/Minecraft.Client/OrbisMedia/DLC": true,
|
||||
"**/Minecraft.Client/OrbisMedia/loc": true,
|
||||
"**/Minecraft.Client/OrbisMedia/loc/strings.h": false,
|
||||
"**/Minecraft.Client/OrbisMedia/Media": true,
|
||||
"**/Minecraft.Client/PS3/4JLibs/libs": true,
|
||||
"**/Minecraft.Client/PS3/DATA": true,
|
||||
"**/Minecraft.Client/PS3/Edge": true,
|
||||
"**/Minecraft.Client/PS3/GameConfig/MinecraftIcon.png": true,
|
||||
"**/Minecraft.Client/PS3/GameConfig/set.png": true,
|
||||
"**/Minecraft.Client/PS3/Iggy/lib": true,
|
||||
"**/Minecraft.Client/PS3/Media": true,
|
||||
"**/Minecraft.Client/PS3/Media/*.h": true,
|
||||
"**/Minecraft.Client/PS3/Miles/lib": true,
|
||||
"**/Minecraft.Client/PS3/Sound": true,
|
||||
"**/Minecraft.Client/PS3/SPU_Tasks/*.o": true,
|
||||
"**/Minecraft.Client/PS3/SPU_Tasks/mssspurs.elf": true,
|
||||
"**/Minecraft.Client/PS3/PS3ProductCodes.bin": true,
|
||||
"**/Minecraft.Client/PS3_GAME": true,
|
||||
"**/Minecraft.Client/PS3Media/DLC": true,
|
||||
"**/Minecraft.Client/PS3Media/loc": true,
|
||||
"**/Minecraft.Client/PS3Media/Media": true,
|
||||
"**/Minecraft.Client/PS4_GAME": true,
|
||||
"**/Minecraft.Client/PSVita/4JLibs/libs": true,
|
||||
"**/Minecraft.Client/PSVita/app": true,
|
||||
"**/Minecraft.Client/PSVita/Builds": true,
|
||||
"**/Minecraft.Client/PSVita/GameConfig": true,
|
||||
"**/Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h": false,
|
||||
"**/Minecraft.Client/PSVita/Iggy/lib": true,
|
||||
"**/Minecraft.Client/PSVita/Miles/lib": true,
|
||||
"**/Minecraft.Client/PSVita/Sound": true,
|
||||
"**/Minecraft.Client/PSVita/Tutorial": true,
|
||||
"**/Minecraft.Client/PSVita/configuration.psp2path": true,
|
||||
"**/Minecraft.Client/PSVita/PSVitaProductCodes.bin": true,
|
||||
"**/Minecraft.Client/PSVita/session_image.png": true,
|
||||
"**/Minecraft.Client/PSVitaMedia/DLC": true,
|
||||
"**/Minecraft.Client/PSVitaMedia/loc": true,
|
||||
"**/Minecraft.Client/PSVitaMedia/Media": true,
|
||||
"**/Minecraft.Client/PSVitaMedia/Tutorial": true,
|
||||
"**/Minecraft.Client/PSVitaMedia/Minecraft.Client.self": true,
|
||||
"**/Minecraft.Client/redist64": true
|
||||
"**/Minecraft.Client/sce_sys": true
|
||||
"**/Minecraft.Client/TROPDIR": true
|
||||
"**/Minecraft.Client/Windows64/4JLibs/libs": true,
|
||||
"**/Minecraft.Client/Windows64/GameConfig/Minecraft.spa": true,
|
||||
"**/Minecraft.Client/Windows64/GameHDD": true,
|
||||
"**/Minecraft.Client/Windows64/Iggy/lib": true,
|
||||
"**/Minecraft.Client/Windows64Media": true,
|
||||
"**/Minecraft.Client/Windows64Media/4J_strings.h": false,
|
||||
"**/Minecraft.Client/Windows64Media/strings.h": false,
|
||||
"**/Minecraft.Client/x64": true,
|
||||
"**/Minecraft.Client/Xbox/4JLibs/libs": true,
|
||||
"**/Minecraft.Client/Xbox/4JLibs/Media": true,
|
||||
"**/Minecraft.Client/Xbox/Cheats": true,
|
||||
"**/Minecraft.Client/Xbox/ContentPackageBuild": true,
|
||||
"**/Minecraft.Client/Xbox/Docs": true,
|
||||
"**/Minecraft.Client/Xbox/GameConfig": true,
|
||||
"**/Minecraft.Client/Xbox/GameConfig/Minecraft.spa.h": false,
|
||||
"**/Minecraft.Client/Xbox/kinect": true,
|
||||
"**/Minecraft.Client/Xbox/loc": true,
|
||||
"**/Minecraft.Client/Xbox/ReleaseBuild": true,
|
||||
"**/Minecraft.Client/Xbox/SubmissionBuild": true,
|
||||
"**/Minecraft.Client/Xbox/Title Update": true,
|
||||
"**/Minecraft.Client/Xbox/TMSFiles": true,
|
||||
"**/Minecraft.Client/Xbox/MinecraftWindows.ico": true,
|
||||
"**/Minecraft.Client/Xbox/small.ico": true,
|
||||
"**/Minecraft.Client/alphaTest.png": true,
|
||||
"**/Minecraft.Client/thumbnailTest64.png": true,
|
||||
"**/Minecraft.Client/thumbnailTest128.png": true,
|
||||
"**/Minecraft.Client/thumbnailTest256.png": true,
|
||||
"**/Minecraft.Client/thumbnailTest1028.png": true,
|
||||
"**/Minecraft.World/x64_Debug": true,
|
||||
"**/Minecraft.World/x64_Release": true
|
||||
"**/x64": true
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ private:
|
|||
wstring title;
|
||||
wstring desc;
|
||||
Achievement *ach;
|
||||
__int64 startTime;
|
||||
int64_t startTime;
|
||||
ItemRenderer *ir;
|
||||
bool isHelper;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,27 @@
|
|||
#include "stdafx.h"
|
||||
#include "ChatScreen.h"
|
||||
#include "ClientConnection.h"
|
||||
#include "Font.h"
|
||||
#include "MultiplayerLocalPlayer.h"
|
||||
#include "..\Minecraft.World\SharedConstants.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\Minecraft.World\ChatPacket.h"
|
||||
|
||||
const wstring ChatScreen::allowedChars = SharedConstants::acceptableLetters;
|
||||
vector<wstring> ChatScreen::s_chatHistory;
|
||||
int ChatScreen::s_historyIndex = -1;
|
||||
wstring ChatScreen::s_historyDraft;
|
||||
|
||||
bool ChatScreen::isAllowedChatChar(wchar_t c)
|
||||
{
|
||||
return c >= 0x20 && (c == L'\u00A7' || allowedChars.empty() || allowedChars.find(c) != wstring::npos);
|
||||
}
|
||||
|
||||
ChatScreen::ChatScreen()
|
||||
{
|
||||
frame = 0;
|
||||
cursorIndex = 0;
|
||||
s_historyIndex = -1;
|
||||
}
|
||||
|
||||
void ChatScreen::init()
|
||||
|
|
@ -24,6 +37,50 @@ void ChatScreen::removed()
|
|||
void ChatScreen::tick()
|
||||
{
|
||||
frame++;
|
||||
if (cursorIndex > static_cast<int>(message.length()))
|
||||
cursorIndex = static_cast<int>(message.length());
|
||||
}
|
||||
|
||||
void ChatScreen::handlePasteRequest()
|
||||
{
|
||||
wstring pasted = Screen::getClipboard();
|
||||
for (size_t i = 0; i < pasted.length() && static_cast<int>(message.length()) < SharedConstants::maxChatLength; i++)
|
||||
{
|
||||
if (isAllowedChatChar(pasted[i]))
|
||||
{
|
||||
message.insert(cursorIndex, 1, pasted[i]);
|
||||
cursorIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatScreen::applyHistoryMessage()
|
||||
{
|
||||
message = s_historyIndex >= 0 ? s_chatHistory[s_historyIndex] : s_historyDraft;
|
||||
cursorIndex = static_cast<int>(message.length());
|
||||
}
|
||||
|
||||
void ChatScreen::handleHistoryUp()
|
||||
{
|
||||
if (s_chatHistory.empty()) return;
|
||||
if (s_historyIndex == -1)
|
||||
{
|
||||
s_historyDraft = message;
|
||||
s_historyIndex = static_cast<int>(s_chatHistory.size()) - 1;
|
||||
}
|
||||
else if (s_historyIndex > 0)
|
||||
s_historyIndex--;
|
||||
applyHistoryMessage();
|
||||
}
|
||||
|
||||
void ChatScreen::handleHistoryDown()
|
||||
{
|
||||
if (s_chatHistory.empty()) return;
|
||||
if (s_historyIndex < static_cast<int>(s_chatHistory.size()) - 1)
|
||||
s_historyIndex++;
|
||||
else
|
||||
s_historyIndex = -1;
|
||||
applyHistoryMessage();
|
||||
}
|
||||
|
||||
void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
|
|
@ -35,31 +92,67 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
|||
}
|
||||
if (eventKey == Keyboard::KEY_RETURN)
|
||||
{
|
||||
wstring msg = trimString(message);
|
||||
if (msg.length() > 0)
|
||||
wstring trim = trimString(message);
|
||||
if (trim.length() > 0)
|
||||
{
|
||||
wstring trim = trimString(message);
|
||||
if (!minecraft->handleClientSideCommand(trim))
|
||||
{
|
||||
minecraft->player->chat(trim);
|
||||
MultiplayerLocalPlayer* mplp = dynamic_cast<MultiplayerLocalPlayer*>(minecraft->player.get());
|
||||
if (mplp && mplp->connection)
|
||||
mplp->connection->send(shared_ptr<ChatPacket>(new ChatPacket(trim)));
|
||||
}
|
||||
if (s_chatHistory.empty() || s_chatHistory.back() != trim)
|
||||
{
|
||||
s_chatHistory.push_back(trim);
|
||||
if (s_chatHistory.size() > CHAT_HISTORY_MAX)
|
||||
s_chatHistory.erase(s_chatHistory.begin());
|
||||
}
|
||||
}
|
||||
minecraft->setScreen(NULL);
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1);
|
||||
if (allowedChars.find(ch) >= 0 && message.length() < SharedConstants::maxChatLength)
|
||||
if (eventKey == Keyboard::KEY_UP) { handleHistoryUp(); return; }
|
||||
if (eventKey == Keyboard::KEY_DOWN) { handleHistoryDown(); return; }
|
||||
if (eventKey == Keyboard::KEY_LEFT)
|
||||
{
|
||||
message += ch;
|
||||
if (cursorIndex > 0)
|
||||
cursorIndex--;
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_RIGHT)
|
||||
{
|
||||
if (cursorIndex < static_cast<int>(message.length()))
|
||||
cursorIndex++;
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_BACK && cursorIndex > 0)
|
||||
{
|
||||
message.erase(cursorIndex - 1, 1);
|
||||
cursorIndex--;
|
||||
return;
|
||||
}
|
||||
if (isAllowedChatChar(ch) && static_cast<int>(message.length()) < SharedConstants::maxChatLength)
|
||||
{
|
||||
message.insert(cursorIndex, 1, ch);
|
||||
cursorIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatScreen::render(int xm, int ym, float a)
|
||||
{
|
||||
fill(2, height - 14, width - 2, height - 2, 0x80000000);
|
||||
drawString(font, L"> " + message + (frame / 6 % 2 == 0 ? L"_" : L""), 4, height - 12, 0xe0e0e0);
|
||||
|
||||
const wstring prefix = L"> ";
|
||||
int x = 4;
|
||||
drawString(font, prefix, x, height - 12, 0xe0e0e0);
|
||||
x += font->width(prefix);
|
||||
wstring beforeCursor = message.substr(0, cursorIndex);
|
||||
wstring afterCursor = message.substr(cursorIndex);
|
||||
drawStringLiteral(font, beforeCursor, x, height - 12, 0xe0e0e0);
|
||||
x += font->widthLiteral(beforeCursor);
|
||||
if (frame / 6 % 2 == 0)
|
||||
drawString(font, L"_", x, height - 12, 0xe0e0e0);
|
||||
x += font->width(L"_");
|
||||
drawStringLiteral(font, afterCursor, x, height - 12, 0xe0e0e0);
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
|
||||
|
|
@ -71,13 +164,15 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum)
|
|||
{
|
||||
if (message.length() > 0 && message[message.length()-1]!=L' ')
|
||||
{
|
||||
message += L" ";
|
||||
message = message.substr(0, cursorIndex) + L" " + message.substr(cursorIndex);
|
||||
cursorIndex++;
|
||||
}
|
||||
message += minecraft->gui->selectedName;
|
||||
unsigned int maxLength = SharedConstants::maxChatLength;
|
||||
if (message.length() > maxLength)
|
||||
size_t nameLen = minecraft->gui->selectedName.length();
|
||||
size_t insertLen = (message.length() + nameLen <= SharedConstants::maxChatLength) ? nameLen : (SharedConstants::maxChatLength - message.length());
|
||||
if (insertLen > 0)
|
||||
{
|
||||
message = message.substr(0, maxLength);
|
||||
message = message.substr(0, cursorIndex) + minecraft->gui->selectedName.substr(0, insertLen) + message.substr(cursorIndex);
|
||||
cursorIndex += static_cast<int>(insertLen);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -85,5 +180,4 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum)
|
|||
Screen::mouseClicked(x, y, buttonNum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,21 +1,33 @@
|
|||
#pragma once
|
||||
#include "Screen.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
class ChatScreen : public Screen
|
||||
{
|
||||
protected:
|
||||
wstring message;
|
||||
int cursorIndex;
|
||||
void applyHistoryMessage();
|
||||
|
||||
private:
|
||||
int frame;
|
||||
static const size_t CHAT_HISTORY_MAX = 100;
|
||||
static std::vector<wstring> s_chatHistory;
|
||||
static int s_historyIndex;
|
||||
static wstring s_historyDraft;
|
||||
static const wstring allowedChars;
|
||||
static bool isAllowedChatChar(wchar_t c);
|
||||
|
||||
public:
|
||||
ChatScreen(); //4J added
|
||||
ChatScreen();
|
||||
virtual void init();
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
private:
|
||||
static const wstring allowedChars;
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
virtual void handlePasteRequest();
|
||||
virtual void handleHistoryUp();
|
||||
virtual void handleHistoryDown();
|
||||
|
||||
protected:
|
||||
void keyPressed(wchar_t ch, int eventKey);
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -759,6 +759,18 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#ifdef _WINDOWS64
|
||||
// Win64 keeps local-player identity separate from network smallId; also guard against creating
|
||||
// a duplicate remote player for a local slot by checking the username directly.
|
||||
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if (minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->name == packet->name)
|
||||
{
|
||||
app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*#ifdef _WINDOWS64
|
||||
// On Windows64 all XUIDs are INVALID_XUID so the XUID check above never fires.
|
||||
// packet->m_playerIndex is the server-assigned sequential index (set via LoginPacket),
|
||||
|
|
@ -800,22 +812,50 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
|||
|
||||
#ifdef _WINDOWS64
|
||||
{
|
||||
IQNetPlayer* matchedQNetPlayer = NULL;
|
||||
PlayerUID pktXuid = player->getXuid();
|
||||
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e;
|
||||
// Legacy compatibility path for peers still using embedded smallId XUIDs.
|
||||
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;
|
||||
matchedQNetPlayer = npx->GetQNetPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
// Current Win64 path: identify QNet player by name and attach packet XUID.
|
||||
if (matchedQNetPlayer == NULL)
|
||||
{
|
||||
for (BYTE smallId = 0; smallId < MINECRAFT_NET_MAX_PLAYERS; ++smallId)
|
||||
{
|
||||
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||
if (np == NULL)
|
||||
continue;
|
||||
|
||||
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
||||
IQNetPlayer* qp = npx->GetQNetPlayer();
|
||||
if (qp != NULL && qp->m_gamertag[0] == 0)
|
||||
if (qp != NULL && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0)
|
||||
{
|
||||
wcsncpy_s(qp->m_gamertag, 32, packet->name.c_str(), _TRUNCATE);
|
||||
matchedQNetPlayer = qp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matchedQNetPlayer != NULL)
|
||||
{
|
||||
// Store packet-authoritative XUID on this network slot so later lookups by XUID
|
||||
// (e.g. remove player, display mapping) work for both legacy and uid.dat clients.
|
||||
matchedQNetPlayer->m_resolvedXuid = pktXuid;
|
||||
if (matchedQNetPlayer->m_gamertag[0] == 0)
|
||||
{
|
||||
wcsncpy_s(matchedQNetPlayer->m_gamertag, 32, packet->name.c_str(), _TRUNCATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -985,6 +1025,8 @@ void ClientConnection::handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packe
|
|||
qp->m_smallId = 0;
|
||||
qp->m_isRemote = false;
|
||||
qp->m_isHostPlayer = false;
|
||||
// Clear resolved id to avoid stale XUID -> player matches after disconnect.
|
||||
qp->m_resolvedXuid = INVALID_XUID;
|
||||
qp->m_gamertag[0] = 0;
|
||||
qp->SetCustomDataValue(0);
|
||||
}
|
||||
|
|
@ -1399,6 +1441,9 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
|||
|
||||
switch(packet->m_messageType)
|
||||
{
|
||||
case ChatPacket::e_ChatCustom:
|
||||
message = (packet->m_stringArgs.size() >= 1) ? packet->m_stringArgs[0] : L"";
|
||||
break;
|
||||
case ChatPacket::e_ChatBedOccupied:
|
||||
message = app.GetString(IDS_TILE_BED_OCCUPIED);
|
||||
break;
|
||||
|
|
@ -3956,4 +4001,4 @@ ClientConnection::DeferredEntityLinkPacket::DeferredEntityLinkPacket(shared_ptr<
|
|||
{
|
||||
m_recievedTick = GetTickCount();
|
||||
m_packet = packet;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,16 +260,13 @@ void SoundEngine::updateMiniAudio()
|
|||
continue;
|
||||
}
|
||||
|
||||
float finalVolume = s->info.volume;
|
||||
float finalVolume = s->info.volume * m_MasterEffectsVolume;
|
||||
if (finalVolume > 1.0f)
|
||||
finalVolume = 1.0f;
|
||||
|
||||
ma_sound_set_volume(&s->sound, finalVolume);
|
||||
|
||||
if (!s->info.bUseSoundsPitchVal)
|
||||
{
|
||||
ma_sound_set_pitch(&s->sound, s->info.pitch);
|
||||
}
|
||||
ma_sound_set_pitch(&s->sound, s->info.pitch);
|
||||
|
||||
if (s->info.bIs3D)
|
||||
{
|
||||
|
|
@ -967,14 +964,8 @@ void SoundEngine::playMusicTick()
|
|||
// AP - moved to a separate function so it can be called from the mixer callback on Vita
|
||||
void SoundEngine::playMusicUpdate()
|
||||
{
|
||||
//return;
|
||||
static bool firstCall = true;
|
||||
static float fMusicVol = 0.0f;
|
||||
if( firstCall )
|
||||
{
|
||||
fMusicVol = getMasterMusicVolume();
|
||||
firstCall = false;
|
||||
}
|
||||
fMusicVol = getMasterMusicVolume();
|
||||
|
||||
switch(m_StreamState)
|
||||
{
|
||||
|
|
@ -1242,7 +1233,7 @@ void SoundEngine::playMusicUpdate()
|
|||
|
||||
ma_sound_set_pitch(&m_musicStream, m_StreamingAudioInfo.pitch);
|
||||
|
||||
float finalVolume = m_StreamingAudioInfo.volume * m_MasterMusicVolume;
|
||||
float finalVolume = m_StreamingAudioInfo.volume * getMasterMusicVolume();
|
||||
|
||||
ma_sound_set_volume(&m_musicStream, finalVolume);
|
||||
ma_result startResult = ma_sound_start(&m_musicStream);
|
||||
|
|
@ -1370,14 +1361,11 @@ void SoundEngine::playMusicUpdate()
|
|||
}
|
||||
|
||||
// volume change required?
|
||||
if (fMusicVol != getMasterMusicVolume())
|
||||
if (m_musicStreamActive)
|
||||
{
|
||||
if (m_musicStreamActive)
|
||||
{
|
||||
float finalVolume = m_StreamingAudioInfo.volume * fMusicVol;
|
||||
float finalVolume = m_StreamingAudioInfo.volume * fMusicVol;
|
||||
|
||||
ma_sound_set_volume(&m_musicStream, finalVolume);
|
||||
}
|
||||
ma_sound_set_volume(&m_musicStream, finalVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3791,8 +3791,8 @@ extern "C" {
|
|||
typedef signed int ma_int32;
|
||||
typedef unsigned int ma_uint32;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
typedef signed __int64 ma_int64;
|
||||
typedef unsigned __int64 ma_uint64;
|
||||
typedef signed long long ma_int64;
|
||||
typedef unsigned long long ma_uint64;
|
||||
#else
|
||||
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
|
||||
#pragma GCC diagnostic push
|
||||
|
|
@ -11249,7 +11249,7 @@ struct ma_sound
|
|||
float* pProcessingCache; /* Will be null if pDataSource is null. */
|
||||
ma_uint32 processingCacheFramesRemaining;
|
||||
ma_uint32 processingCacheCap;
|
||||
ma_bool8 ownsDataSource;
|
||||
ma_bool8 ownsDataSource;
|
||||
|
||||
/*
|
||||
We're declaring a resource manager data source object here to save us a malloc when loading a
|
||||
|
|
@ -11596,7 +11596,7 @@ IMPLEMENTATION
|
|||
|
||||
#include <sys/time.h> /* select() (used for ma_sleep()). */
|
||||
#include <time.h> /* For nanosleep() */
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* For fstat(), etc. */
|
||||
|
|
@ -11729,7 +11729,7 @@ IMPLEMENTATION
|
|||
#endif
|
||||
|
||||
#if _MSC_VER >= 1600 && (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219)
|
||||
static MA_INLINE unsigned __int64 ma_xgetbv(int reg)
|
||||
static MA_INLINE unsigned long long ma_xgetbv(int reg)
|
||||
{
|
||||
return _xgetbv(reg);
|
||||
}
|
||||
|
|
@ -17622,7 +17622,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
|
|||
(void)stackSize; /* Suppress unused parameter warning. */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (scheduler != -1) {
|
||||
int priorityMin = sched_get_priority_min(scheduler);
|
||||
|
|
@ -23061,7 +23061,7 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device
|
|||
CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE);
|
||||
{
|
||||
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
|
||||
}
|
||||
}
|
||||
if (CoInitializeResult == S_OK || CoInitializeResult == S_FALSE) { ma_CoUninitialize(pContext); }
|
||||
|
||||
if (FAILED(hr)) { /* <-- This is checking the call above to ma_CoCreateInstance(). */
|
||||
|
|
@ -29687,7 +29687,7 @@ static ma_result ma_device_start__alsa(ma_device* pDevice)
|
|||
}
|
||||
|
||||
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
|
||||
/*
|
||||
/*
|
||||
When data is written to the device we wait for the device to get ready to receive data with poll(). In my testing
|
||||
I have observed that poll() can sometimes block forever unless the device is started explicitly with snd_pcm_start()
|
||||
or some data is written with snd_pcm_writei().
|
||||
|
|
@ -35996,7 +35996,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat));
|
||||
if (status != noErr) {
|
||||
((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit);
|
||||
|
|
@ -39310,7 +39310,7 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
|
|||
|
||||
(void)error;
|
||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream));
|
||||
|
||||
|
||||
/*
|
||||
When we get an error, we'll assume that the stream is in an erroneous state and needs to be restarted. From the documentation,
|
||||
we cannot do this from the error callback. Therefore we are going to use an event thread for the AAudio backend to do this
|
||||
|
|
@ -39322,13 +39322,13 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
|
|||
else {
|
||||
job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE);
|
||||
job.data.device.aaudio.reroute.pDevice = pDevice;
|
||||
|
||||
|
||||
if (pStream == pDevice->aaudio.pStreamCapture) {
|
||||
job.data.device.aaudio.reroute.deviceType = ma_device_type_capture;
|
||||
} else {
|
||||
job.data.device.aaudio.reroute.deviceType = ma_device_type_playback;
|
||||
}
|
||||
|
||||
|
||||
result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job);
|
||||
if (result != MA_SUCCESS) {
|
||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n");
|
||||
|
|
@ -39925,7 +39925,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
|
|||
|
||||
/* We got disconnected! Retry a few times, until we find a connected device! */
|
||||
iAttempt = 0;
|
||||
while (iAttempt++ < maxAttempts) {
|
||||
while (iAttempt++ < maxAttempts) {
|
||||
/* Device tearing down? No need to reroute! */
|
||||
if (ma_atomic_bool32_get(&pDevice->aaudio.isTearingDown)) {
|
||||
result = MA_SUCCESS; /* Caller should continue as normal. */
|
||||
|
|
@ -40023,7 +40023,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -61704,7 +61704,7 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf
|
|||
/* Not implemented. Fall back to seek/tell/seek. */
|
||||
ma_int64 cursor;
|
||||
ma_int64 sizeInBytes;
|
||||
|
||||
|
||||
result = ma_default_vfs_tell(pVFS, file, &cursor);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
|
|
@ -76937,7 +76937,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float
|
|||
if (pSound->processingCacheFramesRemaining > 0) {
|
||||
MA_MOVE_MEMORY(pSound->pProcessingCache, ma_offset_pcm_frames_ptr_f32(pSound->pProcessingCache, frameCountIn, dataSourceChannels), pSound->processingCacheFramesRemaining * ma_get_bytes_per_frame(ma_format_f32, dataSourceChannels));
|
||||
}
|
||||
|
||||
|
||||
totalFramesRead += (ma_uint32)frameCountOut; /* Safe cast. */
|
||||
|
||||
if (result != MA_SUCCESS || ma_sound_at_end(pSound)) {
|
||||
|
|
@ -78439,7 +78439,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con
|
|||
if (pSound->processingCacheCap == 0) {
|
||||
pSound->processingCacheCap = 512;
|
||||
}
|
||||
|
||||
|
||||
pSound->pProcessingCache = (float*)ma_calloc(pSound->processingCacheCap * ma_get_bytes_per_frame(ma_format_f32, engineNodeConfig.channelsIn), &pEngine->allocationCallbacks);
|
||||
if (pSound->pProcessingCache == NULL) {
|
||||
ma_engine_node_uninit(&pSound->engineNode, &pEngine->allocationCallbacks);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -28,7 +28,7 @@ typedef struct _JoinFromInviteData
|
|||
DWORD dwUserIndex; // dwUserIndex
|
||||
DWORD dwLocalUsersMask; // dwUserMask
|
||||
const INVITE_INFO *pInviteInfo; // pInviteInfo
|
||||
}
|
||||
}
|
||||
JoinFromInviteData;
|
||||
|
||||
class Player;
|
||||
|
|
@ -55,7 +55,7 @@ class Merchant;
|
|||
|
||||
class CMinecraftAudio;
|
||||
|
||||
class CMinecraftApp
|
||||
class CMinecraftApp
|
||||
|
||||
#ifdef _XBOX
|
||||
: public CXuiModule
|
||||
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
/* 4J-JEV:
|
||||
* We need more space in the profile data because of the new achievements and statistics
|
||||
* We need more space in the profile data because of the new achievements and statistics
|
||||
* necessary for the new expanded achievement set.
|
||||
*/
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
|
||||
|
|
@ -164,7 +164,7 @@ public:
|
|||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
|
|
@ -282,7 +282,7 @@ public:
|
|||
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal);
|
||||
void ActionDebugMask(int iPad, bool bSetAllClear=false);
|
||||
|
||||
//
|
||||
//
|
||||
bool IsLocalMultiplayerAvailable();
|
||||
|
||||
// for sign in change monitoring
|
||||
|
|
@ -359,7 +359,7 @@ public:
|
|||
|
||||
// Texture Pack Data files (icon, banner, comparison shot & text)
|
||||
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
bool IsFileInTPD(int iConfig);
|
||||
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
int GetTPDSize() {return m_MEM_TPD.size();}
|
||||
|
|
@ -444,7 +444,7 @@ private:
|
|||
static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
|
||||
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
|
||||
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
|
||||
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
|
||||
|
||||
void HandleButtonPresses(int iPad);
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ private:
|
|||
|
||||
static unsigned int m_uiLastSignInData;
|
||||
|
||||
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
|
||||
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
|
||||
GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT];
|
||||
|
||||
// For promo work
|
||||
|
|
@ -517,7 +517,7 @@ private:
|
|||
eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
|
||||
eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
|
||||
eXuiServerAction m_eGlobalXuiServerAction;
|
||||
|
|
@ -541,20 +541,20 @@ private:
|
|||
// Trial timer
|
||||
float m_fTrialTimerStart,mfTrialPausedTime;
|
||||
typedef struct TimeInfo
|
||||
{
|
||||
LARGE_INTEGER qwTime;
|
||||
LARGE_INTEGER qwAppTime;
|
||||
{
|
||||
LARGE_INTEGER qwTime;
|
||||
LARGE_INTEGER qwAppTime;
|
||||
|
||||
float fAppTime;
|
||||
float fElapsedTime;
|
||||
float fSecsPerTick;
|
||||
} TIMEINFO;
|
||||
float fAppTime;
|
||||
float fElapsedTime;
|
||||
float fSecsPerTick;
|
||||
} TIMEINFO;
|
||||
|
||||
TimeInfo m_Time;
|
||||
|
||||
protected:
|
||||
static const int MAX_TIPS_GAMETIP = 50;
|
||||
static const int MAX_TIPS_TRIVIATIP = 20;
|
||||
static const int MAX_TIPS_GAMETIP = 50;
|
||||
static const int MAX_TIPS_TRIVIATIP = 20;
|
||||
static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP];
|
||||
static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP];
|
||||
static Random *TipRandom;
|
||||
|
|
@ -606,7 +606,7 @@ public:
|
|||
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
|
||||
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
|
||||
#else
|
||||
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile);
|
||||
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, uint64_t, uint64_t, WCHAR *, unsigned int, int, WCHAR *pDataFile);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
|
||||
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
|
||||
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
|
||||
|
|
@ -634,7 +634,7 @@ private:
|
|||
#if 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;
|
||||
static unordered_map<string,DLC_INFO * > DLCInfo;
|
||||
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
|
||||
#elif defined(_DURANGO)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
|
|
@ -729,7 +729,7 @@ public:
|
|||
|
||||
// World seed from png image
|
||||
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
|
||||
// Game rules
|
||||
GameRuleManager m_gameRules;
|
||||
|
|
@ -773,7 +773,7 @@ public:
|
|||
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
|
||||
int GetDLCInfoTexturesOffersCount();
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(char *);
|
||||
DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
|
||||
bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID);
|
||||
|
|
@ -935,5 +935,5 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
//singleton
|
||||
//singleton
|
||||
//extern CMinecraftApp app;
|
||||
|
|
|
|||
|
|
@ -19,17 +19,17 @@ private:
|
|||
ConsoleSchematicFile::ESchematicRotation m_rotation;
|
||||
int m_dimension;
|
||||
|
||||
__int64 m_totalBlocksChanged;
|
||||
__int64 m_totalBlocksChangedLighting;
|
||||
int64_t m_totalBlocksChanged;
|
||||
int64_t m_totalBlocksChangedLighting;
|
||||
bool m_completed;
|
||||
|
||||
void updateLocationBox();
|
||||
public:
|
||||
public:
|
||||
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
|
||||
~ApplySchematicRuleDefinition();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
|
||||
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
|||
dos->writeInt(m_zSize);
|
||||
|
||||
byteArray ba(new BYTE[ m_data.length ], m_data.length);
|
||||
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
|
||||
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
|
||||
m_data.data, m_data.length);
|
||||
|
||||
dos->writeInt(ba.length);
|
||||
|
|
@ -71,13 +71,13 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||
m_ySize = dis->readInt();
|
||||
m_zSize = dis->readInt();
|
||||
|
||||
int compressedSize = dis->readInt();
|
||||
int compressedSize = dis->readInt();
|
||||
byteArray compressedBuffer(compressedSize);
|
||||
dis->readFully(compressedBuffer);
|
||||
|
||||
if(m_data.data != NULL)
|
||||
{
|
||||
delete [] m_data.data;
|
||||
delete [] m_data.data;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||
double z = pos->get(2)->data;
|
||||
|
||||
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
{
|
||||
x = ((IntTag *) eTag->get(L"TileX") )->data;
|
||||
y = ((IntTag *) eTag->get(L"TileY") )->data;
|
||||
z = ((IntTag *) eTag->get(L"TileZ") )->data;
|
||||
|
|
@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
|||
delete tag;
|
||||
}
|
||||
|
||||
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
|
||||
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
|
||||
|
|
@ -281,7 +281,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
|||
// blockData[i] = Tile::endStone_Id;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0,"Setting Block data");
|
||||
chunk->setBlockData(blockData);
|
||||
PIXEndNamedEvent();
|
||||
|
|
@ -323,7 +323,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
|||
|
||||
// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so
|
||||
// we can do the sort of lighting that might propagate out of the chunk.
|
||||
__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
int64_t ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = max(destinationBox->x0, (double)chunk->x*16);
|
||||
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
|
||||
|
|
@ -445,7 +445,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||
|
||||
if ( teCopy != NULL )
|
||||
{
|
||||
{
|
||||
CompoundTag *teData = new CompoundTag();
|
||||
te->save(teData);
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
for (auto it = m_entities.begin(); it != m_entities.end();)
|
||||
{
|
||||
Vec3 *source = it->first;
|
||||
|
||||
|
||||
double targetX = source->x;
|
||||
double targetY = source->y + destinationBox->y0;
|
||||
double targetZ = source->z;
|
||||
|
|
@ -498,7 +498,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
if( e->GetType() == eTYPE_PAINTING )
|
||||
{
|
||||
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
|
||||
|
||||
|
||||
double tileX = painting->xTile;
|
||||
double tileZ = painting->zTile;
|
||||
schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ);
|
||||
|
|
@ -511,7 +511,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
else if( e->GetType() == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
|
||||
|
||||
|
||||
double tileX = frame->xTile;
|
||||
double tileZ = frame->zTile;
|
||||
schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ);
|
||||
|
|
@ -559,7 +559,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
zStart-=1;
|
||||
else if(zStart < 0 && zStart%2 !=0)
|
||||
zStart-=1;
|
||||
|
||||
|
||||
// We want the end to be odd to have a total size that is even
|
||||
if(xEnd > 0 && xEnd%2 == 0)
|
||||
xEnd+=1;
|
||||
|
|
@ -613,7 +613,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
|
||||
// Every x is a whole row
|
||||
for(int xPos = xStart; xPos < xStart + xSize; ++xPos)
|
||||
{
|
||||
{
|
||||
int xc = xPos >> 4;
|
||||
|
||||
int x0 = xPos - xc * 16;
|
||||
|
|
@ -622,7 +622,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
if (x1 > 16) x1 = 16;
|
||||
|
||||
for(int zPos = zStart; zPos < zStart + zSize;)
|
||||
{
|
||||
{
|
||||
int zc = zPos >> 4;
|
||||
|
||||
int z0 = zStart - zc * 16;
|
||||
|
|
@ -713,11 +713,11 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
}
|
||||
|
||||
// 4J-JEV: Changed to check for instances of minecarts and hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and eTYPE_MINECART
|
||||
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
|
||||
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
|
||||
{
|
||||
CompoundTag *eTag = new CompoundTag();
|
||||
if( e->save(eTag) )
|
||||
{
|
||||
{
|
||||
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos");
|
||||
|
||||
pos->get(0)->data -= xStart;
|
||||
|
|
@ -725,7 +725,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
pos->get(2)->data -= zStart;
|
||||
|
||||
if( e->instanceof(eTYPE_HANGING_ENTITY) )
|
||||
{
|
||||
{
|
||||
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
|
||||
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
|
||||
((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
|
||||
|
|
@ -766,7 +766,7 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data,
|
|||
// skyLightP += skyLightData.length;
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
bool bHasLower, bHasUpper;
|
||||
bHasLower = bHasUpper = false;
|
||||
int lowerY0, lowerY1, upperY0, upperY1;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private:
|
|||
vector<shared_ptr<TileEntity> > m_tileEntities;
|
||||
vector< pair<Vec3 *, CompoundTag *> > m_entities;
|
||||
|
||||
public:
|
||||
public:
|
||||
byteArray m_data;
|
||||
|
||||
public:
|
||||
|
|
@ -72,8 +72,8 @@ public:
|
|||
void save(DataOutputStream *dos);
|
||||
void load(DataInputStream *dis);
|
||||
|
||||
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
int64_t applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
|
||||
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
typedef struct _ValueType
|
||||
{
|
||||
union{
|
||||
__int64 i64;
|
||||
int64_t i64;
|
||||
int i;
|
||||
char c;
|
||||
bool b;
|
||||
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual ~GameRule();
|
||||
|
||||
Connection *getConnection() { return m_connection; }
|
||||
|
||||
|
||||
ValueType getParameter(const wstring ¶meterName);
|
||||
void setParameter(const wstring ¶meterName,ValueType value);
|
||||
GameRuleDefinition *getGameRuleDefinition();
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
// Read File.
|
||||
|
||||
// version_number
|
||||
__int64 version = dis.readShort();
|
||||
int64_t version = dis.readShort();
|
||||
unsigned char compressionType = 0;
|
||||
if(version == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
|||
{
|
||||
if(attributeName.compare(L"seed") == 0)
|
||||
{
|
||||
m_seed = _fromString<__int64>(attributeValue);
|
||||
m_seed = _fromString<int64_t>(attributeValue);
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnX") == 0)
|
||||
|
|
@ -700,7 +700,7 @@ void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete
|
|||
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||
|
||||
__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; }
|
||||
int64_t LevelGenerationOptions::getLevelSeed() { return m_seed; }
|
||||
int LevelGenerationOptions::getLevelHasBeenInCreative() { return m_bHasBeenInCreative; }
|
||||
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
|
||||
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GrSource
|
|||
public:
|
||||
// 4J-JEV:
|
||||
// Moved all this here; I didn't like that all this header information
|
||||
// was being mixed in with all the game information as they have
|
||||
// was being mixed in with all the game information as they have
|
||||
// completely different lifespans.
|
||||
|
||||
virtual bool requiresTexturePack()=0;
|
||||
|
|
@ -146,7 +146,7 @@ public:
|
|||
|
||||
private:
|
||||
// This should match the "MapOptionsRule" definition in the XML schema
|
||||
__int64 m_seed;
|
||||
int64_t m_seed;
|
||||
bool m_useFlatWorld;
|
||||
Pos *m_spawnPos;
|
||||
int m_bHasBeenInCreative;
|
||||
|
|
@ -171,13 +171,13 @@ public:
|
|||
~LevelGenerationOptions();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
__int64 getLevelSeed();
|
||||
int64_t getLevelSeed();
|
||||
int getLevelHasBeenInCreative();
|
||||
Pos *getSpawnPos();
|
||||
bool getuseFlatWorld();
|
||||
|
|
@ -190,7 +190,7 @@ public:
|
|||
private:
|
||||
void clearSchematics();
|
||||
|
||||
public:
|
||||
public:
|
||||
ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen);
|
||||
|
||||
public:
|
||||
|
|
@ -211,7 +211,7 @@ public:
|
|||
|
||||
void loadBaseSaveData();
|
||||
static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
|
||||
|
||||
|
||||
// 4J-JEV:
|
||||
// ApplySchematicRules contain limited state
|
||||
// which needs to be reset BEFORE a new game starts.
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@
|
|||
CGameNetworkManager g_NetworkManager;
|
||||
CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager;
|
||||
|
||||
__int64 CGameNetworkManager::messageQueue[512];
|
||||
__int64 CGameNetworkManager::byteQueue[512];
|
||||
int64_t CGameNetworkManager::messageQueue[512];
|
||||
int64_t CGameNetworkManager::byteQueue[512];
|
||||
int CGameNetworkManager::messageQueuePos = 0;
|
||||
|
||||
CGameNetworkManager::CGameNetworkManager()
|
||||
|
|
@ -194,7 +194,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
ProfileManager.SetDeferredSignoutEnabled(true);
|
||||
#endif
|
||||
|
||||
__int64 seed = 0;
|
||||
int64_t seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
|
|
@ -287,7 +287,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
}
|
||||
}
|
||||
|
||||
static __int64 sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
|
||||
static int64_t sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
|
||||
ServerStoppedCreate(false);
|
||||
if( g_NetworkManager.IsHost() )
|
||||
{
|
||||
|
|
@ -929,7 +929,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
|
||||
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
{
|
||||
__int64 seed = 0;
|
||||
int64_t seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ public:
|
|||
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
void ForceFriendsSessionRefresh();
|
||||
|
||||
|
||||
// Session joining and leaving
|
||||
|
||||
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
|
||||
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
|
||||
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
||||
bool LeaveGame(bool bMigrateHost);
|
||||
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
|
|
@ -113,13 +113,13 @@ public:
|
|||
void ResetLeavingGame();
|
||||
|
||||
// Threads
|
||||
|
||||
|
||||
bool IsNetworkThreadRunning();
|
||||
static int RunNetworkGameThreadProc( void* lpParameter );
|
||||
static int ServerThreadProc( void* lpParameter );
|
||||
static int ExitAndJoinFromInviteThreadProc( void* lpParam );
|
||||
|
||||
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
|
||||
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
|
||||
static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad);
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public:
|
|||
static void _LeaveGame();
|
||||
static int ChangeSessionTypeThreadProc( void* lpParam );
|
||||
|
||||
// System flags
|
||||
// System flags
|
||||
|
||||
void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
|
@ -145,8 +145,8 @@ public:
|
|||
|
||||
void ServerStoppedCreate(bool create); // Create the signal
|
||||
void ServerStopped(); // Signal that we are ready
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
bool ServerStoppedValid(); // Is non-NULL
|
||||
|
||||
#ifdef __PSVITA__
|
||||
|
|
@ -164,9 +164,9 @@ public:
|
|||
|
||||
// Used for debugging output
|
||||
static const int messageQueue_length = 512;
|
||||
static __int64 messageQueue[messageQueue_length];
|
||||
static int64_t messageQueue[messageQueue_length];
|
||||
static const int byteQueue_length = 512;
|
||||
static __int64 byteQueue[byteQueue_length];
|
||||
static int64_t byteQueue[byteQueue_length];
|
||||
static int messageQueuePos;
|
||||
|
||||
// Methods called from PlatformNetworkManager
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "..\..\Xbox\Network\NetworkPlayerXbox.h"
|
||||
#ifdef _WINDOWS64
|
||||
#include "..\..\Windows64\Network\WinsockNetLayer.h"
|
||||
#include "..\..\Windows64\Windows64_Xuid.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\User.h"
|
||||
#include <iostream>
|
||||
|
|
@ -234,6 +235,7 @@ void CPlatformNetworkManagerStub::DoWork()
|
|||
qnetPlayer->m_smallId = 0;
|
||||
qnetPlayer->m_isRemote = false;
|
||||
qnetPlayer->m_isHostPlayer = false;
|
||||
qnetPlayer->m_resolvedXuid = INVALID_XUID;
|
||||
qnetPlayer->m_gamertag[0] = 0;
|
||||
qnetPlayer->SetCustomDataValue(0);
|
||||
WinsockNetLayer::PushFreeSmallId(disconnectedSmallId);
|
||||
|
|
@ -354,7 +356,9 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
|
|||
#ifdef _WINDOWS64
|
||||
IQNet::m_player[0].m_smallId = 0;
|
||||
IQNet::m_player[0].m_isRemote = false;
|
||||
// world host is pinned to legacy host XUID to keep old player data compatibility.
|
||||
IQNet::m_player[0].m_isHostPlayer = true;
|
||||
IQNet::m_player[0].m_resolvedXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
IQNet::s_playerCount = 1;
|
||||
#endif
|
||||
|
||||
|
|
@ -411,6 +415,8 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int l
|
|||
IQNet::m_player[0].m_smallId = 0;
|
||||
IQNet::m_player[0].m_isRemote = true;
|
||||
IQNet::m_player[0].m_isHostPlayer = true;
|
||||
// Remote host still maps to legacy host XUID in mixed old/new sessions.
|
||||
IQNet::m_player[0].m_resolvedXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
wcsncpy_s(IQNet::m_player[0].m_gamertag, 32, searchResult->data.hostName, _TRUNCATE);
|
||||
|
||||
WinsockNetLayer::StopDiscovery();
|
||||
|
|
@ -426,6 +432,8 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int l
|
|||
IQNet::m_player[localSmallId].m_smallId = localSmallId;
|
||||
IQNet::m_player[localSmallId].m_isRemote = false;
|
||||
IQNet::m_player[localSmallId].m_isHostPlayer = false;
|
||||
// Local non-host identity is the persistent uid.dat XUID.
|
||||
IQNet::m_player[localSmallId].m_resolvedXuid = Win64Xuid::ResolvePersistentXuid();
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
wcscpy_s(IQNet::m_player[localSmallId].m_gamertag, 32, pMinecraft->user->name.c_str());
|
||||
|
|
@ -726,7 +734,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
|||
info->data.playerCount = lanSessions[i].playerCount;
|
||||
info->data.maxPlayers = lanSessions[i].maxPlayers;
|
||||
|
||||
info->sessionId = (SessionID)((unsigned __int64)inet_addr(lanSessions[i].hostIP) | ((unsigned __int64)lanSessions[i].hostPort << 32));
|
||||
info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32));
|
||||
|
||||
friendsSessions[0].push_back(info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,6 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms()
|
|||
return INT_MAX;
|
||||
}
|
||||
|
||||
__int64 currentTime = System::currentTimeMillis();
|
||||
int64_t currentTime = System::currentTimeMillis();
|
||||
return (int)( currentTime - m_lastChunkPacketTime );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,5 +39,5 @@ public:
|
|||
private:
|
||||
SQRNetworkPlayer *m_sqrPlayer;
|
||||
Socket *m_pSocket;
|
||||
__int64 m_lastChunkPacketTime;
|
||||
int64_t m_lastChunkPacketTime;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ bool SQRNetworkPlayer::IsReady()
|
|||
{
|
||||
return ( ( m_flags & SNP_FLAG_READY_MASK ) == SNP_FLAG_READY_MASK );
|
||||
}
|
||||
|
||||
|
||||
PlayerUID SQRNetworkPlayer::GetUID()
|
||||
{
|
||||
return m_ISD.m_UID;
|
||||
|
|
@ -224,7 +224,7 @@ void SQRNetworkPlayer::SendData( SQRNetworkPlayer *pPlayerTarget, const void *da
|
|||
{
|
||||
AckFlags ackFlags = ack ? e_flag_AckRequested : e_flag_AckNotRequested;
|
||||
// Our network is connected as a star. If we are the host, then we can send to any remote player. If we're a client, we can send only to the host.
|
||||
// The host can also send to other local players, but this doesn't need to go through Rudp.
|
||||
// The host can also send to other local players, but this doesn't need to go through Rudp.
|
||||
if( m_host )
|
||||
{
|
||||
if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_LOCAL ) )
|
||||
|
|
@ -286,7 +286,7 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
|
|||
sendBlock.end = NULL;
|
||||
sendBlock.current = NULL;
|
||||
sendBlock.ack = ackFlags;
|
||||
m_sendQueue.push(sendBlock);
|
||||
m_sendQueue.push(sendBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -299,13 +299,13 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
|
|||
sendBlock.current = sendBlock.start;
|
||||
sendBlock.ack = ackFlags;
|
||||
memcpy( sendBlock.start, dataCurrent, dataSize);
|
||||
m_sendQueue.push(sendBlock);
|
||||
m_sendQueue.push(sendBlock);
|
||||
dataRemaining -= dataSize;
|
||||
dataCurrent += dataSize;
|
||||
}
|
||||
|
||||
}
|
||||
m_totalBytesInSendQueue += dataSize;
|
||||
m_totalBytesInSendQueue += dataSize;
|
||||
|
||||
// if the queue had something in it already, then the UDP callback will fire and call SendMoreInternal
|
||||
// so we don't call it here, to avoid a deadlock
|
||||
|
|
@ -343,7 +343,7 @@ int SQRNetworkPlayer::WriteDataPacket(const void* data, int dataSize, AckFlags a
|
|||
// nothing was sent!
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
assert(ret==packetSize || ret > headerSize); // we must make sure we've sent the entire packet or the header and some data at least
|
||||
ret -= headerSize;
|
||||
if(ackFlags == e_flag_AckRequested)
|
||||
|
|
@ -443,7 +443,7 @@ void SQRNetworkPlayer::ReadAck()
|
|||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#ifdef PRINT_ACK_STATS
|
||||
__int64 timeTaken = System::currentTimeMillis() - m_ackStats[0];
|
||||
int64_t timeTaken = System::currentTimeMillis() - m_ackStats[0];
|
||||
if(timeTaken < m_minAckTime)
|
||||
m_minAckTime = timeTaken;
|
||||
if(timeTaken > m_maxAckTime)
|
||||
|
|
@ -525,7 +525,7 @@ void SQRNetworkPlayer::SendMoreInternal()
|
|||
{
|
||||
keepSending = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( ( ret >= 0 ) || ( ret == sc_wouldBlockFlag ) )
|
||||
{
|
||||
|
||||
|
|
@ -543,7 +543,7 @@ void SQRNetworkPlayer::SendMoreInternal()
|
|||
// Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent
|
||||
remainingBytes = dataSize;
|
||||
}
|
||||
m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes;
|
||||
m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes;
|
||||
}
|
||||
}
|
||||
} while (keepSending);
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ class SQRNetworkPlayer
|
|||
};
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
std::vector<__int64> m_ackStats;
|
||||
std::vector<int64_t> m_ackStats;
|
||||
int m_minAckTime;
|
||||
int m_maxAckTime;
|
||||
int m_totalAcks;
|
||||
__int64 m_totalAckTime;
|
||||
int64_t m_totalAckTime;
|
||||
int m_averageAckTime;
|
||||
#endif
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ class SQRNetworkPlayer
|
|||
{
|
||||
public:
|
||||
unsigned char m_smallId; // Id to uniquely and permanently identify this player between machines - assigned by the server
|
||||
PlayerUID m_UID;
|
||||
PlayerUID m_UID;
|
||||
};
|
||||
|
||||
SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID);
|
||||
|
|
@ -114,7 +114,7 @@ class SQRNetworkPlayer
|
|||
int WriteDataPacket(const void* data, int dataSize, AckFlags ackFlags);
|
||||
void ReadAck();
|
||||
void WriteAck();
|
||||
|
||||
|
||||
int GetOutstandingAckCount();
|
||||
int GetSendQueueSizeBytes();
|
||||
int GetSendQueueSizeMessages();
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ static SceRemoteStorageStatus statParams;
|
|||
// {
|
||||
// app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
// {
|
||||
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
|
||||
//
|
||||
//
|
||||
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
|
||||
// }
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ ESavePlatform SonyRemoteStorage::getSavePlatform()
|
|||
|
||||
}
|
||||
|
||||
__int64 SonyRemoteStorage::getSaveSeed()
|
||||
int64_t SonyRemoteStorage::getSaveSeed()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return 0;
|
||||
|
|
@ -223,9 +223,9 @@ const char* SonyRemoteStorage::getRemoteSaveFilename()
|
|||
|
||||
int SonyRemoteStorage::getSaveFilesize()
|
||||
{
|
||||
if(m_getInfoStatus == e_infoFound)
|
||||
if(m_getInfoStatus == e_infoFound)
|
||||
{
|
||||
return m_remoteFileInfo->fileSize;
|
||||
return m_remoteFileInfo->fileSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -288,9 +288,9 @@ bool SonyRemoteStorage::saveIsAvailable()
|
|||
if(m_getInfoStatus != e_infoFound)
|
||||
return false;
|
||||
#ifdef __PS3__
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
|
||||
#elif defined __PSVITA__
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
|
||||
#else // __ORBIS__
|
||||
return true;
|
||||
#endif
|
||||
|
|
@ -320,7 +320,7 @@ int SonyRemoteStorage::getDataProgress()
|
|||
int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize;
|
||||
|
||||
|
||||
__int64 time = System::currentTimeMillis();
|
||||
int64_t time = System::currentTimeMillis();
|
||||
int elapsedSecs = (time - m_startTime) / 1000;
|
||||
float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
|
||||
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
|
||||
|
|
@ -341,15 +341,15 @@ bool SonyRemoteStorage::shutdown()
|
|||
if(m_bInitialised)
|
||||
{
|
||||
int ret = sceRemoteStorageTerm();
|
||||
if(ret >= 0)
|
||||
if(ret >= 0)
|
||||
{
|
||||
app.DebugPrintf("Term request done \n");
|
||||
m_bInitialised = false;
|
||||
free(m_memPoolBuffer);
|
||||
m_memPoolBuffer = NULL;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Error in Term request: 0x%x \n", ret);
|
||||
return false;
|
||||
|
|
@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
|
|||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
__int64 iSeed = strtoll(seed,NULL,10);
|
||||
int64_t iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
|
|
@ -433,7 +433,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
|||
char descDataVersion[9];
|
||||
sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion);
|
||||
memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null
|
||||
|
||||
|
||||
|
||||
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
|
||||
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
|
||||
|
|
@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
|||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
__int64 iSeed = strtoll(seed,NULL,10);
|
||||
int64_t iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
|
|
@ -468,7 +468,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
|||
uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
|
||||
{
|
||||
char hexString[9];
|
||||
ZeroMemory(hexString,9);
|
||||
ZeroMemory(hexString,9);
|
||||
memcpy(hexString, hexBytes,8);
|
||||
|
||||
uint32_t u32Val = 0;
|
||||
|
|
@ -481,7 +481,7 @@ uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
|
|||
uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes)
|
||||
{
|
||||
char hexString[17];
|
||||
ZeroMemory(hexString,17);
|
||||
ZeroMemory(hexString,17);
|
||||
memcpy(hexString, hexBytes,16);
|
||||
|
||||
uint64_t u64Val = 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "..\..\Common\Network\Sony\sceRemoteStorage\header\sceRemoteStorage.h"
|
||||
|
|
@ -43,7 +43,7 @@ public:
|
|||
char m_saveFileDesc[128];
|
||||
|
||||
class DescriptionData
|
||||
{
|
||||
{
|
||||
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
|
||||
public:
|
||||
char m_platform[4];
|
||||
|
|
@ -54,7 +54,7 @@ public:
|
|||
};
|
||||
|
||||
class DescriptionData_V2
|
||||
{
|
||||
{
|
||||
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
|
||||
public:
|
||||
char m_platformNone[4]; // set to no platform, to indicate we're using the newer version of the data
|
||||
|
|
@ -73,7 +73,7 @@ public:
|
|||
public:
|
||||
int m_descDataVersion;
|
||||
ESavePlatform m_savePlatform;
|
||||
__int64 m_seed;
|
||||
int64_t m_seed;
|
||||
uint32_t m_hostOptions;
|
||||
uint32_t m_texturePack;
|
||||
uint32_t m_saveVersion;
|
||||
|
|
@ -115,7 +115,7 @@ public:
|
|||
const char* getLocalFilename();
|
||||
const char* getSaveNameUTF8();
|
||||
ESavePlatform getSavePlatform();
|
||||
__int64 getSaveSeed();
|
||||
int64_t getSaveSeed();
|
||||
unsigned int getSaveHostOptions();
|
||||
unsigned int getSaveTexturePack();
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ public:
|
|||
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
||||
static int setDataThread(void* lpParam);
|
||||
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
|
||||
protected:
|
||||
const char* getRemoteSaveFilename();
|
||||
|
|
@ -154,7 +154,7 @@ protected:
|
|||
unsigned int m_thumbnailDataSize;
|
||||
C4JThread* m_SetDataThread;
|
||||
PSAVE_INFO m_setDataSaveInfo;
|
||||
__int64 m_startTime;
|
||||
int64_t m_startTime;
|
||||
|
||||
bool m_bAborting;
|
||||
bool m_bTransferStarted;
|
||||
|
|
|
|||
|
|
@ -1486,12 +1486,26 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
|||
}
|
||||
break;
|
||||
case ACTION_MENU_UP:
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.WasMouseWheelConsumed())
|
||||
{
|
||||
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_UP);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
//ui.PlayUISFX(eSFX_Focus);
|
||||
m_eCurrTapState = eTapStateUp;
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_DOWN:
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.WasMouseWheelConsumed())
|
||||
{
|
||||
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_DOWN);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
//ui.PlayUISFX(eSFX_Focus);
|
||||
m_eCurrTapState = eTapStateDown;
|
||||
|
|
|
|||
|
|
@ -1099,13 +1099,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
|
|||
break;
|
||||
case ACTION_MENU_OTHER_STICK_DOWN:
|
||||
{
|
||||
int pageStep = TabSpec::rows;
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.WasMouseWheelConsumed())
|
||||
{
|
||||
pageStep = 1;
|
||||
}
|
||||
#endif
|
||||
int pageStep = 1;
|
||||
m_tabPage[m_curTab] += pageStep;
|
||||
if(m_tabPage[m_curTab] >= specs[m_curTab]->getPageCount())
|
||||
{
|
||||
|
|
@ -1119,13 +1113,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
|
|||
break;
|
||||
case ACTION_MENU_OTHER_STICK_UP:
|
||||
{
|
||||
int pageStep = TabSpec::rows;
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.WasMouseWheelConsumed())
|
||||
{
|
||||
pageStep = 1;
|
||||
}
|
||||
#endif
|
||||
int pageStep = 1;
|
||||
m_tabPage[m_curTab] -= pageStep;
|
||||
if(m_tabPage[m_curTab] < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,10 +55,16 @@ void UIComponent_Chat::handleTimerComplete(int id)
|
|||
float opacity = pGui->getOpacity(m_iPad, i);
|
||||
if( opacity > 0 )
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
// Chat drawn by Gui::render with color codes. Hides Iggy chat to avoid double chats.
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
#else
|
||||
m_controlLabelBackground[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setLabel( pGui->getMessage(m_iPad,i) );
|
||||
|
||||
#endif
|
||||
anyVisible = true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void UIComponent_Panorama::tick()
|
|||
EnterCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
if(pMinecraft->level!=NULL)
|
||||
{
|
||||
__int64 i64TimeOfDay =0;
|
||||
int64_t i64TimeOfDay =0;
|
||||
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
|
||||
if(pMinecraft->level->dimension->id==0)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
|
|||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
|
|
@ -112,7 +112,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
|
|||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ UIControl::UIControl()
|
|||
m_isVisible = true;
|
||||
m_bHidden = false;
|
||||
m_eControlType = eNoControl;
|
||||
m_id = -1;
|
||||
m_pParentPanel = NULL;
|
||||
}
|
||||
|
||||
bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
|
||||
|
|
|
|||
|
|
@ -38,12 +38,14 @@ protected:
|
|||
bool m_bHidden; // set by the Remove call
|
||||
|
||||
public:
|
||||
UIControl *m_pParentPanel; // set by UI_MAP_ELEMENT macro during mapElementsAndNames
|
||||
|
||||
void setControlType(eUIControlType eType) {m_eControlType=eType;}
|
||||
eUIControlType getControlType() {return m_eControlType;}
|
||||
void setId(int iID) { m_id=iID; }
|
||||
int getId() { return m_id; }
|
||||
UIScene * getParentScene() {return m_parentScene;}
|
||||
UIControl* getParentPanel() { return m_pParentPanel; }
|
||||
|
||||
protected:
|
||||
IggyValuePath m_iggyPath;
|
||||
|
|
@ -62,10 +64,8 @@ public:
|
|||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
|
||||
void UpdateControl();
|
||||
#ifdef __PSVITA__
|
||||
void setHidden(bool bHidden) {m_bHidden=bHidden;}
|
||||
bool getHidden(void) {return m_bHidden;}
|
||||
#endif
|
||||
|
||||
IggyValuePath *getIggyValuePath();
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ void UIControl_ButtonList::setButtonLabel(int iButtonId, const wstring &label)
|
|||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetButtonLabel, 2 , value );
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
|
||||
{
|
||||
IggyDataValue result;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
void setButtonLabel(int iButtonId, const wstring &label);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::init(UIString label, int id, __int64 min, __int64 max)
|
||||
void UIControl_SpaceIndicatorBar::init(UIString label, int id, int64_t min, int64_t max)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
|
@ -61,11 +61,11 @@ void UIControl_SpaceIndicatorBar::reset()
|
|||
setSaveGameOffset(0.0f);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::addSave(__int64 size)
|
||||
void UIControl_SpaceIndicatorBar::addSave(int64_t size)
|
||||
{
|
||||
float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
|
||||
m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) );
|
||||
m_sizeAndOffsets.push_back( pair<int64_t, float>(size, startPercent) );
|
||||
|
||||
m_currentTotal += size;
|
||||
setTotalSize(m_currentTotal);
|
||||
|
|
@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
|
|||
{
|
||||
if(index >= 0 && index < m_sizeAndOffsets.size())
|
||||
{
|
||||
pair<__int64,float> values = m_sizeAndOffsets[index];
|
||||
pair<int64_t,float> values = m_sizeAndOffsets[index];
|
||||
setSaveSize(values.first);
|
||||
setSaveGameOffset(values.second);
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
|
|||
}
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size)
|
||||
{
|
||||
m_currentSave = size;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
|
|||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value );
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size)
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size)
|
||||
{
|
||||
float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,28 +6,28 @@ class UIControl_SpaceIndicatorBar : public UIControl_Base
|
|||
{
|
||||
private:
|
||||
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
|
||||
__int64 m_min;
|
||||
__int64 m_max;
|
||||
__int64 m_currentSave, m_currentTotal;
|
||||
int64_t m_min;
|
||||
int64_t m_max;
|
||||
int64_t m_currentSave, m_currentTotal;
|
||||
float m_currentOffset;
|
||||
|
||||
vector<pair<__int64,float> > m_sizeAndOffsets;
|
||||
vector<pair<int64_t,float> > m_sizeAndOffsets;
|
||||
|
||||
public:
|
||||
UIControl_SpaceIndicatorBar();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
|
||||
|
||||
void init(UIString label, int id, __int64 min, __int64 max);
|
||||
void init(UIString label, int id, int64_t min, int64_t max);
|
||||
virtual void ReInit();
|
||||
void reset();
|
||||
|
||||
void addSave(__int64 size);
|
||||
void addSave(int64_t size);
|
||||
void selectSave(int index);
|
||||
|
||||
|
||||
private:
|
||||
void setSaveSize(__int64 size);
|
||||
void setTotalSize(__int64 totalSize);
|
||||
void setSaveSize(int64_t size);
|
||||
void setTotalSize(int64_t totalSize);
|
||||
void setSaveGameOffset(float offset);
|
||||
};
|
||||
|
|
@ -5,6 +5,15 @@
|
|||
UIControl_TextInput::UIControl_TextInput()
|
||||
{
|
||||
m_bHasFocus = false;
|
||||
m_bHasCaret = false;
|
||||
m_bCaretChecked = false;
|
||||
#ifdef _WINDOWS64
|
||||
m_bDirectEditing = false;
|
||||
m_iCursorPos = 0;
|
||||
m_iCharLimit = 0;
|
||||
m_iDirectEditCooldown = 0;
|
||||
m_iCaretBlinkTimer = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
|
||||
|
|
@ -16,6 +25,7 @@ bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, co
|
|||
m_textName = registerFastName(L"text");
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
m_funcSetCharLimit = registerFastName(L"SetCharLimit");
|
||||
m_funcSetCaretIndex = registerFastName(L"SetCaretIndex");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
@ -81,3 +91,197 @@ void UIControl_TextInput::SetCharLimit(int iLimit)
|
|||
value[0].number = iLimit;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCharLimit , 1 , value );
|
||||
}
|
||||
|
||||
void UIControl_TextInput::setCaretVisible(bool visible)
|
||||
{
|
||||
if (!m_parentScene || !m_parentScene->getMovie())
|
||||
return;
|
||||
|
||||
// Check once whether this SWF's FJ_TextInput actually has a m_mcCaret child.
|
||||
// IggyValuePathMakeNameRef always succeeds (creates a ref to undefined),
|
||||
// so we validate by trying to read a property from the resolved path.
|
||||
if (!m_bCaretChecked)
|
||||
{
|
||||
IggyValuePath caretPath;
|
||||
if (IggyValuePathMakeNameRef(&caretPath, getIggyValuePath(), "m_mcCaret"))
|
||||
{
|
||||
rrbool test = false;
|
||||
IggyResult res = IggyValueGetBooleanRS(&caretPath, m_nameVisible, NULL, &test);
|
||||
m_bHasCaret = (res == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bHasCaret = false;
|
||||
}
|
||||
m_bCaretChecked = true;
|
||||
}
|
||||
if (!m_bHasCaret)
|
||||
return;
|
||||
|
||||
IggyValuePath caretPath;
|
||||
if (IggyValuePathMakeNameRef(&caretPath, getIggyValuePath(), "m_mcCaret"))
|
||||
{
|
||||
IggyValueSetBooleanRS(&caretPath, m_nameVisible, NULL, visible);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_TextInput::setCaretIndex(int index)
|
||||
{
|
||||
if (!m_parentScene || !m_parentScene->getMovie())
|
||||
return;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCaretIndex , 1 , value );
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
|
||||
void UIControl_TextInput::beginDirectEdit(int charLimit)
|
||||
{
|
||||
const wchar_t* current = getLabel();
|
||||
m_editBuffer = current ? current : L"";
|
||||
m_textBeforeEdit = m_editBuffer;
|
||||
m_iCursorPos = (int)m_editBuffer.length();
|
||||
m_iCharLimit = charLimit;
|
||||
m_bDirectEditing = true;
|
||||
m_iDirectEditCooldown = 0;
|
||||
m_iCaretBlinkTimer = 0;
|
||||
g_KBMInput.ClearCharBuffer();
|
||||
setCaretVisible(true);
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
|
||||
UIControl_TextInput::EDirectEditResult UIControl_TextInput::tickDirectEdit()
|
||||
{
|
||||
if (m_iDirectEditCooldown > 0)
|
||||
m_iDirectEditCooldown--;
|
||||
|
||||
if (!m_bDirectEditing)
|
||||
{
|
||||
setCaretVisible(false);
|
||||
return eDirectEdit_Continue;
|
||||
}
|
||||
|
||||
// Enforce caret visibility and position every tick — setLabel() and Flash
|
||||
// focus changes can reset both at any time.
|
||||
setCaretVisible(true);
|
||||
setCaretIndex(m_iCursorPos);
|
||||
|
||||
// For SWFs without m_mcCaret, insert '_' at the cursor position.
|
||||
// All characters remain visible — '_' sits between them like a cursor.
|
||||
if (!m_bHasCaret)
|
||||
{
|
||||
wstring display = m_editBuffer;
|
||||
display.insert(m_iCursorPos, 1, L'_');
|
||||
setLabel(display.c_str());
|
||||
}
|
||||
|
||||
EDirectEditResult result = eDirectEdit_Continue;
|
||||
bool changed = false;
|
||||
|
||||
// Consume typed characters from the KBM buffer
|
||||
wchar_t ch;
|
||||
while (g_KBMInput.ConsumeChar(ch))
|
||||
{
|
||||
if (ch == 0x08) // Backspace
|
||||
{
|
||||
if (m_iCursorPos > 0)
|
||||
{
|
||||
m_editBuffer.erase(m_iCursorPos - 1, 1);
|
||||
m_iCursorPos--;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (ch == 0x0D) // Enter — confirm edit
|
||||
{
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 4;
|
||||
setLabel(m_editBuffer.c_str(), true);
|
||||
setCaretVisible(false);
|
||||
return eDirectEdit_Confirmed;
|
||||
}
|
||||
else if (m_iCharLimit <= 0 || (int)m_editBuffer.length() < m_iCharLimit)
|
||||
{
|
||||
m_editBuffer.insert(m_iCursorPos, 1, ch);
|
||||
m_iCursorPos++;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Arrow keys, Home, End, Delete for cursor movement
|
||||
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
|
||||
{
|
||||
m_iCursorPos--;
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
if (g_KBMInput.IsKeyPressed(VK_RIGHT) && m_iCursorPos < (int)m_editBuffer.length())
|
||||
{
|
||||
m_iCursorPos++;
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
if (g_KBMInput.IsKeyPressed(VK_HOME))
|
||||
{
|
||||
m_iCursorPos = 0;
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
if (g_KBMInput.IsKeyPressed(VK_END))
|
||||
{
|
||||
m_iCursorPos = (int)m_editBuffer.length();
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
if (g_KBMInput.IsKeyPressed(VK_DELETE) && m_iCursorPos < (int)m_editBuffer.length())
|
||||
{
|
||||
m_editBuffer.erase(m_iCursorPos, 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Escape — cancel edit and restore original text
|
||||
if (g_KBMInput.IsKeyPressed(VK_ESCAPE))
|
||||
{
|
||||
m_editBuffer = m_textBeforeEdit;
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 4;
|
||||
setLabel(m_editBuffer.c_str());
|
||||
setCaretVisible(false);
|
||||
return eDirectEdit_Cancelled;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
if (m_bHasCaret)
|
||||
{
|
||||
setLabel(m_editBuffer.c_str());
|
||||
setCaretIndex(m_iCursorPos);
|
||||
}
|
||||
// SWFs without caret: the cursor block above already updates the label every tick
|
||||
}
|
||||
|
||||
return eDirectEdit_Continue;
|
||||
}
|
||||
|
||||
void UIControl_TextInput::cancelDirectEdit()
|
||||
{
|
||||
if (m_bDirectEditing)
|
||||
{
|
||||
m_editBuffer = m_textBeforeEdit;
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 4;
|
||||
setLabel(m_editBuffer.c_str(), true);
|
||||
setCaretVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_TextInput::confirmDirectEdit()
|
||||
{
|
||||
if (m_bDirectEditing)
|
||||
{
|
||||
m_bDirectEditing = false;
|
||||
setLabel(m_editBuffer.c_str(), true);
|
||||
setCaretVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,20 @@ class UIControl_TextInput : public UIControl_Base
|
|||
{
|
||||
private:
|
||||
IggyName m_textName, m_funcChangeState, m_funcSetCharLimit;
|
||||
IggyName m_funcSetCaretIndex;
|
||||
bool m_bHasFocus;
|
||||
bool m_bHasCaret;
|
||||
bool m_bCaretChecked;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
bool m_bDirectEditing;
|
||||
wstring m_textBeforeEdit;
|
||||
wstring m_editBuffer;
|
||||
int m_iCursorPos;
|
||||
int m_iCharLimit;
|
||||
int m_iDirectEditCooldown;
|
||||
int m_iCaretBlinkTimer;
|
||||
#endif
|
||||
|
||||
public:
|
||||
UIControl_TextInput();
|
||||
|
|
@ -19,4 +32,24 @@ public:
|
|||
virtual void setFocus(bool focus);
|
||||
|
||||
void SetCharLimit(int iLimit);
|
||||
|
||||
void setCaretVisible(bool visible);
|
||||
void setCaretIndex(int index);
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
enum EDirectEditResult
|
||||
{
|
||||
eDirectEdit_Continue,
|
||||
eDirectEdit_Confirmed,
|
||||
eDirectEdit_Cancelled,
|
||||
};
|
||||
|
||||
void beginDirectEdit(int charLimit = 0);
|
||||
EDirectEditResult tickDirectEdit();
|
||||
void cancelDirectEdit();
|
||||
void confirmDirectEdit();
|
||||
bool isDirectEditing() const { return m_bDirectEditing; }
|
||||
int getDirectEditCooldown() const { return m_iDirectEditCooldown; }
|
||||
const wstring& getEditBuffer() const { return m_editBuffer; }
|
||||
#endif
|
||||
};
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include "UI.h"
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Slider.h"
|
||||
#include "UIControl_TexturePackList.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\LocalPlayer.h"
|
||||
#include "..\..\DLCTexturePack.h"
|
||||
|
|
@ -143,7 +144,7 @@ extern "C" void *__real_malloc(size_t t);
|
|||
extern "C" void __real_free(void *t);
|
||||
#endif
|
||||
|
||||
__int64 UIController::iggyAllocCount = 0;
|
||||
int64_t UIController::iggyAllocCount = 0;
|
||||
static unordered_map<void *,size_t> allocations;
|
||||
static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned )
|
||||
{
|
||||
|
|
@ -237,6 +238,8 @@ UIController::UIController()
|
|||
m_winUserIndex = 0;
|
||||
m_mouseDraggingSliderScene = eUIScene_COUNT;
|
||||
m_mouseDraggingSliderId = -1;
|
||||
m_mouseClickConsumedByScene = false;
|
||||
m_bMouseHoverHorizontalList = false;
|
||||
m_lastHoverMouseX = -1;
|
||||
m_lastHoverMouseY = -1;
|
||||
m_accumulatedTicks = 0;
|
||||
|
|
@ -499,7 +502,7 @@ void UIController::tick()
|
|||
}
|
||||
|
||||
// Clear out the cached movie file data
|
||||
__int64 currentTime = System::currentTimeMillis();
|
||||
int64_t currentTime = System::currentTimeMillis();
|
||||
for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
|
||||
{
|
||||
if(it->second.m_expiry < currentTime)
|
||||
|
|
@ -619,7 +622,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN
|
|||
IggyMemoryUseInfo memoryInfo;
|
||||
rrbool res;
|
||||
int iteration = 0;
|
||||
__int64 totalStatic = 0;
|
||||
int64_t totalStatic = 0;
|
||||
while(res = IggyDebugGetMemoryUseInfo ( NULL ,
|
||||
lib ,
|
||||
"" ,
|
||||
|
|
@ -750,7 +753,7 @@ void UIController::CleanUpSkinReload()
|
|||
byteArray UIController::getMovieData(const wstring &filename)
|
||||
{
|
||||
// Cache everything we load in the current tick
|
||||
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
|
||||
int64_t targetTime = System::currentTimeMillis() + (1000LL * 60);
|
||||
auto it = m_cachedMovieData.find(filename);
|
||||
if(it == m_cachedMovieData.end() )
|
||||
{
|
||||
|
|
@ -784,40 +787,36 @@ void UIController::tickInput()
|
|||
#endif
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
m_mouseClickConsumedByScene = false;
|
||||
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
|
||||
{
|
||||
UIScene *pScene = NULL;
|
||||
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)
|
||||
// Search by layer priority across all groups (layer-first).
|
||||
// Tooltip layer is skipped because it holds non-interactive
|
||||
// overlays (button hints, timer) that should never capture mouse.
|
||||
// Old group-first order found those tooltips on eUIGroup_Fullscreen
|
||||
// before reaching in-game menus on eUIGroup_Player1.
|
||||
static const EUILayer mouseLayers[] = {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
eUILayer_Debug,
|
||||
#endif
|
||||
eUILayer_Error,
|
||||
eUILayer_Alert,
|
||||
eUILayer_Popup,
|
||||
eUILayer_Fullscreen,
|
||||
eUILayer_Scene,
|
||||
};
|
||||
for (int l = 0; l < _countof(mouseLayers) && !pScene; ++l)
|
||||
{
|
||||
pScene = m_groups[grp]->GetTopScene(eUILayer_Debug);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Tooltips);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Error);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Alert);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Popup);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Fullscreen);
|
||||
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Scene);
|
||||
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)
|
||||
{
|
||||
pScene = m_groups[grp]->GetTopScene(mouseLayers[l]);
|
||||
}
|
||||
}
|
||||
if (pScene && pScene->getMovie())
|
||||
{
|
||||
Iggy *movie = pScene->getMovie();
|
||||
int rawMouseX = g_KBMInput.GetMouseX();
|
||||
int rawMouseY = g_KBMInput.GetMouseY();
|
||||
F32 mouseX = (F32)rawMouseX;
|
||||
F32 mouseY = (F32)rawMouseY;
|
||||
|
||||
extern HWND g_hWnd;
|
||||
if (g_hWnd)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
int winW = rc.right - rc.left;
|
||||
int winH = rc.bottom - rc.top;
|
||||
if (winW > 0 && winH > 0)
|
||||
{
|
||||
mouseX = mouseX * (m_fScreenWidth / (F32)winW);
|
||||
mouseY = mouseY * (m_fScreenHeight / (F32)winH);
|
||||
}
|
||||
}
|
||||
|
||||
// Only update hover focus when the mouse has actually moved,
|
||||
// so that mouse-wheel scrolling can change list selection
|
||||
|
|
@ -826,43 +825,21 @@ void UIController::tickInput()
|
|||
m_lastHoverMouseX = rawMouseX;
|
||||
m_lastHoverMouseY = rawMouseY;
|
||||
|
||||
if (mouseMoved)
|
||||
// Convert mouse to scene/movie coordinates
|
||||
F32 sceneMouseX = (F32)rawMouseX;
|
||||
F32 sceneMouseY = (F32)rawMouseY;
|
||||
{
|
||||
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
|
||||
IggyFocusableObject focusables[64];
|
||||
S32 numFocusables = 0;
|
||||
IggyPlayerGetFocusableObjects(movie, ¤tFocus, focusables, 64, &numFocusables);
|
||||
|
||||
if (numFocusables > 0 && numFocusables <= 64)
|
||||
extern HWND g_hWnd;
|
||||
RECT rc;
|
||||
if (g_hWnd && GetClientRect(g_hWnd, &rc))
|
||||
{
|
||||
IggyFocusHandle hitObject = IGGY_FOCUS_NULL;
|
||||
for (S32 i = 0; i < numFocusables; ++i)
|
||||
int winW = rc.right - rc.left;
|
||||
int winH = rc.bottom - rc.top;
|
||||
if (winW > 0 && winH > 0)
|
||||
{
|
||||
if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 &&
|
||||
mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1)
|
||||
{
|
||||
hitObject = focusables[i].object;
|
||||
break;
|
||||
}
|
||||
sceneMouseX = sceneMouseX * ((F32)pScene->getRenderWidth() / (F32)winW);
|
||||
sceneMouseY = sceneMouseY * ((F32)pScene->getRenderHeight() / (F32)winH);
|
||||
}
|
||||
|
||||
if (hitObject != currentFocus)
|
||||
{
|
||||
IggyPlayerSetFocusRS(movie, hitObject, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert mouse to scene/movie coordinates for slider hit testing
|
||||
F32 sceneMouseX = mouseX;
|
||||
F32 sceneMouseY = mouseY;
|
||||
{
|
||||
S32 displayWidth = 0, displayHeight = 0;
|
||||
pScene->GetParentLayer()->getRenderDimensions(displayWidth, displayHeight);
|
||||
if (displayWidth > 0 && displayHeight > 0)
|
||||
{
|
||||
sceneMouseX = mouseX * ((F32)pScene->getRenderWidth() / (F32)displayWidth);
|
||||
sceneMouseY = mouseY * ((F32)pScene->getRenderHeight() / (F32)displayHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -876,6 +853,110 @@ void UIController::tickInput()
|
|||
panelOffsetY = pMainPanel->getYPos();
|
||||
}
|
||||
|
||||
// Mouse hover — hit test against C++ control bounds.
|
||||
// Simple controls use SetFocusToElement; list controls
|
||||
// use their own SetTouchFocus for Flash-side hit testing.
|
||||
if (mouseMoved)
|
||||
{
|
||||
m_bMouseHoverHorizontalList = false;
|
||||
vector<UIControl *> *controls = pScene->GetControls();
|
||||
if (controls)
|
||||
{
|
||||
int hitControlId = -1;
|
||||
S32 hitArea = INT_MAX;
|
||||
UIControl *hitCtrl = NULL;
|
||||
for (size_t i = 0; i < controls->size(); ++i)
|
||||
{
|
||||
UIControl *ctrl = (*controls)[i];
|
||||
if (!ctrl || ctrl->getHidden() || !ctrl->getVisible() || ctrl->getId() < 0)
|
||||
continue;
|
||||
|
||||
UIControl::eUIControlType type = ctrl->getControlType();
|
||||
if (type != UIControl::eButton && type != UIControl::eTextInput &&
|
||||
type != UIControl::eCheckBox && type != UIControl::eSlider &&
|
||||
type != UIControl::eButtonList && type != UIControl::eTexturePackList)
|
||||
continue;
|
||||
|
||||
// If the scene has an active panel (e.g. tab menus),
|
||||
// skip controls that aren't children of that panel.
|
||||
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
|
||||
continue;
|
||||
|
||||
ctrl->UpdateControl();
|
||||
S32 cx = ctrl->getXPos() + panelOffsetX;
|
||||
S32 cy = ctrl->getYPos() + panelOffsetY;
|
||||
S32 cw = ctrl->getWidth();
|
||||
S32 ch = ctrl->getHeight();
|
||||
// TexturePackList origin is where the slot area starts,
|
||||
// not the top-left of the whole control — use GetRealHeight.
|
||||
if (type == UIControl::eTexturePackList)
|
||||
ch = ((UIControl_TexturePackList *)ctrl)->GetRealHeight();
|
||||
if (cw <= 0 || ch <= 0)
|
||||
continue;
|
||||
|
||||
if (sceneMouseX >= cx && sceneMouseX <= cx + cw &&
|
||||
sceneMouseY >= cy && sceneMouseY <= cy + ch)
|
||||
{
|
||||
if (type == UIControl::eButtonList)
|
||||
{
|
||||
// ButtonList manages focus internally via Flash —
|
||||
// pass mouse coords so it can highlight the right item.
|
||||
((UIControl_ButtonList *)ctrl)->SetTouchFocus(
|
||||
(S32)sceneMouseX, (S32)sceneMouseY, false);
|
||||
hitControlId = -1;
|
||||
hitArea = INT_MAX;
|
||||
hitCtrl = NULL;
|
||||
break; // ButtonList takes priority
|
||||
}
|
||||
if (type == UIControl::eTexturePackList)
|
||||
{
|
||||
// TexturePackList expects coords relative to its origin.
|
||||
UIControl_TexturePackList *pList = (UIControl_TexturePackList *)ctrl;
|
||||
pScene->SetFocusToElement(ctrl->getId());
|
||||
pList->SetTouchFocus(
|
||||
(S32)(sceneMouseX - cx), (S32)(sceneMouseY - cy), false);
|
||||
m_bMouseHoverHorizontalList = true;
|
||||
hitControlId = -1;
|
||||
hitArea = INT_MAX;
|
||||
hitCtrl = NULL;
|
||||
break;
|
||||
}
|
||||
S32 area = cw * ch;
|
||||
if (area < hitArea)
|
||||
{
|
||||
hitControlId = ctrl->getId();
|
||||
hitArea = area;
|
||||
hitCtrl = ctrl;
|
||||
if (type == UIControl::eSlider)
|
||||
m_bMouseHoverHorizontalList = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitControlId >= 0 && pScene->getControlFocus() != hitControlId)
|
||||
{
|
||||
// During direct editing, don't let hover move focus
|
||||
// away to other TextInputs (e.g. sign lines).
|
||||
if (hitCtrl && hitCtrl->getControlType() == UIControl::eTextInput
|
||||
&& pScene->isDirectEditBlocking())
|
||||
{
|
||||
// Skip — keep focus on the actively-edited input
|
||||
}
|
||||
else
|
||||
{
|
||||
pScene->SetFocusToElement(hitControlId);
|
||||
// TextInput: SetFocusToElement triggers ChangeState which
|
||||
// shows the caret. Hide it immediately — the render pass
|
||||
// happens after both tickInput and scene tick, so no flicker.
|
||||
if (hitCtrl && hitCtrl->getControlType() == UIControl::eTextInput)
|
||||
{
|
||||
((UIControl_TextInput *)hitCtrl)->setCaretVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT);
|
||||
bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT);
|
||||
|
||||
|
|
@ -890,12 +971,51 @@ void UIController::tickInput()
|
|||
vector<UIControl *> *controls = pScene->GetControls();
|
||||
if (controls)
|
||||
{
|
||||
// Set Iggy dispatch focus for TextInput on click (not hover)
|
||||
// so ACTION_MENU_OK targets the correct text field.
|
||||
for (size_t i = 0; i < controls->size(); ++i)
|
||||
{
|
||||
UIControl *ctrl = (*controls)[i];
|
||||
if (!ctrl || ctrl->getControlType() != UIControl::eTextInput || !ctrl->getVisible())
|
||||
continue;
|
||||
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
|
||||
continue;
|
||||
ctrl->UpdateControl();
|
||||
S32 cx = ctrl->getXPos() + panelOffsetX;
|
||||
S32 cy = ctrl->getYPos() + panelOffsetY;
|
||||
S32 cw = ctrl->getWidth();
|
||||
S32 ch = ctrl->getHeight();
|
||||
if (cw > 0 && ch > 0 &&
|
||||
sceneMouseX >= cx && sceneMouseX <= cx + cw &&
|
||||
sceneMouseY >= cy && sceneMouseY <= cy + ch)
|
||||
{
|
||||
Iggy *movie = pScene->getMovie();
|
||||
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
|
||||
IggyFocusableObject focusables[64];
|
||||
S32 numFocusables = 0;
|
||||
IggyPlayerGetFocusableObjects(movie, ¤tFocus, focusables, 64, &numFocusables);
|
||||
for (S32 fi = 0; fi < numFocusables && fi < 64; ++fi)
|
||||
{
|
||||
if (sceneMouseX >= focusables[fi].x0 && sceneMouseX <= focusables[fi].x1 &&
|
||||
sceneMouseY >= focusables[fi].y0 && sceneMouseY <= focusables[fi].y1)
|
||||
{
|
||||
IggyPlayerSetFocusRS(movie, focusables[fi].object, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < controls->size(); ++i)
|
||||
{
|
||||
UIControl *ctrl = (*controls)[i];
|
||||
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
|
||||
continue;
|
||||
|
||||
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
|
||||
continue;
|
||||
|
||||
UIControl_Slider *pSlider = (UIControl_Slider *)ctrl;
|
||||
pSlider->UpdateControl();
|
||||
S32 cx = pSlider->getXPos() + panelOffsetX;
|
||||
|
|
@ -942,6 +1062,12 @@ void UIController::tickInput()
|
|||
m_mouseDraggingSliderScene = eUIScene_COUNT;
|
||||
m_mouseDraggingSliderId = -1;
|
||||
}
|
||||
|
||||
// Let the scene handle mouse clicks for custom navigation (e.g. crafting slots)
|
||||
if (leftPressed && m_mouseDraggingSliderId < 0)
|
||||
{
|
||||
m_mouseClickConsumedByScene = pScene->handleMouseClick(sceneMouseX, sceneMouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1206,7 +1332,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
|||
|
||||
if ((key == ACTION_MENU_OK || key == ACTION_MENU_A) && !g_KBMInput.IsMouseGrabbed())
|
||||
{
|
||||
if (m_mouseDraggingSliderId < 0)
|
||||
if (m_mouseDraggingSliderId < 0 && !m_mouseClickConsumedByScene)
|
||||
{
|
||||
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT)) { pressed = true; down = true; }
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT)) { released = true; down = false; }
|
||||
|
|
@ -1214,6 +1340,14 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
|||
}
|
||||
}
|
||||
|
||||
// Right click → ACTION_MENU_X (pick up half stack in inventory)
|
||||
if (key == ACTION_MENU_X && !g_KBMInput.IsMouseGrabbed())
|
||||
{
|
||||
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_RIGHT)) { pressed = true; down = true; }
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_RIGHT)) { released = true; down = false; }
|
||||
if (!pressed && !released && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)) { down = true; }
|
||||
}
|
||||
|
||||
// Scroll wheel for list scrolling — only consume the wheel value when the
|
||||
// action key actually matches, so the other direction isn't lost.
|
||||
if (!g_KBMInput.IsMouseGrabbed() && (key == ACTION_MENU_OTHER_STICK_UP || key == ACTION_MENU_OTHER_STICK_DOWN))
|
||||
|
|
@ -1231,6 +1365,16 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
|||
pressed = true;
|
||||
down = true;
|
||||
}
|
||||
|
||||
// Remap scroll wheel to navigation actions. Use LEFT/RIGHT when
|
||||
// hovering a horizontal list (e.g. TexturePackList), UP/DOWN otherwise.
|
||||
if (pressed && g_KBMInput.IsKBMActive())
|
||||
{
|
||||
if (m_bMouseHoverHorizontalList)
|
||||
key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_LEFT : ACTION_MENU_RIGHT;
|
||||
else
|
||||
key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_UP : ACTION_MENU_DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1297,8 +1441,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
|||
//!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) &&
|
||||
key == ACTION_MENU_STICK_PRESS)
|
||||
{
|
||||
__int64 totalStatic = 0;
|
||||
__int64 totalDynamic = 0;
|
||||
int64_t totalStatic = 0;
|
||||
int64_t totalDynamic = 0;
|
||||
app.DebugPrintf(app.USER_SR, "********************************\n");
|
||||
app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n");
|
||||
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
|
||||
|
|
@ -1307,8 +1451,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
|||
}
|
||||
for(unsigned int i = 0; i < eLibrary_Count; ++i)
|
||||
{
|
||||
__int64 libraryStatic = 0;
|
||||
__int64 libraryDynamic = 0;
|
||||
int64_t libraryStatic = 0;
|
||||
int64_t libraryDynamic = 0;
|
||||
|
||||
if(m_iggyLibraries[i] != IGGY_INVALID_LIBRARY)
|
||||
{
|
||||
|
|
@ -1723,6 +1867,7 @@ void UIController::unregisterSubstitutionTexture(const wstring &textureName, boo
|
|||
bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer, EUIGroup group)
|
||||
{
|
||||
static bool bSeenUpdateTextThisSession = false;
|
||||
#if 0 // Disable since we don't use this
|
||||
// If you're navigating to the multigamejoinload, and the player hasn't seen the updates message yet, display it now
|
||||
// display this message the first 3 times
|
||||
if((scene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0))
|
||||
|
|
@ -1730,6 +1875,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI
|
|||
scene=eUIScene_NewUpdateMessage;
|
||||
bSeenUpdateTextThisSession=true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// if you're trying to navigate to the inventory,the crafting, pause or game info or any of the trigger scenes and there's already a menu up (because you were pressing a few buttons at the same time) then ignore the navigate
|
||||
if(GetMenuDisplayed(iPad))
|
||||
|
|
@ -2335,14 +2481,20 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal)
|
|||
|
||||
void UIController::PlayUISFX(ESoundEffect eSound)
|
||||
{
|
||||
__uint64 time = System::currentTimeMillis();
|
||||
uint64_t time = System::currentTimeMillis();
|
||||
|
||||
// Don't play multiple SFX on the same tick
|
||||
// (prevents horrible sounds when programmatically setting multiple checkboxes)
|
||||
if (time - m_lastUiSfx < 10) { return; }
|
||||
m_lastUiSfx = time;
|
||||
|
||||
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
|
||||
float pitch = 1.0f;
|
||||
if (eSound == eSFX_Focus)
|
||||
{
|
||||
pitch += (m_randomDistribution(m_randomGenerator) - 0.5f) / 10;
|
||||
}
|
||||
|
||||
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,pitch);
|
||||
}
|
||||
|
||||
void UIController::DisplayGamertag(unsigned int iPad, bool show)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using namespace std;
|
|||
#include "IUIController.h"
|
||||
#include "UIEnums.h"
|
||||
#include "UIGroup.h"
|
||||
#include <random>
|
||||
|
||||
class UIAbstractBitmapFont;
|
||||
class UIBitmapFont;
|
||||
|
|
@ -15,7 +16,7 @@ class UIControl;
|
|||
class UIController : public IUIController
|
||||
{
|
||||
public:
|
||||
static __int64 iggyAllocCount;
|
||||
static int64_t iggyAllocCount;
|
||||
|
||||
// MGH - added to prevent crash loading Iggy movies while the skins were being reloaded
|
||||
static CRITICAL_SECTION ms_reloadSkinCS;
|
||||
|
|
@ -29,7 +30,7 @@ private:
|
|||
CRITICAL_SECTION m_navigationLock;
|
||||
|
||||
static const int UI_REPEAT_KEY_DELAY_MS = 300; // How long from press until the first repeat
|
||||
static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats
|
||||
static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats
|
||||
DWORD m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1];
|
||||
|
||||
float m_fScreenWidth;
|
||||
|
|
@ -49,7 +50,7 @@ private:
|
|||
eFont_Korean,
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 4J-JEV: It's important that currentFont == targetFont, unless updateCurrentLanguage is going to be called.
|
||||
EFont m_eCurrentFont, m_eTargetFont;
|
||||
|
||||
|
|
@ -63,6 +64,9 @@ private:
|
|||
UITTFFont *m_mcTTFFont;
|
||||
UIBitmapFont *m_moj7, *m_moj11;
|
||||
|
||||
std::mt19937 m_randomGenerator;
|
||||
std::uniform_real_distribution<float> m_randomDistribution;
|
||||
|
||||
public:
|
||||
void setCleanupOnReload();
|
||||
void updateCurrentFont();
|
||||
|
|
@ -72,7 +76,7 @@ private:
|
|||
// 4J-PB - ui element type for PSVita touch control
|
||||
#ifdef __PSVITA__
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
UIControl *pControl;
|
||||
S32 x1,y1,x2,y2;
|
||||
|
|
@ -137,7 +141,7 @@ private:
|
|||
|
||||
C4JRender::eViewportType m_currentRenderViewport;
|
||||
bool m_bCustomRenderPosition;
|
||||
|
||||
|
||||
static DWORD m_dwTrialTimerLimitSecs;
|
||||
|
||||
unordered_map<wstring, byteArray> m_substitutionTextures;
|
||||
|
|
@ -145,7 +149,7 @@ private:
|
|||
typedef struct _CachedMovieData
|
||||
{
|
||||
byteArray m_ba;
|
||||
__int64 m_expiry;
|
||||
int64_t m_expiry;
|
||||
} CachedMovieData;
|
||||
unordered_map<wstring, CachedMovieData> m_cachedMovieData;
|
||||
|
||||
|
|
@ -160,6 +164,8 @@ private:
|
|||
unsigned int m_winUserIndex;
|
||||
EUIScene m_mouseDraggingSliderScene;
|
||||
int m_mouseDraggingSliderId;
|
||||
bool m_mouseClickConsumedByScene;
|
||||
bool m_bMouseHoverHorizontalList;
|
||||
int m_lastHoverMouseX;
|
||||
int m_lastHoverMouseY;
|
||||
//bool m_bSysUIShowing;
|
||||
|
|
@ -167,7 +173,7 @@ private:
|
|||
C4JThread *m_reloadSkinThread;
|
||||
bool m_navigateToHomeOnReload;
|
||||
int m_accumulatedTicks;
|
||||
__uint64 m_lastUiSfx; // Tracks time (ms) of last UI sound effect
|
||||
uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect
|
||||
|
||||
D3D11_RECT m_customRenderingClearRect;
|
||||
|
||||
|
|
@ -211,7 +217,7 @@ protected:
|
|||
void postInit();
|
||||
|
||||
|
||||
public:
|
||||
public:
|
||||
CRITICAL_SECTION m_Allocatorlock;
|
||||
void SetupFont();
|
||||
bool PendingFontChange();
|
||||
|
|
@ -243,7 +249,7 @@ private:
|
|||
void tickInput();
|
||||
void handleInput();
|
||||
void handleKeyPress(unsigned int iPad, unsigned int key);
|
||||
|
||||
|
||||
protected:
|
||||
static rrbool RADLINK ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call );
|
||||
|
||||
|
|
@ -313,7 +319,7 @@ private:
|
|||
public:
|
||||
void CloseAllPlayersScenes();
|
||||
void CloseUIScenes(int iPad, bool forceIPad = false);
|
||||
|
||||
|
||||
virtual bool IsPauseMenuDisplayed(int iPad);
|
||||
virtual bool IsContainerMenuDisplayed(int iPad);
|
||||
virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void UIGroup::tick()
|
|||
}
|
||||
|
||||
// Handle deferred update focus
|
||||
if (m_updateFocusStateCountdown > 0)
|
||||
if (m_updateFocusStateCountdown > 0)
|
||||
{
|
||||
m_updateFocusStateCountdown--;
|
||||
if (m_updateFocusStateCountdown == 0)_UpdateFocusState();
|
||||
|
|
@ -233,7 +233,7 @@ void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
|
|||
}
|
||||
}
|
||||
|
||||
// FOCUS
|
||||
// FOCUS
|
||||
|
||||
// Check that a layer may recieve focus, specifically that there is no infocus layer above
|
||||
bool UIGroup::RequestFocus(UILayer* layerPtr)
|
||||
|
|
@ -389,16 +389,16 @@ unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr)
|
|||
// can't get here...
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIGroup::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||
|
||||
void UIGroup::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
|
||||
{
|
||||
__int64 groupStatic = 0;
|
||||
__int64 groupDynamic = 0;
|
||||
int64_t groupStatic = 0;
|
||||
int64_t groupDynamic = 0;
|
||||
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group);
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n",i);
|
||||
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
|
||||
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
|
||||
app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n",i);
|
||||
}
|
||||
app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n", groupStatic, groupDynamic);
|
||||
|
|
@ -412,7 +412,7 @@ int UIGroup::getCommandBufferList()
|
|||
return m_commandBufferList;
|
||||
}
|
||||
|
||||
// Returns the first scene of given type if it exists, NULL otherwise
|
||||
// Returns the first scene of given type if it exists, NULL otherwise
|
||||
UIScene *UIGroup::FindScene(EUIScene sceneType)
|
||||
{
|
||||
UIScene *pScene = NULL;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ private:
|
|||
UIScene_HUD *m_hud;
|
||||
|
||||
C4JRender::eViewportType m_viewportType;
|
||||
|
||||
|
||||
EUIGroup m_group;
|
||||
int m_iPad;
|
||||
|
||||
|
||||
bool m_bMenuDisplayed;
|
||||
bool m_bPauseMenuDisplayed;
|
||||
bool m_bContainerMenuDisplayed;
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void SetViewportType(C4JRender::eViewportType type);
|
||||
C4JRender::eViewportType GetViewportType();
|
||||
|
||||
|
||||
virtual void HandleDLCMountingComplete();
|
||||
virtual void HandleDLCInstalled();
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
@ -99,15 +99,15 @@ public:
|
|||
bool IsFullscreenGroup();
|
||||
|
||||
void handleUnlockFullVersion();
|
||||
|
||||
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
|
||||
|
||||
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
|
||||
|
||||
unsigned int GetLayerIndex(UILayer* layerPtr);
|
||||
|
||||
int getCommandBufferList();
|
||||
UIScene *FindScene(EUIScene sceneType);
|
||||
|
||||
private:
|
||||
private:
|
||||
void _UpdateFocusState();
|
||||
void updateStackStates();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -877,10 +877,10 @@ void UILayer::handleUnlockFullVersion()
|
|||
}
|
||||
}
|
||||
|
||||
void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||
void UILayer::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
|
||||
{
|
||||
__int64 layerStatic = 0;
|
||||
__int64 layerDynamic = 0;
|
||||
int64_t layerStatic = 0;
|
||||
int64_t layerDynamic = 0;
|
||||
for(auto& it : m_components)
|
||||
{
|
||||
it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ public:
|
|||
|
||||
// INPUT
|
||||
void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
#ifdef __PSVITA__
|
||||
#ifdef __PSVITA__
|
||||
// Current active scene
|
||||
UIScene *getCurrentScene();
|
||||
#endif
|
||||
// FOCUS
|
||||
|
||||
|
||||
bool updateFocusState(bool allowedFocus = false);
|
||||
|
||||
public:
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
void handleUnlockFullVersion();
|
||||
UIScene *FindScene(EUIScene sceneType);
|
||||
|
||||
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
|
||||
|
||||
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ void UIScene::initialiseMovie()
|
|||
m_bUpdateOpacity = true;
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
void UIScene::SetFocusToElement(int iID)
|
||||
{
|
||||
IggyDataValue result;
|
||||
|
|
@ -329,11 +329,11 @@ void UIScene::loadMovie()
|
|||
}
|
||||
|
||||
byteArray baFile = ui.getMovieData(moviePath.c_str());
|
||||
__int64 beforeLoad = ui.iggyAllocCount;
|
||||
int64_t beforeLoad = ui.iggyAllocCount;
|
||||
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
|
||||
__int64 afterLoad = ui.iggyAllocCount;
|
||||
int64_t afterLoad = ui.iggyAllocCount;
|
||||
IggyPlayerInitializeAndTickRS ( swf );
|
||||
__int64 afterTick = ui.iggyAllocCount;
|
||||
int64_t afterTick = ui.iggyAllocCount;
|
||||
|
||||
if(!swf)
|
||||
{
|
||||
|
|
@ -362,8 +362,8 @@ void UIScene::loadMovie()
|
|||
IggyMemoryUseInfo memoryInfo;
|
||||
rrbool res;
|
||||
int iteration = 0;
|
||||
__int64 totalStatic = 0;
|
||||
__int64 totalDynamic = 0;
|
||||
int64_t totalStatic = 0;
|
||||
int64_t totalDynamic = 0;
|
||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||
NULL ,
|
||||
0 ,
|
||||
|
|
@ -406,15 +406,15 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||
void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
|
||||
{
|
||||
if(!swf) return;
|
||||
|
||||
IggyMemoryUseInfo memoryInfo;
|
||||
rrbool res;
|
||||
int iteration = 0;
|
||||
__int64 sceneStatic = 0;
|
||||
__int64 sceneDynamic = 0;
|
||||
int64_t sceneStatic = 0;
|
||||
int64_t sceneDynamic = 0;
|
||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||
NULL ,
|
||||
"" ,
|
||||
|
|
@ -447,6 +447,19 @@ void UIScene::tick()
|
|||
IggyPlayerTickRS( swf );
|
||||
m_hasTickedOnce = true;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
{
|
||||
vector<UIControl_TextInput*> inputs;
|
||||
getDirectEditInputs(inputs);
|
||||
for (size_t i = 0; i < inputs.size(); i++)
|
||||
{
|
||||
UIControl_TextInput::EDirectEditResult result = inputs[i]->tickDirectEdit();
|
||||
if (result != UIControl_TextInput::eDirectEdit_Continue)
|
||||
onDirectEditFinished(inputs[i], result);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
UIControl* UIScene::GetMainPanel()
|
||||
|
|
@ -454,6 +467,113 @@ UIControl* UIScene::GetMainPanel()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
bool UIScene::isDirectEditBlocking()
|
||||
{
|
||||
vector<UIControl_TextInput*> inputs;
|
||||
getDirectEditInputs(inputs);
|
||||
for (size_t i = 0; i < inputs.size(); i++)
|
||||
{
|
||||
if (inputs[i]->isDirectEditing() || inputs[i]->getDirectEditCooldown() > 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UIScene::handleMouseClick(F32 x, F32 y)
|
||||
{
|
||||
S32 panelOffsetX = 0, panelOffsetY = 0;
|
||||
UIControl *pMainPanel = GetMainPanel();
|
||||
if (pMainPanel)
|
||||
{
|
||||
pMainPanel->UpdateControl();
|
||||
panelOffsetX = pMainPanel->getXPos();
|
||||
panelOffsetY = pMainPanel->getYPos();
|
||||
}
|
||||
|
||||
// Click-outside-to-deselect: confirm any active direct edit if
|
||||
// the click landed outside the editing text input.
|
||||
{
|
||||
vector<UIControl_TextInput*> deInputs;
|
||||
getDirectEditInputs(deInputs);
|
||||
for (size_t i = 0; i < deInputs.size(); i++)
|
||||
{
|
||||
if (!deInputs[i]->isDirectEditing())
|
||||
continue;
|
||||
deInputs[i]->UpdateControl();
|
||||
S32 cx = deInputs[i]->getXPos() + panelOffsetX;
|
||||
S32 cy = deInputs[i]->getYPos() + panelOffsetY;
|
||||
S32 cw = deInputs[i]->getWidth();
|
||||
S32 ch = deInputs[i]->getHeight();
|
||||
if (!(cw > 0 && ch > 0 && x >= cx && x <= cx + cw && y >= cy && y <= cy + ch))
|
||||
{
|
||||
deInputs[i]->confirmDirectEdit();
|
||||
onDirectEditFinished(deInputs[i], UIControl_TextInput::eDirectEdit_Confirmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vector<UIControl *> *controls = GetControls();
|
||||
if (!controls) return false;
|
||||
|
||||
// Hit-test controls and pick the smallest-area match to handle
|
||||
// overlapping Flash bounds correctly without sacrificing precision.
|
||||
int bestId = -1;
|
||||
S32 bestArea = INT_MAX;
|
||||
UIControl *bestCtrl = NULL;
|
||||
|
||||
for (size_t i = 0; i < controls->size(); ++i)
|
||||
{
|
||||
UIControl *ctrl = (*controls)[i];
|
||||
if (!ctrl || ctrl->getHidden() || !ctrl->getVisible() || ctrl->getId() < 0)
|
||||
continue;
|
||||
|
||||
UIControl::eUIControlType type = ctrl->getControlType();
|
||||
if (type != UIControl::eButton && type != UIControl::eTextInput &&
|
||||
type != UIControl::eCheckBox)
|
||||
continue;
|
||||
|
||||
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
|
||||
continue;
|
||||
|
||||
ctrl->UpdateControl();
|
||||
S32 cx = ctrl->getXPos() + panelOffsetX;
|
||||
S32 cy = ctrl->getYPos() + panelOffsetY;
|
||||
S32 cw = ctrl->getWidth();
|
||||
S32 ch = ctrl->getHeight();
|
||||
if (cw <= 0 || ch <= 0)
|
||||
continue;
|
||||
|
||||
if (x >= cx && x <= cx + cw && y >= cy && y <= cy + ch)
|
||||
{
|
||||
S32 area = cw * ch;
|
||||
if (area < bestArea)
|
||||
{
|
||||
bestArea = area;
|
||||
bestId = ctrl->getId();
|
||||
bestCtrl = ctrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestId >= 0 && bestCtrl)
|
||||
{
|
||||
if (bestCtrl->getControlType() == UIControl::eCheckBox)
|
||||
{
|
||||
UIControl_CheckBox *cb = (UIControl_CheckBox *)bestCtrl;
|
||||
bool newState = !cb->IsChecked();
|
||||
cb->setChecked(newState);
|
||||
handleCheckboxToggled((F64)bestId, newState);
|
||||
}
|
||||
else
|
||||
{
|
||||
handlePress((F64)bestId, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene::addTimer(int id, int ms)
|
||||
{
|
||||
|
|
@ -534,12 +654,13 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene)
|
|||
// update the button positions since they may have changed
|
||||
UpdateSceneControls();
|
||||
|
||||
// mark the button as removed
|
||||
control->setHidden(true);
|
||||
// remove it from the touchboxes
|
||||
ui.TouchBoxRebuild(control->getParentScene());
|
||||
#endif
|
||||
|
||||
// mark the button as removed so hover/touch hit-tests skip it
|
||||
control->setHidden(true);
|
||||
|
||||
}
|
||||
|
||||
void UIScene::slideLeft()
|
||||
|
|
@ -900,6 +1021,25 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released
|
|||
app.DebugPrintf("UI WARNING: Ignoring input as game action does not translate to an Iggy keycode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
// If a navigation key is pressed with no focused element, focus the first
|
||||
// available one so arrow keys work even when the mouse is over empty space.
|
||||
if(pressed && (iggyKeyCode == IGGY_KEYCODE_UP || iggyKeyCode == IGGY_KEYCODE_DOWN ||
|
||||
iggyKeyCode == IGGY_KEYCODE_LEFT || iggyKeyCode == IGGY_KEYCODE_RIGHT))
|
||||
{
|
||||
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
|
||||
IggyFocusableObject focusables[64];
|
||||
S32 numFocusables = 0;
|
||||
IggyPlayerGetFocusableObjects(swf, ¤tFocus, focusables, 64, &numFocusables);
|
||||
if(currentFocus == IGGY_FOCUS_NULL && numFocusables > 0)
|
||||
{
|
||||
IggyPlayerSetFocusRS(swf, focusables[0].object, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
IggyEvent keyEvent;
|
||||
// 4J Stu - Keyloc is always standard as we don't care about shift/alt
|
||||
IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard );
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using namespace std;
|
|||
|
||||
#include "UIEnums.h"
|
||||
#include "UIControl_Base.h"
|
||||
#include "UIControl_TextInput.h"
|
||||
|
||||
class ItemRenderer;
|
||||
class UILayer;
|
||||
|
|
@ -16,22 +17,26 @@ class UILayer;
|
|||
virtual bool mapElementsAndNames() \
|
||||
{ \
|
||||
parentClass::mapElementsAndNames(); \
|
||||
IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() );
|
||||
IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() ); \
|
||||
UIControl *_mapPanel = NULL;
|
||||
|
||||
#define UI_END_MAP_ELEMENTS_AND_NAMES() \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define UI_MAP_ELEMENT( var, name) \
|
||||
{ var.setupControl(this, currentRoot , name ); m_controls.push_back(&var); }
|
||||
{ var.setupControl(this, currentRoot , name ); var.m_pParentPanel = _mapPanel; m_controls.push_back(&var); }
|
||||
|
||||
#define UI_BEGIN_MAP_CHILD_ELEMENTS( parent ) \
|
||||
{ \
|
||||
IggyValuePath *lastRoot = currentRoot; \
|
||||
currentRoot = parent.getIggyValuePath();
|
||||
UIControl *_lastPanel = _mapPanel; \
|
||||
currentRoot = parent.getIggyValuePath(); \
|
||||
_mapPanel = &parent;
|
||||
|
||||
#define UI_END_MAP_CHILD_ELEMENTS() \
|
||||
currentRoot = lastRoot; \
|
||||
_mapPanel = _lastPanel; \
|
||||
}
|
||||
|
||||
#define UI_MAP_NAME( var, name ) \
|
||||
|
|
@ -40,7 +45,7 @@ class UILayer;
|
|||
class UIScene
|
||||
{
|
||||
friend class UILayer;
|
||||
public:
|
||||
public:
|
||||
IggyValuePath *m_rootPath;
|
||||
|
||||
private:
|
||||
|
|
@ -80,7 +85,7 @@ public:
|
|||
|
||||
protected:
|
||||
ESceneResolution m_loadedResolution;
|
||||
|
||||
|
||||
bool m_bIsReloading;
|
||||
bool m_bFocussedOnce;
|
||||
|
||||
|
|
@ -96,7 +101,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual Iggy *getMovie() { return swf; }
|
||||
|
||||
|
||||
void destroyMovie();
|
||||
virtual void reloadMovie(bool force = false);
|
||||
virtual bool needsReloaded();
|
||||
|
|
@ -129,7 +134,7 @@ private:
|
|||
void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo);
|
||||
|
||||
public:
|
||||
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
|
||||
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
|
||||
|
||||
public:
|
||||
UIScene(int iPad, UILayer *parentLayer);
|
||||
|
|
@ -141,8 +146,10 @@ public:
|
|||
virtual void tick();
|
||||
|
||||
IggyName registerFastName(const wstring &name);
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
void SetFocusToElement(int iID);
|
||||
#endif
|
||||
#ifdef __PSVITA__
|
||||
void SetFocusToElement(int iID);
|
||||
void UpdateSceneControls();
|
||||
#endif
|
||||
protected:
|
||||
|
|
@ -162,7 +169,7 @@ public:
|
|||
|
||||
void gainFocus();
|
||||
void loseFocus();
|
||||
|
||||
|
||||
virtual void updateTooltips();
|
||||
virtual void updateComponents() {}
|
||||
virtual void handleGainFocus(bool navBack);
|
||||
|
|
@ -177,6 +184,19 @@ public:
|
|||
// returns main panel if controls are not living in the root
|
||||
virtual UIControl* GetMainPanel();
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
// Direct edit support: scenes override to register their text inputs.
|
||||
// Base class handles tickDirectEdit in tick(), click-outside-to-deselect
|
||||
// in handleMouseClick(), and provides isDirectEditBlocking() for guards.
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs) {}
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result) {}
|
||||
bool isDirectEditBlocking();
|
||||
|
||||
// Mouse click dispatch. Hit-tests C++ controls and picks the smallest-area
|
||||
// match, then calls handlePress. Override for custom behaviour (e.g. crafting).
|
||||
virtual bool handleMouseClick(F32 x, F32 y);
|
||||
#endif
|
||||
|
||||
void removeControl( UIControl_Base *control, bool centreScene);
|
||||
void slideLeft();
|
||||
void slideRight();
|
||||
|
|
@ -193,7 +213,7 @@ public:
|
|||
protected:
|
||||
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
|
||||
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
|
||||
|
||||
|
||||
bool m_cacheSlotRenders;
|
||||
bool m_needsCacheRendered;
|
||||
int m_expectedCachedSlotCount;
|
||||
|
|
@ -269,7 +289,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
#ifdef _DURANGO
|
||||
#ifdef _DURANGO
|
||||
virtual long long getDefaultGtcButtons() { return _360_GTC_BACK; }
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,19 @@ void UIScene_AnvilMenu::tick()
|
|||
{
|
||||
UIScene_AbstractContainerMenu::tick();
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
// Live update: sync item name per-keystroke while editing (like Java edition)
|
||||
if (m_textInputAnvil.isDirectEditing())
|
||||
{
|
||||
const wstring& buf = m_textInputAnvil.getEditBuffer();
|
||||
if (buf != m_itemName)
|
||||
{
|
||||
m_itemName = buf;
|
||||
updateItemName();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
handleTick();
|
||||
}
|
||||
|
||||
|
|
@ -306,26 +319,67 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection)
|
|||
return control;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
void UIScene_AnvilMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
inputs.push_back(&m_textInputAnvil);
|
||||
}
|
||||
|
||||
void UIScene_AnvilMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
m_itemName = input->getEditBuffer();
|
||||
updateItemName();
|
||||
}
|
||||
#endif
|
||||
|
||||
int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
|
||||
{
|
||||
// 4J HEG - No reason to set value if keyboard was cancelled
|
||||
UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam;
|
||||
pClass->setIgnoreInput(false);
|
||||
|
||||
if (bRes)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
Win64_GetKeyboardText(pchText, 128);
|
||||
pClass->setEditNameValue((wchar_t *)pchText);
|
||||
pClass->m_itemName = (wchar_t *)pchText;
|
||||
pClass->updateItemName();
|
||||
#else
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
|
||||
InputManager.GetText(pchText);
|
||||
pClass->setEditNameValue((wchar_t *)pchText);
|
||||
pClass->m_itemName = (wchar_t *)pchText;
|
||||
pClass->updateItemName();
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIScene_AnvilMenu::handleEditNamePressed()
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking())
|
||||
return;
|
||||
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
m_textInputAnvil.beginDirectEdit(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
setIgnoreInput(true);
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = app.GetString(IDS_TITLE_RENAME);
|
||||
kbData.defaultText = m_textInputAnvil.getLabel();
|
||||
kbData.maxChars = 30;
|
||||
kbData.callback = &UIScene_AnvilMenu::KeyboardCompleteCallback;
|
||||
kbData.lpParam = this;
|
||||
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
|
||||
}
|
||||
#else
|
||||
setIgnoreInput(true);
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
int language = XGetLanguage();
|
||||
|
|
@ -337,13 +391,13 @@ void UIScene_AnvilMenu::handleEditNamePressed()
|
|||
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
break;
|
||||
default:
|
||||
// 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIScene_AnvilMenu::setEditNameValue(const wstring &name)
|
||||
|
|
@ -357,6 +411,8 @@ void UIScene_AnvilMenu::setEditNameEditable(bool enabled)
|
|||
|
||||
void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
||||
{
|
||||
if (!getMovie()) return;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
|
|
@ -375,6 +431,8 @@ void UIScene_AnvilMenu::showCross(bool show)
|
|||
{
|
||||
if(m_showingCross != show)
|
||||
{
|
||||
if (!getMovie()) return;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ protected:
|
|||
|
||||
virtual UIControl *getSection(ESceneSection eSection);
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
#endif
|
||||
static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes);
|
||||
virtual void handleEditNamePressed();
|
||||
virtual void setEditNameValue(const wstring &name);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "UIScene_CraftingMenu.h"
|
||||
#ifdef _WINDOWS64
|
||||
#include "..\..\Windows64\Iggy\gdraw\gdraw_d3d11.h"
|
||||
#endif
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#define GAME_CRAFTING_TOUCHUPDATE_TIMER_ID 0
|
||||
|
|
@ -12,6 +15,11 @@
|
|||
|
||||
UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
m_hSlotBoundsValid = false;
|
||||
m_hSlotX0 = m_hSlotY0 = m_hSlotY1 = 0;
|
||||
m_hSlotSpacing = 0;
|
||||
#endif
|
||||
m_bIgnoreKeyPresses = false;
|
||||
|
||||
CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData;
|
||||
|
|
@ -254,12 +262,14 @@ wstring UIScene_CraftingMenu::getMoviePath()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
UIControl* UIScene_CraftingMenu::GetMainPanel()
|
||||
{
|
||||
return &m_controlMainPanel;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
|
||||
{
|
||||
// perform action on release
|
||||
|
|
@ -383,6 +393,85 @@ void UIScene_CraftingMenu::handleTimerComplete(int id)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
bool UIScene_CraftingMenu::handleMouseClick(F32 x, F32 y)
|
||||
{
|
||||
if (!m_hSlotBoundsValid || m_hSlotSpacing <= 0)
|
||||
return false;
|
||||
|
||||
// Tab click — tabs sit directly above the H slot row. We derive their
|
||||
// bounds from the H slot positions cached in customDraw, since the Vita
|
||||
// TouchPanel controls are full-screen overlays with unusable bounds.
|
||||
int maxTabs = (m_iContainerType == RECIPE_TYPE_3x3) ? m_iMaxGroup3x3 : m_iMaxGroup2x2;
|
||||
F32 slotHeight = m_hSlotY1 - m_hSlotY0;
|
||||
F32 tabRowY0 = (m_hSlotY0 * 0.75f) - slotHeight * 1.55f;
|
||||
F32 tabRowY1 = tabRowY0 + (slotHeight * 1.7f);
|
||||
F32 tabRowWidth = m_hSlotSpacing * m_iCraftablesMaxHSlotC;
|
||||
F32 tabWidth = tabRowWidth / maxTabs;
|
||||
|
||||
if (tabWidth > 0 && x >= m_hSlotX0 && x < m_hSlotX0 + tabRowWidth &&
|
||||
y >= tabRowY0 && y < tabRowY1)
|
||||
{
|
||||
int iTab = (int)((x - m_hSlotX0) / tabWidth);
|
||||
if (iTab >= 0 && iTab < maxTabs && iTab != m_iGroupIndex)
|
||||
{
|
||||
showTabHighlight(m_iGroupIndex, false);
|
||||
m_iGroupIndex = iTab;
|
||||
showTabHighlight(m_iGroupIndex, true);
|
||||
m_iCurrentSlotHIndex = 0;
|
||||
m_iCurrentSlotVIndex = 1;
|
||||
CheckRecipesAvailable();
|
||||
iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1;
|
||||
iVSlotIndexA[1] = 0;
|
||||
iVSlotIndexA[2] = 1;
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// H slot click — select or craft
|
||||
F32 rowWidth = m_hSlotSpacing * m_iCraftablesMaxHSlotC;
|
||||
if (x >= m_hSlotX0 && x < m_hSlotX0 + rowWidth &&
|
||||
y >= m_hSlotY0 && y < m_hSlotY1)
|
||||
{
|
||||
int iNewSlot = (int)((x - m_hSlotX0) / m_hSlotSpacing);
|
||||
if (iNewSlot >= 0 && iNewSlot < m_iCraftablesMaxHSlotC)
|
||||
{
|
||||
// Only interact with populated slots
|
||||
if (CanBeMadeA[iNewSlot].iCount == 0)
|
||||
return true;
|
||||
|
||||
if (iNewSlot == m_iCurrentSlotHIndex)
|
||||
{
|
||||
// Click on already-selected slot — craft the item
|
||||
handleKeyDown(m_iPad, ACTION_MENU_A, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
int iOldHSlot = m_iCurrentSlotHIndex;
|
||||
m_iCurrentSlotHIndex = iNewSlot;
|
||||
m_iCurrentSlotVIndex = 1;
|
||||
iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1;
|
||||
iVSlotIndexA[1] = 0;
|
||||
iVSlotIndexA[2] = 1;
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
if (CanBeMadeA[iOldHSlot].iCount > 0)
|
||||
setShowCraftHSlot(iOldHSlot, true);
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Consume all mouse clicks so misses don't generate ACTION_MENU_A
|
||||
// and accidentally craft. Only blocks mouse-originated presses.
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene_CraftingMenu::handleReload()
|
||||
{
|
||||
m_slotListInventory.addSlots(CRAFTING_INVENTORY_SLOT_START,CRAFTING_INVENTORY_SLOT_END - CRAFTING_INVENTORY_SLOT_START);
|
||||
|
|
@ -478,6 +567,32 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
|
|||
{
|
||||
decorations = false;
|
||||
int iIndex = slotId - CRAFTING_H_SLOT_START;
|
||||
#ifdef _WINDOWS64
|
||||
// Cache H slot SWF-space positions from the custom draw transform matrix
|
||||
if (iIndex == 0 || iIndex == 1)
|
||||
{
|
||||
F32 mat[16];
|
||||
gdraw_D3D11_CalculateCustomDraw_4J(region, mat);
|
||||
// Matrix to SWF coords (same formula as setupCustomDrawMatrices)
|
||||
F32 sw = (F32)getRenderWidth();
|
||||
F32 sh = (F32)getRenderHeight();
|
||||
F32 swfX = sw * (1.0f + mat[3]) / 2.0f;
|
||||
F32 swfY = sh * (1.0f - mat[7]) / 2.0f;
|
||||
if (iIndex == 0)
|
||||
{
|
||||
m_hSlotX0 = swfX;
|
||||
m_hSlotY0 = swfY;
|
||||
// Slot visual height from matrix scale and region height
|
||||
F32 slotH = sh * (-mat[5]) / 2.0f * region->y1;
|
||||
m_hSlotY1 = swfY + slotH;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hSlotSpacing = swfX - m_hSlotX0;
|
||||
m_hSlotBoundsValid = (m_hSlotSpacing > 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(m_hSlotsInfo[iIndex].show)
|
||||
{
|
||||
item = m_hSlotsInfo[iIndex].item;
|
||||
|
|
|
|||
|
|
@ -66,10 +66,19 @@ public:
|
|||
|
||||
#ifdef __PSVITA__
|
||||
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
|
||||
virtual UIControl* GetMainPanel();
|
||||
virtual void handleTouchBoxRebuild();
|
||||
virtual void handleTimerComplete(int id);
|
||||
#endif
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
virtual UIControl* GetMainPanel();
|
||||
#endif
|
||||
#ifdef _WINDOWS64
|
||||
virtual bool handleMouseClick(F32 x, F32 y);
|
||||
// Cached from customDraw — H slot bounding boxes in SWF space
|
||||
F32 m_hSlotX0, m_hSlotY0, m_hSlotY1;
|
||||
F32 m_hSlotSpacing; // x distance between slot 0 and slot 1
|
||||
bool m_hSlotBoundsValid;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
UIControl m_controlMainPanel;
|
||||
|
|
@ -97,7 +106,7 @@ protected:
|
|||
ETouchInput_TouchPanel_5,
|
||||
ETouchInput_TouchPanel_6,
|
||||
ETouchInput_CraftingHSlots,
|
||||
|
||||
|
||||
ETouchInput_Count,
|
||||
};
|
||||
UIControl_Touch m_TouchInput[ETouchInput_Count];
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
|
|||
m_labelTexturePackDescription.init(L"");
|
||||
|
||||
WCHAR TempString[256];
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]));
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]));
|
||||
m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty));
|
||||
|
||||
m_MoreOptionsParams.bGenerateOptions=TRUE;
|
||||
m_MoreOptionsParams.bStructures=TRUE;
|
||||
m_MoreOptionsParams.bStructures=TRUE;
|
||||
m_MoreOptionsParams.bFlatWorld=FALSE;
|
||||
m_MoreOptionsParams.bBonusChest=FALSE;
|
||||
m_MoreOptionsParams.bPVP = TRUE;
|
||||
|
|
@ -84,10 +84,6 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
|
|||
m_iGameModeId = GameType::SURVIVAL->getId();
|
||||
m_pDLCPack = NULL;
|
||||
m_bRebuildTouchBoxes = false;
|
||||
#ifdef _WINDOWS64
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 0;
|
||||
#endif
|
||||
|
||||
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
||||
// 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it.
|
||||
|
|
@ -95,7 +91,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
|
|||
m_MoreOptionsParams.bOnlineSettingChangedBySystem=false;
|
||||
|
||||
// 4J-PB - Removing this so that we can attempt to create an online game on PS3 when we are a restricted child account
|
||||
// It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online,
|
||||
// It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online,
|
||||
// instead of just greying out the online setting in the More Options
|
||||
// #ifdef __PS3__
|
||||
// if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||
|
|
@ -128,9 +124,9 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
|
|||
{
|
||||
// The profile settings say Online, but either the player is offline, or they are not allowed to play online
|
||||
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up online game checkbox
|
||||
bool bOnlineGame = m_MoreOptionsParams.bOnlineGame;
|
||||
m_checkboxOnline.SetEnable(true);
|
||||
|
|
@ -293,53 +289,6 @@ void UIScene_CreateWorldMenu::tick()
|
|||
{
|
||||
UIScene::tick();
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (m_iDirectEditCooldown > 0)
|
||||
m_iDirectEditCooldown--;
|
||||
|
||||
if (m_bDirectEditing)
|
||||
{
|
||||
wchar_t ch;
|
||||
bool changed = false;
|
||||
while (g_KBMInput.ConsumeChar(ch))
|
||||
{
|
||||
if (ch == 0x08) // backspace
|
||||
{
|
||||
if (!m_worldName.empty())
|
||||
{
|
||||
m_worldName.pop_back();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (ch == 0x0D) // enter - confirm
|
||||
{
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 4; // absorb the matching ACTION_MENU_OK that follows
|
||||
m_editWorldName.setLabel(m_worldName.c_str());
|
||||
}
|
||||
else if ((int)m_worldName.length() < 25)
|
||||
{
|
||||
m_worldName += ch;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Escape cancels and restores the original name
|
||||
if (m_bDirectEditing && g_KBMInput.IsKeyPressed(VK_ESCAPE))
|
||||
{
|
||||
m_worldName = m_worldNameBeforeEdit;
|
||||
m_bDirectEditing = false;
|
||||
m_iDirectEditCooldown = 4;
|
||||
m_editWorldName.setLabel(m_worldName.c_str());
|
||||
m_buttonCreateWorld.setEnable(!m_worldName.empty());
|
||||
}
|
||||
else if (changed)
|
||||
{
|
||||
m_editWorldName.setLabel(m_worldName.c_str());
|
||||
m_buttonCreateWorld.setEnable(!m_worldName.empty());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(m_iSetTexturePackDescription >= 0 )
|
||||
{
|
||||
|
|
@ -393,7 +342,7 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
|
|||
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
|
||||
|
||||
// results switched for this dialog
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
pClass->m_MoreOptionsParams.bOnlineGame=false;
|
||||
pClass->checkStateAndStartGame();
|
||||
|
|
@ -403,11 +352,24 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
void UIScene_CreateWorldMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
inputs.push_back(&m_editWorldName);
|
||||
}
|
||||
|
||||
void UIScene_CreateWorldMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
m_worldName = input->getEditBuffer();
|
||||
m_buttonCreateWorld.setEnable(!m_worldName.empty());
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
if(m_bIgnoreInput) return;
|
||||
#ifdef _WINDOWS64
|
||||
if (m_bDirectEditing || m_iDirectEditCooldown > 0) { handled = true; return; }
|
||||
if (isDirectEditBlocking()) { handled = true; return; }
|
||||
#endif
|
||||
|
||||
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
|
||||
|
|
@ -431,7 +393,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
|
|||
if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() )
|
||||
{
|
||||
UINT uiIDA[1] = { IDS_CONFIRM_OK };
|
||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
|
||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -442,7 +404,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
|
|||
case ACTION_MENU_OTHER_STICK_UP:
|
||||
case ACTION_MENU_OTHER_STICK_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
|
||||
|
||||
bool bOnlineGame = m_checkboxOnline.IsChecked();
|
||||
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame)
|
||||
{
|
||||
|
|
@ -464,7 +426,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
|
|||
{
|
||||
if(m_bIgnoreInput) return;
|
||||
#ifdef _WINDOWS64
|
||||
if (m_bDirectEditing || m_iDirectEditCooldown > 0) return;
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
|
||||
//CD - Added for audio
|
||||
|
|
@ -476,7 +438,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
|
|||
{
|
||||
m_bIgnoreInput=true;
|
||||
#ifdef _WINDOWS64
|
||||
if (Win64_IsControllerConnected())
|
||||
if (!g_KBMInput.IsKBMActive())
|
||||
{
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD);
|
||||
|
|
@ -488,11 +450,8 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
|
|||
}
|
||||
else
|
||||
{
|
||||
// PC without controller: edit the name field directly in-place.
|
||||
m_bIgnoreInput = false; // Don't block input - m_bDirectEditing is the guard
|
||||
m_worldNameBeforeEdit = m_worldName;
|
||||
m_bDirectEditing = true;
|
||||
g_KBMInput.ClearCharBuffer();
|
||||
m_bIgnoreInput = false;
|
||||
m_editWorldName.beginDirectEdit(25);
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
|
|
@ -618,7 +577,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
|
|||
if(m_MoreOptionsParams.dwTexturePack!=0)
|
||||
{
|
||||
// texture pack hasn't been set yet, so check what it will be
|
||||
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
|
||||
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
|
||||
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack;
|
||||
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();
|
||||
|
||||
|
|
@ -670,7 +629,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
|
|||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this);
|
||||
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this);
|
||||
#endif
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
|
|
@ -697,7 +656,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue)
|
|||
m_sliderDifficulty.handleSliderMove(value);
|
||||
|
||||
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value]));
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value]));
|
||||
m_sliderDifficulty.setLabel(TempString);
|
||||
break;
|
||||
}
|
||||
|
|
@ -744,7 +703,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
|
|||
m_MoreOptionsParams.bInviteOnly = FALSE;
|
||||
m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE;
|
||||
}
|
||||
|
||||
|
||||
m_checkboxOnline.SetEnable(bMultiplayerAllowed);
|
||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||
|
||||
|
|
@ -778,7 +737,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
|
|||
PBYTE pbImageData=NULL;
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.iData = m_iConfigA[i];
|
||||
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
|
||||
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
|
||||
|
|
@ -836,7 +795,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
bool isOnlineGame = m_MoreOptionsParams.bOnlineGame;
|
||||
int iPadNotSignedInLive = -1;
|
||||
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
|
||||
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||
{
|
||||
if (ProfileManager.IsSignedIn(i) && (i == primaryPad || isLocalMultiplayerAvailable))
|
||||
|
|
@ -888,7 +847,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
|
|
@ -944,7 +903,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
SceNpCommerceDialogParam param;
|
||||
sceNpCommerceDialogParamInitialize(¶m);
|
||||
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
||||
|
||||
iResult=sceNpCommerceDialogOpen(¶m);
|
||||
|
|
@ -959,7 +918,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
#endif
|
||||
|
||||
if(m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == TRUE)
|
||||
{
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||
|
|
@ -1032,7 +991,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
SceNpCommerceDialogParam param;
|
||||
sceNpCommerceDialogParamInitialize(¶m);
|
||||
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
||||
|
||||
iResult=sceNpCommerceDialogOpen(¶m);
|
||||
|
|
@ -1095,8 +1054,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
SceNpCommerceDialogParam param;
|
||||
sceNpCommerceDialogParamInitialize(¶m);
|
||||
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
||||
|
||||
iResult=sceNpCommerceDialogOpen(¶m);
|
||||
|
||||
|
|
@ -1169,14 +1128,14 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
|||
|
||||
// start the game
|
||||
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
|
||||
__int64 seedValue = 0;
|
||||
int64_t seedValue = 0;
|
||||
|
||||
NetworkGameInitData *param = new NetworkGameInitData();
|
||||
param->levelName = wWorldName;
|
||||
|
||||
if (wSeed.length() != 0)
|
||||
{
|
||||
__int64 value = 0;
|
||||
int64_t value = 0;
|
||||
unsigned int len = (unsigned int)wSeed.length();
|
||||
|
||||
//Check if the input string contains a numerical value
|
||||
|
|
@ -1195,7 +1154,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
|||
|
||||
//If the input string is a numerical value, convert it to a number
|
||||
if( isNumber )
|
||||
value = _fromString<__int64>(wSeed);
|
||||
value = _fromString<int64_t>(wSeed);
|
||||
|
||||
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
|
||||
if( value != 0 )
|
||||
|
|
@ -1239,7 +1198,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
|||
app.SetGameHostOption(eGameHostOption_HostCanFly,pClass->m_MoreOptionsParams.bHostPrivileges);
|
||||
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges);
|
||||
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges );
|
||||
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_MobGriefing, pClass->m_MoreOptionsParams.bMobGriefing);
|
||||
app.SetGameHostOption(eGameHostOption_KeepInventory, pClass->m_MoreOptionsParams.bKeepInventory);
|
||||
app.SetGameHostOption(eGameHostOption_DoMobSpawning, pClass->m_MoreOptionsParams.bDoMobSpawning);
|
||||
|
|
@ -1247,8 +1206,8 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
|||
app.SetGameHostOption(eGameHostOption_DoTileDrops, pClass->m_MoreOptionsParams.bDoTileDrops);
|
||||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, pClass->m_MoreOptionsParams.bNaturalRegeneration);
|
||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, pClass->m_MoreOptionsParams.bDoDaylightCycle);
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
|
||||
#ifdef _LARGE_WORLDS
|
||||
app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN
|
||||
pClass->m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1);
|
||||
|
|
@ -1411,7 +1370,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pClass->m_bIgnoreInput = false;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1422,7 +1381,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
|
|||
{
|
||||
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
|
||||
|
||||
|
|
@ -1467,7 +1426,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
|
|||
ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
#if defined( __ORBIS__) || defined(__PSVITA__)
|
||||
bool isOnlineGame = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
|
||||
if(isOnlineGame)
|
||||
|
|
@ -1497,7 +1456,7 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
|
|||
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam;
|
||||
pClass->m_bIgnoreInput = false;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad);
|
||||
}
|
||||
|
|
@ -1509,28 +1468,28 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
|
|||
// {
|
||||
// int32_t iResult;
|
||||
// UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam;
|
||||
//
|
||||
//
|
||||
// // continue offline, or upsell PS Plus?
|
||||
// if(result==C4JStorage::EMessage_ResultDecline)
|
||||
// if(result==C4JStorage::EMessage_ResultDecline)
|
||||
// {
|
||||
// // upsell psplus
|
||||
// int32_t iResult=sceNpCommerceDialogInitialize();
|
||||
//
|
||||
//
|
||||
// SceNpCommerceDialogParam param;
|
||||
// sceNpCommerceDialogParamInitialize(¶m);
|
||||
// param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
||||
// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||
// param.userId = ProfileManager.getUserID(pClass->m_iPad);
|
||||
//
|
||||
//
|
||||
// iResult=sceNpCommerceDialogOpen(¶m);
|
||||
// }
|
||||
// else if(result==C4JStorage::EMessage_ResultAccept)
|
||||
// else if(result==C4JStorage::EMessage_ResultAccept)
|
||||
// {
|
||||
// // continue offline
|
||||
// pClass->m_MoreOptionsParams.bOnlineGame=false;
|
||||
// pClass->checkStateAndStartGame();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// pClass->m_bIgnoreInput=false;
|
||||
// return 0;
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -51,11 +51,6 @@ private:
|
|||
DLCPack * m_pDLCPack;
|
||||
bool m_bRebuildTouchBoxes;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
bool m_bDirectEditing;
|
||||
wstring m_worldNameBeforeEdit;
|
||||
int m_iDirectEditCooldown;
|
||||
#endif
|
||||
|
||||
public:
|
||||
UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer);
|
||||
|
|
@ -83,6 +78,10 @@ protected:
|
|||
public:
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void StartSharedLaunchFlow();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,72 @@ wstring UIScene_DebugCreateSchematic::getMoviePath()
|
|||
return L"DebugCreateSchematic";
|
||||
}
|
||||
|
||||
UIControl_TextInput* UIScene_DebugCreateSchematic::getTextInputForControl(eControls ctrl)
|
||||
{
|
||||
switch (ctrl)
|
||||
{
|
||||
case eControl_Name: return &m_textInputName;
|
||||
case eControl_StartX: return &m_textInputStartX;
|
||||
case eControl_StartY: return &m_textInputStartY;
|
||||
case eControl_StartZ: return &m_textInputStartZ;
|
||||
case eControl_EndX: return &m_textInputEndX;
|
||||
case eControl_EndY: return &m_textInputEndY;
|
||||
case eControl_EndZ: return &m_textInputEndZ;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
void UIScene_DebugCreateSchematic::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
inputs.push_back(&m_textInputName);
|
||||
inputs.push_back(&m_textInputStartX);
|
||||
inputs.push_back(&m_textInputStartY);
|
||||
inputs.push_back(&m_textInputStartZ);
|
||||
inputs.push_back(&m_textInputEndX);
|
||||
inputs.push_back(&m_textInputEndY);
|
||||
inputs.push_back(&m_textInputEndZ);
|
||||
}
|
||||
|
||||
void UIScene_DebugCreateSchematic::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
wstring value = input->getEditBuffer();
|
||||
int iVal = 0;
|
||||
if (!value.empty())
|
||||
iVal = _fromString<int>(value);
|
||||
|
||||
if (input == &m_textInputName)
|
||||
{
|
||||
if (!value.empty())
|
||||
swprintf(m_data->name, 64, L"%ls", value.c_str());
|
||||
else
|
||||
swprintf(m_data->name, 64, L"schematic");
|
||||
}
|
||||
else if (input == &m_textInputStartX) m_data->startX = iVal;
|
||||
else if (input == &m_textInputStartY) m_data->startY = iVal;
|
||||
else if (input == &m_textInputStartZ) m_data->startZ = iVal;
|
||||
else if (input == &m_textInputEndX) m_data->endX = iVal;
|
||||
else if (input == &m_textInputEndY) m_data->endY = iVal;
|
||||
else if (input == &m_textInputEndZ) m_data->endZ = iVal;
|
||||
}
|
||||
|
||||
bool UIScene_DebugCreateSchematic::handleMouseClick(F32 x, F32 y)
|
||||
{
|
||||
UIScene::handleMouseClick(x, y);
|
||||
return true; // always consume to prevent Iggy re-entry on empty space
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene_DebugCreateSchematic::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
}
|
||||
|
||||
void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
|
||||
|
||||
switch(key)
|
||||
|
|
@ -67,6 +131,9 @@ void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, b
|
|||
|
||||
void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
switch((int)controlId)
|
||||
{
|
||||
case eControl_Create:
|
||||
|
|
@ -112,8 +179,28 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_EndX:
|
||||
case eControl_EndY:
|
||||
case eControl_EndZ:
|
||||
m_keyboardCallbackControl = (eControls)((int)controlId);
|
||||
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
{
|
||||
m_keyboardCallbackControl = (eControls)((int)controlId);
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl);
|
||||
if (input) input->beginDirectEdit(25);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = L"Enter something";
|
||||
kbData.defaultText = L"";
|
||||
kbData.maxChars = 25;
|
||||
kbData.callback = &UIScene_DebugCreateSchematic::KeyboardCompleteCallback;
|
||||
kbData.lpParam = this;
|
||||
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
@ -138,9 +225,15 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b
|
|||
{
|
||||
UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
Win64_GetKeyboardText(pchText, 128);
|
||||
#else
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
|
||||
InputManager.GetText(pchText);
|
||||
#endif
|
||||
|
||||
if(pchText[0]!=0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ private:
|
|||
|
||||
ConsoleSchematicFile::XboxSchematicInitParam *m_data;
|
||||
|
||||
|
||||
public:
|
||||
UIScene_DebugCreateSchematic(int iPad, void *initData, UILayer *parentLayer);
|
||||
|
||||
|
|
@ -58,8 +59,14 @@ protected:
|
|||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual wstring getMoviePath();
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
virtual bool handleMouseClick(F32 x, F32 y);
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual void tick();
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
|
||||
|
|
@ -68,6 +75,7 @@ protected:
|
|||
virtual void handleCheckboxToggled(F64 controlId, bool selected);
|
||||
|
||||
private:
|
||||
UIControl_TextInput* getTextInputForControl(eControls ctrl);
|
||||
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
|
||||
};
|
||||
#endif
|
||||
|
|
@ -31,19 +31,19 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer
|
|||
|
||||
WCHAR TempString[256];
|
||||
|
||||
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camX);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camX);
|
||||
m_textInputX.init(TempString, eControl_CamX);
|
||||
|
||||
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camY);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camY);
|
||||
m_textInputY.init(TempString, eControl_CamY);
|
||||
|
||||
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camZ);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camZ);
|
||||
m_textInputZ.init(TempString, eControl_CamZ);
|
||||
|
||||
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_yRot);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_yRot);
|
||||
m_textInputYRot.init(TempString, eControl_YRot);
|
||||
|
||||
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_elev);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_elev);
|
||||
m_textInputElevation.init(TempString, eControl_Elevation);
|
||||
|
||||
m_checkboxLockPlayer.init(L"Lock Player", eControl_LockPlayer, app.GetFreezePlayers());
|
||||
|
|
@ -55,6 +55,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer
|
|||
m_labelCamY.init(L"CamY");
|
||||
m_labelCamZ.init(L"CamZ");
|
||||
m_labelYRotElev.init(L"Y-Rot & Elevation (Degs)");
|
||||
|
||||
}
|
||||
|
||||
wstring UIScene_DebugSetCamera::getMoviePath()
|
||||
|
|
@ -62,8 +63,59 @@ wstring UIScene_DebugSetCamera::getMoviePath()
|
|||
return L"DebugSetCamera";
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
UIControl_TextInput* UIScene_DebugSetCamera::getTextInputForControl(eControls ctrl)
|
||||
{
|
||||
switch (ctrl)
|
||||
{
|
||||
case eControl_CamX: return &m_textInputX;
|
||||
case eControl_CamY: return &m_textInputY;
|
||||
case eControl_CamZ: return &m_textInputZ;
|
||||
case eControl_YRot: return &m_textInputYRot;
|
||||
case eControl_Elevation: return &m_textInputElevation;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_DebugSetCamera::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
inputs.push_back(&m_textInputX);
|
||||
inputs.push_back(&m_textInputY);
|
||||
inputs.push_back(&m_textInputZ);
|
||||
inputs.push_back(&m_textInputYRot);
|
||||
inputs.push_back(&m_textInputElevation);
|
||||
}
|
||||
|
||||
void UIScene_DebugSetCamera::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
wstring value = input->getEditBuffer();
|
||||
double val = 0;
|
||||
if (!value.empty()) val = _fromString<double>(value);
|
||||
|
||||
if (input == &m_textInputX) currentPosition->m_camX = val;
|
||||
else if (input == &m_textInputY) currentPosition->m_camY = val;
|
||||
else if (input == &m_textInputZ) currentPosition->m_camZ = val;
|
||||
else if (input == &m_textInputYRot) currentPosition->m_yRot = val;
|
||||
else if (input == &m_textInputElevation) currentPosition->m_elev = val;
|
||||
}
|
||||
|
||||
bool UIScene_DebugSetCamera::handleMouseClick(F32 x, F32 y)
|
||||
{
|
||||
UIScene::handleMouseClick(x, y);
|
||||
return true; // always consume to prevent Iggy re-entry on empty space
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene_DebugSetCamera::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
}
|
||||
|
||||
void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) { handled = true; return; }
|
||||
#endif
|
||||
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
|
||||
|
||||
switch(key)
|
||||
|
|
@ -88,11 +140,14 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pr
|
|||
|
||||
void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
switch((int)controlId)
|
||||
{
|
||||
case eControl_Teleport:
|
||||
app.SetXuiServerAction( ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_SetCameraLocation,
|
||||
eXuiServerAction_SetCameraLocation,
|
||||
(void *)currentPosition);
|
||||
break;
|
||||
case eControl_CamX:
|
||||
|
|
@ -100,8 +155,26 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_CamZ:
|
||||
case eControl_YRot:
|
||||
case eControl_Elevation:
|
||||
m_keyboardCallbackControl = (eControls)((int)controlId);
|
||||
m_keyboardCallbackControl = (eControls)((int)controlId);
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl);
|
||||
if (input) input->beginDirectEdit(25);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = L"Enter value";
|
||||
kbData.defaultText = L"";
|
||||
kbData.maxChars = 25;
|
||||
kbData.callback = &UIScene_DebugSetCamera::KeyboardCompleteCallback;
|
||||
kbData.lpParam = this;
|
||||
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
#endif
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
@ -119,9 +192,13 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected)
|
|||
int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
|
||||
{
|
||||
UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam;
|
||||
uint16_t pchText[2048];//[128];
|
||||
ZeroMemory(pchText, 2048/*128*/ * sizeof(uint16_t) );
|
||||
uint16_t pchText[2048];
|
||||
ZeroMemory(pchText, 2048 * sizeof(uint16_t));
|
||||
#ifdef _WINDOWS64
|
||||
Win64_GetKeyboardText(pchText, 2048);
|
||||
#else
|
||||
InputManager.GetText(pchText);
|
||||
#endif
|
||||
|
||||
if(pchText[0]!=0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ private:
|
|||
FreezePlayerParam *fpp;
|
||||
|
||||
eControls m_keyboardCallbackControl;
|
||||
#ifdef _WINDOWS64
|
||||
UIControl_TextInput* getTextInputForControl(eControls ctrl);
|
||||
#endif
|
||||
|
||||
public:
|
||||
UIScene_DebugSetCamera(int iPad, void *initData, UILayer *parentLayer);
|
||||
|
|
@ -54,6 +57,12 @@ protected:
|
|||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual wstring getMoviePath();
|
||||
virtual void tick();
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
virtual bool handleMouseClick(F32 x, F32 y);
|
||||
#endif
|
||||
|
||||
public:
|
||||
// INPUT
|
||||
|
|
|
|||
|
|
@ -753,10 +753,16 @@ void UIScene_HUD::handleTimerComplete(int id)
|
|||
float opacity = pGui->getOpacity(m_iPad, i);
|
||||
if( opacity > 0 )
|
||||
{
|
||||
#if 0 // def _WINDOWS64 // Use Iggy chat until Gui::render has visual parity
|
||||
// Chat drawn by Gui::render with color codes. Hides Iggy chat to avoid double chats.
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
#else
|
||||
m_controlLabelBackground[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setLabel( pGui->getMessagesCount(m_iPad) ? pGui->getMessage(m_iPad,i) : L"" );
|
||||
|
||||
#endif
|
||||
anyVisible = true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -83,17 +83,23 @@ void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, bo
|
|||
case C4JStorage::eOptions_Callback_Read:
|
||||
case C4JStorage::eOptions_Callback_Read_FileNotFound:
|
||||
// we've either read it, or it wasn't found
|
||||
#if 0
|
||||
if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
|
||||
{
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ui.NavigateToScene(0,eUIScene_SaveMessage);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
#if 0
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
#else
|
||||
ui.NavigateToScene(0,eUIScene_SaveMessage);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#elif defined _XBOX_ONE
|
||||
|
|
@ -131,17 +137,23 @@ void UIScene_Intro::handleAnimationEnd()
|
|||
case C4JStorage::eOptions_Callback_Read:
|
||||
case C4JStorage::eOptions_Callback_Read_FileNotFound:
|
||||
// we've either read it, or it wasn't found
|
||||
#if 0
|
||||
if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
|
||||
{
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ui.NavigateToScene(0,eUIScene_SaveMessage);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
#if 0
|
||||
ui.NavigateToScene(0,eUIScene_EULA);
|
||||
#else
|
||||
ui.NavigateToScene(0,eUIScene_SaveMessage);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@ void UIScene_Keyboard::tick()
|
|||
{
|
||||
UIScene::tick();
|
||||
|
||||
// Sync our buffer from Flash so we pick up changes made via controller/on-screen buttons.
|
||||
// Without this, switching between controller and keyboard would use stale text.
|
||||
const wchar_t* flashText = m_KeyboardTextInput.getLabel();
|
||||
if (flashText)
|
||||
m_win64TextBuffer = flashText;
|
||||
|
||||
// Accumulate physical keyboard chars into our own buffer, then push to Flash via setLabel.
|
||||
// This bypasses Iggy's focus system (char events only route to the focused element).
|
||||
// The char buffer is cleared on open so Enter/clicks from the triggering action don't leak in.
|
||||
|
|
|
|||
|
|
@ -257,6 +257,9 @@ void UIScene_LaunchMoreOptionsMenu::handleDestroy()
|
|||
void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
if(m_bIgnoreInput) return;
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
|
||||
//app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");
|
||||
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
|
||||
|
|
@ -334,7 +337,9 @@ void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel()
|
||||
{
|
||||
if(m_tabIndex == 0)
|
||||
|
|
@ -546,11 +551,16 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
|
|||
{
|
||||
UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam;
|
||||
pClass->m_bIgnoreInput=false;
|
||||
// 4J HEG - No reason to set value if keyboard was cancelled
|
||||
if (bRes)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
Win64_GetKeyboardText(pchText, 128);
|
||||
pClass->m_editSeed.setLabel((wchar_t *)pchText);
|
||||
pClass->m_params->seed = (wchar_t *)pchText;
|
||||
#else
|
||||
#ifdef __PSVITA__
|
||||
//CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH]
|
||||
uint16_t pchText[2048];
|
||||
ZeroMemory(pchText, 2048 * sizeof(uint16_t) );
|
||||
#else
|
||||
|
|
@ -560,18 +570,52 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
|
|||
InputManager.GetText(pchText);
|
||||
pClass->m_editSeed.setLabel((wchar_t *)pchText);
|
||||
pClass->m_params->seed = (wchar_t *)pchText;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
void UIScene_LaunchMoreOptionsMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
inputs.push_back(&m_editSeed);
|
||||
}
|
||||
|
||||
void UIScene_LaunchMoreOptionsMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
if (result == UIControl_TextInput::eDirectEdit_Confirmed)
|
||||
m_params->seed = input->getEditBuffer();
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
if(m_bIgnoreInput) return;
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
|
||||
switch((int)controlId)
|
||||
{
|
||||
case eControl_EditSeed:
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
m_editSeed.beginDirectEdit(60);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIgnoreInput = true;
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD_SEED);
|
||||
kbData.defaultText = m_editSeed.getLabel();
|
||||
kbData.maxChars = 60;
|
||||
kbData.callback = &UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback;
|
||||
kbData.lpParam = this;
|
||||
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||
}
|
||||
#else
|
||||
m_bIgnoreInput=true;
|
||||
#ifdef __PS3__
|
||||
int language = XGetLanguage();
|
||||
|
|
@ -583,12 +627,12 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
|
|||
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
break;
|
||||
default:
|
||||
// 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -140,6 +140,10 @@ protected:
|
|||
public:
|
||||
virtual void tick();
|
||||
virtual void handleDestroy();
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
#endif
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
virtual void handleFocusChange(F64 controlId, F64 childId);
|
||||
|
|
@ -160,6 +164,8 @@ private:
|
|||
|
||||
#ifdef __PSVITA__
|
||||
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
|
||||
virtual UIControl* GetMainPanel();
|
||||
#endif //__PSVITA__
|
||||
#if defined(__PSVITA__) || defined(_WINDOWS64)
|
||||
virtual UIControl* GetMainPanel();
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ private:
|
|||
};
|
||||
|
||||
static int m_iDifficultyTitleSettingA[4];
|
||||
|
||||
|
||||
UIControl m_controlMainPanel;
|
||||
UIControl_Label m_labelGameName, m_labelSeed, m_labelCreatedMode;
|
||||
UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld;
|
||||
|
|
@ -43,7 +43,7 @@ private:
|
|||
|
||||
LevelGenerationOptions *m_levelGen;
|
||||
DLCPack * m_pDLCPack;
|
||||
|
||||
|
||||
int m_iSaveGameInfoIndex;
|
||||
int m_CurrentDifficulty;
|
||||
bool m_bGameModeCreative;
|
||||
|
|
@ -58,7 +58,7 @@ private:
|
|||
bool m_bRequestQuadrantSignin;
|
||||
bool m_bIsCorrupt;
|
||||
bool m_bThumbnailGetFailed;
|
||||
__int64 m_seed;
|
||||
int64_t m_seed;
|
||||
wstring m_levelName;
|
||||
|
||||
#ifdef __PS3__
|
||||
|
|
@ -73,7 +73,7 @@ private:
|
|||
bool m_bRebuildTouchBoxes;
|
||||
public:
|
||||
UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLayer);
|
||||
|
||||
|
||||
virtual void updateTooltips();
|
||||
virtual void updateComponents();
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ private:
|
|||
#ifdef _DURANGO
|
||||
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
|
||||
#endif
|
||||
|
||||
|
||||
static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static void StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask);
|
||||
static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner);
|
||||
|
|
|
|||
|
|
@ -1168,6 +1168,43 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr
|
|||
LaunchSaveTransfer();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef _WINDOWS64
|
||||
// Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL)
|
||||
if(pressed && !repeat && ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled())
|
||||
{
|
||||
if(DoesSavesListHaveFocus() && (m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC))
|
||||
{
|
||||
m_bIgnoreInput = true;
|
||||
if(StorageManager.EnoughSpaceForAMinSaveGame())
|
||||
{
|
||||
UINT uiIDA[3];
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_TITLE_RENAMESAVE;
|
||||
uiIDA[2]=IDS_TOOLTIPS_DELETESAVE;
|
||||
ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, 3, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this);
|
||||
}
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}
|
||||
else if(DoesMashUpWorldHaveFocus() && (m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX))
|
||||
{
|
||||
LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1);
|
||||
if(!levelGen->isTutorial() && levelGen->requiresTexturePack())
|
||||
{
|
||||
m_bIgnoreInput = true;
|
||||
app.HideMashupPackWorld(m_iPad, levelGen->getRequiredTexturePackId());
|
||||
m_iState = e_SavesRepopulateAfterMashupHide;
|
||||
}
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ACTION_MENU_Y:
|
||||
|
|
@ -2134,7 +2171,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save
|
|||
// Make our next save default to the name of the level
|
||||
StorageManager.SetSaveTitle(saveFile->getName().c_str());
|
||||
|
||||
__int64 fileSize = saveFile->length();
|
||||
int64_t fileSize = saveFile->length();
|
||||
FileInputStream fis(*saveFile);
|
||||
byteArray ba(fileSize);
|
||||
fis.read(ba);
|
||||
|
|
@ -2198,7 +2235,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
|
|||
mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null
|
||||
StorageManager.SetSaveTitle(wSaveName);
|
||||
|
||||
__int64 fileSize = cloudFile.length();
|
||||
int64_t fileSize = cloudFile.length();
|
||||
FileInputStream fis(cloudFile);
|
||||
byteArray ba(fileSize);
|
||||
fis.read(ba);
|
||||
|
|
@ -2394,7 +2431,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS
|
|||
kbData.maxChars = 25;
|
||||
kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback;
|
||||
kbData.lpParam = pClass;
|
||||
kbData.pcMode = !Win64_IsControllerConnected();
|
||||
kbData.pcMode = g_KBMInput.IsKBMActive();
|
||||
ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData);
|
||||
}
|
||||
#elif defined _DURANGO
|
||||
|
|
@ -3542,7 +3579,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
|||
bool bHostOptionsRead = false;
|
||||
unsigned int uiHostOptions = 0;
|
||||
DWORD dwTexturePack;
|
||||
__int64 seedVal;
|
||||
int64_t seedVal;
|
||||
|
||||
char szSeed[50];
|
||||
ZeroMemory(szSeed,50);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer
|
|||
|
||||
m_bConfirmed = false;
|
||||
m_bIgnoreInput = false;
|
||||
m_iSignCursorFrame = 0;
|
||||
#ifdef _WINDOWS64
|
||||
m_iActiveDirectEditLine = -1;
|
||||
m_bNeedsInitialEdit = true;
|
||||
m_bSkipTickNav = false;
|
||||
#endif
|
||||
|
||||
m_buttonConfirm.init(app.GetString(IDS_DONE), eControl_Confirm);
|
||||
m_labelMessage.init(app.GetString(IDS_EDIT_SIGN_MESSAGE));
|
||||
|
|
@ -53,6 +59,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer
|
|||
|
||||
UIScene_SignEntryMenu::~UIScene_SignEntryMenu()
|
||||
{
|
||||
m_sign->SetSelectedLine(-1);
|
||||
m_parentLayer->removeComponent(eUIComponent_MenuBackground);
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +84,79 @@ void UIScene_SignEntryMenu::tick()
|
|||
{
|
||||
UIScene::tick();
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
// On first tick, auto-start editing line 1 if KBM is active (Java-style flow)
|
||||
if (m_bNeedsInitialEdit)
|
||||
{
|
||||
m_bNeedsInitialEdit = false;
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
SetFocusToElement(eControl_Line1);
|
||||
m_iActiveDirectEditLine = 0;
|
||||
m_textInputLines[0].beginDirectEdit(15);
|
||||
}
|
||||
}
|
||||
|
||||
// UP/DOWN navigation — must happen after tickDirectEdit (so typed chars are consumed)
|
||||
// and before sign cursor update (so the cursor is correct for this frame's render)
|
||||
// m_bSkipTickNav prevents double-processing when handleInput auto-started editing this frame
|
||||
if (m_iActiveDirectEditLine >= 0 && !m_bSkipTickNav)
|
||||
{
|
||||
int navDir = 0;
|
||||
if (g_KBMInput.IsKeyPressed(VK_DOWN)) navDir = 1;
|
||||
else if (g_KBMInput.IsKeyPressed(VK_UP)) navDir = -1;
|
||||
|
||||
if (navDir != 0)
|
||||
{
|
||||
int newLine = m_iActiveDirectEditLine + navDir;
|
||||
if (newLine >= eControl_Line1 && newLine <= eControl_Line4)
|
||||
{
|
||||
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
|
||||
SetFocusToElement(newLine);
|
||||
m_iActiveDirectEditLine = newLine;
|
||||
m_textInputLines[newLine].beginDirectEdit(15);
|
||||
}
|
||||
else if (navDir > 0)
|
||||
{
|
||||
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
|
||||
SetFocusToElement(eControl_Confirm);
|
||||
m_iActiveDirectEditLine = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_bSkipTickNav = false;
|
||||
|
||||
if (m_iActiveDirectEditLine >= 0 && !m_textInputLines[m_iActiveDirectEditLine].isDirectEditing())
|
||||
m_iActiveDirectEditLine = -1;
|
||||
#endif
|
||||
|
||||
// Blinking > text < cursor on the 3D sign
|
||||
m_iSignCursorFrame++;
|
||||
if (m_iSignCursorFrame / 6 % 2 == 0)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (m_iActiveDirectEditLine >= 0)
|
||||
m_sign->SetSelectedLine(m_iActiveDirectEditLine);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int focusedLine = -1;
|
||||
for (int i = eControl_Line1; i <= eControl_Line4; i++)
|
||||
{
|
||||
if (controlHasFocus(i))
|
||||
{
|
||||
focusedLine = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_sign->SetSelectedLine(focusedLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sign->SetSelectedLine(-1);
|
||||
}
|
||||
|
||||
if(m_bConfirmed)
|
||||
{
|
||||
m_bConfirmed = false;
|
||||
|
|
@ -107,6 +187,9 @@ void UIScene_SignEntryMenu::tick()
|
|||
void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
if(m_bConfirmed || m_bIgnoreInput) return;
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) { handled = true; return; }
|
||||
#endif
|
||||
|
||||
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
|
||||
|
||||
|
|
@ -132,31 +215,124 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre
|
|||
#ifdef __ORBIS__
|
||||
case ACTION_MENU_TOUCHPAD_PRESS:
|
||||
#endif
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_UP:
|
||||
case ACTION_MENU_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
#ifdef _WINDOWS64
|
||||
// Auto-start editing if focus moved to a line (e.g. UP from Confirm)
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
for (int i = eControl_Line1; i <= eControl_Line4; i++)
|
||||
{
|
||||
if (controlHasFocus(i))
|
||||
{
|
||||
m_iActiveDirectEditLine = i;
|
||||
m_textInputLines[i].beginDirectEdit(15);
|
||||
m_bSkipTickNav = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
void UIScene_SignEntryMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
inputs.push_back(&m_textInputLines[i]);
|
||||
}
|
||||
|
||||
void UIScene_SignEntryMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
|
||||
{
|
||||
int line = -1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (input == &m_textInputLines[i]) { line = i; break; }
|
||||
}
|
||||
if (line != m_iActiveDirectEditLine) return;
|
||||
|
||||
if (result == UIControl_TextInput::eDirectEdit_Confirmed)
|
||||
{
|
||||
int newLine = line + 1;
|
||||
if (newLine <= eControl_Line4)
|
||||
{
|
||||
SetFocusToElement(newLine);
|
||||
m_iActiveDirectEditLine = newLine;
|
||||
m_textInputLines[newLine].beginDirectEdit(15);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iActiveDirectEditLine = -1;
|
||||
m_bConfirmed = true;
|
||||
}
|
||||
}
|
||||
else if (result == UIControl_TextInput::eDirectEdit_Cancelled)
|
||||
{
|
||||
m_iActiveDirectEditLine = -1;
|
||||
wstring temp = L"";
|
||||
for (int j = 0; j < 4; j++)
|
||||
m_sign->SetMessage(j, temp);
|
||||
navigateBack();
|
||||
ui.PlayUISFX(eSFX_Back);
|
||||
}
|
||||
}
|
||||
|
||||
bool UIScene_SignEntryMenu::handleMouseClick(F32 x, F32 y)
|
||||
{
|
||||
if (m_iActiveDirectEditLine >= 0)
|
||||
{
|
||||
// During direct edit, only the Done button is clickable.
|
||||
// Hit-test it manually — all other clicks are consumed but ignored.
|
||||
m_buttonConfirm.UpdateControl();
|
||||
S32 cx = m_buttonConfirm.getXPos();
|
||||
S32 cy = m_buttonConfirm.getYPos();
|
||||
S32 cw = m_buttonConfirm.getWidth();
|
||||
S32 ch = m_buttonConfirm.getHeight();
|
||||
if (cw > 0 && ch > 0 && x >= cx && x <= cx + cw && y >= cy && y <= cy + ch)
|
||||
{
|
||||
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
|
||||
m_iActiveDirectEditLine = -1;
|
||||
m_bConfirmed = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return UIScene::handleMouseClick(x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
|
||||
{
|
||||
// 4J HEG - No reason to set value if keyboard was cancelled
|
||||
UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam;
|
||||
pClass->m_bIgnoreInput = false;
|
||||
if (bRes)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
Win64_GetKeyboardText(pchText, 128);
|
||||
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText);
|
||||
#else
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
|
||||
InputManager.GetText(pchText);
|
||||
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (isDirectEditBlocking()) return;
|
||||
#endif
|
||||
switch((int)controlId)
|
||||
{
|
||||
case eControl_Confirm:
|
||||
|
|
@ -170,6 +346,28 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_Line4:
|
||||
{
|
||||
m_iEditingLine = (int)controlId;
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.IsKBMActive())
|
||||
{
|
||||
// Only start editing from keyboard (Enter on focused line), not mouse clicks
|
||||
if (!g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT))
|
||||
{
|
||||
m_iActiveDirectEditLine = m_iEditingLine;
|
||||
m_textInputLines[m_iEditingLine].beginDirectEdit(15);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIgnoreInput = true;
|
||||
UIKeyboardInitData kbData;
|
||||
kbData.title = app.GetString(IDS_SIGN_TITLE);
|
||||
kbData.defaultText = m_textInputLines[m_iEditingLine].getLabel();
|
||||
kbData.maxChars = 15;
|
||||
kbData.callback = &UIScene_SignEntryMenu::KeyboardCompleteCallback;
|
||||
kbData.lpParam = this;
|
||||
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
|
||||
}
|
||||
#else
|
||||
m_bIgnoreInput = true;
|
||||
#ifdef _XBOX_ONE
|
||||
// 4J-PB - Xbox One uses the Windows virtual keyboard, and doesn't have the Xbox 360 Latin keyboard type, so we can't restrict the input set to alphanumeric. The closest we get is the emailSmtpAddress type.
|
||||
|
|
@ -187,6 +385,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
|||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ private:
|
|||
int m_iEditingLine;
|
||||
bool m_bConfirmed;
|
||||
bool m_bIgnoreInput;
|
||||
int m_iSignCursorFrame;
|
||||
#ifdef _WINDOWS64
|
||||
int m_iActiveDirectEditLine;
|
||||
bool m_bNeedsInitialEdit;
|
||||
bool m_bSkipTickNav;
|
||||
#endif
|
||||
|
||||
UIControl_Button m_buttonConfirm;
|
||||
UIControl_Label m_labelMessage;
|
||||
|
|
@ -50,6 +56,11 @@ protected:
|
|||
public:
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
#ifdef _WINDOWS64
|
||||
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
|
||||
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
|
||||
virtual bool handleMouseClick(F32 x, F32 y);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void handlePress(F64 controlId, F64 childId);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData;
|
||||
|
||||
m_MoreOptionsParams.bGenerateOptions=TRUE;
|
||||
m_MoreOptionsParams.bStructures=TRUE;
|
||||
m_MoreOptionsParams.bStructures=TRUE;
|
||||
m_MoreOptionsParams.bFlatWorld=FALSE;
|
||||
m_MoreOptionsParams.bBonusChest=FALSE;
|
||||
m_MoreOptionsParams.bPVP = TRUE;
|
||||
|
|
@ -96,7 +96,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
{
|
||||
// The profile settings say Online, but either the player is offline, or they are not allowed to play online
|
||||
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_ButtonGameMode.SetText(app.GetString(IDS_GAMEMODE_SURVIVAL));
|
||||
|
|
@ -104,7 +104,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
|
||||
m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty);
|
||||
m_SliderDifficulty.SetValue(m_CurrentDifficulty);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
|
||||
m_SliderDifficulty.SetText(TempString);
|
||||
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
|
|
@ -135,7 +135,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
m_NewWorld.SetEnable(true);
|
||||
|
||||
m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH);
|
||||
|
||||
|
||||
wstring wWorldName = m_EditWorldName.GetText();
|
||||
|
||||
// set the caret to the end of the default text
|
||||
|
|
@ -148,7 +148,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
|
||||
XuiSetTimer(m_hObj,GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME);
|
||||
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
|
||||
|
||||
|
||||
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
|
||||
|
||||
// 4J-PB - Load up any texture pack data we have locally in the XZP
|
||||
|
|
@ -176,7 +176,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
||||
HRESULT hr;
|
||||
for(unsigned int i = 0; i < texturePacksCount; ++i)
|
||||
|
|
@ -189,7 +189,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
|
|||
|
||||
if(dwImageBytes > 0 && pbImageData)
|
||||
{
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.fEnabled = TRUE;
|
||||
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
|
||||
if(pDLCTexPack)
|
||||
{
|
||||
|
|
@ -297,7 +297,7 @@ HRESULT CScene_MultiGameCreate::OnDestroy()
|
|||
app.RemoveMemoryTPDFile(app.TMSFileA[i].iConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
app.FreeLocalTMSFiles(eTMSFileType_TexturePack);
|
||||
|
||||
return S_OK;
|
||||
|
|
@ -338,7 +338,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
|
||||
// DLC might have been corrupt
|
||||
if(ullOfferID_Full!=0LL)
|
||||
{
|
||||
{
|
||||
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF);
|
||||
|
||||
UINT uiIDA[3];
|
||||
|
|
@ -374,7 +374,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
// if the profile data has been changed, then force a profile write (we save the online/invite/friends of friends settings)
|
||||
// It seems we're allowed to break the 5 minute rule if it's the result of a user action
|
||||
// check the checkboxes
|
||||
|
||||
|
||||
// Only save the online setting if the user changed it - we may change it because we're offline, but don't want that saved
|
||||
if(!m_MoreOptionsParams.bOnlineSettingChangedBySystem)
|
||||
{
|
||||
|
|
@ -389,15 +389,15 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
if(m_MoreOptionsParams.dwTexturePack!=0)
|
||||
{
|
||||
// texture pack hasn't been set yet, so check what it will be
|
||||
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
|
||||
|
||||
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
|
||||
|
||||
if(pTexturePack==NULL)
|
||||
{
|
||||
// corrupt DLC so set it to the default textures
|
||||
m_MoreOptionsParams.dwTexturePack=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
m_pDLCPack=pTexturePack->getDLCPack();
|
||||
// do we have a license?
|
||||
if(m_pDLCPack && !m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
||||
|
|
@ -439,11 +439,11 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE)
|
||||
{
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||
|
|
@ -478,7 +478,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
BOOL pccFriendsAllowed = TRUE;
|
||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
|
||||
|
||||
if(isClientSide && noUGC )
|
||||
{
|
||||
m_bIgnoreInput = false;
|
||||
|
|
@ -495,7 +495,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
|
|||
}
|
||||
}
|
||||
else if(hObjPressed==m_MoreOptions)
|
||||
{
|
||||
{
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_LaunchMoreOptionsMenu,&m_MoreOptionsParams);
|
||||
}
|
||||
else if(hObjPressed == m_ButtonGameMode)
|
||||
|
|
@ -527,7 +527,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
|
|||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
if(ProfileManager.IsSignedIn(iPad))
|
||||
{
|
||||
{
|
||||
ULONGLONG ullIndexA[1];
|
||||
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
|
|||
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
|
||||
// the license change coming in when the offer has been installed will cause this scene to refresh
|
||||
// the license change coming in when the offer has been installed will cause this scene to refresh
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -629,12 +629,12 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot
|
|||
// Enable the done button when we have all of the necessary information
|
||||
wstring wWorldName = m_EditWorldName.GetText();
|
||||
BOOL bHasWorldName = ( wWorldName.length()!=0);
|
||||
m_NewWorld.SetEnable(bHasWorldName);
|
||||
m_NewWorld.SetEnable(bHasWorldName);
|
||||
}
|
||||
else if(hObjSource==m_SliderDifficulty.GetSlider() )
|
||||
{
|
||||
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue);
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
|
||||
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
|
||||
m_SliderDifficulty.SetText(TempString);
|
||||
}
|
||||
|
||||
|
|
@ -656,11 +656,11 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo
|
|||
|
||||
HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||
{
|
||||
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
|
||||
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
|
||||
switch(pTimer->nId)
|
||||
{
|
||||
|
||||
|
||||
|
||||
case GAME_CREATE_ONLINE_TIMER_ID:
|
||||
{
|
||||
bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
||||
|
|
@ -693,7 +693,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID:
|
||||
{
|
||||
// also check for any new texture packs info being available
|
||||
|
|
@ -718,7 +718,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
|
|||
PBYTE pbImageData=NULL;
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.iData = m_iConfigA[i];
|
||||
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
|
||||
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
|
||||
|
|
@ -734,7 +734,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
|
|||
bool bAllDone=true;
|
||||
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
||||
{
|
||||
if(m_iConfigA[i]!=-1)
|
||||
if(m_iConfigA[i]!=-1)
|
||||
{
|
||||
bAllDone = false;
|
||||
}
|
||||
|
|
@ -756,7 +756,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
|
|||
{
|
||||
CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
|
||||
|
||||
|
|
@ -780,7 +780,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
|
|||
BOOL pccFriendsAllowed = TRUE;
|
||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
|
||||
|
||||
if(isClientSide && noUGC )
|
||||
{
|
||||
pClass->m_bIgnoreInput = false;
|
||||
|
|
@ -816,7 +816,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
|
|||
if(ProfileManager.IsSignedIn(iPad))
|
||||
{
|
||||
DWORD dwLocalUsersMask = 0;
|
||||
|
||||
|
||||
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
|
||||
bool noPrivileges = false;
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
|
|||
BOOL pccFriendsAllowed = TRUE;
|
||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
|
||||
|
||||
if(isClientSide && (noPrivileges || noUGC) )
|
||||
{
|
||||
if( noUGC )
|
||||
|
|
@ -863,7 +863,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pClass->m_bIgnoreInput = false;
|
||||
pClass->SetShow( TRUE );
|
||||
}
|
||||
|
|
@ -884,7 +884,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
|
|||
|
||||
// create the world and launch
|
||||
wstring wWorldName = pClass->m_EditWorldName.GetText();
|
||||
|
||||
|
||||
StorageManager.ResetSaveData();
|
||||
// Make our next save default to the name of the level
|
||||
StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str());
|
||||
|
|
@ -904,11 +904,11 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
|
|||
|
||||
// start the game
|
||||
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
|
||||
__int64 seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
||||
int64_t seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
||||
|
||||
if (wSeed.length() != 0)
|
||||
{
|
||||
__int64 value = 0;
|
||||
int64_t value = 0;
|
||||
unsigned int len = (unsigned int)wSeed.length();
|
||||
|
||||
//Check if the input string contains a numerical value
|
||||
|
|
@ -923,7 +923,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
|
|||
|
||||
//If the input string is a numerical value, convert it to a number
|
||||
if( isNumber )
|
||||
value = _fromString<__int64>(wSeed);
|
||||
value = _fromString<int64_t>(wSeed);
|
||||
|
||||
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
|
||||
if( value != 0 )
|
||||
|
|
@ -948,7 +948,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
|
|||
param->seed = seedValue;
|
||||
param->saveData = NULL;
|
||||
param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack;
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->skins->selectTexturePackById(pClass->m_MoreOptionsParams.dwTexturePack);
|
||||
//pMinecraft->skins->updateUI();
|
||||
|
|
@ -956,7 +956,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
|
|||
app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty);
|
||||
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,pClass->m_MoreOptionsParams.bAllowFriendsOfFriends);
|
||||
app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(pClass->m_iPad,eGameSetting_GamertagsVisible)?1:0);
|
||||
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(pClass->m_iPad,eGameSetting_BedrockFog)?1:0);
|
||||
|
||||
// CXuiList listObject;
|
||||
|
|
@ -999,7 +999,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionStart( XUIMessageTransition *pTransi
|
|||
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
|
||||
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
{
|
||||
m_SliderDifficulty.SetValueDisplay(FALSE);
|
||||
}
|
||||
|
||||
|
|
@ -1015,7 +1015,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionEnd( XUIMessageTransition *pTransiti
|
|||
{
|
||||
}
|
||||
else if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
{
|
||||
if(m_bSetup && m_texturePackDescDisplayed)
|
||||
{
|
||||
XUITimeline *timeline;
|
||||
|
|
@ -1054,7 +1054,7 @@ HRESULT CScene_MultiGameCreate::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotif
|
|||
if(hObjSource == m_pTexturePacksList->m_hObj)
|
||||
{
|
||||
UpdateTexturePackDescription(pNotifySelChangedData->iItem);
|
||||
|
||||
|
||||
// 4J-JEV: Removed expand description check, taken care of elsewhere.
|
||||
}
|
||||
|
||||
|
|
@ -1205,9 +1205,9 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
|
|||
StorageManager.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CScene_MultiGameCreate::TexturePackDialogReturned,this,app.GetStringTable());
|
||||
}
|
||||
|
||||
// do set the texture pack id, and on the user pressing create world, check they have it
|
||||
// do set the texture pack id, and on the user pressing create world, check they have it
|
||||
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
|
||||
return ;
|
||||
return ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1221,7 +1221,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
|||
pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel();
|
||||
// Exit with or without saving
|
||||
// Decline means install full version of the texture pack in this dialog
|
||||
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
// we need to enable background downloading for the DLC
|
||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||
|
|
@ -1248,7 +1248,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
|||
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pClass->m_bIgnoreInput=false;
|
||||
return 0;
|
||||
|
|
@ -1274,12 +1274,12 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCInstalled()
|
|||
}
|
||||
|
||||
HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
|
||||
{
|
||||
{
|
||||
// refill the texture pack list
|
||||
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
||||
HRESULT hr;
|
||||
for(unsigned int i = 0; i < texturePacksCount; ++i)
|
||||
|
|
@ -1292,7 +1292,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
|
|||
|
||||
if(dwImageBytes > 0 && pbImageData)
|
||||
{
|
||||
ListInfo.fEnabled = TRUE;
|
||||
ListInfo.fEnabled = TRUE;
|
||||
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
|
||||
|
||||
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
|
||||
|
|
|
|||
|
|
@ -1945,7 +1945,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
|
|||
// Make our next save default to the name of the level
|
||||
StorageManager.SetSaveTitle(saveFile->getName().c_str());
|
||||
|
||||
__int64 fileSize = saveFile->length();
|
||||
int64_t fileSize = saveFile->length();
|
||||
FileInputStream fis(*saveFile);
|
||||
byteArray ba(fileSize);
|
||||
fis.read(ba);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
|||
MapChildControls();
|
||||
|
||||
// Display the tooltips
|
||||
HRESULT hr = S_OK;
|
||||
HRESULT hr = S_OK;
|
||||
CXuiElement xuiElement = m_hObj;
|
||||
HXUIOBJ hTemp;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
|
||||
// make sure there's not a mount going on before using the textures
|
||||
if(bCheckTexturePack && app.DLCInstallProcessCompleted() )
|
||||
{
|
||||
{
|
||||
TexturePack *tPack = pMinecraft->skins->getSelected();
|
||||
|
||||
if(tPack->getId()!=app.GetRequiredTexturePackID())
|
||||
|
|
@ -186,7 +186,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
|
||||
pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID());
|
||||
|
||||
// probably had background downloads enabled, so turn them off
|
||||
// probably had background downloads enabled, so turn them off
|
||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
|
||||
}
|
||||
else
|
||||
|
|
@ -223,7 +223,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
{
|
||||
if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
|
||||
{
|
||||
int iGuiScale;
|
||||
int iGuiScale;
|
||||
|
||||
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
{
|
||||
|
|
@ -234,7 +234,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen);
|
||||
}
|
||||
m_BossHealthGroup[i].SetShow(TRUE);
|
||||
m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
|
||||
m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
|
||||
|
||||
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
{
|
||||
|
|
@ -364,7 +364,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() );
|
||||
m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() );
|
||||
|
|
@ -468,15 +468,15 @@ void CXuiSceneBase::_TickAllBaseScenes()
|
|||
XUIMessage xuiMsg;
|
||||
CustomMessage_TickScene( &xuiMsg );
|
||||
XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg );
|
||||
|
||||
|
||||
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0;
|
||||
if(bDisplayGui && pMinecraft->localplayers[i] != NULL)
|
||||
{
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -495,18 +495,18 @@ HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal )
|
|||
HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID )
|
||||
{
|
||||
ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX );
|
||||
|
||||
|
||||
XUIRect xuiRect, xuiRectSmall;
|
||||
HRESULT hr=S_OK;
|
||||
LPCWSTR pString=NULL;
|
||||
float fWidth,fHeight;
|
||||
|
||||
|
||||
// Want to be able to show just a button (for RB LB)
|
||||
if(iTextID>=0)
|
||||
{
|
||||
pString=app.GetString(iTextID);
|
||||
}
|
||||
|
||||
|
||||
if(hTooltipText[iPad][uiTooltip]==NULL)
|
||||
{
|
||||
HXUIOBJ hObj=NULL;
|
||||
|
|
@ -514,7 +514,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
|
|||
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]);
|
||||
hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]);
|
||||
}
|
||||
|
||||
|
||||
if(hTooltipTextSmall[iPad][uiTooltip]==NULL)
|
||||
{
|
||||
HXUIOBJ hObj=NULL;
|
||||
|
|
@ -525,8 +525,8 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
|
|||
|
||||
if(iTextID>=0)
|
||||
{
|
||||
hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
|
||||
|
||||
hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
|
||||
|
||||
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
|
||||
XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
|
||||
XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight);
|
||||
|
|
@ -537,7 +537,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
|
|||
|
||||
|
||||
hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall);
|
||||
|
||||
|
||||
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
|
||||
XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
|
||||
XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight);
|
||||
|
|
@ -749,7 +749,7 @@ HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB,
|
|||
m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB );
|
||||
m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB );
|
||||
m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS );
|
||||
|
||||
|
||||
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA );
|
||||
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB );
|
||||
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX );
|
||||
|
|
@ -860,7 +860,7 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
|
|||
|
||||
if(bShow && pMinecraft->level!=NULL)
|
||||
{
|
||||
__int64 i64TimeOfDay =0;
|
||||
int64_t i64TimeOfDay =0;
|
||||
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
|
||||
if(pMinecraft->level->dimension->id==0)
|
||||
{
|
||||
|
|
@ -945,11 +945,11 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
|
|||
int nStart, nEnd;
|
||||
// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart );
|
||||
// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd );
|
||||
// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
|
||||
// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
|
||||
XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart );
|
||||
XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd );
|
||||
XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
|
||||
|
||||
XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -960,7 +960,7 @@ HRESULT CXuiSceneBase::_HidePressStart()
|
|||
|
||||
HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
|
||||
{
|
||||
WCHAR wcAutosaveCountdown[100];
|
||||
WCHAR wcAutosaveCountdown[100];
|
||||
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
|
||||
m_TrialTimer.SetText(wcAutosaveCountdown);
|
||||
return S_OK;
|
||||
|
|
@ -974,7 +974,7 @@ HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal)
|
|||
|
||||
HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
|
||||
{
|
||||
WCHAR wcTime[20];
|
||||
WCHAR wcTime[20];
|
||||
|
||||
DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
|
||||
|
||||
|
|
@ -982,7 +982,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
|
|||
{
|
||||
dwTimeTicks=m_dwTrialTimerLimitSecs;
|
||||
}
|
||||
|
||||
|
||||
dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks;
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
|
|
@ -1038,7 +1038,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad)
|
|||
HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position )
|
||||
{
|
||||
// turn off the empty quadrant logo
|
||||
if(m_hEmptyQuadrantLogo!=NULL)
|
||||
if(m_hEmptyQuadrantLogo!=NULL)
|
||||
{
|
||||
XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE);
|
||||
}
|
||||
|
|
@ -1086,12 +1086,12 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
|
|||
XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE);
|
||||
}
|
||||
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
//640x480 ->1280x720
|
||||
scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f;
|
||||
XuiElementSetScale(m_hObj, &scale);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1127,7 +1127,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
|
|||
// No position adjustment
|
||||
case e_BaseScene_Fullscreen:
|
||||
tooltipsPos.x=SAFEZONE_HALF_WIDTH;
|
||||
tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
|
||||
tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
|
||||
crouchIconPos.x=SAFEZONE_HALF_WIDTH;
|
||||
crouchIconPos.y=SAFEZONE_HALF_HEIGHT;
|
||||
fBackWidth=XUI_BASE_SCENE_WIDTH;
|
||||
|
|
@ -1303,7 +1303,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
|
||||
|
||||
// Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants
|
||||
if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
|
||||
if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
|
||||
(RenderManager.IsHiDef() || RenderManager.IsWidescreen()) )
|
||||
{
|
||||
D3DXVECTOR3 selectedItemPos;
|
||||
|
|
@ -1328,17 +1328,17 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
|
||||
// The move applies to the whole scene, so we'll need to move tooltips back in some cases
|
||||
|
||||
selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
|
||||
selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
|
||||
selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f);
|
||||
|
||||
// Adjust selectedItemPos based on what gui is displayed
|
||||
|
||||
|
||||
// 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
|
||||
// 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
|
||||
float fYOffset=0.0f;
|
||||
|
||||
unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2;
|
||||
|
||||
|
||||
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
|
||||
{
|
||||
// SURVIVAL MODE - Move up further because of hearts, shield and xp
|
||||
|
|
@ -1353,7 +1353,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
default: // 2
|
||||
fYOffset = -94.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1368,7 +1368,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
default: // 2
|
||||
fYOffset = -58.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1425,14 +1425,14 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
// 4J-PB - If it's in split screen vertical, adjust the position
|
||||
// Adjust selectedItemPos based on what gui is displayed
|
||||
if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right))
|
||||
{
|
||||
{
|
||||
float scale=0.5f;
|
||||
selectedItemPos.y -= (scale * 88.0f);
|
||||
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
|
||||
{
|
||||
selectedItemPos.y -= (scale * 80.0f);
|
||||
}
|
||||
|
||||
|
||||
// 4J-PB - selected the gui scale based on the slider settings
|
||||
unsigned char ucGuiScale;
|
||||
float fYOffset=0.0f;
|
||||
|
|
@ -1455,7 +1455,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
|
|||
default: // 2
|
||||
fYOffset = 85.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
selectedItemPos.y+=fYOffset;
|
||||
}
|
||||
|
||||
|
|
@ -1606,7 +1606,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
|
|||
{
|
||||
// The host decides whether these are on or off
|
||||
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
|
||||
{
|
||||
{
|
||||
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
|
||||
{
|
||||
wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad));
|
||||
|
|
@ -1621,7 +1621,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
|
|||
}
|
||||
// The host decides whether these are on or off
|
||||
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
|
||||
{
|
||||
{
|
||||
XuiElementSetShow(m_hGamerTagA[iPad],bDisplay);
|
||||
|
||||
// set the opacity of the gamertag
|
||||
|
|
@ -1712,11 +1712,11 @@ void CXuiSceneBase::_HideAllGameUIElements()
|
|||
m_uiSelectedItemOpacityCountDown[i] = 0;
|
||||
m_selectedItemA[i].SetShow(FALSE);
|
||||
m_selectedItemSmallA[i].SetShow(FALSE);
|
||||
|
||||
|
||||
m_BossHealthGroup[i].SetShow(FALSE);
|
||||
m_bossHealthVisible[i] = FALSE;
|
||||
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
|
||||
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
|
||||
|
||||
_DisplayGamertag(i,FALSE);
|
||||
}
|
||||
|
|
@ -1845,12 +1845,12 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
|
|||
if( i>0 && lastVisible!=-1 )
|
||||
{
|
||||
float width, height;
|
||||
XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
|
||||
XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
|
||||
|
||||
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
|
||||
lastPos.x += width + m_iTooltipSpacingGap;
|
||||
|
||||
XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
|
||||
XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
|
||||
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
|
||||
lastPosSmall.x += width + m_iTooltipSpacingGapSmall;
|
||||
}
|
||||
|
|
@ -1948,15 +1948,15 @@ HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, i
|
|||
}
|
||||
else
|
||||
{
|
||||
// does the tooltip need to change?
|
||||
// does the tooltip need to change?
|
||||
if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate)
|
||||
{
|
||||
CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] );
|
||||
}
|
||||
}
|
||||
CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -2067,14 +2067,14 @@ HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScen
|
|||
}
|
||||
|
||||
HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
|
||||
{
|
||||
{
|
||||
EBaseScenePosition padPositions[XUSER_MAX_COUNT];
|
||||
|
||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
padPositions[idx] = e_BaseScene_NotSet;
|
||||
}
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
// If the game is not started (or is being held paused for a bit) then display all scenes fullscreen
|
||||
|
|
@ -2134,7 +2134,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
|
|||
padPositions[idx] = e_BaseScene_Right;
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
padPositions[idx] = e_BaseScene_Top_Left;
|
||||
padPositions[idx] = e_BaseScene_Top_Left;
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
padPositions[idx] = e_BaseScene_Top_Right;
|
||||
|
|
@ -2168,7 +2168,7 @@ void CXuiSceneBase::UpdateSelectedItemPos(int iPad)
|
|||
CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad);
|
||||
}
|
||||
|
||||
HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
|
||||
HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
|
||||
{
|
||||
return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ typedef uLong FAR uLongf;
|
|||
# define z_off64_t off64_t
|
||||
#else
|
||||
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
||||
# define z_off64_t __int64
|
||||
# define z_off64_t long long
|
||||
# else
|
||||
# define z_off64_t z_off_t
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ void CreateWorldScreen::buttonClicked(Button *button)
|
|||
if (done) return;
|
||||
done = true;
|
||||
|
||||
__int64 seedValue = (new Random())->nextLong();
|
||||
int64_t seedValue = (new Random())->nextLong();
|
||||
wstring seedString = seedEdit->getValue();
|
||||
|
||||
if (seedString.length() != 0)
|
||||
{
|
||||
// try to convert it to a long first
|
||||
// try { // 4J - removed try/catch
|
||||
__int64 value = _fromString<__int64>(seedString);
|
||||
int64_t value = _fromString<int64_t>(seedString);
|
||||
if (value != 0)
|
||||
{
|
||||
seedValue = value;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
class DemoLevel : public Level
|
||||
{
|
||||
private:
|
||||
static const __int64 DEMO_LEVEL_SEED = 0; // 4J - TODO - was "Don't Look Back".hashCode();
|
||||
static const int64_t DEMO_LEVEL_SEED = 0; // 4J - TODO - was "Don't Look Back".hashCode();
|
||||
static const int DEMO_SPAWN_X = 796;
|
||||
static const int DEMO_SPAWN_Y = 72;
|
||||
static const int DEMO_SPAWN_Z = -731;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ void DemoMode::tick()
|
|||
SurvivalMode::tick();
|
||||
|
||||
/* 4J - TODO - seems unlikely we need this demo mode anyway
|
||||
__int64 time = minecraft->level->getTime();
|
||||
__int64 day = (time / Level::TICKS_PER_DAY) + 1;
|
||||
int64_t time = minecraft->level->getTime();
|
||||
int64_t day = (time / Level::TICKS_PER_DAY) + 1;
|
||||
|
||||
demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS));
|
||||
if (demoHasEnded)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange()
|
|||
// Clear the DLC installed flag so the scenes will pick up the new dlc (could be a full pack install)
|
||||
app.ClearDLCInstalled();
|
||||
app.DebugPrintf(">>> HandleDLCLicenseChange - Updating license for DLC [%ls]\n",xOffer.wszOfferName);
|
||||
pack->updateLicenseMask(1);
|
||||
pack->updateLicenseMask(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -100,7 +100,7 @@ void CConsoleMinecraftApp::ExitGame()
|
|||
}
|
||||
void CConsoleMinecraftApp::FatalLoadError()
|
||||
{
|
||||
// 4J-PB -
|
||||
// 4J-PB -
|
||||
//for(int i=0;i<10;i++)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
|
|
@ -204,7 +204,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D
|
|||
// load the local file
|
||||
WCHAR wchFilename[64];
|
||||
|
||||
|
||||
|
||||
// 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds
|
||||
swprintf(wchFilename,L"DLCImages/%s",wchName);
|
||||
HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
|
@ -269,7 +269,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
|||
StorageManager.SetSaveTitle(wWorldName.c_str());
|
||||
|
||||
bool isFlat = false;
|
||||
__int64 seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
||||
int64_t seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
||||
|
||||
NetworkGameInitData *param = new NetworkGameInitData();
|
||||
param->seed = seedValue;
|
||||
|
|
@ -308,7 +308,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
|||
thread->Run();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
eDLCContentType e_DLC_Type;
|
||||
//WCHAR *wchDisplayName;
|
||||
|
|
@ -397,7 +397,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data)
|
|||
app.DebugPrintf("Couldn't find %ls\n",Data.wszDisplayName);
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::Shutdown()
|
||||
|
|
@ -455,7 +455,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in
|
|||
{
|
||||
app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadBannedList\n");
|
||||
C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData;
|
||||
|
||||
|
||||
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
|
||||
|
||||
if(pFileData)
|
||||
|
|
@ -471,7 +471,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in
|
|||
// mark the level as not checked against banned levels - it'll be checked once the level starts
|
||||
app.SetBanListCheck(iPad,false);
|
||||
|
||||
// Xbox One will clear things within the DownloadBlob
|
||||
// Xbox One will clear things within the DownloadBlob
|
||||
#ifndef _XBOX_ONE
|
||||
delete [] pFileData->pbData;
|
||||
delete [] pFileData;
|
||||
|
|
@ -558,11 +558,11 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
|
|||
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
|
||||
app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n");
|
||||
if(lpvData!=NULL)
|
||||
{
|
||||
{
|
||||
vector<C4JStorage::PTMSPP_FILE_DETAILS> *pvTmsFileDetails=(vector<C4JStorage::PTMSPP_FILE_DETAILS> *)lpvData;
|
||||
|
||||
if(pvTmsFileDetails->size()>0)
|
||||
{
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
// dump out the file list
|
||||
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
|
||||
|
|
@ -707,7 +707,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage:
|
|||
{
|
||||
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
|
||||
|
||||
if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota
|
||||
if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota
|
||||
|| saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage )
|
||||
{
|
||||
StorageManager.SetSaveDisabled(true);
|
||||
|
|
@ -718,10 +718,10 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage:
|
|||
else message = IDS_SAVE_INCOMPLETE_EXPLANATION_LOCAL_STORAGE;
|
||||
|
||||
UINT uiIDA[3] =
|
||||
{
|
||||
IDS_SAVE_INCOMPLETE_RETRY_SAVING,
|
||||
IDS_SAVE_INCOMPLETE_DISABLE_SAVING,
|
||||
IDS_SAVE_INCOMPLETE_DELETE_SAVES
|
||||
{
|
||||
IDS_SAVE_INCOMPLETE_RETRY_SAVING,
|
||||
IDS_SAVE_INCOMPLETE_DISABLE_SAVING,
|
||||
IDS_SAVE_INCOMPLETE_DELETE_SAVES
|
||||
};
|
||||
|
||||
if ( ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, message, uiIDA,3,0,Callback_SaveGameIncompleteMessageBoxReturned,pClass, app.GetStringTable()) == C4JStorage::EMessage_Busy)
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@
|
|||
#define __RADLITTLEENDIAN__
|
||||
#ifdef __i386__
|
||||
#define __RADX86__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#endif
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
#define __RADX86__
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#endif
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
#define __RADNACL__
|
||||
#define __RAD32__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define __RADX86__
|
||||
#define __RADX86__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
#define __RAD64REGS__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
#endif
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
||||
|
||||
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
|
||||
|
||||
#define __RADWIIU__
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
|
||||
#undef RADRESTRICT /* could have been defined above... */
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
#endif
|
||||
|
|
@ -885,7 +885,7 @@
|
|||
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
|
||||
#else
|
||||
// NOTE: / / is a guaranteed parse error in C/C++.
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#endif
|
||||
|
||||
// WARNING : RAD_TLS should really only be used for debug/tools stuff
|
||||
|
|
@ -917,8 +917,8 @@
|
|||
#define RAD_S32 signed int
|
||||
// But pointers are 64 bits.
|
||||
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
|
||||
#define RAD_SINTa __w64 signed __int64
|
||||
#define RAD_UINTa __w64 unsigned __int64
|
||||
#define RAD_SINTa __w64 signed long long
|
||||
#define RAD_UINTa __w64 unsigned long long
|
||||
#else // non-vc.net compiler or /Wp64 turned off
|
||||
#define RAD_UINTa unsigned long long
|
||||
#define RAD_SINTa signed long long
|
||||
|
|
@ -976,8 +976,8 @@
|
|||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#elif defined(__RADX64__) || defined(__RAD32__)
|
||||
#define RAD_U64 unsigned __int64
|
||||
#define RAD_S64 signed __int64
|
||||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#else
|
||||
// 16-bit
|
||||
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
|
||||
|
|
@ -1134,7 +1134,7 @@
|
|||
|
||||
// helpers for doing an if ( ) with expect :
|
||||
// if ( RAD_LIKELY(expr) ) { ... }
|
||||
|
||||
|
||||
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
|
||||
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
|
||||
|
||||
|
|
@ -1324,7 +1324,7 @@
|
|||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable:4127)) \
|
||||
} while(0) \
|
||||
__pragma(warning(pop))
|
||||
__pragma(warning(pop))
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
__pragma(warning(push)) \
|
||||
|
|
@ -1333,10 +1333,10 @@
|
|||
__pragma(warning(pop))
|
||||
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
|
||||
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
|
|
@ -1345,7 +1345,7 @@
|
|||
|
||||
#define RAD_STATEMENT_END_FALSE \
|
||||
} while ( (void)0,0 )
|
||||
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
} while ( (void)1,1 )
|
||||
|
||||
|
|
@ -1355,7 +1355,7 @@
|
|||
RAD_STATEMENT_START \
|
||||
code \
|
||||
RAD_STATEMENT_END_FALSE
|
||||
|
||||
|
||||
#define RAD_INFINITE_LOOP( code ) \
|
||||
RAD_STATEMENT_START \
|
||||
code \
|
||||
|
|
@ -1363,7 +1363,7 @@
|
|||
|
||||
|
||||
// Must be placed after variable declarations for code compiled as .c
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
# define RR_UNUSED_VARIABLE(x) (void) x
|
||||
#else
|
||||
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
|
||||
|
|
@ -1473,7 +1473,7 @@
|
|||
// just to make gcc shut up about derefing null :
|
||||
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
|
||||
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
|
||||
|
||||
|
||||
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
|
||||
// you should then RR_ASSERT( &(ret->member) == ptr );
|
||||
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
|
||||
|
|
@ -1482,7 +1482,7 @@
|
|||
// Cache / prefetch macros :
|
||||
|
||||
// RR_PREFETCH for various platforms :
|
||||
//
|
||||
//
|
||||
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
|
||||
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
|
||||
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
|
||||
|
|
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
||||
// RAD_NO_BREAK : option if you don't like your assert to break
|
||||
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
|
||||
#ifdef RAD_NO_BREAK
|
||||
|
|
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
|
||||
|
||||
//-----------------------------------
|
||||
#ifdef RR_DO_ASSERTS
|
||||
#ifdef RR_DO_ASSERTS
|
||||
|
||||
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
|
||||
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
|
||||
|
|
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
|
|||
#define RR_BSWAP16 _byteswap_ushort
|
||||
#define RR_BSWAP32 _byteswap_ulong
|
||||
|
||||
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
|
||||
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define RR_BSWAP64 _byteswap_uint64
|
||||
|
||||
|
|
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
|
|||
return _Long;
|
||||
}
|
||||
|
||||
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
|
||||
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
|
||||
{
|
||||
__asm {
|
||||
mov eax, DWORD PTR _Long
|
||||
|
|
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
|
|||
|
||||
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||
|
||||
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
||||
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
|
||||
#pragma intrinsic(_rotl64)
|
||||
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
|
||||
|
||||
#elif defined(__RADCELL__)
|
||||
|
||||
|
|
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
|||
|
||||
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
|
||||
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
|
||||
|
||||
#else
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -114,8 +114,8 @@
|
|||
#define __RADLITTLEENDIAN__
|
||||
#ifdef __i386__
|
||||
#define __RADX86__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#endif
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
#define __RADX86__
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#endif
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
#define __RADNACL__
|
||||
#define __RAD32__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define __RADX86__
|
||||
#define __RADX86__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
#define __RAD64REGS__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
#endif
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
||||
|
||||
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
|
||||
|
||||
#define __RADWIIU__
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
|
||||
#undef RADRESTRICT /* could have been defined above... */
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
#endif
|
||||
|
|
@ -885,7 +885,7 @@
|
|||
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
|
||||
#else
|
||||
// NOTE: / / is a guaranteed parse error in C/C++.
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#endif
|
||||
|
||||
// WARNING : RAD_TLS should really only be used for debug/tools stuff
|
||||
|
|
@ -917,8 +917,8 @@
|
|||
#define RAD_S32 signed int
|
||||
// But pointers are 64 bits.
|
||||
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
|
||||
#define RAD_SINTa __w64 signed __int64
|
||||
#define RAD_UINTa __w64 unsigned __int64
|
||||
#define RAD_SINTa __w64 signed long long
|
||||
#define RAD_UINTa __w64 unsigned long long
|
||||
#else // non-vc.net compiler or /Wp64 turned off
|
||||
#define RAD_UINTa unsigned long long
|
||||
#define RAD_SINTa signed long long
|
||||
|
|
@ -976,8 +976,8 @@
|
|||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#elif defined(__RADX64__) || defined(__RAD32__)
|
||||
#define RAD_U64 unsigned __int64
|
||||
#define RAD_S64 signed __int64
|
||||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#else
|
||||
// 16-bit
|
||||
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
|
||||
|
|
@ -1134,7 +1134,7 @@
|
|||
|
||||
// helpers for doing an if ( ) with expect :
|
||||
// if ( RAD_LIKELY(expr) ) { ... }
|
||||
|
||||
|
||||
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
|
||||
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
|
||||
|
||||
|
|
@ -1324,7 +1324,7 @@
|
|||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable:4127)) \
|
||||
} while(0) \
|
||||
__pragma(warning(pop))
|
||||
__pragma(warning(pop))
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
__pragma(warning(push)) \
|
||||
|
|
@ -1333,10 +1333,10 @@
|
|||
__pragma(warning(pop))
|
||||
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
|
||||
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
|
|
@ -1345,7 +1345,7 @@
|
|||
|
||||
#define RAD_STATEMENT_END_FALSE \
|
||||
} while ( (void)0,0 )
|
||||
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
} while ( (void)1,1 )
|
||||
|
||||
|
|
@ -1355,7 +1355,7 @@
|
|||
RAD_STATEMENT_START \
|
||||
code \
|
||||
RAD_STATEMENT_END_FALSE
|
||||
|
||||
|
||||
#define RAD_INFINITE_LOOP( code ) \
|
||||
RAD_STATEMENT_START \
|
||||
code \
|
||||
|
|
@ -1363,7 +1363,7 @@
|
|||
|
||||
|
||||
// Must be placed after variable declarations for code compiled as .c
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
# define RR_UNUSED_VARIABLE(x) (void) x
|
||||
#else
|
||||
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
|
||||
|
|
@ -1473,7 +1473,7 @@
|
|||
// just to make gcc shut up about derefing null :
|
||||
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
|
||||
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
|
||||
|
||||
|
||||
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
|
||||
// you should then RR_ASSERT( &(ret->member) == ptr );
|
||||
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
|
||||
|
|
@ -1482,7 +1482,7 @@
|
|||
// Cache / prefetch macros :
|
||||
|
||||
// RR_PREFETCH for various platforms :
|
||||
//
|
||||
//
|
||||
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
|
||||
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
|
||||
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
|
||||
|
|
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
||||
// RAD_NO_BREAK : option if you don't like your assert to break
|
||||
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
|
||||
#ifdef RAD_NO_BREAK
|
||||
|
|
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
|
||||
|
||||
//-----------------------------------
|
||||
#ifdef RR_DO_ASSERTS
|
||||
#ifdef RR_DO_ASSERTS
|
||||
|
||||
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
|
||||
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
|
||||
|
|
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
|
|||
#define RR_BSWAP16 _byteswap_ushort
|
||||
#define RR_BSWAP32 _byteswap_ulong
|
||||
|
||||
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
|
||||
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define RR_BSWAP64 _byteswap_uint64
|
||||
|
||||
|
|
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
|
|||
return _Long;
|
||||
}
|
||||
|
||||
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
|
||||
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
|
||||
{
|
||||
__asm {
|
||||
mov eax, DWORD PTR _Long
|
||||
|
|
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
|
|||
|
||||
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||
|
||||
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
||||
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
|
||||
#pragma intrinsic(_rotl64)
|
||||
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
|
||||
|
||||
#elif defined(__RADCELL__)
|
||||
|
||||
|
|
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
|||
|
||||
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
|
||||
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
|
||||
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ DQRNetworkManager::SessionInfo::SessionInfo()
|
|||
}
|
||||
|
||||
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
|
||||
const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTStateMappings[DQRNetworkManager::DNM_INT_STATE_COUNT] =
|
||||
const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTStateMappings[DQRNetworkManager::DNM_INT_STATE_COUNT] =
|
||||
{
|
||||
DNM_STATE_INITIALISING, // DNM_INT_STATE_INITIALISING
|
||||
DNM_STATE_INITIALISE_FAILED, // DNM_INT_STATE_INITIALISE_FAILED
|
||||
|
|
@ -64,7 +64,7 @@ const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTSt
|
|||
DNM_STATE_PLAYING, // DNM_INT_STATE_PLAYING
|
||||
DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING
|
||||
DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING_FAILED
|
||||
DNM_STATE_ENDING, // DNM_INT_STATE_ENDING
|
||||
DNM_STATE_ENDING, // DNM_INT_STATE_ENDING
|
||||
};
|
||||
|
||||
DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener)
|
||||
|
|
@ -146,7 +146,7 @@ void DQRNetworkManager::EnableDebugXBLContext(MXS::XboxLiveContext^ XBLContext)
|
|||
|
||||
// Show service calls from Xbox Services on the UI for easy debugging
|
||||
XBLContext->Settings->EnableServiceCallRoutedEvents = true;
|
||||
XBLContext->Settings->ServiceCallRouted += ref new Windows::Foundation::EventHandler<Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^>(
|
||||
XBLContext->Settings->ServiceCallRouted += ref new Windows::Foundation::EventHandler<Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^>(
|
||||
[=]( Platform::Object^, Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^ args )
|
||||
{
|
||||
//if( args->HttpStatus != 200 )
|
||||
|
|
@ -308,14 +308,14 @@ void DQRNetworkManager::JoinSession(int playerMask)
|
|||
m_isHosting = false;
|
||||
|
||||
sockaddr_in6 localSocketAddressStorage;
|
||||
|
||||
|
||||
ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage));
|
||||
|
||||
|
||||
localSocketAddressStorage.sin6_family = AF_INET6;
|
||||
localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower);
|
||||
|
||||
|
||||
memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any));
|
||||
|
||||
|
||||
m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage));
|
||||
|
||||
m_joinCreateSessionAttempts = 0;
|
||||
|
|
@ -402,7 +402,7 @@ bool DQRNetworkManager::AddUsersToSession(int playerMask, MXSM::MultiplayerSessi
|
|||
// We need to get a MultiplayerSession for each player that is joining
|
||||
|
||||
MXSM::MultiplayerSession^ session = nullptr;
|
||||
|
||||
|
||||
WXS::User^ newUser = ProfileManager.GetUser(i);
|
||||
if( newUser == nullptr )
|
||||
{
|
||||
|
|
@ -451,12 +451,12 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
|
|||
// We need to handle this differently for the host and other machines. As the procedure for adding a reserved slot for a local player whilst on the host doesn't seem to work
|
||||
//
|
||||
// On the host machine, we:
|
||||
//
|
||||
//
|
||||
// (1) Get a MPSD for the player that is being added
|
||||
// (2) Call the join method
|
||||
// (3) Write the MPSD
|
||||
// (4) Update the player sync data, and broadcast out to all clients
|
||||
|
||||
|
||||
// On remote machines, we:
|
||||
//
|
||||
// (1) join the party
|
||||
|
|
@ -473,10 +473,10 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( !m_isOfflineGame )
|
||||
{
|
||||
// This is going to involve some async processing
|
||||
// This is going to involve some async processing
|
||||
|
||||
MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser);
|
||||
if( newUserXBLContext == nullptr )
|
||||
|
|
@ -558,7 +558,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
|
|||
SendRoomSyncInfo();
|
||||
m_listener->HandlePlayerJoined(pPlayer); // This is for notifying of local players joining in an offline game
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Can fail (notably if m_roomSyncData contains players who've left)
|
||||
assert(0);
|
||||
|
|
@ -571,7 +571,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
|
|||
{
|
||||
// Check if there's any available slots before attempting to add the player to the party. We can still fail joining later if
|
||||
// the host can't add a reserved slot for us for some reason but better checking on the client side before even attempting.
|
||||
|
||||
|
||||
WXS::User^ newUser = ProfileManager.GetUser(userIndex);
|
||||
|
||||
MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser);
|
||||
|
|
@ -622,16 +622,16 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
|
|||
|
||||
bool DQRNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex)
|
||||
{
|
||||
// We need to handle this differently for the host and other machines.
|
||||
// We need to handle this differently for the host and other machines.
|
||||
//
|
||||
// On the host machine, we:
|
||||
//
|
||||
//
|
||||
// (1) Get a MPSD for the player that is being removed
|
||||
// (2) Call the leave method
|
||||
// (3) Write the MPSD
|
||||
// (4) Leave the party
|
||||
// (5) Update the player sync data, and broadcast out to all clients
|
||||
|
||||
|
||||
// On remote machines, we:
|
||||
//
|
||||
// (1) Get a MPSD for the player that is being removed
|
||||
|
|
@ -651,7 +651,7 @@ bool DQRNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( !m_isOfflineGame )
|
||||
{
|
||||
if( m_chat )
|
||||
|
|
@ -714,7 +714,7 @@ bool DQRNetworkManager::IsHost()
|
|||
}
|
||||
|
||||
// Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The
|
||||
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
|
||||
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
|
||||
// it also requires that it is informed of the state changes leading up to not being in the session, before this should report false.
|
||||
bool DQRNetworkManager::IsInSession()
|
||||
{
|
||||
|
|
@ -788,7 +788,7 @@ wstring DQRNetworkManager::GetDisplayNameByGamertag(wstring gamertag)
|
|||
{
|
||||
return m_displayNames[gamertag];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return gamertag;
|
||||
}
|
||||
|
|
@ -902,14 +902,14 @@ void DQRNetworkManager::Tick_VoiceChat()
|
|||
{
|
||||
m_chat->AddLocalUser(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_vecChatPlayersJoined.clear();
|
||||
LeaveCriticalSection(&m_csVecChatPlayers);
|
||||
}
|
||||
|
||||
void DQRNetworkManager::Tick_Party()
|
||||
{
|
||||
{
|
||||
// If the primary player has been flagged as having left the party, then we don't respond immediately as it is possible we are just transitioning from one party to another, and it would be much
|
||||
// nicer to handle this kind of transition directly. If we do get a new party within this time period, then we'll handle by asking the user if they want to leave the game they are currently in etc.
|
||||
if( m_playersLeftParty )
|
||||
|
|
@ -919,7 +919,7 @@ void DQRNetworkManager::Tick_Party()
|
|||
// We've waited long enough. User must (hopefully) have just left the party
|
||||
// Previously we'd switch to offline but that causes a world of pain with forced sign-outs
|
||||
if( m_playersLeftParty & 1 )
|
||||
{
|
||||
{
|
||||
// Before we switch to an offline game, check to see if there is currently a new party. If this is the case and
|
||||
// we're here, then its because we were added to a party, but didn't receive a gamesessionready event. So if we have
|
||||
// a party here that we've joined, and the number of players in the party (including us) is more than MAX_PLAYERS_IN_TEMPLATE,
|
||||
|
|
@ -955,7 +955,7 @@ void DQRNetworkManager::Tick_Party()
|
|||
m_playersLeftParty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Forced sign out
|
||||
if (m_handleForcedSignOut)
|
||||
{
|
||||
|
|
@ -1064,7 +1064,7 @@ void DQRNetworkManager::Tick_ResolveGamertags()
|
|||
HostGamertagResolveDetails *details = m_hostGamertagResolveResults.front();
|
||||
|
||||
details->m_pPlayer->SetName(details->m_name.c_str());
|
||||
|
||||
|
||||
LogComment("Adding a player");
|
||||
if( AddRoomSyncPlayer(details->m_pPlayer, details->m_sessionAddress, details->m_channel ) )
|
||||
{
|
||||
|
|
@ -1154,7 +1154,7 @@ void DQRNetworkManager::Tick_StateMachine()
|
|||
break;
|
||||
case DNM_INT_STATE_JOINING_SENDING_UNRELIABLE:
|
||||
{
|
||||
__int64 timeNow = System::currentTimeMillis();
|
||||
int64_t timeNow = System::currentTimeMillis();
|
||||
// m_firstUnreliableSendTime of 0 indicates that we haven't tried sending an unreliable packet yet so need to send one and initialise things
|
||||
if( m_firstUnreliableSendTime == 0 )
|
||||
{
|
||||
|
|
@ -1188,7 +1188,7 @@ void DQRNetworkManager::Tick_StateMachine()
|
|||
{
|
||||
// Timeout if we've been waiting for reserved slots for our joining players for too long. This is most likely because the host doesn't have room for all the slots we wanted, and we weren't able to determine this
|
||||
// when we went to join the game (ie someone else was joining at the same time). At this point we need to remove any local players that did already join, from both the session and the party.
|
||||
__int64 timeNow = System::currentTimeMillis();
|
||||
int64_t timeNow = System::currentTimeMillis();
|
||||
if( ( timeNow - m_startedWaitingForReservationsTime ) > JOIN_RESERVATION_WAIT_TIME )
|
||||
{
|
||||
SetState(DNM_INT_STATE_JOINING_FAILED_TIDY_UP);
|
||||
|
|
@ -1332,7 +1332,7 @@ void DQRNetworkManager::HandleSessionChange(MXSM::MultiplayerSession^ multiplaye
|
|||
{
|
||||
((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr );
|
||||
}
|
||||
|
||||
|
||||
m_multiplayerSession = multiplayerSession;
|
||||
}
|
||||
|
||||
|
|
@ -1362,7 +1362,7 @@ MXSM::MultiplayerSession^ DQRNetworkManager::WriteSessionHelper( MXS::XboxLiveCo
|
|||
})
|
||||
.wait();
|
||||
|
||||
if( outputMultiplayerSession != nullptr &&
|
||||
if( outputMultiplayerSession != nullptr &&
|
||||
outputMultiplayerSession->SessionReference != nullptr )
|
||||
{
|
||||
app.DebugPrintf( "Session written OK\n" );
|
||||
|
|
@ -1422,7 +1422,7 @@ WXM::MultiplayerSessionReference^ DQRNetworkManager::ConvertToWindowsXboxMultipl
|
|||
{
|
||||
return ref new WXM::MultiplayerSessionReference(
|
||||
sessionRef->SessionName,
|
||||
sessionRef->ServiceConfigurationId,
|
||||
sessionRef->ServiceConfigurationId,
|
||||
sessionRef->SessionTemplateName
|
||||
);
|
||||
}
|
||||
|
|
@ -1458,7 +1458,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
|
|||
// And when we are done, anything left in the temporary vector must be a player that left
|
||||
for( int i = 0; i < pNewSyncData->playerCount; i++ )
|
||||
{
|
||||
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
|
||||
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
|
||||
bool bAlreadyExisted = false;
|
||||
for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++)
|
||||
{
|
||||
|
|
@ -1491,7 +1491,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
|
|||
}
|
||||
|
||||
LogCommentFormat(L"Adding new player, index %d - type %d, small Id %d, name %s, xuid %s\n",i,m_players[i]->m_type,pNewPlayer->m_smallId,pNewPlayer->m_name,pNewPlayer->m_XUID);
|
||||
|
||||
|
||||
m_players[i]->SetSmallId(pNewPlayer->m_smallId);
|
||||
m_players[i]->SetName(pNewPlayer->m_name);
|
||||
m_players[i]->SetUID(PlayerUID(pNewPlayer->m_XUID));
|
||||
|
|
@ -1525,7 +1525,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
|
|||
bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel)
|
||||
{
|
||||
if( m_roomSyncData.playerCount == MAX_ONLINE_PLAYER_COUNT ) return false;
|
||||
|
||||
|
||||
EnterCriticalSection(&m_csRoomSyncData);
|
||||
// Find the first entry that isn't us, to decide what to sync before. Don't consider entry #0 as this is reserved to indicate the host.
|
||||
int insertAtIdx = m_roomSyncData.playerCount;
|
||||
|
|
@ -1552,11 +1552,11 @@ bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned in
|
|||
{
|
||||
m_roomSyncData.players[i] = m_roomSyncData.players[i-1];
|
||||
m_players[i] = m_players[i - 1];
|
||||
}
|
||||
}
|
||||
m_roomSyncData.players[insertAtIdx].m_channel = channel;
|
||||
m_roomSyncData.players[insertAtIdx].m_sessionAddress = sessionAddress;
|
||||
int xuidLength = pPlayer->GetUID().toString().length() + 1; // +1 for terminator
|
||||
m_roomSyncData.players[insertAtIdx].m_XUID = new wchar_t [xuidLength];
|
||||
m_roomSyncData.players[insertAtIdx].m_XUID = new wchar_t [xuidLength];
|
||||
wcsncpy(m_roomSyncData.players[insertAtIdx].m_XUID, pPlayer->GetUID().toString().c_str(), xuidLength);
|
||||
m_roomSyncData.players[insertAtIdx].m_smallId = pPlayer->GetSmallId();
|
||||
wcscpy_s(m_roomSyncData.players[insertAtIdx].m_name, pPlayer->GetName());
|
||||
|
|
@ -1587,7 +1587,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses
|
|||
{
|
||||
m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i];
|
||||
m_players[iWriteIdx] = m_players[i];
|
||||
iWriteIdx++;
|
||||
iWriteIdx++;
|
||||
}
|
||||
}
|
||||
m_roomSyncData.playerCount = iWriteIdx;
|
||||
|
|
@ -1618,7 +1618,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer)
|
|||
{
|
||||
m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i];
|
||||
m_players[iWriteIdx] = m_players[i];
|
||||
iWriteIdx++;
|
||||
iWriteIdx++;
|
||||
}
|
||||
}
|
||||
m_roomSyncData.playerCount = iWriteIdx;
|
||||
|
|
@ -1659,13 +1659,13 @@ void DQRNetworkManager::SendRoomSyncInfo()
|
|||
uint32_t sizeHigh = internalBytes >> 8;
|
||||
uint32_t sizeLow = internalBytes & 0xff;
|
||||
|
||||
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
|
||||
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
|
||||
data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself
|
||||
data[2] = DQR_INTERNAL_PLAYER_TABLE;
|
||||
|
||||
memcpy(data + 3, &xuidBytes, 4);
|
||||
memcpy(data + 7, &m_roomSyncData, sizeof(RoomSyncData));
|
||||
unsigned char *pucCurr = data + 7 + sizeof(RoomSyncData);
|
||||
unsigned char *pucCurr = data + 7 + sizeof(RoomSyncData);
|
||||
|
||||
for( int i = 0 ; i < m_roomSyncData.playerCount; i++ )
|
||||
{
|
||||
|
|
@ -1701,12 +1701,12 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid)
|
|||
uint32_t sizeHigh = internalBytes >> 8;
|
||||
uint32_t sizeLow = internalBytes & 0xff;
|
||||
|
||||
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
|
||||
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
|
||||
data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself
|
||||
data[2] = DQR_INTERNAL_ADD_PLAYER_FAILED;
|
||||
|
||||
memcpy(data + 3, &xuidBytes, 4);
|
||||
memcpy(data + 7, xuid->Data(), xuidBytes);
|
||||
memcpy(data + 7, xuid->Data(), xuidBytes);
|
||||
|
||||
SendBytesRaw(-1, data, totalBytes, true);
|
||||
|
||||
|
|
@ -1927,7 +1927,7 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
// Actually create the session (locally), using the primary player's context
|
||||
try
|
||||
{
|
||||
session = ref new MXSM::MultiplayerSession( primaryUserXBLContext,
|
||||
session = ref new MXSM::MultiplayerSession( primaryUserXBLContext,
|
||||
ref new MXSM::MultiplayerSessionReference( SERVICE_CONFIG_ID, MATCH_SESSION_TEMPLATE_NAME, sessionName ),
|
||||
0, // this means that it will use the maxMembers specified in the session template.
|
||||
false,
|
||||
|
|
@ -1972,7 +1972,7 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
|
||||
session->Join( GetNextSmallIdAsJsonString(), true );
|
||||
session->SetCurrentUserStatus( MXSM::MultiplayerSessionMemberStatus::Active );
|
||||
|
||||
|
||||
// Get device ID for current user & set in the session
|
||||
Platform::String^ secureDeviceAddress = WXN::SecureDeviceAddress::GetLocal()->GetBase64String();
|
||||
session->SetCurrentUserSecureDeviceAddressBase64( secureDeviceAddress );
|
||||
|
|
@ -1997,7 +1997,7 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
return 0;
|
||||
}
|
||||
m_partyController->SetJoinability(m_listener->IsSessionJoinable());
|
||||
|
||||
|
||||
// Add reservations for anyone in the party, who isn't the primary player. Just adding local players for now, but perhaps this should add
|
||||
// other party members at this stage?
|
||||
for ( WXM::PartyMember^ member : partyView->Members )
|
||||
|
|
@ -2029,8 +2029,8 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
session->SetHostDeviceToken( hostMember->DeviceToken );
|
||||
|
||||
m_partyController->RegisterGamePlayersChangedEventHandler();
|
||||
|
||||
// Update session on the server
|
||||
|
||||
// Update session on the server
|
||||
HRESULT hr = S_OK;
|
||||
session = WriteSessionHelper( primaryUserXBLContext, session, MXSM::MultiplayerSessionWriteMode::UpdateExisting, hr );
|
||||
|
||||
|
|
@ -2086,14 +2086,14 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
if( m_state == DNM_INT_STATE_HOSTING_FAILED) return 0;
|
||||
|
||||
sockaddr_in6 localSocketAddressStorage;
|
||||
|
||||
|
||||
ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage));
|
||||
|
||||
|
||||
localSocketAddressStorage.sin6_family = AF_INET6;
|
||||
localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower);
|
||||
|
||||
|
||||
memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any));
|
||||
|
||||
|
||||
m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage));
|
||||
|
||||
// This shouldn't ever happen, but seems worth checking that we don't have a pre-existing session in case there's any way to get here with one already running
|
||||
|
|
@ -2184,7 +2184,7 @@ int DQRNetworkManager::HostGameThreadProc()
|
|||
if( m_currentUserMask & ( 1 << i ) && ProfileManager.IsSignedIn(i))
|
||||
{
|
||||
auto user = ProfileManager.GetUser(i);
|
||||
wstring displayName = ProfileManager.GetDisplayName(i);
|
||||
wstring displayName = ProfileManager.GetDisplayName(i);
|
||||
|
||||
DQRNetworkPlayer* pPlayer = new DQRNetworkPlayer(this, ( ( smallId == m_hostSmallId ) ? DQRNetworkPlayer::DNP_TYPE_HOST : DQRNetworkPlayer::DNP_TYPE_LOCAL ), true, i, localSessionAddress);
|
||||
pPlayer->SetSmallId(smallId);
|
||||
|
|
@ -2234,7 +2234,7 @@ int DQRNetworkManager::LeaveRoomThreadProc()
|
|||
|
||||
// Request RTS to be terminated
|
||||
RTS_Terminate();
|
||||
|
||||
|
||||
// Now leave the game session. We need to do this for each player in turn, writing each time
|
||||
bool bError = false;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
|
|
@ -2339,7 +2339,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc()
|
|||
|
||||
// We can fail to join at various points, and in at least one case (if it is down to RUDP unreliable packets timing out) then we don't have m_joinSessionUserMask bits set any more,
|
||||
// but we Do have m_currentUserMask set. Any of these should be considered users we should be attempting to remove from the session.
|
||||
int removeSessionMask = m_joinSessionUserMask | m_currentUserMask;
|
||||
int removeSessionMask = m_joinSessionUserMask | m_currentUserMask;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if( removeSessionMask & ( 1 << i ) )
|
||||
|
|
@ -2428,7 +2428,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc()
|
|||
{
|
||||
LogComment(L"Starting thread to update custom data");
|
||||
WXS::User^ primaryUser = ProfileManager.GetUser(0);
|
||||
|
||||
|
||||
if( primaryUser == nullptr )
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -2550,7 +2550,7 @@ void DQRNetworkManager::HandlePlayerRemovedFromParty(int playerMask)
|
|||
{
|
||||
// As a client, we don't have any messy changing to offline game or saving etc. to do, so we can respond immediately to leaving the party
|
||||
if( playerMask & 1 )
|
||||
{
|
||||
{
|
||||
DQRNetworkManager::LogComment(L"Primary player on this system has left the party - leaving game\n");
|
||||
app.SetDisconnectReason(DisconnectPacket::eDisconnect_ExitedGame);
|
||||
LeaveRoom();
|
||||
|
|
@ -2725,7 +2725,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
|
|||
m_joinSessionUserMask = playerMask;
|
||||
m_isInSession = true;
|
||||
m_isOfflineGame = false;
|
||||
|
||||
|
||||
m_startedWaitingForReservationsTime = System::currentTimeMillis();
|
||||
SetState(DNM_INT_STATE_JOINING_WAITING_FOR_RESERVATIONS);
|
||||
|
||||
|
|
@ -2742,7 +2742,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
|
|||
if( sessionRef != nullptr )
|
||||
{
|
||||
// Allow 2 seconds before we let the player cancel
|
||||
__int64 allowCancelTime = System::currentTimeMillis() + (1000 * 2);
|
||||
int64_t allowCancelTime = System::currentTimeMillis() + (1000 * 2);
|
||||
|
||||
// Now leave the game session. We need to do this for each player in turn, writing each time. Consider that any of the joining
|
||||
// members *may* have a slot (reserved or active) depending on how far progressed the joining got.
|
||||
|
|
@ -2814,7 +2814,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
|
|||
break;
|
||||
}
|
||||
|
||||
__int64 currentTime = System::currentTimeMillis();
|
||||
int64_t currentTime = System::currentTimeMillis();
|
||||
if( currentTime > allowCancelTime)
|
||||
{
|
||||
shownCancelScreen = true;
|
||||
|
|
@ -2893,7 +2893,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
|
|||
SetState(DNM_INT_STATE_JOINING_FAILED);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
while(!ccTask.is_done())
|
||||
{
|
||||
|
|
@ -3013,7 +3013,7 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player)
|
|||
{
|
||||
if (player->IsLocal())
|
||||
{
|
||||
// Player is local so we can just ask profile manager
|
||||
// Player is local so we can just ask profile manager
|
||||
SetDisplayName(player->GetUID(), ProfileManager.GetDisplayName(player->GetLocalPlayerIndex()));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public:
|
|||
static const int MAX_ONLINE_PLAYER_COUNT = 8;
|
||||
static const int MAX_ONLINE_PLAYER_NAME_LENGTH = 21;
|
||||
|
||||
// This class stores everything about a player that must be synchronised between machines.
|
||||
// This class stores everything about a player that must be synchronised between machines.
|
||||
class PlayerSyncData
|
||||
{
|
||||
public:
|
||||
|
|
@ -210,7 +210,7 @@ public:
|
|||
DNM_STATE_JOINING,
|
||||
|
||||
DNM_STATE_STARTING,
|
||||
DNM_STATE_PLAYING,
|
||||
DNM_STATE_PLAYING,
|
||||
|
||||
DNM_STATE_LEAVING,
|
||||
DNM_STATE_ENDING,
|
||||
|
|
@ -339,9 +339,9 @@ private:
|
|||
static const eDQRNetworkManagerState m_INTtoEXTStateMappings[DNM_INT_STATE_COUNT];
|
||||
eDQRNetworkManagerInternalState m_state;
|
||||
eDQRNetworkManagerState m_stateExternal;
|
||||
__int64 m_lastUnreliableSendTime;
|
||||
__int64 m_firstUnreliableSendTime;
|
||||
__int64 m_startedWaitingForReservationsTime;
|
||||
int64_t m_lastUnreliableSendTime;
|
||||
int64_t m_firstUnreliableSendTime;
|
||||
int64_t m_startedWaitingForReservationsTime;
|
||||
unsigned char *m_customSessionData;
|
||||
unsigned int m_customSessionDataSize;
|
||||
int m_customDataDirtyUpdateTicks;
|
||||
|
|
@ -361,7 +361,7 @@ private:
|
|||
|
||||
CRITICAL_SECTION m_csRoomSyncData;
|
||||
RoomSyncData m_roomSyncData;
|
||||
DQRNetworkPlayer *m_players[MAX_ONLINE_PLAYER_COUNT];
|
||||
DQRNetworkPlayer *m_players[MAX_ONLINE_PLAYER_COUNT];
|
||||
|
||||
IDQRNetworkManagerListener *m_listener;
|
||||
PartyController *m_partyController;
|
||||
|
|
@ -389,7 +389,7 @@ private:
|
|||
int m_joinCreateSessionAttempts;
|
||||
|
||||
C4JThread *m_CreateSessionThread;
|
||||
C4JThread *m_LeaveRoomThread;
|
||||
C4JThread *m_LeaveRoomThread;
|
||||
C4JThread *m_TidyUpJoinThread;
|
||||
C4JThread *m_UpdateCustomSessionDataThread;
|
||||
C4JThread *m_RTS_DoWorkThread;
|
||||
|
|
@ -426,7 +426,7 @@ private:
|
|||
int GetQueueSizeMessages();
|
||||
void SendBytesRaw(int smallId, BYTE *bytes, int byteCount, bool reliableAndSequential);
|
||||
void SendBytesChat(unsigned int address, BYTE *bytes, int byteCount, bool reliable, bool sequential, bool broadcast);
|
||||
|
||||
|
||||
bool AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel);
|
||||
void RemoveRoomSyncPlayersWithSessionAddress(unsigned int sessionAddress);
|
||||
void RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer);
|
||||
|
|
@ -438,7 +438,7 @@ private:
|
|||
int GetSessionIndexForSmallId(unsigned char smallId);
|
||||
int GetSessionIndexAndSmallIdForHost(unsigned char *smallId);
|
||||
|
||||
static void LogComment( Platform::String^ strText );
|
||||
static void LogComment( Platform::String^ strText );
|
||||
static void LogCommentFormat( LPCWSTR strMsg, ... );
|
||||
static void LogCommentWithError( Platform::String^ strTest, HRESULT hr );
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ public:
|
|||
void SetDisplayName(PlayerUID xuid, wstring displayName);
|
||||
|
||||
private:
|
||||
__int64 m_playersLeftPartyTime;
|
||||
int64_t m_playersLeftPartyTime;
|
||||
int m_playersLeftParty;
|
||||
|
||||
bool GetBestPartyUserIndex();
|
||||
|
|
@ -502,7 +502,7 @@ private:
|
|||
bool GetGameSessionData(MXSM::MultiplayerSession^ session, void *gameSessionData);
|
||||
|
||||
public:
|
||||
static Platform::Collections::Vector<Platform::String^>^ GetFriends();
|
||||
static Platform::Collections::Vector<Platform::String^>^ GetFriends();
|
||||
|
||||
private:
|
||||
SessionSearchResult *m_sessionSearchResults;
|
||||
|
|
@ -551,7 +551,7 @@ private:
|
|||
void Process_RTS_MESSAGE_STATUS_TERMINATED(RTS_Message &message);
|
||||
|
||||
// Outgoing messages - to be called from the RTS work thread, to process requests from the main thread
|
||||
|
||||
|
||||
void ProcessRTSMessagesOutgoing();
|
||||
void Process_RTS_MESSAGE_START_CLIENT(RTS_Message &message);
|
||||
void Process_RTS_MESSAGE_START_HOST(RTS_Message &message);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
// 4J-PB -
|
||||
// The ATG Framework is a common set of C++ class libraries that is used by the samples in the XDK, and was developed by the Advanced Technology Group (ATG).
|
||||
// The ATG Framework offers a clean and consistent format for the samples. These classes define functions used by all the samples.
|
||||
// The ATG Framework together with the samples demonstrates best practices and innovative techniques for Xbox 360. There are many useful sections of code in the samples.
|
||||
// You are encouraged to incorporate this code into your titles.
|
||||
// 4J-PB -
|
||||
// The ATG Framework is a common set of C++ class libraries that is used by the samples in the XDK, and was developed by the Advanced Technology Group (ATG).
|
||||
// The ATG Framework offers a clean and consistent format for the samples. These classes define functions used by all the samples.
|
||||
// The ATG Framework together with the samples demonstrates best practices and innovative techniques for Xbox 360. There are many useful sections of code in the samples.
|
||||
// You are encouraged to incorporate this code into your titles.
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// AtgXmlParser.cpp
|
||||
//
|
||||
//
|
||||
// Simple callback non-validating XML parser implementation.
|
||||
//
|
||||
// Xbox Advanced Technology Group.
|
||||
|
|
@ -35,7 +35,7 @@ XMLParser::XMLParser()
|
|||
// Name: XMLParser::~XMLParser
|
||||
//-------------------------------------------------------------------------------------
|
||||
XMLParser::~XMLParser()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -51,11 +51,11 @@ VOID XMLParser::FillBuffer()
|
|||
|
||||
if( m_hFile == NULL )
|
||||
{
|
||||
if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE )
|
||||
if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE )
|
||||
NChars = XML_READ_BUFFER_SIZE;
|
||||
else
|
||||
NChars = m_uInXMLBufferCharsLeft;
|
||||
|
||||
|
||||
CopyMemory( m_pReadBuf, m_pInXMLBuffer, NChars );
|
||||
m_uInXMLBufferCharsLeft -= NChars;
|
||||
m_pInXMLBuffer += NChars;
|
||||
|
|
@ -69,7 +69,7 @@ VOID XMLParser::FillBuffer()
|
|||
}
|
||||
|
||||
m_dwCharsConsumed += NChars;
|
||||
__int64 iProgress = m_dwCharsTotal ? (( (__int64)m_dwCharsConsumed * 1000 ) / (__int64)m_dwCharsTotal) : 0;
|
||||
int64_t iProgress = m_dwCharsTotal ? (( (int64_t)m_dwCharsConsumed * 1000 ) / (int64_t)m_dwCharsTotal) : 0;
|
||||
m_pISAXCallback->SetParseProgress( (DWORD)iProgress );
|
||||
|
||||
m_pReadBuf[ NChars ] = '\0';
|
||||
|
|
@ -89,7 +89,7 @@ VOID XMLParser::SkipNextAdvance()
|
|||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Name: XMLParser::ConsumeSpace
|
||||
// Desc: Skips spaces in the current stream
|
||||
// Desc: Skips spaces in the current stream
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::ConsumeSpace()
|
||||
{
|
||||
|
|
@ -104,29 +104,29 @@ HRESULT XMLParser::ConsumeSpace()
|
|||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
}
|
||||
SkipNextAdvance();
|
||||
}
|
||||
SkipNextAdvance();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Name: XMLParser::ConvertEscape
|
||||
// Desc: Copies and converts an escape sequence into m_pWriteBuf
|
||||
// Desc: Copies and converts an escape sequence into m_pWriteBuf
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::ConvertEscape()
|
||||
{
|
||||
{
|
||||
HRESULT hr;
|
||||
WCHAR wVal = 0;
|
||||
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
// all escape sequences start with &, so ignore the first character
|
||||
|
||||
// all escape sequences start with &, so ignore the first character
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
if ( m_Ch == '#' ) // character as hex or decimal
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
|
|
@ -135,9 +135,9 @@ HRESULT XMLParser::ConvertEscape()
|
|||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
while ( m_Ch != ';' )
|
||||
{
|
||||
{
|
||||
wVal *= 16;
|
||||
|
||||
if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) )
|
||||
|
|
@ -151,11 +151,11 @@ HRESULT XMLParser::ConvertEscape()
|
|||
else if ( ( m_Ch >= 'A' ) && ( m_Ch <= 'F' ) )
|
||||
{
|
||||
wVal += m_Ch - 'A' + 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected hex digit as part of &#x escape sequence" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected hex digit as part of &#x escape sequence" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
|
|
@ -165,7 +165,7 @@ HRESULT XMLParser::ConvertEscape()
|
|||
else // decimal number
|
||||
{
|
||||
while ( m_Ch != ';' )
|
||||
{
|
||||
{
|
||||
wVal *= 10;
|
||||
|
||||
if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) )
|
||||
|
|
@ -174,7 +174,7 @@ HRESULT XMLParser::ConvertEscape()
|
|||
}
|
||||
else
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected decimal digit as part of &# escape sequence" );
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected decimal digit as part of &# escape sequence" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ HRESULT XMLParser::ConvertEscape()
|
|||
m_Ch = wVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// must be an entity reference
|
||||
|
||||
|
|
@ -197,13 +197,13 @@ HRESULT XMLParser::ConvertEscape()
|
|||
SkipNextAdvance();
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal );
|
||||
m_pWritePtr = pEntityRefVal;
|
||||
|
||||
if ( EntityRefLen == 0 )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting entity name after &" );
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting entity name after &" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ HRESULT XMLParser::ConvertEscape()
|
|||
wVal = '"';
|
||||
else
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Unrecognized entity name after & - (should be lt, gt, amp, apos, or quot)" );
|
||||
Error( E_INVALID_XML_SYNTAX, "Unrecognized entity name after & - (should be lt, gt, amp, apos, or quot)" );
|
||||
return E_INVALID_XML_SYNTAX; // return false if unrecognized token sequence
|
||||
}
|
||||
|
||||
|
|
@ -228,10 +228,10 @@ HRESULT XMLParser::ConvertEscape()
|
|||
|
||||
if( m_Ch != ';' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected terminating ; for entity reference" );
|
||||
Error( E_INVALID_XML_SYNTAX, "Expected terminating ; for entity reference" );
|
||||
return E_INVALID_XML_SYNTAX; // malformed reference - needs terminating ;
|
||||
}
|
||||
|
||||
|
||||
m_Ch = wVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -250,41 +250,41 @@ HRESULT XMLParser::AdvanceAttrVal()
|
|||
return hr;
|
||||
|
||||
if( ( m_Ch != '"' ) && ( m_Ch != '\'' ) )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Attribute values must be enclosed in quotes" );
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Attribute values must be enclosed in quotes" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
wQuoteChar = m_Ch;
|
||||
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
else if( m_Ch == wQuoteChar )
|
||||
break;
|
||||
return hr;
|
||||
else if( m_Ch == wQuoteChar )
|
||||
break;
|
||||
else if( m_Ch == '&' )
|
||||
{
|
||||
SkipNextAdvance();
|
||||
if( FAILED( hr = ConvertEscape() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
}
|
||||
else if( m_Ch == '<' )
|
||||
else if( m_Ch == '<' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
Error( E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
|
||||
// copy character into the buffer
|
||||
|
||||
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
|
||||
|
||||
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
|
||||
*m_pWritePtr = m_Ch;
|
||||
m_pWritePtr++;
|
||||
m_pWritePtr++;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -296,18 +296,18 @@ HRESULT XMLParser::AdvanceAttrVal()
|
|||
// Ignores leading whitespace. Currently does not support unicode names
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::AdvanceName()
|
||||
{
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
|
||||
if( ( ( m_Ch < 'A' ) || ( m_Ch > 'Z' ) ) &&
|
||||
( ( m_Ch < 'a' ) || ( m_Ch > 'z' ) ) &&
|
||||
( m_Ch != '_' ) && ( m_Ch != ':' ) )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Names must start with an alphabetic character or _ or :" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
Error( E_INVALID_XML_SYNTAX, "Names must start with an alphabetic character or _ or :" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
while( ( ( m_Ch >= 'A' ) && ( m_Ch <= 'Z' ) ) ||
|
||||
|
|
@ -319,17 +319,17 @@ HRESULT XMLParser::AdvanceName()
|
|||
|
||||
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
|
||||
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
}
|
||||
|
||||
*m_pWritePtr = m_Ch;
|
||||
m_pWritePtr++;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
SkipNextAdvance();
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -343,7 +343,7 @@ HRESULT XMLParser::AdvanceName()
|
|||
// Returns S_OK if there are more characters, E_ABORT for no characters to read
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
|
||||
{
|
||||
{
|
||||
if( m_bSkipNextAdvance )
|
||||
{
|
||||
m_bSkipNextAdvance = FALSE;
|
||||
|
|
@ -351,20 +351,20 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
|
|||
}
|
||||
|
||||
// If we hit EOF in the middle of a character,
|
||||
// it's ok-- we'll just have a corrupt last character
|
||||
// it's ok-- we'll just have a corrupt last character
|
||||
// (the buffer is padded with double NULLs )
|
||||
|
||||
if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) )
|
||||
{
|
||||
// Read more from the file
|
||||
FillBuffer();
|
||||
FillBuffer();
|
||||
|
||||
// We are at EOF if it is still NULL
|
||||
if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) )
|
||||
{
|
||||
if( !bOkToFail )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Unexpected EOF while parsing XML file" );
|
||||
Error( E_INVALID_XML_SYNTAX, "Unexpected EOF while parsing XML file" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
else
|
||||
|
|
@ -372,7 +372,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
|
|||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_bUnicode == FALSE )
|
||||
{
|
||||
|
|
@ -382,13 +382,13 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
|
|||
else // if( m_bUnicode == TRUE )
|
||||
{
|
||||
m_Ch = *((WCHAR *)m_pReadPtr);
|
||||
|
||||
|
||||
if( m_bReverseBytes )
|
||||
{
|
||||
m_Ch = ( m_Ch << 8 ) + ( m_Ch >> 8 );
|
||||
}
|
||||
|
||||
m_pReadPtr += 2;
|
||||
|
||||
m_pReadPtr += 2;
|
||||
}
|
||||
|
||||
if( m_Ch == '\n' )
|
||||
|
|
@ -398,114 +398,114 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
|
|||
}
|
||||
else if( m_Ch != '\r' )
|
||||
m_pISAXCallback->m_LinePos++;
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Name: XMLParser::AdvanceElement
|
||||
// Desc: Builds <element> data, calls callback
|
||||
// Desc: Builds <element> data, calls callback
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::AdvanceElement()
|
||||
{
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// write ptr at the beginning of the buffer
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
return hr;
|
||||
|
||||
// if first character wasn't '<', we wouldn't be here
|
||||
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
|
||||
if( m_Ch == '!' )
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if ( m_Ch == '-' )
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != '-' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != '-' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '-' after '<!-'" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceComment() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = AdvanceComment() ) )
|
||||
return hr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if( m_Ch != '[' )
|
||||
|
||||
if( m_Ch != '[' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'C' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'C' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'D' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'D' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'A' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'A' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'T' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'T' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'A' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != 'A' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != '[' )
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( m_Ch != '[' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
if( FAILED( hr = AdvanceCDATA() ) )
|
||||
if( FAILED( hr = AdvanceCDATA() ) )
|
||||
return hr;
|
||||
}
|
||||
else if( m_Ch == '/' )
|
||||
else if( m_Ch == '/' )
|
||||
{
|
||||
WCHAR *pEntityRefVal = m_pWritePtr;
|
||||
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
return hr;
|
||||
|
||||
if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal,
|
||||
if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal,
|
||||
(UINT) ( m_pWritePtr - pEntityRefVal ) ) ) )
|
||||
return E_ABORT;
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
return hr;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
if( m_Ch != '>' )
|
||||
{
|
||||
|
|
@ -513,42 +513,42 @@ HRESULT XMLParser::AdvanceElement()
|
|||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
}
|
||||
else if( m_Ch == '?' )
|
||||
else if( m_Ch == '?' )
|
||||
{
|
||||
// just skip any xml header tag since not really important after identifying character set
|
||||
for( ;; )
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
if ( m_Ch == '>' )
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLAttribute Attributes[ XML_MAX_ATTRIBUTES_PER_ELEMENT ];
|
||||
XMLAttribute Attributes[ XML_MAX_ATTRIBUTES_PER_ELEMENT ];
|
||||
UINT NumAttrs;
|
||||
|
||||
WCHAR *pEntityRefVal = m_pWritePtr;
|
||||
UINT EntityRefLen;
|
||||
|
||||
NumAttrs = 0;
|
||||
|
||||
|
||||
SkipNextAdvance();
|
||||
|
||||
// Entity tag
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
return hr;
|
||||
|
||||
EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal );
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
return hr;
|
||||
|
||||
// read attributes
|
||||
while( ( m_Ch != '>' ) && ( m_Ch != '/' ) )
|
||||
{
|
||||
|
|
@ -556,31 +556,31 @@ HRESULT XMLParser::AdvanceElement()
|
|||
|
||||
if ( NumAttrs >= XML_MAX_ATTRIBUTES_PER_ELEMENT )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Elements may not have more than %d attributes", XML_MAX_ATTRIBUTES_PER_ELEMENT );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
Error( E_INVALID_XML_SYNTAX, "Elements may not have more than %d attributes", XML_MAX_ATTRIBUTES_PER_ELEMENT );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
Attributes[ NumAttrs ].strName = m_pWritePtr;
|
||||
|
||||
|
||||
// Attribute name
|
||||
if( FAILED( hr = AdvanceName() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
Attributes[ NumAttrs ].NameLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName );
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
return hr;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
if( m_Ch != '=' )
|
||||
if( m_Ch != '=' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '=' character after attribute name" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
return hr;
|
||||
|
||||
Attributes[ NumAttrs ].strValue = m_pWritePtr;
|
||||
|
|
@ -588,29 +588,29 @@ HRESULT XMLParser::AdvanceElement()
|
|||
if( FAILED( hr = AdvanceAttrVal() ) )
|
||||
return hr;
|
||||
|
||||
Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr -
|
||||
Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr -
|
||||
Attributes[ NumAttrs ].strValue );
|
||||
|
||||
++NumAttrs;
|
||||
|
||||
|
||||
if( FAILED( hr = ConsumeSpace() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
}
|
||||
|
||||
if( m_Ch == '/' )
|
||||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
return hr;
|
||||
if( m_Ch != '>' )
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Expecting '>' after '/' in element tag" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
|
||||
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
|
||||
Attributes, NumAttrs ) ) )
|
||||
return E_ABORT;
|
||||
|
||||
|
|
@ -619,7 +619,7 @@ HRESULT XMLParser::AdvanceElement()
|
|||
}
|
||||
else
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
|
||||
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
|
||||
Attributes, NumAttrs ) ) )
|
||||
return E_ABORT;
|
||||
}
|
||||
|
|
@ -637,7 +637,7 @@ HRESULT XMLParser::AdvanceCDATA()
|
|||
{
|
||||
HRESULT hr;
|
||||
WORD wStage = 0;
|
||||
|
||||
|
||||
if( FAILED( m_pISAXCallback->CDATABegin() ) )
|
||||
return E_ABORT;
|
||||
|
||||
|
|
@ -645,10 +645,10 @@ HRESULT XMLParser::AdvanceCDATA()
|
|||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
*m_pWritePtr = m_Ch;
|
||||
m_pWritePtr++;
|
||||
|
||||
|
||||
if( ( m_Ch == ']' ) && ( wStage == 0 ) )
|
||||
wStage = 1;
|
||||
else if( ( m_Ch == ']' ) && ( wStage == 1 ) )
|
||||
|
|
@ -666,9 +666,9 @@ HRESULT XMLParser::AdvanceCDATA()
|
|||
if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) )
|
||||
return E_ABORT;
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
|
||||
return E_ABORT;
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ HRESULT XMLParser::AdvanceCDATA()
|
|||
|
||||
if( FAILED( m_pISAXCallback->CDATAEnd() ) )
|
||||
return E_ABORT;
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -694,24 +694,24 @@ HRESULT XMLParser::AdvanceComment()
|
|||
{
|
||||
if( FAILED( hr = AdvanceCharacter() ) )
|
||||
return hr;
|
||||
|
||||
|
||||
if (( m_Ch == '-' ) && ( wStage == 0 ))
|
||||
wStage = 1;
|
||||
else if (( m_Ch == '-' ) && ( wStage == 1 ))
|
||||
wStage = 2;
|
||||
else if (( m_Ch == '>' ) && ( wStage == 2 ))
|
||||
break;
|
||||
else if (( m_Ch == '>' ) && ( wStage == 2 ))
|
||||
break;
|
||||
else
|
||||
wStage = 0;
|
||||
wStage = 0;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Name: XMLParser::RegisterSAXCallbackInterface
|
||||
// Desc: Registers callback interface
|
||||
// Desc: Registers callback interface
|
||||
//-------------------------------------------------------------------------------------
|
||||
VOID XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback )
|
||||
{
|
||||
|
|
@ -721,7 +721,7 @@ VOID XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback )
|
|||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Name: XMLParser::GetSAXCallbackInterface
|
||||
// Desc: Returns current callback interface
|
||||
// Desc: Returns current callback interface
|
||||
//-------------------------------------------------------------------------------------
|
||||
ISAXCallback* XMLParser::GetSAXCallbackInterface()
|
||||
{
|
||||
|
|
@ -740,7 +740,7 @@ HRESULT XMLParser::MainParseLoop()
|
|||
|
||||
if( FAILED( m_pISAXCallback->StartDocument() ) )
|
||||
return E_ABORT;
|
||||
|
||||
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
|
||||
FillBuffer();
|
||||
|
|
@ -751,57 +751,57 @@ HRESULT XMLParser::MainParseLoop()
|
|||
m_bReverseBytes = FALSE;
|
||||
m_pReadPtr += 2;
|
||||
}
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0xFFFE )
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0xFFFE )
|
||||
{
|
||||
m_bUnicode = TRUE;
|
||||
m_bReverseBytes = TRUE;
|
||||
m_pReadPtr += 2;
|
||||
m_pReadPtr += 2;
|
||||
}
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0x003C )
|
||||
{
|
||||
m_bUnicode = TRUE;
|
||||
m_bReverseBytes = FALSE;
|
||||
}
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0x3C00 )
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0x003C )
|
||||
{
|
||||
m_bUnicode = TRUE;
|
||||
m_bReverseBytes = TRUE;
|
||||
m_bReverseBytes = FALSE;
|
||||
}
|
||||
else if ( *((WCHAR *) m_pReadBuf ) == 0x3C00 )
|
||||
{
|
||||
m_bUnicode = TRUE;
|
||||
m_bReverseBytes = TRUE;
|
||||
}
|
||||
else if ( m_pReadBuf[ 0 ] == 0x3C )
|
||||
{
|
||||
m_bUnicode = FALSE;
|
||||
m_bReverseBytes = FALSE;
|
||||
m_bUnicode = FALSE;
|
||||
m_bReverseBytes = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Error( E_INVALID_XML_SYNTAX, "Unrecognized encoding (parser does not support UTF-8 language encodings)" );
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
return E_INVALID_XML_SYNTAX;
|
||||
}
|
||||
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
if( FAILED( AdvanceCharacter( TRUE ) ) )
|
||||
{
|
||||
if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) )
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
|
||||
return E_ABORT;
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
|
||||
return E_ABORT;
|
||||
|
||||
bWhiteSpaceOnly = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if( FAILED( m_pISAXCallback->EndDocument() ) )
|
||||
return E_ABORT;
|
||||
|
||||
return S_OK;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if( m_Ch == '<' )
|
||||
{
|
||||
if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) )
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
|
||||
return E_ABORT;
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
|
||||
return E_ABORT;
|
||||
|
||||
bWhiteSpaceOnly = TRUE;
|
||||
}
|
||||
|
|
@ -810,45 +810,45 @@ HRESULT XMLParser::MainParseLoop()
|
|||
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
|
||||
if( FAILED( hr = AdvanceElement() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = AdvanceElement() ) )
|
||||
return hr;
|
||||
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if( m_Ch == '&' )
|
||||
{
|
||||
SkipNextAdvance();
|
||||
if( FAILED( hr = ConvertEscape() ) )
|
||||
return hr;
|
||||
if( FAILED( hr = ConvertEscape() ) )
|
||||
return hr;
|
||||
}
|
||||
|
||||
if( bWhiteSpaceOnly && ( m_Ch != ' ' ) && ( m_Ch != '\n' ) && ( m_Ch != '\r' ) &&
|
||||
( m_Ch != '\t' ) )
|
||||
if( bWhiteSpaceOnly && ( m_Ch != ' ' ) && ( m_Ch != '\n' ) && ( m_Ch != '\r' ) &&
|
||||
( m_Ch != '\t' ) )
|
||||
{
|
||||
bWhiteSpaceOnly = FALSE;
|
||||
}
|
||||
|
||||
*m_pWritePtr = m_Ch;
|
||||
m_pWritePtr++;
|
||||
|
||||
|
||||
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
|
||||
{
|
||||
if( !bWhiteSpaceOnly )
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf,
|
||||
( UINT ) ( m_pWritePtr - m_pWriteBuf ),
|
||||
{
|
||||
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf,
|
||||
( UINT ) ( m_pWritePtr - m_pWriteBuf ),
|
||||
TRUE ) ) )
|
||||
{
|
||||
return E_ABORT;
|
||||
return E_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
m_pWritePtr = m_pWriteBuf;
|
||||
bWhiteSpaceOnly = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -858,36 +858,36 @@ HRESULT XMLParser::MainParseLoop()
|
|||
// Desc: Builds element data
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
|
||||
{
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( m_pISAXCallback == NULL )
|
||||
return E_NOINTERFACE;
|
||||
|
||||
m_pISAXCallback->m_LineNum = 1;
|
||||
m_pISAXCallback->m_LineNum = 1;
|
||||
m_pISAXCallback->m_LinePos = 0;
|
||||
m_pISAXCallback->m_strFilename = strFilename; // save this off only while we parse the file
|
||||
|
||||
m_bSkipNextAdvance = FALSE;
|
||||
m_pReadPtr = m_pReadBuf;
|
||||
|
||||
m_pReadPtr = m_pReadBuf;
|
||||
|
||||
m_pReadBuf[ 0 ] = '\0';
|
||||
m_pReadBuf[ 1 ] = '\0';
|
||||
|
||||
m_pReadBuf[ 1 ] = '\0';
|
||||
|
||||
m_pInXMLBuffer = NULL;
|
||||
m_uInXMLBufferCharsLeft = 0;
|
||||
|
||||
|
||||
WCHAR wchFilename[ 64 ];
|
||||
|
||||
swprintf_s(wchFilename,64,L"%s",strFilename);
|
||||
|
||||
m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL );
|
||||
m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL );
|
||||
|
||||
if( m_hFile == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
{
|
||||
Error( E_COULD_NOT_OPEN_FILE, "Error opening file" );
|
||||
hr = E_COULD_NOT_OPEN_FILE;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -897,14 +897,14 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
|
|||
m_dwCharsConsumed = 0;
|
||||
hr = MainParseLoop();
|
||||
}
|
||||
|
||||
|
||||
// Close the file
|
||||
if( m_hFile != INVALID_HANDLE_VALUE )
|
||||
CloseHandle( m_hFile );
|
||||
m_hFile = INVALID_HANDLE_VALUE;
|
||||
|
||||
// we no longer own strFilename, so un-set it
|
||||
m_pISAXCallback->m_strFilename = NULL;
|
||||
m_pISAXCallback->m_strFilename = NULL;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
@ -914,38 +914,38 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
|
|||
// Desc: Builds element data
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize )
|
||||
{
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
if( m_pISAXCallback == NULL )
|
||||
return E_NOINTERFACE;
|
||||
|
||||
m_pISAXCallback->m_LineNum = 1;
|
||||
m_pISAXCallback->m_LineNum = 1;
|
||||
m_pISAXCallback->m_LinePos = 0;
|
||||
m_pISAXCallback->m_strFilename = ""; // save this off only while we parse the file
|
||||
|
||||
m_bSkipNextAdvance = FALSE;
|
||||
m_pReadPtr = m_pReadBuf;
|
||||
|
||||
|
||||
m_pReadBuf[ 0 ] = '\0';
|
||||
m_pReadBuf[ 1 ] = '\0';
|
||||
m_pReadBuf[ 1 ] = '\0';
|
||||
|
||||
m_hFile = NULL;
|
||||
m_pInXMLBuffer = strBuffer;
|
||||
m_uInXMLBufferCharsLeft = uBufferSize;
|
||||
m_dwCharsTotal = uBufferSize;
|
||||
m_dwCharsConsumed = 0;
|
||||
|
||||
|
||||
hr = MainParseLoop();
|
||||
|
||||
// we no longer own strFilename, so un-set it
|
||||
m_pISAXCallback->m_strFilename = NULL;
|
||||
m_pISAXCallback->m_strFilename = NULL;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// XMLParser::Error()
|
||||
// XMLParser::Error()
|
||||
// Logs an error through the callback interface
|
||||
//-------------------------------------------------------------------------------------
|
||||
#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation
|
||||
|
|
@ -960,7 +960,7 @@ VOID XMLParser::Error( HRESULT hErr, CONST CHAR* strFormat, ... )
|
|||
va_start( pArglist, strFormat );
|
||||
|
||||
vsprintf( strBuffer, strFormat, pArglist );
|
||||
|
||||
|
||||
m_pISAXCallback->Error( hErr, strBuffer );
|
||||
va_end( pArglist );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Windows64\Social\SocialManager.h"
|
||||
#include "Windows64\Sentient\DynamicConfigurations.h"
|
||||
#include "Windows64\Network\WinsockNetLayer.h"
|
||||
#include "Windows64\Windows64_Xuid.h"
|
||||
#elif defined __PSVITA__
|
||||
#include "PSVita\Sentient\SentientManager.h"
|
||||
#include "StatsCounter.h"
|
||||
|
|
@ -200,7 +201,15 @@ DWORD IQNetPlayer::GetCurrentRtt() { return 0; }
|
|||
bool IQNetPlayer::IsHost() { return m_isHostPlayer; }
|
||||
bool IQNetPlayer::IsGuest() { return false; }
|
||||
bool IQNetPlayer::IsLocal() { return !m_isRemote; }
|
||||
PlayerUID IQNetPlayer::GetXuid() { return (PlayerUID)(0xe000d45248242f2e + m_smallId); } // todo: restore to INVALID_XUID once saves support this
|
||||
PlayerUID IQNetPlayer::GetXuid()
|
||||
{
|
||||
// Compatibility model:
|
||||
// - Preferred path: use per-player resolved XUID populated from login/add-player flow.
|
||||
// - Fallback path: keep legacy base+smallId behavior for peers/saves still on old scheme.
|
||||
if (m_resolvedXuid != INVALID_XUID)
|
||||
return m_resolvedXuid;
|
||||
return (PlayerUID)(0xe000d45248242f2e + m_smallId);
|
||||
}
|
||||
LPCWSTR IQNetPlayer::GetGamertag() { return m_gamertag; }
|
||||
int IQNetPlayer::GetSessionIndex() { return m_smallId; }
|
||||
bool IQNetPlayer::IsTalking() { return false; }
|
||||
|
|
@ -226,6 +235,7 @@ void Win64_SetupRemoteQNetPlayer(IQNetPlayer * player, BYTE smallId, bool isHost
|
|||
player->m_smallId = smallId;
|
||||
player->m_isRemote = !isLocal;
|
||||
player->m_isHostPlayer = isHost;
|
||||
player->m_resolvedXuid = INVALID_XUID;
|
||||
swprintf_s(player->m_gamertag, 32, L"Player%d", smallId);
|
||||
if (smallId >= IQNet::s_playerCount)
|
||||
IQNet::s_playerCount = smallId + 1;
|
||||
|
|
@ -285,8 +295,13 @@ IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid)
|
|||
{
|
||||
for (DWORD i = 0; i < s_playerCount; i++)
|
||||
{
|
||||
if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i];
|
||||
if (!Win64_IsActivePlayer(&m_player[i], i))
|
||||
continue;
|
||||
|
||||
if (m_player[i].GetXuid() == xuid)
|
||||
return &m_player[i];
|
||||
}
|
||||
// Keep existing stub behavior: return host slot instead of NULL on miss.
|
||||
return &m_player[0];
|
||||
}
|
||||
DWORD IQNet::GetPlayerCount()
|
||||
|
|
@ -301,7 +316,13 @@ DWORD IQNet::GetPlayerCount()
|
|||
QNET_STATE IQNet::GetState() { return _iQNetStubState; }
|
||||
bool IQNet::IsHost() { return s_isHosting; }
|
||||
HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO * pInviteInfo) { return S_OK; }
|
||||
void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; }
|
||||
void IQNet::HostGame()
|
||||
{
|
||||
_iQNetStubState = QNET_STATE_SESSION_STARTING;
|
||||
s_isHosting = true;
|
||||
// Host slot keeps legacy XUID so old host player data remains addressable.
|
||||
m_player[0].m_resolvedXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
}
|
||||
void IQNet::ClientJoinGame()
|
||||
{
|
||||
_iQNetStubState = QNET_STATE_SESSION_STARTING;
|
||||
|
|
@ -312,6 +333,7 @@ void IQNet::ClientJoinGame()
|
|||
m_player[i].m_smallId = (BYTE)i;
|
||||
m_player[i].m_isRemote = true;
|
||||
m_player[i].m_isHostPlayer = false;
|
||||
m_player[i].m_resolvedXuid = INVALID_XUID;
|
||||
m_player[i].m_gamertag[0] = 0;
|
||||
m_player[i].SetCustomDataValue(0);
|
||||
}
|
||||
|
|
@ -326,6 +348,7 @@ void IQNet::EndGame()
|
|||
m_player[i].m_smallId = (BYTE)i;
|
||||
m_player[i].m_isRemote = false;
|
||||
m_player[i].m_isHostPlayer = false;
|
||||
m_player[i].m_resolvedXuid = INVALID_XUID;
|
||||
m_player[i].m_gamertag[0] = 0;
|
||||
m_player[i].SetCustomDataValue(0);
|
||||
}
|
||||
|
|
@ -575,10 +598,13 @@ void C_4JProfile::GetXUID(int iPad, PlayerUID * pXuid, bool bOnlineXuid)
|
|||
*pXuid = INVALID_XUID;
|
||||
return;
|
||||
}
|
||||
// LoginPacket reads this value as client identity:
|
||||
// - host keeps legacy host XUID for world compatibility
|
||||
// - non-host uses persistent uid.dat-backed XUID
|
||||
if (IQNet::s_isHosting)
|
||||
*pXuid = 0xe000d45248242f2e;
|
||||
*pXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
else
|
||||
*pXuid = 0xe000d45248242f2e + WinsockNetLayer::GetLocalSmallId();
|
||||
*pXuid = Win64Xuid::ResolvePersistentXuid();
|
||||
#else
|
||||
* pXuid = 0xe000d45248242f2e + iPad;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor
|
|||
enforceUnicodeSheet = false;
|
||||
bidirectional = false;
|
||||
xPos = yPos = 0.0f;
|
||||
m_bold = false;
|
||||
m_italic = false;
|
||||
m_underline = false;
|
||||
m_strikethrough = false;
|
||||
|
||||
// Set up member variables
|
||||
m_cols = cols;
|
||||
|
|
@ -126,6 +130,60 @@ Font::~Font()
|
|||
}
|
||||
#endif
|
||||
|
||||
void Font::renderStyleLine(float x0, float y0, float x1, float y1)
|
||||
{
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
float u = 0.0f, v = 0.0f;
|
||||
t->begin();
|
||||
t->tex(u, v);
|
||||
t->vertex(x0, y1, 0.0f);
|
||||
t->tex(u, v);
|
||||
t->vertex(x1, y1, 0.0f);
|
||||
t->tex(u, v);
|
||||
t->vertex(x1, y0, 0.0f);
|
||||
t->tex(u, v);
|
||||
t->vertex(x0, y0, 0.0f);
|
||||
t->end();
|
||||
}
|
||||
|
||||
void Font::addCharacterQuad(wchar_t c)
|
||||
{
|
||||
float xOff = c % m_cols * m_charWidth;
|
||||
float yOff = c / m_cols * m_charWidth;
|
||||
float width = charWidths[c] - .01f;
|
||||
float height = m_charHeight - .01f;
|
||||
float fontWidth = m_cols * m_charWidth;
|
||||
float fontHeight = m_rows * m_charHeight;
|
||||
const float shear = m_italic ? (height * 0.25f) : 0.0f;
|
||||
float x0 = xPos, x1 = xPos + width + shear;
|
||||
float y0 = yPos, y1 = yPos + height;
|
||||
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x0, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x1, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x1, y0, 0.0f);
|
||||
t->tex(xOff / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x0, y0, 0.0f);
|
||||
|
||||
if (m_bold)
|
||||
{
|
||||
float dx = 1.0f;
|
||||
t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x0 + dx, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x1 + dx, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x1 + dx, y0, 0.0f);
|
||||
t->tex(xOff / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x0 + dx, y0, 0.0f);
|
||||
}
|
||||
|
||||
xPos += static_cast<float>(charWidths[c]);
|
||||
}
|
||||
|
||||
void Font::renderCharacter(wchar_t c)
|
||||
{
|
||||
float xOff = c % m_cols * m_charWidth;
|
||||
|
|
@ -137,37 +195,47 @@ void Font::renderCharacter(wchar_t c)
|
|||
float fontWidth = m_cols * m_charWidth;
|
||||
float fontHeight = m_rows * m_charHeight;
|
||||
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
// 4J Stu - Changed to a quad so that we can use within a command buffer
|
||||
#if 1
|
||||
const float shear = m_italic ? (height * 0.25f) : 0.0f;
|
||||
float x0 = xPos, x1 = xPos + width + shear;
|
||||
float y0 = yPos, y1 = yPos + height;
|
||||
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(xPos, yPos + height, 0.0f);
|
||||
|
||||
t->vertex(x0, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(xPos + width, yPos + height, 0.0f);
|
||||
|
||||
t->vertex(x1, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, yOff / fontHeight);
|
||||
t->vertex(xPos + width, yPos, 0.0f);
|
||||
|
||||
t->vertex(x1, y0, 0.0f);
|
||||
t->tex(xOff / fontWidth, yOff / fontHeight);
|
||||
t->vertex(xPos, yPos, 0.0f);
|
||||
|
||||
t->vertex(x0, y0, 0.0f);
|
||||
t->end();
|
||||
#else
|
||||
t->begin(GL_TRIANGLE_STRIP);
|
||||
t->tex(xOff / 128.0F, yOff / 128.0F);
|
||||
t->vertex(xPos, yPos, 0.0f);
|
||||
t->tex(xOff / 128.0F, (yOff + 7.99f) / 128.0F);
|
||||
t->vertex(xPos, yPos + 7.99f, 0.0f);
|
||||
t->tex((xOff + width) / 128.0F, yOff / 128.0F);
|
||||
t->vertex(xPos + width, yPos, 0.0f);
|
||||
t->tex((xOff + width) / 128.0F, (yOff + 7.99f) / 128.0F);
|
||||
t->vertex(xPos + width, yPos + 7.99f, 0.0f);
|
||||
t->end();
|
||||
#endif
|
||||
|
||||
xPos += (float) charWidths[c];
|
||||
if (m_bold)
|
||||
{
|
||||
float dx = 1.0f;
|
||||
t->begin();
|
||||
t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x0 + dx, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight);
|
||||
t->vertex(x1 + dx, y1, 0.0f);
|
||||
t->tex((xOff + width) / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x1 + dx, y0, 0.0f);
|
||||
t->tex(xOff / fontWidth, yOff / fontHeight);
|
||||
t->vertex(x0 + dx, y0, 0.0f);
|
||||
t->end();
|
||||
}
|
||||
|
||||
if (m_underline)
|
||||
renderStyleLine(x0, y1 - 1.0f, xPos + static_cast<float>(charWidths[c]), y1);
|
||||
|
||||
if (m_strikethrough)
|
||||
{
|
||||
float mid = y0 + height * 0.5f;
|
||||
renderStyleLine(x0, mid - 0.5f, xPos + static_cast<float>(charWidths[c]), mid + 0.5f);
|
||||
}
|
||||
|
||||
xPos += static_cast<float>(charWidths[c]);
|
||||
}
|
||||
|
||||
void Font::drawShadow(const wstring& str, int x, int y, int color)
|
||||
|
|
@ -176,6 +244,26 @@ void Font::drawShadow(const wstring& str, int x, int y, int color)
|
|||
draw(str, x, y, color, false);
|
||||
}
|
||||
|
||||
void Font::drawShadowLiteral(const wstring& str, int x, int y, int color)
|
||||
{
|
||||
int shadowColor = (color & 0xFCFCFC) >> 2 | (color & 0xFF000000);
|
||||
drawLiteral(str, x + 1, y + 1, shadowColor);
|
||||
drawLiteral(str, x, y, color);
|
||||
}
|
||||
|
||||
void Font::drawLiteral(const wstring& str, int x, int y, int color)
|
||||
{
|
||||
if (str.empty()) return;
|
||||
if ((color & 0xFC000000) == 0) color |= 0xFF000000;
|
||||
textures->bindTexture(m_textureLocation);
|
||||
glColor4f((color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F, (color >> 24 & 255) / 255.0F);
|
||||
xPos = static_cast<float>(x);
|
||||
yPos = static_cast<float>(y);
|
||||
wstring cleanStr = sanitize(str);
|
||||
for (size_t i = 0; i < cleanStr.length(); ++i)
|
||||
renderCharacter(cleanStr.at(i));
|
||||
}
|
||||
|
||||
void Font::drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h)
|
||||
{
|
||||
drawWordWrapInternal(str, x + 1, y + 1, w, color, true, h);
|
||||
|
|
@ -193,24 +281,42 @@ wstring Font::reorderBidi(const wstring &str)
|
|||
return str;
|
||||
}
|
||||
|
||||
static bool isSectionFormatCode(wchar_t ca)
|
||||
{
|
||||
if ((ca >= L'0' && ca <= L'9') || (ca >= L'a' && ca <= L'f') || (ca >= L'A' && ca <= L'F'))
|
||||
return true;
|
||||
wchar_t l = static_cast<wchar_t>(ca | 32);
|
||||
return l == L'l' || l == L'o' || l == L'n' || l == L'm' || l == L'r' || l == L'k';
|
||||
}
|
||||
|
||||
void Font::draw(const wstring &str, bool dropShadow)
|
||||
{
|
||||
// Bind the texture
|
||||
textures->bindTexture(m_textureLocation);
|
||||
|
||||
bool noise = false;
|
||||
m_bold = m_italic = m_underline = m_strikethrough = false;
|
||||
wstring cleanStr = sanitize(str);
|
||||
|
||||
for (int i = 0; i < (int)cleanStr.length(); ++i)
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
|
||||
for (int i = 0; i < static_cast<int>(cleanStr.length()); ++i)
|
||||
{
|
||||
// Map character
|
||||
wchar_t c = cleanStr.at(i);
|
||||
|
||||
if (c == 167 && i + 1 < cleanStr.length())
|
||||
{
|
||||
// 4J - following block was:
|
||||
// int colorN = L"0123456789abcdefk".indexOf(str.toLowerCase().charAt(i + 1));
|
||||
wchar_t ca = cleanStr[i+1];
|
||||
if (!isSectionFormatCode(ca))
|
||||
{
|
||||
t->end();
|
||||
renderCharacter(167);
|
||||
renderCharacter(ca);
|
||||
t->begin();
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
int colorN = 16;
|
||||
if(( ca >= L'0' ) && (ca <= L'9')) colorN = ca - L'0';
|
||||
else if(( ca >= L'a' ) && (ca <= L'f')) colorN = (ca - L'a') + 10;
|
||||
|
|
@ -218,20 +324,22 @@ void Font::draw(const wstring &str, bool dropShadow)
|
|||
|
||||
if (colorN == 16)
|
||||
{
|
||||
noise = true;
|
||||
wchar_t l = static_cast<wchar_t>(ca | 32);
|
||||
if (l == L'l') m_bold = true;
|
||||
else if (l == L'o') m_italic = true;
|
||||
else if (l == L'n') m_underline = true;
|
||||
else if (l == L'm') m_strikethrough = true;
|
||||
else if (l == L'r') m_bold = m_italic = m_underline = m_strikethrough = noise = false;
|
||||
else if (l == L'k') noise = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
noise = false;
|
||||
if (colorN < 0 || colorN > 15) colorN = 15;
|
||||
|
||||
if (dropShadow) colorN += 16;
|
||||
|
||||
int color = colors[colorN];
|
||||
glColor3f((color >> 16) / 255.0F, ((color >> 8) & 255) / 255.0F, (color & 255) / 255.0F);
|
||||
}
|
||||
|
||||
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -247,8 +355,10 @@ void Font::draw(const wstring &str, bool dropShadow)
|
|||
c = newc;
|
||||
}
|
||||
|
||||
renderCharacter(c);
|
||||
addCharacterQuad(c);
|
||||
}
|
||||
|
||||
t->end();
|
||||
}
|
||||
|
||||
void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow)
|
||||
|
|
@ -280,20 +390,34 @@ int Font::width(const wstring& str)
|
|||
{
|
||||
wchar_t c = cleanStr.at(i);
|
||||
|
||||
if(c == 167)
|
||||
if (c == 167)
|
||||
{
|
||||
// Ignore the character used to define coloured text
|
||||
++i;
|
||||
if (i + 1 < cleanStr.length() && isSectionFormatCode(cleanStr[i+1]))
|
||||
++i;
|
||||
else
|
||||
{
|
||||
len += charWidths[167];
|
||||
if (i + 1 < cleanStr.length())
|
||||
len += charWidths[static_cast<unsigned>(cleanStr[++i])];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len += charWidths[c];
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int Font::widthLiteral(const wstring& str)
|
||||
{
|
||||
wstring cleanStr = sanitize(str);
|
||||
if (cleanStr == L"") return 0;
|
||||
int len = 0;
|
||||
for (size_t i = 0; i < cleanStr.length(); ++i)
|
||||
len += charWidths[static_cast<unsigned>(cleanStr.at(i))];
|
||||
return len;
|
||||
}
|
||||
|
||||
wstring Font::sanitize(const wstring& str)
|
||||
{
|
||||
wstring sb = str;
|
||||
|
|
@ -467,7 +591,7 @@ void Font::setBidirectional(bool bidirectional)
|
|||
|
||||
bool Font::AllCharactersValid(const wstring &str)
|
||||
{
|
||||
for (int i = 0; i < (int)str.length(); ++i)
|
||||
for (int i = 0; i < static_cast<int>(str.length()); ++i)
|
||||
{
|
||||
wchar_t c = str.at(i);
|
||||
|
||||
|
|
@ -512,15 +636,15 @@ void Font::renderFakeCB(IntBuffer *ib)
|
|||
float uo = (0.0f) / 128.0f;
|
||||
float vo = (0.0f) / 128.0f;
|
||||
|
||||
t->vertexUV((float)(0), (float)( 0 + s), (float)( 0), (float)( ix / 128.0f + uo), (float)( (iy + s) / 128.0f + vo));
|
||||
t->vertexUV((float)(0 + s), (float)( 0 + s), (float)( 0), (float)( (ix + s) / 128.0f + uo), (float)( (iy + s) / 128.0f + vo));
|
||||
t->vertexUV((float)(0 + s), (float)( 0), (float)( 0), (float)( (ix + s) / 128.0f + uo), (float)( iy / 128.0f + vo));
|
||||
t->vertexUV((float)(0), (float)( 0), (float)( 0), (float)( ix / 128.0f + uo), (float)( iy / 128.0f + vo));
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(0 + s), static_cast<float>(0), static_cast<float>(ix / 128.0f + uo), static_cast<float>((iy + s) / 128.0f + vo));
|
||||
t->vertexUV(static_cast<float>(0 + s), static_cast<float>(0 + s), static_cast<float>(0), static_cast<float>((ix + s) / 128.0f + uo), static_cast<float>((iy + s) / 128.0f + vo));
|
||||
t->vertexUV(static_cast<float>(0 + s), static_cast<float>(0), static_cast<float>(0), static_cast<float>((ix + s) / 128.0f + uo), static_cast<float>(iy / 128.0f + vo));
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(0), static_cast<float>(0), static_cast<float>(ix / 128.0f + uo), static_cast<float>(iy / 128.0f + vo));
|
||||
// target.colorBlit(texture, x + xo, y, color, ix, iy,
|
||||
// charWidths[chars[i]], 8);
|
||||
t->end();
|
||||
|
||||
glTranslatef((float)charWidths[i], 0, 0);
|
||||
glTranslatef(static_cast<float>(charWidths[i]), 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ private:
|
|||
float xPos;
|
||||
float yPos;
|
||||
|
||||
// § format state (bold, italic, underline, strikethrough); set during draw(), reset by §r
|
||||
bool m_bold;
|
||||
bool m_italic;
|
||||
bool m_underline;
|
||||
bool m_strikethrough;
|
||||
|
||||
bool enforceUnicodeSheet; // use unicode sheet for ascii
|
||||
bool bidirectional; // use bidi to flip strings
|
||||
|
||||
|
|
@ -41,9 +47,12 @@ public:
|
|||
|
||||
private:
|
||||
void renderCharacter(wchar_t c); // 4J added
|
||||
void addCharacterQuad(wchar_t c);
|
||||
void renderStyleLine(float x0, float y0, float x1, float y1); // solid line for underline/strikethrough
|
||||
|
||||
public:
|
||||
void drawShadow(const wstring& str, int x, int y, int color);
|
||||
void drawShadowLiteral(const wstring& str, int x, int y, int color); // draw without interpreting § codes
|
||||
void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
|
||||
void draw(const wstring &str, int x, int y, int color);
|
||||
/**
|
||||
|
|
@ -58,11 +67,13 @@ private:
|
|||
|
||||
void draw(const wstring &str, bool dropShadow);
|
||||
void draw(const wstring& str, int x, int y, int color, bool dropShadow);
|
||||
void drawLiteral(const wstring& str, int x, int y, int color); // no § parsing
|
||||
int MapCharacter(wchar_t c); // 4J added
|
||||
bool CharacterExists(wchar_t c); // 4J added
|
||||
|
||||
public:
|
||||
int width(const wstring& str);
|
||||
int widthLiteral(const wstring& str); // width without skipping § codes (for chat input)
|
||||
wstring sanitize(const wstring& str);
|
||||
void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
|
||||
|
||||
|
|
|
|||
|
|
@ -745,7 +745,12 @@ void GameRenderer::renderItemInHand(float a, int eye)
|
|||
{
|
||||
turnOnLightLayer(a);
|
||||
PIXBeginNamedEvent(0,"Item in hand render");
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask(false);
|
||||
itemInHandRenderer->render(a);
|
||||
glDepthMask(true);
|
||||
glDisable(GL_BLEND);
|
||||
PIXEndNamedEvent();
|
||||
turnOffLightLayer(a);
|
||||
}
|
||||
|
|
@ -1169,8 +1174,6 @@ void GameRenderer::render(float a, bool bFirst)
|
|||
|
||||
lastNsTime = System::nanoTime();
|
||||
|
||||
ApplyGammaPostProcess();
|
||||
|
||||
if (!mc->options->hideGui || mc->screen != NULL)
|
||||
{
|
||||
mc->gui->render(a, mc->screen != NULL, xMouse, yMouse);
|
||||
|
|
@ -1196,6 +1199,7 @@ void GameRenderer::render(float a, bool bFirst)
|
|||
if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a);
|
||||
}
|
||||
|
||||
ApplyGammaPostProcess();
|
||||
}
|
||||
|
||||
void GameRenderer::renderLevel(float a)
|
||||
|
|
@ -1351,7 +1355,7 @@ void GameRenderer::DisableUpdateThread()
|
|||
#endif
|
||||
}
|
||||
|
||||
void GameRenderer::renderLevel(float a, __int64 until)
|
||||
void GameRenderer::renderLevel(float a, int64_t until)
|
||||
{
|
||||
// if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen
|
||||
|
||||
|
|
@ -1434,7 +1438,7 @@ void GameRenderer::renderLevel(float a, __int64 until)
|
|||
|
||||
if (until == 0) break;
|
||||
|
||||
__int64 diff = until - System::nanoTime();
|
||||
int64_t diff = until - System::nanoTime();
|
||||
if (diff < 0) break;
|
||||
if (diff > 1000000000) break;
|
||||
} while (true);
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ public:
|
|||
void setupCamera(float a, int eye);
|
||||
private:
|
||||
void renderItemInHand(float a, int eye);
|
||||
__int64 lastActiveTime;
|
||||
__int64 lastNsTime;
|
||||
int64_t lastActiveTime;
|
||||
int64_t lastNsTime;
|
||||
// 4J - changes brought forward from 1.8.2
|
||||
bool _updateLightTexture;
|
||||
public:
|
||||
|
|
@ -133,7 +133,7 @@ private:
|
|||
public:
|
||||
void render(float a, bool bFirst); // 4J added bFirst
|
||||
void renderLevel(float a);
|
||||
void renderLevel(float a, __int64 until);
|
||||
void renderLevel(float a, int64_t until);
|
||||
private:
|
||||
Random *random;
|
||||
int rainSoundTime;
|
||||
|
|
|
|||
|
|
@ -846,17 +846,29 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
MemSect(31);
|
||||
if (minecraft->options->renderDebug)
|
||||
{
|
||||
const int debugLeft = 1;
|
||||
const int debugTop = 1;
|
||||
const float maxContentWidth = 1200.f;
|
||||
const float maxContentHeight = 420.f;
|
||||
float scale = (float)(screenWidth - debugLeft - 8) / maxContentWidth;
|
||||
float scaleV = (float)(screenHeight - debugTop - 80) / maxContentHeight;
|
||||
if (scaleV < scale) scale = scaleV;
|
||||
if (scale > 1.f) scale = 1.f;
|
||||
if (scale < 0.5f) scale = 0.5f;
|
||||
glPushMatrix();
|
||||
glTranslatef((float)debugLeft, (float)debugTop, 0.f);
|
||||
glScalef(scale, scale, 1.f);
|
||||
glTranslatef((float)-debugLeft, (float)-debugTop, 0.f);
|
||||
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
|
||||
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff);
|
||||
font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats4(), iSafezoneXHalf+2, 32 + 40, 0xffffff);
|
||||
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", debugLeft, debugTop, 0xffffff);
|
||||
font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), debugLeft, debugTop + 12, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats1(), debugLeft, debugTop + 22, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats2(), debugLeft, debugTop + 32, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats3(), debugLeft, debugTop + 42, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats4(), debugLeft, debugTop + 52, 0xffffff);
|
||||
|
||||
// TERRAIN FEATURES
|
||||
int iYPos=82;
|
||||
int iYPos = debugTop + 62;
|
||||
|
||||
if(minecraft->level->dimension->id==0)
|
||||
{
|
||||
|
|
@ -867,18 +879,31 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
wfeature[eTerrainFeature_Village] = L"Village: ";
|
||||
wfeature[eTerrainFeature_Ravine] = L"Ravine: ";
|
||||
|
||||
for(int i=0;i<app.m_vTerrainFeatures.size();i++)
|
||||
float maxW = (float)(screenWidth - debugLeft - 8) / scale;
|
||||
float maxWForContent = maxW - (float)font->width(L"...");
|
||||
bool truncated[eTerrainFeature_Count] = {};
|
||||
|
||||
for (int i = 0; i < (int)app.m_vTerrainFeatures.size(); i++)
|
||||
{
|
||||
FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i];
|
||||
int type = pFeatureData->eTerrainFeature;
|
||||
if (type < eTerrainFeature_Stronghold || type > eTerrainFeature_Ravine) continue;
|
||||
if (truncated[type]) continue;
|
||||
|
||||
wstring itemInfo = L"[" + std::to_wstring( pFeatureData->x*16 ) + L", " + std::to_wstring( pFeatureData->z*16 ) + L"] ";
|
||||
wfeature[pFeatureData->eTerrainFeature] += itemInfo;
|
||||
if (font->width(wfeature[type] + itemInfo) <= maxWForContent)
|
||||
wfeature[type] += itemInfo;
|
||||
else
|
||||
{
|
||||
wfeature[type] += L"...";
|
||||
truncated[type] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = eTerrainFeature_Stronghold; i < (int) eTerrainFeature_Count; i++ )
|
||||
{
|
||||
font->drawShadow(wfeature[i], iSafezoneXHalf + 2, iYPos, 0xffffff);
|
||||
iYPos+=10;
|
||||
font->drawShadow(wfeature[i], debugLeft, iYPos, 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -899,10 +924,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
double xBlockPos = floor(minecraft->player->x);
|
||||
double yBlockPos = floor(minecraft->player->y);
|
||||
double zBlockPos = floor(minecraft->player->z);
|
||||
drawString(font, L"x: " + std::to_wstring(minecraft->player->x) + L"/ Head: " + std::to_wstring(static_cast<int>(xBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->xChunk), iSafezoneXHalf+2, iYPos + 8 * 0, 0xe0e0e0);
|
||||
drawString(font, L"y: " + std::to_wstring(minecraft->player->y) + L"/ Head: " + std::to_wstring(static_cast<int>(yBlockPos)), iSafezoneXHalf+2, iYPos + 8 * 1, 0xe0e0e0);
|
||||
drawString(font, L"z: " + std::to_wstring(minecraft->player->z) + L"/ Head: " + std::to_wstring(static_cast<int>(zBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->zChunk), iSafezoneXHalf+2, iYPos + 8 * 2, 0xe0e0e0);
|
||||
drawString(font, L"f: " + std::to_wstring(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + std::to_wstring(minecraft->player->yRot), iSafezoneXHalf+2, iYPos + 8 * 3, 0xe0e0e0);
|
||||
drawString(font, L"x: " + std::to_wstring(minecraft->player->x) + L"/ Head: " + std::to_wstring(static_cast<int>(xBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->xChunk), debugLeft, iYPos + 8 * 0, 0xe0e0e0);
|
||||
drawString(font, L"y: " + std::to_wstring(minecraft->player->y) + L"/ Head: " + std::to_wstring(static_cast<int>(yBlockPos)), debugLeft, iYPos + 8 * 1, 0xe0e0e0);
|
||||
drawString(font, L"z: " + std::to_wstring(minecraft->player->z) + L"/ Head: " + std::to_wstring(static_cast<int>(zBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->zChunk), debugLeft, iYPos + 8 * 2, 0xe0e0e0);
|
||||
drawString(font, L"f: " + std::to_wstring(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + std::to_wstring(minecraft->player->yRot), debugLeft, iYPos + 8 * 3, 0xe0e0e0);
|
||||
iYPos += 8*4;
|
||||
|
||||
int px = Mth::floor(minecraft->player->x);
|
||||
|
|
@ -914,7 +939,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource());
|
||||
drawString(
|
||||
font,
|
||||
L"b: " + biome->m_name + L" (" + std::to_wstring(biome->id) + L")", iSafezoneXHalf+2, iYPos, 0xe0e0e0);
|
||||
L"b: " + biome->m_name + L" (" + std::to_wstring(biome->id) + L")", debugLeft, iYPos, 0xe0e0e0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
|
@ -971,15 +996,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
||||
// 4J Stu - We have moved the chat text to a xui
|
||||
#if 0
|
||||
#if 0 // defined(_WINDOWS64) // Temporarily disable this chat in favor of iggy chat until we have better visual parity
|
||||
glPushMatrix();
|
||||
// 4J-PB we need to move this up a bit because we've moved the quick select
|
||||
//glTranslatef(0, ((float)screenHeight) - 48, 0);
|
||||
glTranslatef(0.0f, (float)(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 - 3 + 22) - 24.0f, 0.0f);
|
||||
// glScalef(1.0f / ssc.scale, 1.0f / ssc.scale, 1);
|
||||
glTranslatef(0.0f, static_cast<float>(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 - 3 + 22) - 24.0f, 0.0f);
|
||||
|
||||
// 4J-PB - we need gui messages for each of the possible 4 splitscreen players
|
||||
if(bDisplayGui)
|
||||
{
|
||||
int iPad=minecraft->player->GetXboxPad();
|
||||
|
|
@ -993,23 +1013,21 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
|||
if (t < 0) t = 0;
|
||||
if (t > 1) t = 1;
|
||||
t = t * t;
|
||||
int alpha = (int) (255 * t);
|
||||
int alpha = static_cast<int>(255 * t);
|
||||
if (isChatting) alpha = 255;
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
int x = iSafezoneXHalf+2;
|
||||
int y = -((int)i) * 9;
|
||||
int y = -(static_cast<int>(i)) * 9;
|
||||
if(bTwoPlayerSplitscreen)
|
||||
{
|
||||
y+= iHeightOffset;
|
||||
}
|
||||
|
||||
wstring msg = guiMessages[iPad][i].string;
|
||||
// 4J-PB - fill the black bar across the whole screen, otherwise it looks odd due to the safe area
|
||||
this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
font->drawShadow(msg, iSafezoneXHalf+4, y, 0xffffff + (alpha << 24));
|
||||
}
|
||||
}
|
||||
|
|
@ -1455,7 +1473,7 @@ void Gui::displayClientMessage(int messageId, int iPad)
|
|||
}
|
||||
|
||||
// 4J Added
|
||||
void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataAScale, int dataAWarning, __int64 *dataB, float dataBScale, int dataBWarning)
|
||||
void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataAScale, int dataAWarning, int64_t *dataB, float dataBScale, int dataBWarning)
|
||||
{
|
||||
int height = minecraft->height;
|
||||
// This causes us to cover xScale*dataLength pixels in the horizontal
|
||||
|
|
@ -1494,7 +1512,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
|
|||
t->color(0xff000000 + cc * 256);
|
||||
}
|
||||
|
||||
__int64 aVal = dataA[i] / dataAScale;
|
||||
int64_t aVal = dataA[i] / dataAScale;
|
||||
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||
|
|
@ -1511,7 +1529,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
|
|||
t->color(0xff808080 + cc/2 * 256);
|
||||
}
|
||||
|
||||
__int64 bVal = dataB[i] / dataBScale;
|
||||
int64_t bVal = dataB[i] / dataBScale;
|
||||
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0));
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||
|
|
@ -1522,7 +1540,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int64 (*func)(unsigned int dataPos, unsigned int dataSource) )
|
||||
void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64_t (*func)(unsigned int dataPos, unsigned int dataSource) )
|
||||
{
|
||||
int height = minecraft->height;
|
||||
|
||||
|
|
@ -1539,8 +1557,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int
|
|||
Tesselator *t = Tesselator::getInstance();
|
||||
|
||||
t->begin(GL_LINES);
|
||||
__int64 thisVal = 0;
|
||||
__int64 topVal = 0;
|
||||
int64_t thisVal = 0;
|
||||
int64_t topVal = 0;
|
||||
for (int i = 0; i < dataLength; i++)
|
||||
{
|
||||
thisVal = 0;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,6 @@ public:
|
|||
float getJukeboxOpacity(int iPad);
|
||||
|
||||
// 4J Added
|
||||
void renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataAScale, int dataAWarning, __int64 *dataB, float dataBScale, int dataBWarning);
|
||||
void renderStackedGraph(int dataPos, int dataLength, int dataSources, __int64 (*func)(unsigned int dataPos, unsigned int dataSource) );
|
||||
void renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataAScale, int dataAWarning, int64_t *dataB, float dataBScale, int dataBWarning);
|
||||
void renderStackedGraph(int dataPos, int dataLength, int dataSources, int64_t (*func)(unsigned int dataPos, unsigned int dataSource) );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ void GuiComponent::fill(int x0, int y0, int x1, int y1, int col)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(r, g, b, a);
|
||||
t->begin();
|
||||
t->vertex((float)(x0), (float)( y1), (float)( 0));
|
||||
t->vertex((float)(x1), (float)( y1), (float)( 0));
|
||||
t->vertex((float)(x1), (float)( y0), (float)( 0));
|
||||
t->vertex((float)(x0), (float)( y0), (float)( 0));
|
||||
t->vertex(static_cast<float>(x0), static_cast<float>(y1), static_cast<float>(0));
|
||||
t->vertex(static_cast<float>(x1), static_cast<float>(y1), static_cast<float>(0));
|
||||
t->vertex(static_cast<float>(x1), static_cast<float>(y0), static_cast<float>(0));
|
||||
t->vertex(static_cast<float>(x0), static_cast<float>(y0), static_cast<float>(0));
|
||||
t->end();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_BLEND);
|
||||
|
|
@ -77,11 +77,11 @@ void GuiComponent::fillGradient(int x0, int y0, int x1, int y1, int col1, int co
|
|||
Tesselator *t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
t->color(r1, g1, b1, a1);
|
||||
t->vertex((float)(x1), (float)( y0), blitOffset);
|
||||
t->vertex((float)(x0), (float)( y0), blitOffset);
|
||||
t->vertex(static_cast<float>(x1), static_cast<float>(y0), blitOffset);
|
||||
t->vertex(static_cast<float>(x0), static_cast<float>(y0), blitOffset);
|
||||
t->color(r2, g2, b2, a2);
|
||||
t->vertex((float)(x0), (float)( y1), blitOffset);
|
||||
t->vertex((float)(x1), (float)( y1), blitOffset);
|
||||
t->vertex(static_cast<float>(x0), static_cast<float>(y1), blitOffset);
|
||||
t->vertex(static_cast<float>(x1), static_cast<float>(y1), blitOffset);
|
||||
t->end();
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
|
@ -105,6 +105,11 @@ void GuiComponent::drawString(Font *font, const wstring& str, int x, int y, int
|
|||
font->drawShadow(str, x, y, color);
|
||||
}
|
||||
|
||||
void GuiComponent::drawStringLiteral(Font *font, const wstring& str, int x, int y, int color)
|
||||
{
|
||||
font->drawShadowLiteral(str, x, y, color);
|
||||
}
|
||||
|
||||
void GuiComponent::blit(int x, int y, int sx, int sy, int w, int h)
|
||||
{
|
||||
float us = 1 / 256.0f;
|
||||
|
|
@ -117,20 +122,20 @@ void GuiComponent::blit(int x, int y, int sx, int sy, int w, int h)
|
|||
const float extraShift = 0.75f;
|
||||
|
||||
// 4J - subtracting extraShift (actual screen pixels, so need to compensate for physical & game width) from each x & y coordinate to compensate for centre of pixels in directx vs openGL
|
||||
float dx = ( extraShift * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys;
|
||||
float dx = ( extraShift * static_cast<float>(Minecraft::GetInstance()->width) ) / static_cast<float>(Minecraft::GetInstance()->width_phys);
|
||||
// 4J - Also factor in the scaling from gui coordinate space to the screen. This varies based on user-selected gui scale, and whether we are in a viewport mode or not
|
||||
dx /= Gui::currentGuiScaleFactor;
|
||||
float dy = extraShift / Gui::currentGuiScaleFactor;
|
||||
// Ensure that the x/y, width and height are actually pixel aligned at our current scale factor - in particular, for split screen mode with the default (3X)
|
||||
// scale, we have an overall scale factor of 3 * 0.5 = 1.5, and so any odd pixels won't align
|
||||
float fx = (floorf((float)x * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fy = (floorf((float)y * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fw = (floorf((float)w * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fh = (floorf((float)h * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fx = (floorf(static_cast<float>(x) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fy = (floorf(static_cast<float>(y) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fw = (floorf(static_cast<float>(w) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
float fh = (floorf(static_cast<float>(h) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
|
||||
|
||||
t->vertexUV(fx + 0 - dx, fy + fh - dy, (float)( blitOffset), (float)( (sx + 0) * us), (float)( (sy + h) * vs));
|
||||
t->vertexUV(fx + fw - dx, fy + fh - dy, (float)( blitOffset), (float)( (sx + w) * us), (float)( (sy + h) * vs));
|
||||
t->vertexUV(fx + fw - dx, fy + 0 - dy, (float)( blitOffset), (float)( (sx + w) * us), (float)( (sy + 0) * vs));
|
||||
t->vertexUV(fx + 0 - dx, fy + 0 - dy, (float)( blitOffset), (float)( (sx + 0) * us), (float)( (sy + 0) * vs));
|
||||
t->vertexUV(fx + 0 - dx, fy + fh - dy, static_cast<float>(blitOffset), static_cast<float>((sx + 0) * us), static_cast<float>((sy + h) * vs));
|
||||
t->vertexUV(fx + fw - dx, fy + fh - dy, static_cast<float>(blitOffset), static_cast<float>((sx + w) * us), static_cast<float>((sy + h) * vs));
|
||||
t->vertexUV(fx + fw - dx, fy + 0 - dy, static_cast<float>(blitOffset), static_cast<float>((sx + w) * us), static_cast<float>((sy + 0) * vs));
|
||||
t->vertexUV(fx + 0 - dx, fy + 0 - dy, static_cast<float>(blitOffset), static_cast<float>((sx + 0) * us), static_cast<float>((sy + 0) * vs));
|
||||
t->end();
|
||||
}
|
||||
|
|
@ -15,5 +15,6 @@ public:
|
|||
GuiComponent(); // 4J added
|
||||
void drawCenteredString(Font *font, const wstring& str, int x, int y, int color);
|
||||
void drawString(Font *font, const wstring& str, int x, int y, int color);
|
||||
void drawStringLiteral(Font* font, const wstring& str, int x, int y, int color);
|
||||
void blit(int x, int y, int sx, int sy, int w, int h);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -767,6 +767,9 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
|||
glPushMatrix();
|
||||
glTranslatef((float)-xOff, (float)-yOff, (float)-zOff);
|
||||
|
||||
if (layer == 1)
|
||||
glDepthMask(false);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// AP - also set the camera position so we can work out if a chunk is fogged or not
|
||||
RenderManager.SetCameraPosition((float)-xOff, (float)-yOff, (float)-zOff);
|
||||
|
|
@ -844,6 +847,10 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
|||
#endif // __PS3__
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
if (layer == 1)
|
||||
glDepthMask(true);
|
||||
|
||||
mc->gameRenderer->turnOffLightLayer(alpha); // 4J - brought forward from 1.8.2
|
||||
|
||||
#else
|
||||
|
|
@ -2076,9 +2083,9 @@ bool LevelRenderer::updateDirtyChunks()
|
|||
if( bAtomic || (index == 0) )
|
||||
{
|
||||
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
|
||||
// static __int64 totalTime = 0;
|
||||
// static __int64 countTime = 0;
|
||||
// __int64 startTime = System::currentTimeMillis();
|
||||
// static int64_t totalTime = 0;
|
||||
// static int64_t countTime = 0;
|
||||
// int64_t startTime = System::currentTimeMillis();
|
||||
|
||||
//app.DebugPrintf("Rebuilding permaChunk %d\n", index);
|
||||
|
||||
|
|
@ -2087,7 +2094,7 @@ bool LevelRenderer::updateDirtyChunks()
|
|||
if(index !=0)
|
||||
s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete
|
||||
|
||||
// __int64 endTime = System::currentTimeMillis();
|
||||
// int64_t endTime = System::currentTimeMillis();
|
||||
// totalTime += (endTime - startTime);
|
||||
// countTime++;
|
||||
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
|
||||
|
|
@ -2126,11 +2133,11 @@ bool LevelRenderer::updateDirtyChunks()
|
|||
static Chunk permaChunk;
|
||||
permaChunk.makeCopyForRebuild(chunk);
|
||||
LeaveCriticalSection(&m_csDirtyChunks);
|
||||
// static __int64 totalTime = 0;
|
||||
// static __int64 countTime = 0;
|
||||
// __int64 startTime = System::currentTimeMillis();
|
||||
// static int64_t totalTime = 0;
|
||||
// static int64_t countTime = 0;
|
||||
// int64_t startTime = System::currentTimeMillis();
|
||||
permaChunk.rebuild();
|
||||
// __int64 endTime = System::currentTimeMillis();
|
||||
// int64_t endTime = System::currentTimeMillis();
|
||||
// totalTime += (endTime - startTime);
|
||||
// countTime++;
|
||||
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ using namespace std;
|
|||
|
||||
// AP - this is a system that works out which chunks actually need to be grouped together via the deferral system when doing chunk::rebuild. Doing this will reduce the number
|
||||
// of chunks built in a single group and reduce the chance of seeing through the landscape when digging near the edges/corners of a chunk.
|
||||
// I've added another chunk flag to mark a chunk critical so it swipes a bit from the reference count value (goes to 3 bits to 2). This works on Vita because it doesn't have
|
||||
// I've added another chunk flag to mark a chunk critical so it swipes a bit from the reference count value (goes to 3 bits to 2). This works on Vita because it doesn't have
|
||||
// split screen reference counting.
|
||||
#ifdef __PSVITA__
|
||||
#define _CRITICAL_CHUNKS
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
#elif defined __PS3__
|
||||
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 110 * 1024 * 1024; // 4J - added
|
||||
#else
|
||||
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 55 * 1024 * 1024; // 4J - added
|
||||
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 55 * 1024 * 1024; // 4J - added
|
||||
#endif
|
||||
public:
|
||||
LevelRenderer(Minecraft *mc, Textures *textures);
|
||||
|
|
@ -216,7 +216,7 @@ public:
|
|||
// 4J - added for new render list handling
|
||||
// This defines the maximum size of renderable level, must be big enough to cope with actual size of level + view distance at each side
|
||||
// so that we can render the "infinite" sea at the edges
|
||||
static const int MAX_LEVEL_RENDER_SIZE[3];
|
||||
static const int MAX_LEVEL_RENDER_SIZE[3];
|
||||
static const int DIMENSION_OFFSETS[3];
|
||||
// This is the TOTAL area of columns of chunks to be allocated for render round the players. So for one player, it would be a region of
|
||||
// sqrt(PLAYER_RENDER_AREA) x sqrt(PLAYER_RENDER_AREA)
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
XLockFreeStack<int> dirtyChunksLockFreeStack;
|
||||
|
||||
bool dirtyChunkPresent;
|
||||
__int64 lastDirtyChunkFound;
|
||||
int64_t lastDirtyChunkFound;
|
||||
static const int FORCE_DIRTY_CHUNK_CHECK_PERIOD_MS = 125; // decreased from 250 to 125 - updated by detectiveren
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ public:
|
|||
virtual ~LocalPlayer();
|
||||
|
||||
int m_iScreenSection; // assuming 4player splitscreen for now, or -1 for single player
|
||||
__uint64 ullButtonsPressed; // Stores the button presses, since the inputmanager can be ticked faster than the minecraft
|
||||
uint64_t ullButtonsPressed; // Stores the button presses, since the inputmanager can be ticked faster than the minecraft
|
||||
// player tick, and a button press and release combo can be missed in the minecraft::tick
|
||||
|
||||
__uint64 ullDpad_last;
|
||||
__uint64 ullDpad_this;
|
||||
__uint64 ullDpad_filtered;
|
||||
uint64_t ullDpad_last;
|
||||
uint64_t ullDpad_this;
|
||||
uint64_t ullDpad_filtered;
|
||||
|
||||
// 4J-PB - moved these in from the minecraft structure, since they are per player things for splitscreen
|
||||
//int ticks;
|
||||
|
|
@ -105,7 +105,7 @@ public:
|
|||
virtual void readAdditionalSaveData(CompoundTag *entityTag);
|
||||
virtual void closeContainer();
|
||||
virtual void openTextEdit(shared_ptr<TileEntity> sign);
|
||||
virtual bool openContainer(shared_ptr<Container> container); // 4J added bool return
|
||||
virtual bool openContainer(shared_ptr<Container> container); // 4J added bool return
|
||||
virtual bool openHopper(shared_ptr<HopperTileEntity> container); // 4J added bool return
|
||||
virtual bool openHopper(shared_ptr<MinecartHopper> container); // 4J added bool return
|
||||
virtual bool openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<Container> container); // 4J added bool return
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void MinecartRenderer::render(shared_ptr<Entity> _cart, double x, double y, doub
|
|||
|
||||
bindTexture(cart);
|
||||
|
||||
__int64 seed = cart->entityId * 493286711l;
|
||||
int64_t seed = cart->entityId * 493286711l;
|
||||
seed = seed * seed * 4392167121l + seed * 98761;
|
||||
|
||||
float xo = ((((seed >> 16) & 0x7) + 0.5f) / 8.0f - 0.5f) * 0.004f;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\Minecraft.World\Minecraft.World.h"
|
||||
#include "Windows64\Windows64_Xuid.h"
|
||||
#include "ClientConnection.h"
|
||||
#include "..\Minecraft.World\HellRandomLevelSource.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
|
||||
|
|
@ -84,10 +85,10 @@
|
|||
#define DISABLE_LEVELTICK_THREAD
|
||||
|
||||
Minecraft *Minecraft::m_instance = NULL;
|
||||
__int64 Minecraft::frameTimes[512];
|
||||
__int64 Minecraft::tickTimes[512];
|
||||
int64_t Minecraft::frameTimes[512];
|
||||
int64_t Minecraft::tickTimes[512];
|
||||
int Minecraft::frameTimePos = 0;
|
||||
__int64 Minecraft::warezTime = 0;
|
||||
int64_t Minecraft::warezTime = 0;
|
||||
File Minecraft::workDir = File(L"");
|
||||
|
||||
#ifdef __PSVITA__
|
||||
|
|
@ -634,7 +635,7 @@ void Minecraft::run()
|
|||
return;
|
||||
}
|
||||
|
||||
__int64 lastTime = System::currentTimeMillis();
|
||||
int64_t lastTime = System::currentTimeMillis();
|
||||
int frames = 0;
|
||||
|
||||
while (running)
|
||||
|
|
@ -659,7 +660,7 @@ void Minecraft::run()
|
|||
timer->advanceTime();
|
||||
}
|
||||
|
||||
__int64 beforeTickTime = System::nanoTime();
|
||||
int64_t beforeTickTime = System::nanoTime();
|
||||
for (int i = 0; i < timer->ticks; i++)
|
||||
{
|
||||
ticks++;
|
||||
|
|
@ -671,7 +672,7 @@ void Minecraft::run()
|
|||
// setScreen(new LevelConflictScreen());
|
||||
// }
|
||||
}
|
||||
__int64 tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
checkGlError(L"Pre render");
|
||||
|
||||
TileRenderer::fancy = options->fancyGraphics;
|
||||
|
|
@ -1038,6 +1039,19 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
|
|||
PlayerUID playerXUIDOnline = INVALID_XUID;
|
||||
ProfileManager.GetXUID(idx,&playerXUIDOffline,false);
|
||||
ProfileManager.GetXUID(idx,&playerXUIDOnline,true);
|
||||
#ifdef _WINDOWS64
|
||||
// Compatibility rule for Win64 id migration
|
||||
// host keeps legacy host XUID, non-host uses persistent uid.dat XUID.
|
||||
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
|
||||
}
|
||||
#endif
|
||||
localplayers[idx]->setXuid(playerXUIDOffline);
|
||||
localplayers[idx]->setOnlineXuid(playerXUIDOnline);
|
||||
localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx));
|
||||
|
|
@ -1226,7 +1240,7 @@ void Minecraft::applyFrameMouseLook()
|
|||
|
||||
void Minecraft::run_middle()
|
||||
{
|
||||
static __int64 lastTime = 0;
|
||||
static int64_t lastTime = 0;
|
||||
static bool bFirstTimeIntoGame = true;
|
||||
static bool bAutosaveTimerSet=false;
|
||||
static unsigned int uiAutosaveTimer=0;
|
||||
|
|
@ -1485,7 +1499,7 @@ void Minecraft::run_middle()
|
|||
}
|
||||
|
||||
// Utility keys always work regardless of KBM active state
|
||||
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i) && !ui.GetMenuDisplayed(i))
|
||||
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.GetMenuDisplayed(i))
|
||||
{
|
||||
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_PAUSEMENU;
|
||||
app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i);
|
||||
|
|
@ -1508,7 +1522,7 @@ void Minecraft::run_middle()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef _FINAL_BUILD
|
||||
#if _DEBUG // ndef _FINAL_BUILD // Disable conflicting debug functionality in release builds
|
||||
if( app.DebugSettingsOn() && app.GetUseDPadForDebug() )
|
||||
{
|
||||
localplayers[i]->ullDpad_last = 0;
|
||||
|
|
@ -1790,7 +1804,7 @@ void Minecraft::run_middle()
|
|||
timer->advanceTime();
|
||||
}
|
||||
|
||||
//__int64 beforeTickTime = System::nanoTime();
|
||||
//int64_t beforeTickTime = System::nanoTime();
|
||||
for (int i = 0; i < timer->ticks; i++)
|
||||
{
|
||||
bool bLastTimerTick = ( i == ( timer->ticks - 1 ) );
|
||||
|
|
@ -1876,7 +1890,7 @@ void Minecraft::run_middle()
|
|||
// CompressedTileStorage::tick(); // 4J added
|
||||
// SparseDataStorage::tick(); // 4J added
|
||||
}
|
||||
//__int64 tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
//int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
MemSect(31);
|
||||
checkGlError(L"Pre render");
|
||||
MemSect(0);
|
||||
|
|
@ -2081,14 +2095,14 @@ void Minecraft::emergencySave()
|
|||
setLevel(NULL);
|
||||
}
|
||||
|
||||
void Minecraft::renderFpsMeter(__int64 tickTime)
|
||||
void Minecraft::renderFpsMeter(int64_t tickTime)
|
||||
{
|
||||
int nsPer60Fps = 1000000000l / 60;
|
||||
if (lastTimer == -1)
|
||||
{
|
||||
lastTimer = System::nanoTime();
|
||||
}
|
||||
__int64 now = System::nanoTime();
|
||||
int64_t now = System::nanoTime();
|
||||
Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime;
|
||||
Minecraft::frameTimes[(Minecraft::frameTimePos++) & (Minecraft::frameTimes_length - 1)] = now - lastTimer;
|
||||
lastTimer = now;
|
||||
|
|
@ -2120,7 +2134,7 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
|
|||
t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0));
|
||||
|
||||
t->end();
|
||||
__int64 totalTime = 0;
|
||||
int64_t totalTime = 0;
|
||||
for (int i = 0; i < Minecraft::frameTimes_length; i++)
|
||||
{
|
||||
totalTime += Minecraft::frameTimes[i];
|
||||
|
|
@ -2150,8 +2164,8 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
|
|||
t->color(0xff000000 + cc * 256);
|
||||
}
|
||||
|
||||
__int64 time = Minecraft::frameTimes[i] / 200000;
|
||||
__int64 time2 = Minecraft::tickTimes[i] / 200000;
|
||||
int64_t time = Minecraft::frameTimes[i] / 200000;
|
||||
int64_t time2 = Minecraft::tickTimes[i] / 200000;
|
||||
|
||||
t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0));
|
||||
t->vertex((float)(i + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||
|
|
@ -3637,7 +3651,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
|
||||
if (player->missTime > 0) player->missTime--;
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
#ifdef _DEBUG//_MENUS_ENABLED // disable DPad cheats on release builds
|
||||
if(app.DebugSettingsOn())
|
||||
{
|
||||
#ifndef __PSVITA__
|
||||
|
|
@ -3745,7 +3759,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
player->drop();
|
||||
}
|
||||
|
||||
__uint64 ullButtonsPressed=player->ullButtonsPressed;
|
||||
uint64_t ullButtonsPressed=player->ullButtonsPressed;
|
||||
|
||||
bool selected = false;
|
||||
#ifdef __PSVITA__
|
||||
|
|
@ -4298,6 +4312,19 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
|
|||
// player doesn't have an online UID, set it from the player name
|
||||
playerXUIDOnline.setForAdhoc();
|
||||
}
|
||||
#endif
|
||||
#ifdef _WINDOWS64
|
||||
// On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`.
|
||||
// To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID.
|
||||
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer);
|
||||
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
|
||||
}
|
||||
#endif
|
||||
player->setXuid(playerXUIDOffline);
|
||||
player->setOnlineXuid(playerXUIDOnline);
|
||||
|
|
@ -4481,6 +4508,18 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
|
|||
PlayerUID playerXUIDOnline = INVALID_XUID;
|
||||
ProfileManager.GetXUID(iTempPad,&playerXUIDOffline,false);
|
||||
ProfileManager.GetXUID(iTempPad,&playerXUIDOnline,true);
|
||||
#ifdef _WINDOWS64
|
||||
// Same compatibility rule as create/init paths.
|
||||
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad);
|
||||
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
|
||||
}
|
||||
#endif
|
||||
player->setXuid(playerXUIDOffline);
|
||||
player->setOnlineXuid(playerXUIDOnline);
|
||||
player->setIsGuest( ProfileManager.IsGuest(iTempPad) );
|
||||
|
|
@ -4776,7 +4815,7 @@ void Minecraft::delayTextureReload()
|
|||
reloadTextures = true;
|
||||
}
|
||||
|
||||
__int64 Minecraft::currentTimeMillis()
|
||||
int64_t Minecraft::currentTimeMillis()
|
||||
{
|
||||
return System::currentTimeMillis();//(Sys.getTime() * 1000) / Sys.getTimerResolution();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private:
|
|||
bool hasCrashed;
|
||||
|
||||
C4JThread::EventQueue* levelTickEventQueue;
|
||||
|
||||
|
||||
static void levelTickUpdateFunc(void* pParam);
|
||||
static void levelTickThreadInitFunc();
|
||||
|
||||
|
|
@ -170,11 +170,11 @@ private:
|
|||
LevelStorageSource *levelSource;
|
||||
public:
|
||||
static const int frameTimes_length = 512;
|
||||
static __int64 frameTimes[frameTimes_length];
|
||||
static int64_t frameTimes[frameTimes_length];
|
||||
static const int tickTimes_length = 512;
|
||||
static __int64 tickTimes[tickTimes_length];
|
||||
static int64_t tickTimes[tickTimes_length];
|
||||
static int frameTimePos;
|
||||
static __int64 warezTime;
|
||||
static int64_t warezTime;
|
||||
private:
|
||||
int rightClickDelay;
|
||||
public:
|
||||
|
|
@ -230,9 +230,9 @@ private:
|
|||
// String grabHugeScreenshot(File workDir2, int width, int height, int ssWidth, int ssHeight); // 4J - removed
|
||||
|
||||
// 4J - per player thing?
|
||||
__int64 lastTimer;
|
||||
int64_t lastTimer;
|
||||
|
||||
void renderFpsMeter(__int64 tickTime);
|
||||
void renderFpsMeter(int64_t tickTime);
|
||||
public:
|
||||
void stop();
|
||||
// 4J removed
|
||||
|
|
@ -253,7 +253,7 @@ public:
|
|||
//bool isRaining ;
|
||||
|
||||
// 4J - Moved to per player
|
||||
//__int64 lastTickTime;
|
||||
//int64_t lastTickTime;
|
||||
|
||||
private:
|
||||
// 4J- per player?
|
||||
|
|
@ -300,7 +300,7 @@ public:
|
|||
|
||||
static int maxSupportedTextureSize();
|
||||
void delayTextureReload();
|
||||
static __int64 currentTimeMillis();
|
||||
static int64_t currentTimeMillis();
|
||||
|
||||
#ifdef _DURANGO
|
||||
static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad);
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@
|
|||
//4J Added
|
||||
MinecraftServer *MinecraftServer::server = NULL;
|
||||
bool MinecraftServer::setTimeAtEndOfTick = false;
|
||||
__int64 MinecraftServer::setTime = 0;
|
||||
int64_t MinecraftServer::setTime = 0;
|
||||
bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
|
||||
__int64 MinecraftServer::setTimeOfDay = 0;
|
||||
int64_t MinecraftServer::setTimeOfDay = 0;
|
||||
bool MinecraftServer::m_bPrimaryPlayerSignedOut=false;
|
||||
bool MinecraftServer::s_bServerHalted=false;
|
||||
bool MinecraftServer::s_bSaveOnExitAnswered=false;
|
||||
#ifdef _ACK_CHUNK_SEND_THROTTLING
|
||||
bool MinecraftServer::s_hasSentEnoughPackets = false;
|
||||
__int64 MinecraftServer::s_tickStartTime = 0;
|
||||
int64_t MinecraftServer::s_tickStartTime = 0;
|
||||
vector<INetworkPlayer *> MinecraftServer::s_sentTo;
|
||||
#else
|
||||
int MinecraftServer::s_slowQueuePlayerIndex = 0;
|
||||
|
|
@ -581,7 +581,7 @@ MinecraftServer::~MinecraftServer()
|
|||
DeleteCriticalSection(&m_consoleInputCS);
|
||||
}
|
||||
|
||||
bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed)
|
||||
bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed)
|
||||
{
|
||||
// 4J - removed
|
||||
#if 0
|
||||
|
|
@ -692,7 +692,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
|
|||
// TODO: Stop loading, add error message.
|
||||
}
|
||||
|
||||
__int64 levelNanoTime = System::nanoTime();
|
||||
int64_t levelNanoTime = System::nanoTime();
|
||||
|
||||
wstring levelName = (initData && !initData->levelName.empty()) ? initData->levelName : GetDedicatedServerString(settings, L"level-name", L"world");
|
||||
wstring levelTypeString;
|
||||
|
|
@ -736,10 +736,10 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
|
|||
|
||||
#if 0
|
||||
wstring levelSeedString = settings->getString(L"level-seed", L"");
|
||||
__int64 levelSeed = (new Random())->nextLong();
|
||||
int64_t levelSeed = (new Random())->nextLong();
|
||||
if (levelSeedString.length() > 0)
|
||||
{
|
||||
long newSeed = _fromString<__int64>(levelSeedString);
|
||||
long newSeed = _fromString<int64_t>(levelSeedString);
|
||||
if (newSeed != 0) {
|
||||
levelSeed = newSeed;
|
||||
}
|
||||
|
|
@ -866,7 +866,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
|
|||
DeleteCriticalSection(&m_postProcessCS);
|
||||
}
|
||||
|
||||
bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData)
|
||||
bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, int64_t levelSeed, LevelType *pLevelType, NetworkGameInitData *initData)
|
||||
{
|
||||
// 4J - TODO - do with new save stuff
|
||||
// if (storageSource->requiresConversion(name))
|
||||
|
|
@ -1016,7 +1016,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
|||
m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
m_postUpdateThread->Run();
|
||||
|
||||
__int64 startTime = System::currentTimeMillis();
|
||||
int64_t startTime = System::currentTimeMillis();
|
||||
|
||||
// 4J Stu - Added this to temporarily make starting games on vita faster
|
||||
#ifdef __PSVITA__
|
||||
|
|
@ -1046,7 +1046,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
|||
csf->closeHandle(fe);
|
||||
}
|
||||
|
||||
__int64 lastTime = System::currentTimeMillis();
|
||||
int64_t lastTime = System::currentTimeMillis();
|
||||
#ifdef _LARGE_WORLDS
|
||||
if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld())
|
||||
{
|
||||
|
|
@ -1074,7 +1074,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
|||
}
|
||||
|
||||
#if 0
|
||||
__int64 lastStorageTickTime = System::currentTimeMillis();
|
||||
int64_t lastStorageTickTime = System::currentTimeMillis();
|
||||
|
||||
// Test code to enable full creation of levels at start up
|
||||
int halfsidelen = ( i == 0 ) ? 27 : 9;
|
||||
|
|
@ -1097,7 +1097,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
|||
}
|
||||
}
|
||||
#else
|
||||
__int64 lastStorageTickTime = System::currentTimeMillis();
|
||||
int64_t lastStorageTickTime = System::currentTimeMillis();
|
||||
Pos *spawnPos = level->getSharedSpawnPos();
|
||||
|
||||
int twoRPlusOne = r*2 + 1;
|
||||
|
|
@ -1114,7 +1114,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
|||
return false;
|
||||
}
|
||||
// printf(">>>%d %d %d\n",i,x,z);
|
||||
// __int64 now = System::currentTimeMillis();
|
||||
// int64_t now = System::currentTimeMillis();
|
||||
// if (now < lastTime) lastTime = now;
|
||||
// if (now > lastTime + 1000)
|
||||
{
|
||||
|
|
@ -1679,7 +1679,7 @@ bool MinecraftServer::getForceGameType()
|
|||
return forceGameType;
|
||||
}
|
||||
|
||||
__int64 MinecraftServer::getCurrentTimeMillis()
|
||||
int64_t MinecraftServer::getCurrentTimeMillis()
|
||||
{
|
||||
return System::currentTimeMillis();
|
||||
}
|
||||
|
|
@ -1695,7 +1695,7 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout)
|
|||
}
|
||||
|
||||
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
||||
void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||
void MinecraftServer::run(int64_t seed, void *lpParameter)
|
||||
{
|
||||
NetworkGameInitData *initData = NULL;
|
||||
DWORD initSettings = 0;
|
||||
|
|
@ -1728,18 +1728,18 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
|||
}
|
||||
}
|
||||
|
||||
__int64 lastTime = getCurrentTimeMillis();
|
||||
__int64 unprocessedTime = 0;
|
||||
int64_t lastTime = getCurrentTimeMillis();
|
||||
int64_t unprocessedTime = 0;
|
||||
while (running && !s_bServerHalted)
|
||||
{
|
||||
__int64 now = getCurrentTimeMillis();
|
||||
int64_t now = getCurrentTimeMillis();
|
||||
|
||||
// 4J Stu - When we pause the server, we don't want to count that as time passed
|
||||
// 4J Stu - TU-1 hotifx - Remove this line. We want to make sure that we tick connections at the proper rate when paused
|
||||
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
|
||||
//if(m_isServerPaused) lastTime = now;
|
||||
|
||||
__int64 passedTime = now - lastTime;
|
||||
int64_t passedTime = now - lastTime;
|
||||
if (passedTime > MS_PER_TICK * 40)
|
||||
{
|
||||
// logger.warning("Can't keep up! Did the system time change, or is the server overloaded?");
|
||||
|
|
@ -1765,19 +1765,19 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
|||
else
|
||||
{
|
||||
// int tickcount = 0;
|
||||
// __int64 beforeall = System::currentTimeMillis();
|
||||
// int64_t beforeall = System::currentTimeMillis();
|
||||
while (unprocessedTime > MS_PER_TICK)
|
||||
{
|
||||
unprocessedTime -= MS_PER_TICK;
|
||||
chunkPacketManagement_PreTick();
|
||||
// __int64 before = System::currentTimeMillis();
|
||||
// int64_t before = System::currentTimeMillis();
|
||||
tick();
|
||||
// __int64 after = System::currentTimeMillis();
|
||||
// int64_t after = System::currentTimeMillis();
|
||||
// PIXReportCounter(L"Server time",(float)(after-before));
|
||||
|
||||
chunkPacketManagement_PostTick();
|
||||
}
|
||||
// __int64 afterall = System::currentTimeMillis();
|
||||
// int64_t afterall = System::currentTimeMillis();
|
||||
// PIXReportCounter(L"Server time all",(float)(afterall-beforeall));
|
||||
// PIXReportCounter(L"Server ticks",(float)tickcount);
|
||||
}
|
||||
|
|
@ -2119,15 +2119,15 @@ void MinecraftServer::tick()
|
|||
players->broadcastAll( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id);
|
||||
}
|
||||
// #ifndef __PS3__
|
||||
static __int64 stc = 0;
|
||||
__int64 st0 = System::currentTimeMillis();
|
||||
static int64_t stc = 0;
|
||||
int64_t st0 = System::currentTimeMillis();
|
||||
PIXBeginNamedEvent(0,"Level tick %d",i);
|
||||
((Level *)level)->tick();
|
||||
__int64 st1 = System::currentTimeMillis();
|
||||
int64_t st1 = System::currentTimeMillis();
|
||||
PIXEndNamedEvent();
|
||||
PIXBeginNamedEvent(0,"Update lights %d",i);
|
||||
|
||||
__int64 st2 = System::currentTimeMillis();
|
||||
int64_t st2 = System::currentTimeMillis();
|
||||
PIXEndNamedEvent();
|
||||
PIXBeginNamedEvent(0,"Entity tick %d",i);
|
||||
// 4J added to stop ticking entities in levels when players are not in those levels.
|
||||
|
|
@ -2155,7 +2155,7 @@ void MinecraftServer::tick()
|
|||
level->getTracker()->tick();
|
||||
PIXEndNamedEvent();
|
||||
|
||||
__int64 st3 = System::currentTimeMillis();
|
||||
int64_t st3 = System::currentTimeMillis();
|
||||
// printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : %d\n", st1 - st0, st2 - st1, st3 - st2, st0 - stc );
|
||||
stc = st0;
|
||||
// #endif// __PS3__
|
||||
|
|
@ -2206,7 +2206,7 @@ void MinecraftServer::handleConsoleInputs()
|
|||
}
|
||||
}
|
||||
|
||||
void MinecraftServer::main(__int64 seed, void *lpParameter)
|
||||
void MinecraftServer::main(int64_t seed, void *lpParameter)
|
||||
{
|
||||
#if __PS3__
|
||||
ShutdownManager::HasStarted(ShutdownManager::eServerThread );
|
||||
|
|
@ -2286,7 +2286,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
|
|||
|
||||
void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player)
|
||||
{
|
||||
__int64 currentTime = System::currentTimeMillis();
|
||||
int64_t currentTime = System::currentTimeMillis();
|
||||
|
||||
if( ( currentTime - s_tickStartTime ) >= MAX_TICK_TIME_FOR_PACKET_SENDS )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ class CommandDispatcher;
|
|||
typedef struct _LoadSaveDataThreadParam
|
||||
{
|
||||
LPVOID data;
|
||||
__int64 fileSize;
|
||||
int64_t fileSize;
|
||||
const wstring saveName;
|
||||
_LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {}
|
||||
_LoadSaveDataThreadParam(LPVOID data, int64_t filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {}
|
||||
} LoadSaveDataThreadParam;
|
||||
|
||||
typedef struct _NetworkGameInitData
|
||||
{
|
||||
__int64 seed;
|
||||
int64_t seed;
|
||||
LoadSaveDataThreadParam *saveData;
|
||||
DWORD settings;
|
||||
LevelGenerationOptions *levelGen;
|
||||
|
|
@ -133,9 +133,9 @@ public:
|
|||
~MinecraftServer();
|
||||
private:
|
||||
// 4J Added - LoadSaveDataThreadParam
|
||||
bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed);
|
||||
bool initServer(int64_t seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed);
|
||||
void postProcessTerminate(ProgressRenderer *mcprogress);
|
||||
bool loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData);
|
||||
bool loadLevel(LevelStorageSource *storageSource, const wstring& name, int64_t levelSeed, LevelType *pLevelType, NetworkGameInitData *initData);
|
||||
void setProgress(const wstring& status, int progress);
|
||||
void endProgress();
|
||||
void saveAllChunks();
|
||||
|
|
@ -171,13 +171,13 @@ public:
|
|||
bool isUnderSpawnProtection(Level *level, int x, int y, int z, shared_ptr<Player> player);
|
||||
void setForceGameType(bool forceGameType);
|
||||
bool getForceGameType();
|
||||
static __int64 getCurrentTimeMillis();
|
||||
static int64_t getCurrentTimeMillis();
|
||||
int getPlayerIdleTimeout();
|
||||
void setPlayerIdleTimeout(int playerIdleTimeout);
|
||||
|
||||
public:
|
||||
void halt();
|
||||
void run(__int64 seed, void *lpParameter);
|
||||
void run(int64_t seed, void *lpParameter);
|
||||
|
||||
void broadcastStartSavingPacket();
|
||||
void broadcastStopSavingPacket();
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
void handleConsoleInput(const wstring& msg, ConsoleInputSource *source);
|
||||
void handleConsoleInputs();
|
||||
// void addTickable(Tickable tickable); // 4J removed
|
||||
static void main(__int64 seed, void *lpParameter);
|
||||
static void main(int64_t seed, void *lpParameter);
|
||||
static void HaltServer(bool bPrimaryPlayerSignedOut=false);
|
||||
|
||||
File *getFile(const wstring& name);
|
||||
|
|
@ -208,9 +208,9 @@ private:
|
|||
static MinecraftServer *server;
|
||||
|
||||
static bool setTimeOfDayAtEndOfTick;
|
||||
static __int64 setTimeOfDay;
|
||||
static int64_t setTimeOfDay;
|
||||
static bool setTimeAtEndOfTick;
|
||||
static __int64 setTime;
|
||||
static int64_t setTime;
|
||||
|
||||
static bool m_bPrimaryPlayerSignedOut; // 4J-PB added to tell the stopserver not to save the game - another player may have signed in in their place, so ProfileManager.IsSignedIn isn't enough
|
||||
static bool s_bServerHalted; // 4J Stu Added so that we can halt the server even before it's been created properly
|
||||
|
|
@ -234,9 +234,9 @@ public:
|
|||
|
||||
public:
|
||||
static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; }
|
||||
static void SetTimeOfDay(__int64 time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; }
|
||||
static void SetTime(__int64 time) { setTimeAtEndOfTick = true; setTime = time; }
|
||||
|
||||
static void SetTimeOfDay(int64_t time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; }
|
||||
static void SetTime(int64_t time) { setTimeAtEndOfTick = true; setTime = time; }
|
||||
|
||||
C4JThread::Event* m_serverPausedEvent;
|
||||
private:
|
||||
// 4J Added
|
||||
|
|
@ -245,7 +245,7 @@ private:
|
|||
// 4J Added - A static that stores the QNet index of the player that is next allowed to send a packet in the slow queue
|
||||
#ifdef _ACK_CHUNK_SEND_THROTTLING
|
||||
static bool s_hasSentEnoughPackets;
|
||||
static __int64 s_tickStartTime;
|
||||
static int64_t s_tickStartTime;
|
||||
static vector<INetworkPlayer *> s_sentTo;
|
||||
static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35;
|
||||
#else
|
||||
|
|
@ -267,7 +267,7 @@ public:
|
|||
#ifndef _ACK_CHUNK_SEND_THROTTLING
|
||||
static void cycleSlowQueueIndex();
|
||||
#endif
|
||||
|
||||
|
||||
void chunkPacketManagement_PreTick();
|
||||
void chunkPacketManagement_PostTick();
|
||||
|
||||
|
|
@ -275,5 +275,5 @@ public:
|
|||
void Suspend();
|
||||
bool IsSuspending();
|
||||
|
||||
// 4J Stu - A load of functions were all added in 1.0.1 in the ServerInterface, but I don't think we need any of them
|
||||
// 4J Stu - A load of functions were all added in 1.0.1 in the ServerInterface, but I don't think we need any of them
|
||||
};
|
||||
|
|
|
|||
|
|
@ -789,7 +789,7 @@ void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard)
|
|||
this->scoreboard = scoreboard;
|
||||
}
|
||||
|
||||
void MultiPlayerLevel::setDayTime(__int64 newTime)
|
||||
void MultiPlayerLevel::setDayTime(int64_t newTime)
|
||||
{
|
||||
// 4J: We send daylight cycle rule with host options so don't need this
|
||||
/*if (newTime < 0)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
virtual void createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag);
|
||||
virtual void setScoreboard(Scoreboard *scoreboard);
|
||||
virtual void setDayTime(__int64 newTime);
|
||||
virtual void setDayTime(int64_t newTime);
|
||||
|
||||
// 4J Stu - Added so we can have multiple local connections
|
||||
void addClientConnection(ClientConnection *c) { connections.push_back( c ); }
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@
|
|||
#define __RADLITTLEENDIAN__
|
||||
#ifdef __i386__
|
||||
#define __RADX86__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#endif
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
#define __RADX86__
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#endif
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
#define __RADNACL__
|
||||
#define __RAD32__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define __RADX86__
|
||||
#define __RADX86__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
#define __RAD64REGS__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
#endif
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
||||
|
||||
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
|
||||
|
||||
#define __RADWIIU__
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
|
||||
#undef RADRESTRICT /* could have been defined above... */
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
#endif
|
||||
|
|
@ -885,7 +885,7 @@
|
|||
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
|
||||
#else
|
||||
// NOTE: / / is a guaranteed parse error in C/C++.
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#endif
|
||||
|
||||
// WARNING : RAD_TLS should really only be used for debug/tools stuff
|
||||
|
|
@ -917,8 +917,8 @@
|
|||
#define RAD_S32 signed int
|
||||
// But pointers are 64 bits.
|
||||
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
|
||||
#define RAD_SINTa __w64 signed __int64
|
||||
#define RAD_UINTa __w64 unsigned __int64
|
||||
#define RAD_SINTa __w64 signed long long
|
||||
#define RAD_UINTa __w64 unsigned long long
|
||||
#else // non-vc.net compiler or /Wp64 turned off
|
||||
#define RAD_UINTa unsigned long long
|
||||
#define RAD_SINTa signed long long
|
||||
|
|
@ -976,8 +976,8 @@
|
|||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#elif defined(__RADX64__) || defined(__RAD32__)
|
||||
#define RAD_U64 unsigned __int64
|
||||
#define RAD_S64 signed __int64
|
||||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#else
|
||||
// 16-bit
|
||||
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
|
||||
|
|
@ -1134,7 +1134,7 @@
|
|||
|
||||
// helpers for doing an if ( ) with expect :
|
||||
// if ( RAD_LIKELY(expr) ) { ... }
|
||||
|
||||
|
||||
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
|
||||
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
|
||||
|
||||
|
|
@ -1324,7 +1324,7 @@
|
|||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable:4127)) \
|
||||
} while(0) \
|
||||
__pragma(warning(pop))
|
||||
__pragma(warning(pop))
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
__pragma(warning(push)) \
|
||||
|
|
@ -1333,10 +1333,10 @@
|
|||
__pragma(warning(pop))
|
||||
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
|
||||
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
|
|
@ -1345,7 +1345,7 @@
|
|||
|
||||
#define RAD_STATEMENT_END_FALSE \
|
||||
} while ( (void)0,0 )
|
||||
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
} while ( (void)1,1 )
|
||||
|
||||
|
|
@ -1355,7 +1355,7 @@
|
|||
RAD_STATEMENT_START \
|
||||
code \
|
||||
RAD_STATEMENT_END_FALSE
|
||||
|
||||
|
||||
#define RAD_INFINITE_LOOP( code ) \
|
||||
RAD_STATEMENT_START \
|
||||
code \
|
||||
|
|
@ -1363,7 +1363,7 @@
|
|||
|
||||
|
||||
// Must be placed after variable declarations for code compiled as .c
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
# define RR_UNUSED_VARIABLE(x) (void) x
|
||||
#else
|
||||
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
|
||||
|
|
@ -1473,7 +1473,7 @@
|
|||
// just to make gcc shut up about derefing null :
|
||||
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
|
||||
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
|
||||
|
||||
|
||||
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
|
||||
// you should then RR_ASSERT( &(ret->member) == ptr );
|
||||
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
|
||||
|
|
@ -1482,7 +1482,7 @@
|
|||
// Cache / prefetch macros :
|
||||
|
||||
// RR_PREFETCH for various platforms :
|
||||
//
|
||||
//
|
||||
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
|
||||
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
|
||||
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
|
||||
|
|
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
||||
// RAD_NO_BREAK : option if you don't like your assert to break
|
||||
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
|
||||
#ifdef RAD_NO_BREAK
|
||||
|
|
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
|
||||
|
||||
//-----------------------------------
|
||||
#ifdef RR_DO_ASSERTS
|
||||
#ifdef RR_DO_ASSERTS
|
||||
|
||||
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
|
||||
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
|
||||
|
|
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
|
|||
#define RR_BSWAP16 _byteswap_ushort
|
||||
#define RR_BSWAP32 _byteswap_ulong
|
||||
|
||||
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
|
||||
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define RR_BSWAP64 _byteswap_uint64
|
||||
|
||||
|
|
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
|
|||
return _Long;
|
||||
}
|
||||
|
||||
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
|
||||
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
|
||||
{
|
||||
__asm {
|
||||
mov eax, DWORD PTR _Long
|
||||
|
|
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
|
|||
|
||||
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||
|
||||
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
||||
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
|
||||
#pragma intrinsic(_rotl64)
|
||||
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
|
||||
|
||||
#elif defined(__RADCELL__)
|
||||
|
||||
|
|
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
|||
|
||||
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
|
||||
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
|
||||
|
||||
#else
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -114,8 +114,8 @@
|
|||
#define __RADLITTLEENDIAN__
|
||||
#ifdef __i386__
|
||||
#define __RADX86__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#else
|
||||
#define __RADARM__
|
||||
#endif
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
#define __RADX86__
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#endif
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
#define __RADNACL__
|
||||
#define __RAD32__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define __RADX86__
|
||||
#define __RADX86__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
#define __RAD64REGS__
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE inline
|
||||
#define RADRESTRICT __restrict
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
#endif
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
|
||||
|
||||
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
|
||||
|
||||
#define __RADWIIU__
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
|
||||
#undef RADRESTRICT /* could have been defined above... */
|
||||
#define RADRESTRICT __restrict
|
||||
|
||||
|
||||
#undef RADSTRUCT
|
||||
#define RADSTRUCT struct __attribute__((__packed__))
|
||||
#endif
|
||||
|
|
@ -885,7 +885,7 @@
|
|||
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
|
||||
#else
|
||||
// NOTE: / / is a guaranteed parse error in C/C++.
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
|
||||
#endif
|
||||
|
||||
// WARNING : RAD_TLS should really only be used for debug/tools stuff
|
||||
|
|
@ -917,8 +917,8 @@
|
|||
#define RAD_S32 signed int
|
||||
// But pointers are 64 bits.
|
||||
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
|
||||
#define RAD_SINTa __w64 signed __int64
|
||||
#define RAD_UINTa __w64 unsigned __int64
|
||||
#define RAD_SINTa __w64 signed long long
|
||||
#define RAD_UINTa __w64 unsigned long long
|
||||
#else // non-vc.net compiler or /Wp64 turned off
|
||||
#define RAD_UINTa unsigned long long
|
||||
#define RAD_SINTa signed long long
|
||||
|
|
@ -976,8 +976,8 @@
|
|||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#elif defined(__RADX64__) || defined(__RAD32__)
|
||||
#define RAD_U64 unsigned __int64
|
||||
#define RAD_S64 signed __int64
|
||||
#define RAD_U64 unsigned long long
|
||||
#define RAD_S64 signed long long
|
||||
#else
|
||||
// 16-bit
|
||||
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
|
||||
|
|
@ -1134,7 +1134,7 @@
|
|||
|
||||
// helpers for doing an if ( ) with expect :
|
||||
// if ( RAD_LIKELY(expr) ) { ... }
|
||||
|
||||
|
||||
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
|
||||
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
|
||||
|
||||
|
|
@ -1324,7 +1324,7 @@
|
|||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable:4127)) \
|
||||
} while(0) \
|
||||
__pragma(warning(pop))
|
||||
__pragma(warning(pop))
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
__pragma(warning(push)) \
|
||||
|
|
@ -1333,10 +1333,10 @@
|
|||
__pragma(warning(pop))
|
||||
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
#else
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
#endif
|
||||
|
||||
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
|
||||
|
|
@ -1345,7 +1345,7 @@
|
|||
|
||||
#define RAD_STATEMENT_END_FALSE \
|
||||
} while ( (void)0,0 )
|
||||
|
||||
|
||||
#define RAD_STATEMENT_END_TRUE \
|
||||
} while ( (void)1,1 )
|
||||
|
||||
|
|
@ -1355,7 +1355,7 @@
|
|||
RAD_STATEMENT_START \
|
||||
code \
|
||||
RAD_STATEMENT_END_FALSE
|
||||
|
||||
|
||||
#define RAD_INFINITE_LOOP( code ) \
|
||||
RAD_STATEMENT_START \
|
||||
code \
|
||||
|
|
@ -1363,7 +1363,7 @@
|
|||
|
||||
|
||||
// Must be placed after variable declarations for code compiled as .c
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
|
||||
# define RR_UNUSED_VARIABLE(x) (void) x
|
||||
#else
|
||||
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
|
||||
|
|
@ -1473,7 +1473,7 @@
|
|||
// just to make gcc shut up about derefing null :
|
||||
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
|
||||
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
|
||||
|
||||
|
||||
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
|
||||
// you should then RR_ASSERT( &(ret->member) == ptr );
|
||||
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
|
||||
|
|
@ -1482,7 +1482,7 @@
|
|||
// Cache / prefetch macros :
|
||||
|
||||
// RR_PREFETCH for various platforms :
|
||||
//
|
||||
//
|
||||
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
|
||||
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
|
||||
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
|
||||
|
|
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
||||
// RAD_NO_BREAK : option if you don't like your assert to break
|
||||
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
|
||||
#ifdef RAD_NO_BREAK
|
||||
|
|
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
|
|||
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
|
||||
|
||||
//-----------------------------------
|
||||
#ifdef RR_DO_ASSERTS
|
||||
#ifdef RR_DO_ASSERTS
|
||||
|
||||
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
|
||||
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
|
||||
|
|
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
|
|||
#define RR_BSWAP16 _byteswap_ushort
|
||||
#define RR_BSWAP32 _byteswap_ulong
|
||||
|
||||
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
|
||||
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define RR_BSWAP64 _byteswap_uint64
|
||||
|
||||
|
|
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
|
|||
return _Long;
|
||||
}
|
||||
|
||||
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
|
||||
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
|
||||
{
|
||||
__asm {
|
||||
mov eax, DWORD PTR _Long
|
||||
|
|
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
|
|||
|
||||
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||
|
||||
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
||||
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
|
||||
#pragma intrinsic(_rotl64)
|
||||
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
|
||||
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
|
||||
|
||||
#elif defined(__RADCELL__)
|
||||
|
||||
|
|
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
|
|||
|
||||
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
|
||||
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
|
||||
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
|
||||
|
||||
#else
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue