Merge upstream

This commit is contained in:
bootsareme 2026-03-06 16:41:35 -05:00
commit 3800fddd04
379 changed files with 6240 additions and 4137 deletions

116
.vscode/settings.json vendored Normal file
View 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
}
}

View file

@ -13,7 +13,7 @@ private:
wstring title; wstring title;
wstring desc; wstring desc;
Achievement *ach; Achievement *ach;
__int64 startTime; int64_t startTime;
ItemRenderer *ir; ItemRenderer *ir;
bool isHelper; bool isHelper;

View file

@ -1,14 +1,27 @@
#include "stdafx.h" #include "stdafx.h"
#include "ChatScreen.h" #include "ChatScreen.h"
#include "ClientConnection.h"
#include "Font.h"
#include "MultiplayerLocalPlayer.h" #include "MultiplayerLocalPlayer.h"
#include "..\Minecraft.World\SharedConstants.h" #include "..\Minecraft.World\SharedConstants.h"
#include "..\Minecraft.World\StringHelpers.h" #include "..\Minecraft.World\StringHelpers.h"
#include "..\Minecraft.World\ChatPacket.h"
const wstring ChatScreen::allowedChars = SharedConstants::acceptableLetters; 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() ChatScreen::ChatScreen()
{ {
frame = 0; frame = 0;
cursorIndex = 0;
s_historyIndex = -1;
} }
void ChatScreen::init() void ChatScreen::init()
@ -24,6 +37,50 @@ void ChatScreen::removed()
void ChatScreen::tick() void ChatScreen::tick()
{ {
frame++; 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) 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) if (eventKey == Keyboard::KEY_RETURN)
{ {
wstring msg = trimString(message);
if (msg.length() > 0)
{
wstring trim = trimString(message); wstring trim = trimString(message);
if (trim.length() > 0)
{
if (!minecraft->handleClientSideCommand(trim)) 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); minecraft->setScreen(NULL);
return; return;
} }
if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1); if (eventKey == Keyboard::KEY_UP) { handleHistoryUp(); return; }
if (allowedChars.find(ch) >= 0 && message.length() < SharedConstants::maxChatLength) 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) void ChatScreen::render(int xm, int ym, float a)
{ {
fill(2, height - 14, width - 2, height - 2, 0x80000000); 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); 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' ') 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; size_t nameLen = minecraft->gui->selectedName.length();
unsigned int maxLength = SharedConstants::maxChatLength; size_t insertLen = (message.length() + nameLen <= SharedConstants::maxChatLength) ? nameLen : (SharedConstants::maxChatLength - message.length());
if (message.length() > maxLength) 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 else
@ -85,5 +180,4 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum)
Screen::mouseClicked(x, y, buttonNum); Screen::mouseClicked(x, y, buttonNum);
} }
} }
} }

View file

@ -1,21 +1,33 @@
#pragma once #pragma once
#include "Screen.h" #include "Screen.h"
#include <vector>
using namespace std; using namespace std;
class ChatScreen : public Screen class ChatScreen : public Screen
{ {
protected: protected:
wstring message; wstring message;
int cursorIndex;
void applyHistoryMessage();
private: private:
int frame; 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: public:
ChatScreen(); //4J added ChatScreen();
virtual void init(); virtual void init();
virtual void removed(); virtual void removed();
virtual void tick(); virtual void tick();
private: virtual void handlePasteRequest();
static const wstring allowedChars; virtual void handleHistoryUp();
virtual void handleHistoryDown();
protected: protected:
void keyPressed(wchar_t ch, int eventKey); void keyPressed(wchar_t ch, int eventKey);
public: public:

View file

@ -759,6 +759,18 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
return; 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 /*#ifdef _WINDOWS64
// On Windows64 all XUIDs are INVALID_XUID so the XUID check above never fires. // 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), // packet->m_playerIndex is the server-assigned sequential index (set via LoginPacket),
@ -800,8 +812,10 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
#ifdef _WINDOWS64 #ifdef _WINDOWS64
{ {
IQNetPlayer* matchedQNetPlayer = NULL;
PlayerUID pktXuid = player->getXuid(); PlayerUID pktXuid = player->getXuid();
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e; 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) if (pktXuid >= WIN64_XUID_BASE && pktXuid < WIN64_XUID_BASE + MINECRAFT_NET_MAX_PLAYERS)
{ {
BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE); BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE);
@ -809,12 +823,38 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
if (np != NULL) if (np != NULL)
{ {
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
IQNetPlayer* qp = npx->GetQNetPlayer(); matchedQNetPlayer = npx->GetQNetPlayer();
if (qp != NULL && qp->m_gamertag[0] == 0)
{
wcsncpy_s(qp->m_gamertag, 32, packet->name.c_str(), _TRUNCATE);
} }
} }
// 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 && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0)
{
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 #endif
@ -985,6 +1025,8 @@ void ClientConnection::handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packe
qp->m_smallId = 0; qp->m_smallId = 0;
qp->m_isRemote = false; qp->m_isRemote = false;
qp->m_isHostPlayer = 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->m_gamertag[0] = 0;
qp->SetCustomDataValue(0); qp->SetCustomDataValue(0);
} }
@ -1399,6 +1441,9 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
switch(packet->m_messageType) switch(packet->m_messageType)
{ {
case ChatPacket::e_ChatCustom:
message = (packet->m_stringArgs.size() >= 1) ? packet->m_stringArgs[0] : L"";
break;
case ChatPacket::e_ChatBedOccupied: case ChatPacket::e_ChatBedOccupied:
message = app.GetString(IDS_TILE_BED_OCCUPIED); message = app.GetString(IDS_TILE_BED_OCCUPIED);
break; break;

View file

@ -260,16 +260,13 @@ void SoundEngine::updateMiniAudio()
continue; continue;
} }
float finalVolume = s->info.volume; float finalVolume = s->info.volume * m_MasterEffectsVolume;
if (finalVolume > 1.0f) if (finalVolume > 1.0f)
finalVolume = 1.0f; finalVolume = 1.0f;
ma_sound_set_volume(&s->sound, finalVolume); 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) 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 // AP - moved to a separate function so it can be called from the mixer callback on Vita
void SoundEngine::playMusicUpdate() void SoundEngine::playMusicUpdate()
{ {
//return;
static bool firstCall = true;
static float fMusicVol = 0.0f; static float fMusicVol = 0.0f;
if( firstCall )
{
fMusicVol = getMasterMusicVolume(); fMusicVol = getMasterMusicVolume();
firstCall = false;
}
switch(m_StreamState) switch(m_StreamState)
{ {
@ -1242,7 +1233,7 @@ void SoundEngine::playMusicUpdate()
ma_sound_set_pitch(&m_musicStream, m_StreamingAudioInfo.pitch); 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_sound_set_volume(&m_musicStream, finalVolume);
ma_result startResult = ma_sound_start(&m_musicStream); ma_result startResult = ma_sound_start(&m_musicStream);
@ -1370,8 +1361,6 @@ void SoundEngine::playMusicUpdate()
} }
// volume change required? // volume change required?
if (fMusicVol != getMasterMusicVolume())
{
if (m_musicStreamActive) if (m_musicStreamActive)
{ {
float finalVolume = m_StreamingAudioInfo.volume * fMusicVol; float finalVolume = m_StreamingAudioInfo.volume * fMusicVol;
@ -1380,7 +1369,6 @@ void SoundEngine::playMusicUpdate()
} }
} }
} }
}
else else
{ {
// Music disc playing - if it's a 3D stream, then set the position - we don't have any streaming audio in the world that moves, so this isn't // Music disc playing - if it's a 3D stream, then set the position - we don't have any streaming audio in the world that moves, so this isn't

View file

@ -3791,8 +3791,8 @@ extern "C" {
typedef signed int ma_int32; typedef signed int ma_int32;
typedef unsigned int ma_uint32; typedef unsigned int ma_uint32;
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
typedef signed __int64 ma_int64; typedef signed long long ma_int64;
typedef unsigned __int64 ma_uint64; typedef unsigned long long ma_uint64;
#else #else
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -11729,7 +11729,7 @@ IMPLEMENTATION
#endif #endif
#if _MSC_VER >= 1600 && (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219) #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); return _xgetbv(reg);
} }

View file

@ -5870,7 +5870,7 @@ void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
// // read the local file // // read the local file
// File gtsFile( wsFile->c_str() ); // File gtsFile( wsFile->c_str() );
// //
// __int64 fileSize = gtsFile.length(); // int64_t fileSize = gtsFile.length();
// //
// if(fileSize!=0) // if(fileSize!=0)
// { // {
@ -6901,7 +6901,7 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue)
} }
#if (defined _XBOX || defined _WINDOWS64) #if (defined _XBOX || defined _WINDOWS64)
HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, __uint64 ullOfferID_Full, __uint64 ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile) HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, uint64_t ullOfferID_Full, uint64_t ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile)
{ {
HRESULT hr=S_OK; HRESULT hr=S_OK;
DLC_INFO *pDLCData=new DLC_INFO; DLC_INFO *pDLCData=new DLC_INFO;
@ -8282,7 +8282,7 @@ void CMinecraftApp::GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsig
return; return;
} }
unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId)
{ {
int iTextMetadataBytes = 0; int iTextMetadataBytes = 0;
if(hasSeed) if(hasSeed)

View file

@ -606,7 +606,7 @@ public:
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId); DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName); DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
#else #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); bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
@ -729,7 +729,7 @@ public:
// World seed from png image // World seed from png image
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack); 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 // Game rules
GameRuleManager m_gameRules; GameRuleManager m_gameRules;

View file

@ -19,8 +19,8 @@ private:
ConsoleSchematicFile::ESchematicRotation m_rotation; ConsoleSchematicFile::ESchematicRotation m_rotation;
int m_dimension; int m_dimension;
__int64 m_totalBlocksChanged; int64_t m_totalBlocksChanged;
__int64 m_totalBlocksChangedLighting; int64_t m_totalBlocksChangedLighting;
bool m_completed; bool m_completed;
void updateLocationBox(); void updateLocationBox();

View file

@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
delete tag; 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 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)); int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
@ -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 // 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. // 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 xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);

View file

@ -72,8 +72,8 @@ public:
void save(DataOutputStream *dos); void save(DataOutputStream *dos);
void load(DataInputStream *dis); void load(DataInputStream *dis);
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
__int64 applyLighting(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); 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); static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);

View file

@ -14,7 +14,7 @@ public:
typedef struct _ValueType typedef struct _ValueType
{ {
union{ union{
__int64 i64; int64_t i64;
int i; int i;
char c; char c;
bool b; bool b;

View file

@ -385,7 +385,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
// Read File. // Read File.
// version_number // version_number
__int64 version = dis.readShort(); int64_t version = dis.readShort();
unsigned char compressionType = 0; unsigned char compressionType = 0;
if(version == 0) if(version == 0)
{ {

View file

@ -175,7 +175,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
{ {
if(attributeName.compare(L"seed") == 0) 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); app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed);
} }
else if(attributeName.compare(L"spawnX") == 0) else if(attributeName.compare(L"spawnX") == 0)
@ -700,7 +700,7 @@ void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } 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; } int LevelGenerationOptions::getLevelHasBeenInCreative() { return m_bHasBeenInCreative; }
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; } Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; } bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }

View file

@ -146,7 +146,7 @@ public:
private: private:
// This should match the "MapOptionsRule" definition in the XML schema // This should match the "MapOptionsRule" definition in the XML schema
__int64 m_seed; int64_t m_seed;
bool m_useFlatWorld; bool m_useFlatWorld;
Pos *m_spawnPos; Pos *m_spawnPos;
int m_bHasBeenInCreative; int m_bHasBeenInCreative;
@ -177,7 +177,7 @@ public:
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
__int64 getLevelSeed(); int64_t getLevelSeed();
int getLevelHasBeenInCreative(); int getLevelHasBeenInCreative();
Pos *getSpawnPos(); Pos *getSpawnPos();
bool getuseFlatWorld(); bool getuseFlatWorld();

View file

@ -45,8 +45,8 @@
CGameNetworkManager g_NetworkManager; CGameNetworkManager g_NetworkManager;
CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager; CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager;
__int64 CGameNetworkManager::messageQueue[512]; int64_t CGameNetworkManager::messageQueue[512];
__int64 CGameNetworkManager::byteQueue[512]; int64_t CGameNetworkManager::byteQueue[512];
int CGameNetworkManager::messageQueuePos = 0; int CGameNetworkManager::messageQueuePos = 0;
CGameNetworkManager::CGameNetworkManager() CGameNetworkManager::CGameNetworkManager()
@ -194,7 +194,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
ProfileManager.SetDeferredSignoutEnabled(true); ProfileManager.SetDeferredSignoutEnabled(true);
#endif #endif
__int64 seed = 0; int64_t seed = 0;
if(lpParameter != NULL) if(lpParameter != NULL)
{ {
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; 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); ServerStoppedCreate(false);
if( g_NetworkManager.IsHost() ) if( g_NetworkManager.IsHost() )
{ {
@ -929,7 +929,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
int CGameNetworkManager::ServerThreadProc( void* lpParameter ) int CGameNetworkManager::ServerThreadProc( void* lpParameter )
{ {
__int64 seed = 0; int64_t seed = 0;
if(lpParameter != NULL) if(lpParameter != NULL)
{ {
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;

View file

@ -164,9 +164,9 @@ public:
// Used for debugging output // Used for debugging output
static const int messageQueue_length = 512; static const int messageQueue_length = 512;
static __int64 messageQueue[messageQueue_length]; static int64_t messageQueue[messageQueue_length];
static const int byteQueue_length = 512; static const int byteQueue_length = 512;
static __int64 byteQueue[byteQueue_length]; static int64_t byteQueue[byteQueue_length];
static int messageQueuePos; static int messageQueuePos;
// Methods called from PlatformNetworkManager // Methods called from PlatformNetworkManager

View file

@ -5,6 +5,7 @@
#include "..\..\Xbox\Network\NetworkPlayerXbox.h" #include "..\..\Xbox\Network\NetworkPlayerXbox.h"
#ifdef _WINDOWS64 #ifdef _WINDOWS64
#include "..\..\Windows64\Network\WinsockNetLayer.h" #include "..\..\Windows64\Network\WinsockNetLayer.h"
#include "..\..\Windows64\Windows64_Xuid.h"
#include "..\..\Minecraft.h" #include "..\..\Minecraft.h"
#include "..\..\User.h" #include "..\..\User.h"
#include <iostream> #include <iostream>
@ -234,6 +235,7 @@ void CPlatformNetworkManagerStub::DoWork()
qnetPlayer->m_smallId = 0; qnetPlayer->m_smallId = 0;
qnetPlayer->m_isRemote = false; qnetPlayer->m_isRemote = false;
qnetPlayer->m_isHostPlayer = false; qnetPlayer->m_isHostPlayer = false;
qnetPlayer->m_resolvedXuid = INVALID_XUID;
qnetPlayer->m_gamertag[0] = 0; qnetPlayer->m_gamertag[0] = 0;
qnetPlayer->SetCustomDataValue(0); qnetPlayer->SetCustomDataValue(0);
WinsockNetLayer::PushFreeSmallId(disconnectedSmallId); WinsockNetLayer::PushFreeSmallId(disconnectedSmallId);
@ -354,7 +356,9 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
#ifdef _WINDOWS64 #ifdef _WINDOWS64
IQNet::m_player[0].m_smallId = 0; IQNet::m_player[0].m_smallId = 0;
IQNet::m_player[0].m_isRemote = false; 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_isHostPlayer = true;
IQNet::m_player[0].m_resolvedXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
IQNet::s_playerCount = 1; IQNet::s_playerCount = 1;
#endif #endif
@ -411,6 +415,8 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int l
IQNet::m_player[0].m_smallId = 0; IQNet::m_player[0].m_smallId = 0;
IQNet::m_player[0].m_isRemote = true; IQNet::m_player[0].m_isRemote = true;
IQNet::m_player[0].m_isHostPlayer = 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); wcsncpy_s(IQNet::m_player[0].m_gamertag, 32, searchResult->data.hostName, _TRUNCATE);
WinsockNetLayer::StopDiscovery(); 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_smallId = localSmallId;
IQNet::m_player[localSmallId].m_isRemote = false; IQNet::m_player[localSmallId].m_isRemote = false;
IQNet::m_player[localSmallId].m_isHostPlayer = 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(); Minecraft* pMinecraft = Minecraft::GetInstance();
wcscpy_s(IQNet::m_player[localSmallId].m_gamertag, 32, pMinecraft->user->name.c_str()); 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.playerCount = lanSessions[i].playerCount;
info->data.maxPlayers = lanSessions[i].maxPlayers; 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); friendsSessions[0].push_back(info);
} }

View file

@ -132,6 +132,6 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms()
return INT_MAX; return INT_MAX;
} }
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
return (int)( currentTime - m_lastChunkPacketTime ); return (int)( currentTime - m_lastChunkPacketTime );
} }

View file

@ -39,5 +39,5 @@ public:
private: private:
SQRNetworkPlayer *m_sqrPlayer; SQRNetworkPlayer *m_sqrPlayer;
Socket *m_pSocket; Socket *m_pSocket;
__int64 m_lastChunkPacketTime; int64_t m_lastChunkPacketTime;
}; };

View file

@ -443,7 +443,7 @@ void SQRNetworkPlayer::ReadAck()
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
#ifdef PRINT_ACK_STATS #ifdef PRINT_ACK_STATS
__int64 timeTaken = System::currentTimeMillis() - m_ackStats[0]; int64_t timeTaken = System::currentTimeMillis() - m_ackStats[0];
if(timeTaken < m_minAckTime) if(timeTaken < m_minAckTime)
m_minAckTime = timeTaken; m_minAckTime = timeTaken;
if(timeTaken > m_maxAckTime) if(timeTaken > m_maxAckTime)

View file

@ -68,11 +68,11 @@ class SQRNetworkPlayer
}; };
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
std::vector<__int64> m_ackStats; std::vector<int64_t> m_ackStats;
int m_minAckTime; int m_minAckTime;
int m_maxAckTime; int m_maxAckTime;
int m_totalAcks; int m_totalAcks;
__int64 m_totalAckTime; int64_t m_totalAckTime;
int m_averageAckTime; int m_averageAckTime;
#endif #endif

View file

@ -193,7 +193,7 @@ ESavePlatform SonyRemoteStorage::getSavePlatform()
} }
__int64 SonyRemoteStorage::getSaveSeed() int64_t SonyRemoteStorage::getSaveSeed()
{ {
if(m_getInfoStatus != e_infoFound) if(m_getInfoStatus != e_infoFound)
return 0; return 0;
@ -320,7 +320,7 @@ int SonyRemoteStorage::getDataProgress()
int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize; int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize;
__int64 time = System::currentTimeMillis(); int64_t time = System::currentTimeMillis();
int elapsedSecs = (time - m_startTime) / 1000; int elapsedSecs = (time - m_startTime) / 1000;
float estimatedTransfered = float(elapsedSecs * transferRatePerSec); float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
char seed[22]; char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); 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); SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with // Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions); SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
char seed[22]; char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); 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); SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with // Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions); SetU32HexBytes(descData.m_hostOptions, uiHostOptions);

View file

@ -73,7 +73,7 @@ public:
public: public:
int m_descDataVersion; int m_descDataVersion;
ESavePlatform m_savePlatform; ESavePlatform m_savePlatform;
__int64 m_seed; int64_t m_seed;
uint32_t m_hostOptions; uint32_t m_hostOptions;
uint32_t m_texturePack; uint32_t m_texturePack;
uint32_t m_saveVersion; uint32_t m_saveVersion;
@ -115,7 +115,7 @@ public:
const char* getLocalFilename(); const char* getLocalFilename();
const char* getSaveNameUTF8(); const char* getSaveNameUTF8();
ESavePlatform getSavePlatform(); ESavePlatform getSavePlatform();
__int64 getSaveSeed(); int64_t getSaveSeed();
unsigned int getSaveHostOptions(); unsigned int getSaveHostOptions();
unsigned int getSaveTexturePack(); unsigned int getSaveTexturePack();
@ -154,7 +154,7 @@ protected:
unsigned int m_thumbnailDataSize; unsigned int m_thumbnailDataSize;
C4JThread* m_SetDataThread; C4JThread* m_SetDataThread;
PSAVE_INFO m_setDataSaveInfo; PSAVE_INFO m_setDataSaveInfo;
__int64 m_startTime; int64_t m_startTime;
bool m_bAborting; bool m_bAborting;
bool m_bTransferStarted; bool m_bTransferStarted;

View file

@ -1486,12 +1486,26 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
} }
break; break;
case ACTION_MENU_UP: case ACTION_MENU_UP:
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_UP);
break;
}
#endif
{ {
//ui.PlayUISFX(eSFX_Focus); //ui.PlayUISFX(eSFX_Focus);
m_eCurrTapState = eTapStateUp; m_eCurrTapState = eTapStateUp;
} }
break; break;
case ACTION_MENU_DOWN: case ACTION_MENU_DOWN:
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_DOWN);
break;
}
#endif
{ {
//ui.PlayUISFX(eSFX_Focus); //ui.PlayUISFX(eSFX_Focus);
m_eCurrTapState = eTapStateDown; m_eCurrTapState = eTapStateDown;

View file

@ -1099,13 +1099,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
break; break;
case ACTION_MENU_OTHER_STICK_DOWN: case ACTION_MENU_OTHER_STICK_DOWN:
{ {
int pageStep = TabSpec::rows; int pageStep = 1;
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
pageStep = 1;
}
#endif
m_tabPage[m_curTab] += pageStep; m_tabPage[m_curTab] += pageStep;
if(m_tabPage[m_curTab] >= specs[m_curTab]->getPageCount()) if(m_tabPage[m_curTab] >= specs[m_curTab]->getPageCount())
{ {
@ -1119,13 +1113,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
break; break;
case ACTION_MENU_OTHER_STICK_UP: case ACTION_MENU_OTHER_STICK_UP:
{ {
int pageStep = TabSpec::rows; int pageStep = 1;
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
pageStep = 1;
}
#endif
m_tabPage[m_curTab] -= pageStep; m_tabPage[m_curTab] -= pageStep;
if(m_tabPage[m_curTab] < 0) if(m_tabPage[m_curTab] < 0)
{ {

View file

@ -55,10 +55,16 @@ void UIComponent_Chat::handleTimerComplete(int id)
float opacity = pGui->getOpacity(m_iPad, i); float opacity = pGui->getOpacity(m_iPad, i);
if( opacity > 0 ) 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_controlLabelBackground[i].setOpacity(opacity);
m_labelChatText[i].setOpacity(opacity); m_labelChatText[i].setOpacity(opacity);
m_labelChatText[i].setLabel( pGui->getMessage(m_iPad,i) ); m_labelChatText[i].setLabel( pGui->getMessage(m_iPad,i) );
#endif
anyVisible = true; anyVisible = true;
} }
else else

View file

@ -47,7 +47,7 @@ void UIComponent_Panorama::tick()
EnterCriticalSection(&pMinecraft->m_setLevelCS); EnterCriticalSection(&pMinecraft->m_setLevelCS);
if(pMinecraft->level!=NULL) 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 // are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0) if(pMinecraft->level->dimension->id==0)
{ {

View file

@ -12,6 +12,8 @@ UIControl::UIControl()
m_isVisible = true; m_isVisible = true;
m_bHidden = false; m_bHidden = false;
m_eControlType = eNoControl; m_eControlType = eNoControl;
m_id = -1;
m_pParentPanel = NULL;
} }
bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)

View file

@ -38,12 +38,14 @@ protected:
bool m_bHidden; // set by the Remove call bool m_bHidden; // set by the Remove call
public: public:
UIControl *m_pParentPanel; // set by UI_MAP_ELEMENT macro during mapElementsAndNames
void setControlType(eUIControlType eType) {m_eControlType=eType;} void setControlType(eUIControlType eType) {m_eControlType=eType;}
eUIControlType getControlType() {return m_eControlType;} eUIControlType getControlType() {return m_eControlType;}
void setId(int iID) { m_id=iID; } void setId(int iID) { m_id=iID; }
int getId() { return m_id; } int getId() { return m_id; }
UIScene * getParentScene() {return m_parentScene;} UIScene * getParentScene() {return m_parentScene;}
UIControl* getParentPanel() { return m_pParentPanel; }
protected: protected:
IggyValuePath m_iggyPath; IggyValuePath m_iggyPath;
@ -62,10 +64,8 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void UpdateControl(); void UpdateControl();
#ifdef __PSVITA__
void setHidden(bool bHidden) {m_bHidden=bHidden;} void setHidden(bool bHidden) {m_bHidden=bHidden;}
bool getHidden(void) {return m_bHidden;} bool getHidden(void) {return m_bHidden;}
#endif
IggyValuePath *getIggyValuePath(); IggyValuePath *getIggyValuePath();

View file

@ -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 ); 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) void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
{ {
IggyDataValue result; IggyDataValue result;

View file

@ -37,7 +37,7 @@ public:
void setButtonLabel(int iButtonId, const wstring &label); void setButtonLabel(int iButtonId, const wstring &label);
#ifdef __PSVITA__ #if defined(__PSVITA__) || defined(_WINDOWS64)
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat); void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
bool CanTouchTrigger(S32 iX, S32 iY); bool CanTouchTrigger(S32 iX, S32 iY);
#endif #endif

View file

@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
return success; 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_label = label;
m_id = id; m_id = id;
@ -61,11 +61,11 @@ void UIControl_SpaceIndicatorBar::reset()
setSaveGameOffset(0.0f); 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); 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; m_currentTotal += size;
setTotalSize(m_currentTotal); setTotalSize(m_currentTotal);
@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
{ {
if(index >= 0 && index < m_sizeAndOffsets.size()) 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); setSaveSize(values.first);
setSaveGameOffset(values.second); 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; 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 ); 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); float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);

View file

@ -6,28 +6,28 @@ class UIControl_SpaceIndicatorBar : public UIControl_Base
{ {
private: private:
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc; IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
__int64 m_min; int64_t m_min;
__int64 m_max; int64_t m_max;
__int64 m_currentSave, m_currentTotal; int64_t m_currentSave, m_currentTotal;
float m_currentOffset; float m_currentOffset;
vector<pair<__int64,float> > m_sizeAndOffsets; vector<pair<int64_t,float> > m_sizeAndOffsets;
public: public:
UIControl_SpaceIndicatorBar(); UIControl_SpaceIndicatorBar();
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); 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(); virtual void ReInit();
void reset(); void reset();
void addSave(__int64 size); void addSave(int64_t size);
void selectSave(int index); void selectSave(int index);
private: private:
void setSaveSize(__int64 size); void setSaveSize(int64_t size);
void setTotalSize(__int64 totalSize); void setTotalSize(int64_t totalSize);
void setSaveGameOffset(float offset); void setSaveGameOffset(float offset);
}; };

View file

@ -5,6 +5,15 @@
UIControl_TextInput::UIControl_TextInput() UIControl_TextInput::UIControl_TextInput()
{ {
m_bHasFocus = false; 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) 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_textName = registerFastName(L"text");
m_funcChangeState = registerFastName(L"ChangeState"); m_funcChangeState = registerFastName(L"ChangeState");
m_funcSetCharLimit = registerFastName(L"SetCharLimit"); m_funcSetCharLimit = registerFastName(L"SetCharLimit");
m_funcSetCaretIndex = registerFastName(L"SetCaretIndex");
return success; return success;
} }
@ -81,3 +91,197 @@ void UIControl_TextInput::SetCharLimit(int iLimit)
value[0].number = iLimit; value[0].number = iLimit;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCharLimit , 1 , value ); 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

View file

@ -6,7 +6,20 @@ class UIControl_TextInput : public UIControl_Base
{ {
private: private:
IggyName m_textName, m_funcChangeState, m_funcSetCharLimit; IggyName m_textName, m_funcChangeState, m_funcSetCharLimit;
IggyName m_funcSetCaretIndex;
bool m_bHasFocus; 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: public:
UIControl_TextInput(); UIControl_TextInput();
@ -19,4 +32,24 @@ public:
virtual void setFocus(bool focus); virtual void setFocus(bool focus);
void SetCharLimit(int iLimit); 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
}; };

View file

@ -3,6 +3,7 @@
#include "UI.h" #include "UI.h"
#include "UIScene.h" #include "UIScene.h"
#include "UIControl_Slider.h" #include "UIControl_Slider.h"
#include "UIControl_TexturePackList.h"
#include "..\..\..\Minecraft.World\StringHelpers.h" #include "..\..\..\Minecraft.World\StringHelpers.h"
#include "..\..\LocalPlayer.h" #include "..\..\LocalPlayer.h"
#include "..\..\DLCTexturePack.h" #include "..\..\DLCTexturePack.h"
@ -143,7 +144,7 @@ extern "C" void *__real_malloc(size_t t);
extern "C" void __real_free(void *t); extern "C" void __real_free(void *t);
#endif #endif
__int64 UIController::iggyAllocCount = 0; int64_t UIController::iggyAllocCount = 0;
static unordered_map<void *,size_t> allocations; static unordered_map<void *,size_t> allocations;
static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned ) 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_winUserIndex = 0;
m_mouseDraggingSliderScene = eUIScene_COUNT; m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1; m_mouseDraggingSliderId = -1;
m_mouseClickConsumedByScene = false;
m_bMouseHoverHorizontalList = false;
m_lastHoverMouseX = -1; m_lastHoverMouseX = -1;
m_lastHoverMouseY = -1; m_lastHoverMouseY = -1;
m_accumulatedTicks = 0; m_accumulatedTicks = 0;
@ -499,7 +502,7 @@ void UIController::tick()
} }
// Clear out the cached movie file data // 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();) for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
{ {
if(it->second.m_expiry < currentTime) if(it->second.m_expiry < currentTime)
@ -619,7 +622,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 totalStatic = 0; int64_t totalStatic = 0;
while(res = IggyDebugGetMemoryUseInfo ( NULL , while(res = IggyDebugGetMemoryUseInfo ( NULL ,
lib , lib ,
"" , "" ,
@ -750,7 +753,7 @@ void UIController::CleanUpSkinReload()
byteArray UIController::getMovieData(const wstring &filename) byteArray UIController::getMovieData(const wstring &filename)
{ {
// Cache everything we load in the current tick // 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); auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() ) if(it == m_cachedMovieData.end() )
{ {
@ -784,40 +787,36 @@ void UIController::tickInput()
#endif #endif
{ {
#ifdef _WINDOWS64 #ifdef _WINDOWS64
m_mouseClickConsumedByScene = false;
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{ {
UIScene *pScene = NULL; UIScene *pScene = NULL;
// 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)
{
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)
{ {
pScene = m_groups[grp]->GetTopScene(eUILayer_Debug); pScene = m_groups[grp]->GetTopScene(mouseLayers[l]);
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);
} }
if (pScene && pScene->getMovie()) if (pScene && pScene->getMovie())
{ {
Iggy *movie = pScene->getMovie();
int rawMouseX = g_KBMInput.GetMouseX(); int rawMouseX = g_KBMInput.GetMouseX();
int rawMouseY = g_KBMInput.GetMouseY(); 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, // Only update hover focus when the mouse has actually moved,
// so that mouse-wheel scrolling can change list selection // so that mouse-wheel scrolling can change list selection
@ -826,44 +825,22 @@ void UIController::tickInput()
m_lastHoverMouseX = rawMouseX; m_lastHoverMouseX = rawMouseX;
m_lastHoverMouseY = rawMouseY; m_lastHoverMouseY = rawMouseY;
if (mouseMoved) // Convert mouse to scene/movie coordinates
F32 sceneMouseX = (F32)rawMouseX;
F32 sceneMouseY = (F32)rawMouseY;
{ {
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL; extern HWND g_hWnd;
IggyFocusableObject focusables[64]; RECT rc;
S32 numFocusables = 0; if (g_hWnd && GetClientRect(g_hWnd, &rc))
IggyPlayerGetFocusableObjects(movie, &currentFocus, focusables, 64, &numFocusables);
if (numFocusables > 0 && numFocusables <= 64)
{ {
IggyFocusHandle hitObject = IGGY_FOCUS_NULL; int winW = rc.right - rc.left;
for (S32 i = 0; i < numFocusables; ++i) int winH = rc.bottom - rc.top;
if (winW > 0 && winH > 0)
{ {
if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 && sceneMouseX = sceneMouseX * ((F32)pScene->getRenderWidth() / (F32)winW);
mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1) sceneMouseY = sceneMouseY * ((F32)pScene->getRenderHeight() / (F32)winH);
{
hitObject = focusables[i].object;
break;
} }
} }
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);
}
} }
// Get main panel offset (controls are positioned relative to it) // Get main panel offset (controls are positioned relative to it)
@ -876,6 +853,110 @@ void UIController::tickInput()
panelOffsetY = pMainPanel->getYPos(); 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 leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT);
bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT); bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT);
@ -890,12 +971,51 @@ void UIController::tickInput()
vector<UIControl *> *controls = pScene->GetControls(); vector<UIControl *> *controls = pScene->GetControls();
if (controls) 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, &currentFocus, 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) for (size_t i = 0; i < controls->size(); ++i)
{ {
UIControl *ctrl = (*controls)[i]; UIControl *ctrl = (*controls)[i];
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible()) if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
continue; continue;
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue;
UIControl_Slider *pSlider = (UIControl_Slider *)ctrl; UIControl_Slider *pSlider = (UIControl_Slider *)ctrl;
pSlider->UpdateControl(); pSlider->UpdateControl();
S32 cx = pSlider->getXPos() + panelOffsetX; S32 cx = pSlider->getXPos() + panelOffsetX;
@ -942,6 +1062,12 @@ void UIController::tickInput()
m_mouseDraggingSliderScene = eUIScene_COUNT; m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1; 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 #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 ((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.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT)) { pressed = true; down = true; }
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT)) { released = true; down = false; } 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 // Scroll wheel for list scrolling — only consume the wheel value when the
// action key actually matches, so the other direction isn't lost. // 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)) 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; pressed = true;
down = 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 #endif
@ -1297,8 +1441,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
//!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) && //!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) &&
key == ACTION_MENU_STICK_PRESS) key == ACTION_MENU_STICK_PRESS)
{ {
__int64 totalStatic = 0; int64_t totalStatic = 0;
__int64 totalDynamic = 0; int64_t totalDynamic = 0;
app.DebugPrintf(app.USER_SR, "********************************\n"); app.DebugPrintf(app.USER_SR, "********************************\n");
app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n"); app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n");
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) 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) for(unsigned int i = 0; i < eLibrary_Count; ++i)
{ {
__int64 libraryStatic = 0; int64_t libraryStatic = 0;
__int64 libraryDynamic = 0; int64_t libraryDynamic = 0;
if(m_iggyLibraries[i] != IGGY_INVALID_LIBRARY) 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) bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer, EUIGroup group)
{ {
static bool bSeenUpdateTextThisSession = false; 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 // 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 // display this message the first 3 times
if((scene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0)) 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; scene=eUIScene_NewUpdateMessage;
bSeenUpdateTextThisSession=true; 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 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)) if(GetMenuDisplayed(iPad))
@ -2335,14 +2481,20 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal)
void UIController::PlayUISFX(ESoundEffect eSound) void UIController::PlayUISFX(ESoundEffect eSound)
{ {
__uint64 time = System::currentTimeMillis(); uint64_t time = System::currentTimeMillis();
// Don't play multiple SFX on the same tick // Don't play multiple SFX on the same tick
// (prevents horrible sounds when programmatically setting multiple checkboxes) // (prevents horrible sounds when programmatically setting multiple checkboxes)
if (time - m_lastUiSfx < 10) { return; } if (time - m_lastUiSfx < 10) { return; }
m_lastUiSfx = time; 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) void UIController::DisplayGamertag(unsigned int iPad, bool show)

View file

@ -3,6 +3,7 @@ using namespace std;
#include "IUIController.h" #include "IUIController.h"
#include "UIEnums.h" #include "UIEnums.h"
#include "UIGroup.h" #include "UIGroup.h"
#include <random>
class UIAbstractBitmapFont; class UIAbstractBitmapFont;
class UIBitmapFont; class UIBitmapFont;
@ -15,7 +16,7 @@ class UIControl;
class UIController : public IUIController class UIController : public IUIController
{ {
public: public:
static __int64 iggyAllocCount; static int64_t iggyAllocCount;
// MGH - added to prevent crash loading Iggy movies while the skins were being reloaded // MGH - added to prevent crash loading Iggy movies while the skins were being reloaded
static CRITICAL_SECTION ms_reloadSkinCS; static CRITICAL_SECTION ms_reloadSkinCS;
@ -63,6 +64,9 @@ private:
UITTFFont *m_mcTTFFont; UITTFFont *m_mcTTFFont;
UIBitmapFont *m_moj7, *m_moj11; UIBitmapFont *m_moj7, *m_moj11;
std::mt19937 m_randomGenerator;
std::uniform_real_distribution<float> m_randomDistribution;
public: public:
void setCleanupOnReload(); void setCleanupOnReload();
void updateCurrentFont(); void updateCurrentFont();
@ -145,7 +149,7 @@ private:
typedef struct _CachedMovieData typedef struct _CachedMovieData
{ {
byteArray m_ba; byteArray m_ba;
__int64 m_expiry; int64_t m_expiry;
} CachedMovieData; } CachedMovieData;
unordered_map<wstring, CachedMovieData> m_cachedMovieData; unordered_map<wstring, CachedMovieData> m_cachedMovieData;
@ -160,6 +164,8 @@ private:
unsigned int m_winUserIndex; unsigned int m_winUserIndex;
EUIScene m_mouseDraggingSliderScene; EUIScene m_mouseDraggingSliderScene;
int m_mouseDraggingSliderId; int m_mouseDraggingSliderId;
bool m_mouseClickConsumedByScene;
bool m_bMouseHoverHorizontalList;
int m_lastHoverMouseX; int m_lastHoverMouseX;
int m_lastHoverMouseY; int m_lastHoverMouseY;
//bool m_bSysUIShowing; //bool m_bSysUIShowing;
@ -167,7 +173,7 @@ private:
C4JThread *m_reloadSkinThread; C4JThread *m_reloadSkinThread;
bool m_navigateToHomeOnReload; bool m_navigateToHomeOnReload;
int m_accumulatedTicks; 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; D3D11_RECT m_customRenderingClearRect;

View file

@ -390,10 +390,10 @@ unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr)
return 0; return 0;
} }
void UIGroup::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) void UIGroup::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{ {
__int64 groupStatic = 0; int64_t groupStatic = 0;
__int64 groupDynamic = 0; int64_t groupDynamic = 0;
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group); app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group);
for(unsigned int i = 0; i < eUILayer_COUNT; ++i) for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
{ {

View file

@ -100,7 +100,7 @@ public:
void handleUnlockFullVersion(); void handleUnlockFullVersion();
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
unsigned int GetLayerIndex(UILayer* layerPtr); unsigned int GetLayerIndex(UILayer* layerPtr);

View file

@ -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_t layerStatic = 0;
__int64 layerDynamic = 0; int64_t layerDynamic = 0;
for(auto& it : m_components) for(auto& it : m_components)
{ {
it->PrintTotalMemoryUsage(layerStatic, layerDynamic); it->PrintTotalMemoryUsage(layerStatic, layerDynamic);

View file

@ -88,6 +88,6 @@ public:
void handleUnlockFullVersion(); void handleUnlockFullVersion();
UIScene *FindScene(EUIScene sceneType); UIScene *FindScene(EUIScene sceneType);
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
}; };

View file

@ -234,7 +234,7 @@ void UIScene::initialiseMovie()
m_bUpdateOpacity = true; m_bUpdateOpacity = true;
} }
#ifdef __PSVITA__ #if defined(__PSVITA__) || defined(_WINDOWS64)
void UIScene::SetFocusToElement(int iID) void UIScene::SetFocusToElement(int iID)
{ {
IggyDataValue result; IggyDataValue result;
@ -329,11 +329,11 @@ void UIScene::loadMovie()
} }
byteArray baFile = ui.getMovieData(moviePath.c_str()); byteArray baFile = ui.getMovieData(moviePath.c_str());
__int64 beforeLoad = ui.iggyAllocCount; int64_t beforeLoad = ui.iggyAllocCount;
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
__int64 afterLoad = ui.iggyAllocCount; int64_t afterLoad = ui.iggyAllocCount;
IggyPlayerInitializeAndTickRS ( swf ); IggyPlayerInitializeAndTickRS ( swf );
__int64 afterTick = ui.iggyAllocCount; int64_t afterTick = ui.iggyAllocCount;
if(!swf) if(!swf)
{ {
@ -362,8 +362,8 @@ void UIScene::loadMovie()
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 totalStatic = 0; int64_t totalStatic = 0;
__int64 totalDynamic = 0; int64_t totalDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf , while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL , NULL ,
0 , 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; if(!swf) return;
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 sceneStatic = 0; int64_t sceneStatic = 0;
__int64 sceneDynamic = 0; int64_t sceneDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf , while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL , NULL ,
"" , "" ,
@ -447,6 +447,19 @@ void UIScene::tick()
IggyPlayerTickRS( swf ); IggyPlayerTickRS( swf );
m_hasTickedOnce = true; 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() UIControl* UIScene::GetMainPanel()
@ -454,6 +467,113 @@ UIControl* UIScene::GetMainPanel()
return NULL; 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) 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 // update the button positions since they may have changed
UpdateSceneControls(); UpdateSceneControls();
// mark the button as removed
control->setHidden(true);
// remove it from the touchboxes // remove it from the touchboxes
ui.TouchBoxRebuild(control->getParentScene()); ui.TouchBoxRebuild(control->getParentScene());
#endif #endif
// mark the button as removed so hover/touch hit-tests skip it
control->setHidden(true);
} }
void UIScene::slideLeft() 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"); app.DebugPrintf("UI WARNING: Ignoring input as game action does not translate to an Iggy keycode\n");
return; 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, &currentFocus, focusables, 64, &numFocusables);
if(currentFocus == IGGY_FOCUS_NULL && numFocusables > 0)
{
IggyPlayerSetFocusRS(swf, focusables[0].object, 0);
return;
}
}
#endif
IggyEvent keyEvent; IggyEvent keyEvent;
// 4J Stu - Keyloc is always standard as we don't care about shift/alt // 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 ); IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard );

View file

@ -6,6 +6,7 @@ using namespace std;
#include "UIEnums.h" #include "UIEnums.h"
#include "UIControl_Base.h" #include "UIControl_Base.h"
#include "UIControl_TextInput.h"
class ItemRenderer; class ItemRenderer;
class UILayer; class UILayer;
@ -16,22 +17,26 @@ class UILayer;
virtual bool mapElementsAndNames() \ virtual bool mapElementsAndNames() \
{ \ { \
parentClass::mapElementsAndNames(); \ parentClass::mapElementsAndNames(); \
IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() ); IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() ); \
UIControl *_mapPanel = NULL;
#define UI_END_MAP_ELEMENTS_AND_NAMES() \ #define UI_END_MAP_ELEMENTS_AND_NAMES() \
return true; \ return true; \
} }
#define UI_MAP_ELEMENT( var, name) \ #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 ) \ #define UI_BEGIN_MAP_CHILD_ELEMENTS( parent ) \
{ \ { \
IggyValuePath *lastRoot = currentRoot; \ IggyValuePath *lastRoot = currentRoot; \
currentRoot = parent.getIggyValuePath(); UIControl *_lastPanel = _mapPanel; \
currentRoot = parent.getIggyValuePath(); \
_mapPanel = &parent;
#define UI_END_MAP_CHILD_ELEMENTS() \ #define UI_END_MAP_CHILD_ELEMENTS() \
currentRoot = lastRoot; \ currentRoot = lastRoot; \
_mapPanel = _lastPanel; \
} }
#define UI_MAP_NAME( var, name ) \ #define UI_MAP_NAME( var, name ) \
@ -129,7 +134,7 @@ private:
void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo); void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo);
public: public:
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
public: public:
UIScene(int iPad, UILayer *parentLayer); UIScene(int iPad, UILayer *parentLayer);
@ -141,8 +146,10 @@ public:
virtual void tick(); virtual void tick();
IggyName registerFastName(const wstring &name); IggyName registerFastName(const wstring &name);
#ifdef __PSVITA__ #if defined(__PSVITA__) || defined(_WINDOWS64)
void SetFocusToElement(int iID); void SetFocusToElement(int iID);
#endif
#ifdef __PSVITA__
void UpdateSceneControls(); void UpdateSceneControls();
#endif #endif
protected: protected:
@ -177,6 +184,19 @@ public:
// returns main panel if controls are not living in the root // returns main panel if controls are not living in the root
virtual UIControl* GetMainPanel(); 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 removeControl( UIControl_Base *control, bool centreScene);
void slideLeft(); void slideLeft();
void slideRight(); void slideRight();

View file

@ -96,6 +96,19 @@ void UIScene_AnvilMenu::tick()
{ {
UIScene_AbstractContainerMenu::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(); handleTick();
} }
@ -306,26 +319,67 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection)
return control; 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) 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; UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam;
pClass->setIgnoreInput(false); pClass->setIgnoreInput(false);
if (bRes) 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]; uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) ); ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText); InputManager.GetText(pchText);
pClass->setEditNameValue((wchar_t *)pchText); pClass->setEditNameValue((wchar_t *)pchText);
pClass->m_itemName = (wchar_t *)pchText; pClass->m_itemName = (wchar_t *)pchText;
pClass->updateItemName(); pClass->updateItemName();
#endif
} }
return 0; return 0;
} }
void UIScene_AnvilMenu::handleEditNamePressed() 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); setIgnoreInput(true);
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
int language = XGetLanguage(); 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); InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
break; break;
default: 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); InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended);
break; break;
} }
#else #else
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif #endif
#endif
} }
void UIScene_AnvilMenu::setEditNameValue(const wstring &name) 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) void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
{ {
if (!getMovie()) return;
IggyDataValue result; IggyDataValue result;
IggyDataValue value[2]; IggyDataValue value[2];
@ -375,6 +431,8 @@ void UIScene_AnvilMenu::showCross(bool show)
{ {
if(m_showingCross != show) if(m_showingCross != show)
{ {
if (!getMovie()) return;
IggyDataValue result; IggyDataValue result;
IggyDataValue value[1]; IggyDataValue value[1];

View file

@ -55,6 +55,10 @@ protected:
virtual UIControl *getSection(ESceneSection eSection); 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); static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes);
virtual void handleEditNamePressed(); virtual void handleEditNamePressed();
virtual void setEditNameValue(const wstring &name); virtual void setEditNameValue(const wstring &name);

View file

@ -4,6 +4,9 @@
#include "..\..\MultiplayerLocalPlayer.h" #include "..\..\MultiplayerLocalPlayer.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "UIScene_CraftingMenu.h" #include "UIScene_CraftingMenu.h"
#ifdef _WINDOWS64
#include "..\..\Windows64\Iggy\gdraw\gdraw_d3d11.h"
#endif
#ifdef __PSVITA__ #ifdef __PSVITA__
#define GAME_CRAFTING_TOUCHUPDATE_TIMER_ID 0 #define GAME_CRAFTING_TOUCHUPDATE_TIMER_ID 0
@ -12,6 +15,11 @@
UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) 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; m_bIgnoreKeyPresses = false;
CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData; CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData;
@ -254,12 +262,14 @@ wstring UIScene_CraftingMenu::getMoviePath()
} }
} }
#ifdef __PSVITA__ #if defined(__PSVITA__) || defined(_WINDOWS64)
UIControl* UIScene_CraftingMenu::GetMainPanel() UIControl* UIScene_CraftingMenu::GetMainPanel()
{ {
return &m_controlMainPanel; 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) void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
{ {
// perform action on release // perform action on release
@ -383,6 +393,85 @@ void UIScene_CraftingMenu::handleTimerComplete(int id)
} }
#endif #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() void UIScene_CraftingMenu::handleReload()
{ {
m_slotListInventory.addSlots(CRAFTING_INVENTORY_SLOT_START,CRAFTING_INVENTORY_SLOT_END - CRAFTING_INVENTORY_SLOT_START); 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; decorations = false;
int iIndex = slotId - CRAFTING_H_SLOT_START; 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) if(m_hSlotsInfo[iIndex].show)
{ {
item = m_hSlotsInfo[iIndex].item; item = m_hSlotsInfo[iIndex].item;

View file

@ -66,10 +66,19 @@ public:
#ifdef __PSVITA__ #ifdef __PSVITA__
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); 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 handleTouchBoxRebuild();
virtual void handleTimerComplete(int id); virtual void handleTimerComplete(int id);
#endif #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: protected:
UIControl m_controlMainPanel; UIControl m_controlMainPanel;

View file

@ -84,10 +84,6 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_iGameModeId = GameType::SURVIVAL->getId(); m_iGameModeId = GameType::SURVIVAL->getId();
m_pDLCPack = NULL; m_pDLCPack = NULL;
m_bRebuildTouchBoxes = false; m_bRebuildTouchBoxes = false;
#ifdef _WINDOWS64
m_bDirectEditing = false;
m_iDirectEditCooldown = 0;
#endif
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); 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. // 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it.
@ -293,53 +289,6 @@ void UIScene_CreateWorldMenu::tick()
{ {
UIScene::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 ) if(m_iSetTexturePackDescription >= 0 )
{ {
@ -403,11 +352,24 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
#endif #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) void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{ {
if(m_bIgnoreInput) return; if(m_bIgnoreInput) return;
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) { handled = true; return; } if (isDirectEditBlocking()) { handled = true; return; }
#endif #endif
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
@ -464,7 +426,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{ {
if(m_bIgnoreInput) return; if(m_bIgnoreInput) return;
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) return; if (isDirectEditBlocking()) return;
#endif #endif
//CD - Added for audio //CD - Added for audio
@ -476,7 +438,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{ {
m_bIgnoreInput=true; m_bIgnoreInput=true;
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (Win64_IsControllerConnected()) if (!g_KBMInput.IsKBMActive())
{ {
UIKeyboardInitData kbData; UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD); kbData.title = app.GetString(IDS_CREATE_NEW_WORLD);
@ -488,11 +450,8 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
} }
else else
{ {
// PC without controller: edit the name field directly in-place. m_bIgnoreInput = false;
m_bIgnoreInput = false; // Don't block input - m_bDirectEditing is the guard m_editWorldName.beginDirectEdit(25);
m_worldNameBeforeEdit = m_worldName;
m_bDirectEditing = true;
g_KBMInput.ClearCharBuffer();
} }
#else #else
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default); InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
@ -1169,14 +1128,14 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
// start the game // start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
__int64 seedValue = 0; int64_t seedValue = 0;
NetworkGameInitData *param = new NetworkGameInitData(); NetworkGameInitData *param = new NetworkGameInitData();
param->levelName = wWorldName; param->levelName = wWorldName;
if (wSeed.length() != 0) if (wSeed.length() != 0)
{ {
__int64 value = 0; int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length(); unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value //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 the input string is a numerical value, convert it to a number
if( isNumber ) 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 the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 ) if( value != 0 )

View file

@ -51,11 +51,6 @@ private:
DLCPack * m_pDLCPack; DLCPack * m_pDLCPack;
bool m_bRebuildTouchBoxes; bool m_bRebuildTouchBoxes;
#ifdef _WINDOWS64
bool m_bDirectEditing;
wstring m_worldNameBeforeEdit;
int m_iDirectEditCooldown;
#endif
public: public:
UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer); UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer);
@ -83,6 +78,10 @@ protected:
public: public:
// INPUT // INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); 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: private:
void StartSharedLaunchFlow(); void StartSharedLaunchFlow();

View file

@ -41,8 +41,72 @@ wstring UIScene_DebugCreateSchematic::getMoviePath()
return L"DebugCreateSchematic"; 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) 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); ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
switch(key) 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) void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
{ {
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId) switch((int)controlId)
{ {
case eControl_Create: case eControl_Create:
@ -112,8 +179,28 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
case eControl_EndX: case eControl_EndX:
case eControl_EndY: case eControl_EndY:
case eControl_EndZ: case eControl_EndZ:
{
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 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); InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
}
break; break;
}; };
} }
@ -138,9 +225,15 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b
{ {
UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam; 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]; uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) ); ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText); InputManager.GetText(pchText);
#endif
if(pchText[0]!=0) if(pchText[0]!=0)
{ {

View file

@ -24,6 +24,7 @@ private:
ConsoleSchematicFile::XboxSchematicInitParam *m_data; ConsoleSchematicFile::XboxSchematicInitParam *m_data;
public: public:
UIScene_DebugCreateSchematic(int iPad, void *initData, UILayer *parentLayer); UIScene_DebugCreateSchematic(int iPad, void *initData, UILayer *parentLayer);
@ -58,8 +59,14 @@ protected:
UI_END_MAP_ELEMENTS_AND_NAMES() UI_END_MAP_ELEMENTS_AND_NAMES()
virtual wstring getMoviePath(); 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: public:
virtual void tick();
// INPUT // INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); 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); virtual void handleCheckboxToggled(F64 controlId, bool selected);
private: private:
UIControl_TextInput* getTextInputForControl(eControls ctrl);
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes); static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
}; };
#endif #endif

View file

@ -31,19 +31,19 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer
WCHAR TempString[256]; 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); 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); 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); 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); 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_textInputElevation.init(TempString, eControl_Elevation);
m_checkboxLockPlayer.init(L"Lock Player", eControl_LockPlayer, app.GetFreezePlayers()); 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_labelCamY.init(L"CamY");
m_labelCamZ.init(L"CamZ"); m_labelCamZ.init(L"CamZ");
m_labelYRotElev.init(L"Y-Rot & Elevation (Degs)"); m_labelYRotElev.init(L"Y-Rot & Elevation (Degs)");
} }
wstring UIScene_DebugSetCamera::getMoviePath() wstring UIScene_DebugSetCamera::getMoviePath()
@ -62,8 +63,59 @@ wstring UIScene_DebugSetCamera::getMoviePath()
return L"DebugSetCamera"; 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) 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); ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
switch(key) switch(key)
@ -88,6 +140,9 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pr
void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
{ {
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId) switch((int)controlId)
{ {
case eControl_Teleport: case eControl_Teleport:
@ -101,7 +156,25 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
case eControl_YRot: case eControl_YRot:
case eControl_Elevation: 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); InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
break; break;
}; };
} }
@ -119,9 +192,13 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected)
int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
{ {
UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam; UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam;
uint16_t pchText[2048];//[128]; uint16_t pchText[2048];
ZeroMemory(pchText, 2048/*128*/ * sizeof(uint16_t) ); ZeroMemory(pchText, 2048 * sizeof(uint16_t));
#ifdef _WINDOWS64
Win64_GetKeyboardText(pchText, 2048);
#else
InputManager.GetText(pchText); InputManager.GetText(pchText);
#endif
if(pchText[0]!=0) if(pchText[0]!=0)
{ {

View file

@ -26,6 +26,9 @@ private:
FreezePlayerParam *fpp; FreezePlayerParam *fpp;
eControls m_keyboardCallbackControl; eControls m_keyboardCallbackControl;
#ifdef _WINDOWS64
UIControl_TextInput* getTextInputForControl(eControls ctrl);
#endif
public: public:
UIScene_DebugSetCamera(int iPad, void *initData, UILayer *parentLayer); UIScene_DebugSetCamera(int iPad, void *initData, UILayer *parentLayer);
@ -54,6 +57,12 @@ protected:
UI_END_MAP_ELEMENTS_AND_NAMES() UI_END_MAP_ELEMENTS_AND_NAMES()
virtual wstring getMoviePath(); 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: public:
// INPUT // INPUT

View file

@ -753,10 +753,16 @@ void UIScene_HUD::handleTimerComplete(int id)
float opacity = pGui->getOpacity(m_iPad, i); float opacity = pGui->getOpacity(m_iPad, i);
if( opacity > 0 ) 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_controlLabelBackground[i].setOpacity(opacity);
m_labelChatText[i].setOpacity(opacity); m_labelChatText[i].setOpacity(opacity);
m_labelChatText[i].setLabel( pGui->getMessagesCount(m_iPad) ? pGui->getMessage(m_iPad,i) : L"" ); m_labelChatText[i].setLabel( pGui->getMessagesCount(m_iPad) ? pGui->getMessage(m_iPad,i) : L"" );
#endif
anyVisible = true; anyVisible = true;
} }
else else

View file

@ -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:
case C4JStorage::eOptions_Callback_Read_FileNotFound: case C4JStorage::eOptions_Callback_Read_FileNotFound:
// we've either read it, or it wasn't found // we've either read it, or it wasn't found
#if 0
if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0) if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
{ {
ui.NavigateToScene(0,eUIScene_EULA); ui.NavigateToScene(0,eUIScene_EULA);
} }
else else
#endif
{ {
ui.NavigateToScene(0,eUIScene_SaveMessage); ui.NavigateToScene(0,eUIScene_SaveMessage);
} }
break; break;
default: default:
#if 0
ui.NavigateToScene(0,eUIScene_EULA); ui.NavigateToScene(0,eUIScene_EULA);
#else
ui.NavigateToScene(0,eUIScene_SaveMessage);
#endif
break; break;
} }
#elif defined _XBOX_ONE #elif defined _XBOX_ONE
@ -131,17 +137,23 @@ void UIScene_Intro::handleAnimationEnd()
case C4JStorage::eOptions_Callback_Read: case C4JStorage::eOptions_Callback_Read:
case C4JStorage::eOptions_Callback_Read_FileNotFound: case C4JStorage::eOptions_Callback_Read_FileNotFound:
// we've either read it, or it wasn't found // we've either read it, or it wasn't found
#if 0
if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0) if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
{ {
ui.NavigateToScene(0,eUIScene_EULA); ui.NavigateToScene(0,eUIScene_EULA);
} }
else else
#endif
{ {
ui.NavigateToScene(0,eUIScene_SaveMessage); ui.NavigateToScene(0,eUIScene_SaveMessage);
} }
break; break;
default: default:
#if 0
ui.NavigateToScene(0,eUIScene_EULA); ui.NavigateToScene(0,eUIScene_EULA);
#else
ui.NavigateToScene(0,eUIScene_SaveMessage);
#endif
break; break;
} }

View file

@ -163,6 +163,12 @@ void UIScene_Keyboard::tick()
{ {
UIScene::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. // 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). // 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. // The char buffer is cleared on open so Enter/clicks from the triggering action don't leak in.

View file

@ -257,6 +257,9 @@ void UIScene_LaunchMoreOptionsMenu::handleDestroy()
void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{ {
if(m_bIgnoreInput) return; 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"); //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); 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() UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel()
{ {
if(m_tabIndex == 0) if(m_tabIndex == 0)
@ -546,11 +551,16 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
{ {
UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam; UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam;
pClass->m_bIgnoreInput=false; pClass->m_bIgnoreInput=false;
// 4J HEG - No reason to set value if keyboard was cancelled
if (bRes) 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__ #ifdef __PSVITA__
//CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH]
uint16_t pchText[2048]; uint16_t pchText[2048];
ZeroMemory(pchText, 2048 * sizeof(uint16_t) ); ZeroMemory(pchText, 2048 * sizeof(uint16_t) );
#else #else
@ -560,18 +570,52 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
InputManager.GetText(pchText); InputManager.GetText(pchText);
pClass->m_editSeed.setLabel((wchar_t *)pchText); pClass->m_editSeed.setLabel((wchar_t *)pchText);
pClass->m_params->seed = (wchar_t *)pchText; pClass->m_params->seed = (wchar_t *)pchText;
#endif
} }
return 0; 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) void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
{ {
if(m_bIgnoreInput) return; if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId) switch((int)controlId)
{ {
case eControl_EditSeed: 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; m_bIgnoreInput=true;
#ifdef __PS3__ #ifdef __PS3__
int language = XGetLanguage(); 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); InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
break; break;
default: 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); 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; break;
} }
#else #else
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); 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 #endif
} }
break; break;

View file

@ -140,6 +140,10 @@ protected:
public: public:
virtual void tick(); virtual void tick();
virtual void handleDestroy(); virtual void handleDestroy();
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
#endif
// INPUT // INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleFocusChange(F64 controlId, F64 childId);
@ -160,6 +164,8 @@ private:
#ifdef __PSVITA__ #ifdef __PSVITA__
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
virtual UIControl* GetMainPanel();
#endif //__PSVITA__ #endif //__PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
virtual UIControl* GetMainPanel();
#endif
}; };

View file

@ -58,7 +58,7 @@ private:
bool m_bRequestQuadrantSignin; bool m_bRequestQuadrantSignin;
bool m_bIsCorrupt; bool m_bIsCorrupt;
bool m_bThumbnailGetFailed; bool m_bThumbnailGetFailed;
__int64 m_seed; int64_t m_seed;
wstring m_levelName; wstring m_levelName;
#ifdef __PS3__ #ifdef __PS3__

View file

@ -1168,6 +1168,43 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr
LaunchSaveTransfer(); 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 #endif
break; break;
case ACTION_MENU_Y: 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 // Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str()); StorageManager.SetSaveTitle(saveFile->getName().c_str());
__int64 fileSize = saveFile->length(); int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile); FileInputStream fis(*saveFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);
@ -2198,7 +2235,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null
StorageManager.SetSaveTitle(wSaveName); StorageManager.SetSaveTitle(wSaveName);
__int64 fileSize = cloudFile.length(); int64_t fileSize = cloudFile.length();
FileInputStream fis(cloudFile); FileInputStream fis(cloudFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);
@ -2394,7 +2431,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS
kbData.maxChars = 25; kbData.maxChars = 25;
kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback; kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback;
kbData.lpParam = pClass; kbData.lpParam = pClass;
kbData.pcMode = !Win64_IsControllerConnected(); kbData.pcMode = g_KBMInput.IsKBMActive();
ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData);
} }
#elif defined _DURANGO #elif defined _DURANGO
@ -3542,7 +3579,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
bool bHostOptionsRead = false; bool bHostOptionsRead = false;
unsigned int uiHostOptions = 0; unsigned int uiHostOptions = 0;
DWORD dwTexturePack; DWORD dwTexturePack;
__int64 seedVal; int64_t seedVal;
char szSeed[50]; char szSeed[50];
ZeroMemory(szSeed,50); ZeroMemory(szSeed,50);

View file

@ -18,6 +18,12 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer
m_bConfirmed = false; m_bConfirmed = false;
m_bIgnoreInput = 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_buttonConfirm.init(app.GetString(IDS_DONE), eControl_Confirm);
m_labelMessage.init(app.GetString(IDS_EDIT_SIGN_MESSAGE)); 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() UIScene_SignEntryMenu::~UIScene_SignEntryMenu()
{ {
m_sign->SetSelectedLine(-1);
m_parentLayer->removeComponent(eUIComponent_MenuBackground); m_parentLayer->removeComponent(eUIComponent_MenuBackground);
} }
@ -77,6 +84,79 @@ void UIScene_SignEntryMenu::tick()
{ {
UIScene::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) if(m_bConfirmed)
{ {
m_bConfirmed = false; 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) void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{ {
if(m_bConfirmed || m_bIgnoreInput) return; if(m_bConfirmed || m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (isDirectEditBlocking()) { handled = true; return; }
#endif
ui.AnimateKeyPress(iPad, key, repeat, pressed, released); 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__ #ifdef __ORBIS__
case ACTION_MENU_TOUCHPAD_PRESS: case ACTION_MENU_TOUCHPAD_PRESS:
#endif #endif
sendInputToMovie(key, repeat, pressed, released);
handled = true;
break;
case ACTION_MENU_UP: case ACTION_MENU_UP:
case ACTION_MENU_DOWN: case ACTION_MENU_DOWN:
sendInputToMovie(key, repeat, pressed, released); 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; handled = true;
break; 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) 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; UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam;
pClass->m_bIgnoreInput = false; pClass->m_bIgnoreInput = false;
if (bRes) 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]; uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) ); ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText); InputManager.GetText(pchText);
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText); pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText);
#endif
} }
return 0; return 0;
} }
void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
{ {
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId) switch((int)controlId)
{ {
case eControl_Confirm: case eControl_Confirm:
@ -170,6 +346,28 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
case eControl_Line4: case eControl_Line4:
{ {
m_iEditingLine = (int)controlId; 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; m_bIgnoreInput = true;
#ifdef _XBOX_ONE #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. // 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 #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); 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 #endif
} }
break; break;

View file

@ -21,6 +21,12 @@ private:
int m_iEditingLine; int m_iEditingLine;
bool m_bConfirmed; bool m_bConfirmed;
bool m_bIgnoreInput; bool m_bIgnoreInput;
int m_iSignCursorFrame;
#ifdef _WINDOWS64
int m_iActiveDirectEditLine;
bool m_bNeedsInitialEdit;
bool m_bSkipTickNav;
#endif
UIControl_Button m_buttonConfirm; UIControl_Button m_buttonConfirm;
UIControl_Label m_labelMessage; UIControl_Label m_labelMessage;
@ -50,6 +56,11 @@ protected:
public: public:
// INPUT // INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); 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: protected:
void handlePress(F64 controlId, F64 childId); void handlePress(F64 controlId, F64 childId);

View file

@ -904,11 +904,11 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// start the game // start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); 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) if (wSeed.length() != 0)
{ {
__int64 value = 0; int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length(); unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value //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 the input string is a numerical value, convert it to a number
if( isNumber ) 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 the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 ) if( value != 0 )

View file

@ -1945,7 +1945,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
// Make our next save default to the name of the level // Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str()); StorageManager.SetSaveTitle(saveFile->getName().c_str());
__int64 fileSize = saveFile->length(); int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile); FileInputStream fis(*saveFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);

View file

@ -860,7 +860,7 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
if(bShow && pMinecraft->level!=NULL) 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 // are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0) if(pMinecraft->level->dimension->id==0)
{ {

View file

@ -485,7 +485,7 @@ typedef uLong FAR uLongf;
# define z_off64_t off64_t # define z_off64_t off64_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64 # define z_off64_t long long
# else # else
# define z_off64_t z_off_t # define z_off64_t z_off_t
# endif # endif

View file

@ -97,14 +97,14 @@ void CreateWorldScreen::buttonClicked(Button *button)
if (done) return; if (done) return;
done = true; done = true;
__int64 seedValue = (new Random())->nextLong(); int64_t seedValue = (new Random())->nextLong();
wstring seedString = seedEdit->getValue(); wstring seedString = seedEdit->getValue();
if (seedString.length() != 0) if (seedString.length() != 0)
{ {
// try to convert it to a long first // try to convert it to a long first
// try { // 4J - removed try/catch // try { // 4J - removed try/catch
__int64 value = _fromString<__int64>(seedString); int64_t value = _fromString<int64_t>(seedString);
if (value != 0) if (value != 0)
{ {
seedValue = value; seedValue = value;

View file

@ -4,7 +4,7 @@
class DemoLevel : public Level class DemoLevel : public Level
{ {
private: 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_X = 796;
static const int DEMO_SPAWN_Y = 72; static const int DEMO_SPAWN_Y = 72;
static const int DEMO_SPAWN_Z = -731; static const int DEMO_SPAWN_Z = -731;

View file

@ -13,8 +13,8 @@ void DemoMode::tick()
SurvivalMode::tick(); SurvivalMode::tick();
/* 4J - TODO - seems unlikely we need this demo mode anyway /* 4J - TODO - seems unlikely we need this demo mode anyway
__int64 time = minecraft->level->getTime(); int64_t time = minecraft->level->getTime();
__int64 day = (time / Level::TICKS_PER_DAY) + 1; int64_t day = (time / Level::TICKS_PER_DAY) + 1;
demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS)); demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS));
if (demoHasEnded) if (demoHasEnded)

View file

@ -269,7 +269,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
StorageManager.SetSaveTitle(wWorldName.c_str()); StorageManager.SetSaveTitle(wWorldName.c_str());
bool isFlat = false; 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(); NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue; param->seed = seedValue;

View file

@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #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) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long 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) #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) #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__) #elif defined(__RADCELL__)

View file

@ -326,7 +326,7 @@ RADDEFSTART
typedef CHAR *LPSTR, *PSTR; typedef CHAR *LPSTR, *PSTR;
#ifdef IS_WIN64 #ifdef IS_WIN64
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; typedef unsigned long long ULONG_PTR, *PULONG_PTR;
#else #else
#ifdef _Wp64 #ifdef _Wp64
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300

View file

@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #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) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long 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) #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) #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__) #elif defined(__RADCELL__)

View file

@ -1154,7 +1154,7 @@ void DQRNetworkManager::Tick_StateMachine()
break; break;
case DNM_INT_STATE_JOINING_SENDING_UNRELIABLE: 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 // 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 ) 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 // 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. // 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 ) if( ( timeNow - m_startedWaitingForReservationsTime ) > JOIN_RESERVATION_WAIT_TIME )
{ {
SetState(DNM_INT_STATE_JOINING_FAILED_TIDY_UP); SetState(DNM_INT_STATE_JOINING_FAILED_TIDY_UP);
@ -2742,7 +2742,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
if( sessionRef != nullptr ) if( sessionRef != nullptr )
{ {
// Allow 2 seconds before we let the player cancel // 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 // 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. // 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; break;
} }
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
if( currentTime > allowCancelTime) if( currentTime > allowCancelTime)
{ {
shownCancelScreen = true; shownCancelScreen = true;

View file

@ -339,9 +339,9 @@ private:
static const eDQRNetworkManagerState m_INTtoEXTStateMappings[DNM_INT_STATE_COUNT]; static const eDQRNetworkManagerState m_INTtoEXTStateMappings[DNM_INT_STATE_COUNT];
eDQRNetworkManagerInternalState m_state; eDQRNetworkManagerInternalState m_state;
eDQRNetworkManagerState m_stateExternal; eDQRNetworkManagerState m_stateExternal;
__int64 m_lastUnreliableSendTime; int64_t m_lastUnreliableSendTime;
__int64 m_firstUnreliableSendTime; int64_t m_firstUnreliableSendTime;
__int64 m_startedWaitingForReservationsTime; int64_t m_startedWaitingForReservationsTime;
unsigned char *m_customSessionData; unsigned char *m_customSessionData;
unsigned int m_customSessionDataSize; unsigned int m_customSessionDataSize;
int m_customDataDirtyUpdateTicks; int m_customDataDirtyUpdateTicks;
@ -491,7 +491,7 @@ public:
void SetDisplayName(PlayerUID xuid, wstring displayName); void SetDisplayName(PlayerUID xuid, wstring displayName);
private: private:
__int64 m_playersLeftPartyTime; int64_t m_playersLeftPartyTime;
int m_playersLeftParty; int m_playersLeftParty;
bool GetBestPartyUserIndex(); bool GetBestPartyUserIndex();

View file

@ -69,7 +69,7 @@ VOID XMLParser::FillBuffer()
} }
m_dwCharsConsumed += NChars; 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_pISAXCallback->SetParseProgress( (DWORD)iProgress );
m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars ] = '\0';

View file

@ -21,6 +21,7 @@
#include "Windows64\Social\SocialManager.h" #include "Windows64\Social\SocialManager.h"
#include "Windows64\Sentient\DynamicConfigurations.h" #include "Windows64\Sentient\DynamicConfigurations.h"
#include "Windows64\Network\WinsockNetLayer.h" #include "Windows64\Network\WinsockNetLayer.h"
#include "Windows64\Windows64_Xuid.h"
#elif defined __PSVITA__ #elif defined __PSVITA__
#include "PSVita\Sentient\SentientManager.h" #include "PSVita\Sentient\SentientManager.h"
#include "StatsCounter.h" #include "StatsCounter.h"
@ -200,7 +201,15 @@ DWORD IQNetPlayer::GetCurrentRtt() { return 0; }
bool IQNetPlayer::IsHost() { return m_isHostPlayer; } bool IQNetPlayer::IsHost() { return m_isHostPlayer; }
bool IQNetPlayer::IsGuest() { return false; } bool IQNetPlayer::IsGuest() { return false; }
bool IQNetPlayer::IsLocal() { return !m_isRemote; } 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; } LPCWSTR IQNetPlayer::GetGamertag() { return m_gamertag; }
int IQNetPlayer::GetSessionIndex() { return m_smallId; } int IQNetPlayer::GetSessionIndex() { return m_smallId; }
bool IQNetPlayer::IsTalking() { return false; } bool IQNetPlayer::IsTalking() { return false; }
@ -226,6 +235,7 @@ void Win64_SetupRemoteQNetPlayer(IQNetPlayer * player, BYTE smallId, bool isHost
player->m_smallId = smallId; player->m_smallId = smallId;
player->m_isRemote = !isLocal; player->m_isRemote = !isLocal;
player->m_isHostPlayer = isHost; player->m_isHostPlayer = isHost;
player->m_resolvedXuid = INVALID_XUID;
swprintf_s(player->m_gamertag, 32, L"Player%d", smallId); swprintf_s(player->m_gamertag, 32, L"Player%d", smallId);
if (smallId >= IQNet::s_playerCount) if (smallId >= IQNet::s_playerCount)
IQNet::s_playerCount = smallId + 1; IQNet::s_playerCount = smallId + 1;
@ -285,8 +295,13 @@ IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid)
{ {
for (DWORD i = 0; i < s_playerCount; i++) 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]; return &m_player[0];
} }
DWORD IQNet::GetPlayerCount() DWORD IQNet::GetPlayerCount()
@ -301,7 +316,13 @@ DWORD IQNet::GetPlayerCount()
QNET_STATE IQNet::GetState() { return _iQNetStubState; } QNET_STATE IQNet::GetState() { return _iQNetStubState; }
bool IQNet::IsHost() { return s_isHosting; } bool IQNet::IsHost() { return s_isHosting; }
HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO * pInviteInfo) { return S_OK; } 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() void IQNet::ClientJoinGame()
{ {
_iQNetStubState = QNET_STATE_SESSION_STARTING; _iQNetStubState = QNET_STATE_SESSION_STARTING;
@ -312,6 +333,7 @@ void IQNet::ClientJoinGame()
m_player[i].m_smallId = (BYTE)i; m_player[i].m_smallId = (BYTE)i;
m_player[i].m_isRemote = true; m_player[i].m_isRemote = true;
m_player[i].m_isHostPlayer = false; m_player[i].m_isHostPlayer = false;
m_player[i].m_resolvedXuid = INVALID_XUID;
m_player[i].m_gamertag[0] = 0; m_player[i].m_gamertag[0] = 0;
m_player[i].SetCustomDataValue(0); m_player[i].SetCustomDataValue(0);
} }
@ -326,6 +348,7 @@ void IQNet::EndGame()
m_player[i].m_smallId = (BYTE)i; m_player[i].m_smallId = (BYTE)i;
m_player[i].m_isRemote = false; m_player[i].m_isRemote = false;
m_player[i].m_isHostPlayer = false; m_player[i].m_isHostPlayer = false;
m_player[i].m_resolvedXuid = INVALID_XUID;
m_player[i].m_gamertag[0] = 0; m_player[i].m_gamertag[0] = 0;
m_player[i].SetCustomDataValue(0); m_player[i].SetCustomDataValue(0);
} }
@ -575,10 +598,13 @@ void C_4JProfile::GetXUID(int iPad, PlayerUID * pXuid, bool bOnlineXuid)
*pXuid = INVALID_XUID; *pXuid = INVALID_XUID;
return; 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) if (IQNet::s_isHosting)
*pXuid = 0xe000d45248242f2e; *pXuid = Win64Xuid::GetLegacyEmbeddedHostXuid();
else else
*pXuid = 0xe000d45248242f2e + WinsockNetLayer::GetLocalSmallId(); *pXuid = Win64Xuid::ResolvePersistentXuid();
#else #else
* pXuid = 0xe000d45248242f2e + iPad; * pXuid = 0xe000d45248242f2e + iPad;
#endif #endif

View file

@ -21,6 +21,10 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor
enforceUnicodeSheet = false; enforceUnicodeSheet = false;
bidirectional = false; bidirectional = false;
xPos = yPos = 0.0f; xPos = yPos = 0.0f;
m_bold = false;
m_italic = false;
m_underline = false;
m_strikethrough = false;
// Set up member variables // Set up member variables
m_cols = cols; m_cols = cols;
@ -126,6 +130,60 @@ Font::~Font()
} }
#endif #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) void Font::renderCharacter(wchar_t c)
{ {
float xOff = c % m_cols * m_charWidth; float xOff = c % m_cols * m_charWidth;
@ -137,37 +195,47 @@ void Font::renderCharacter(wchar_t c)
float fontWidth = m_cols * m_charWidth; float fontWidth = m_cols * m_charWidth;
float fontHeight = m_rows * m_charHeight; 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(); Tesselator *t = Tesselator::getInstance();
// 4J Stu - Changed to a quad so that we can use within a command buffer
#if 1
t->begin(); t->begin();
t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight); 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->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->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->tex(xOff / fontWidth, yOff / fontHeight);
t->vertex(xPos, yPos, 0.0f); t->vertex(x0, y0, 0.0f);
t->end(); 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) 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); 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) 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); drawWordWrapInternal(str, x + 1, y + 1, w, color, true, h);
@ -193,24 +281,42 @@ wstring Font::reorderBidi(const wstring &str)
return 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) void Font::draw(const wstring &str, bool dropShadow)
{ {
// Bind the texture // Bind the texture
textures->bindTexture(m_textureLocation); textures->bindTexture(m_textureLocation);
bool noise = false; bool noise = false;
m_bold = m_italic = m_underline = m_strikethrough = false;
wstring cleanStr = sanitize(str); 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 // Map character
wchar_t c = cleanStr.at(i); wchar_t c = cleanStr.at(i);
if (c == 167 && i + 1 < cleanStr.length()) 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]; wchar_t ca = cleanStr[i+1];
if (!isSectionFormatCode(ca))
{
t->end();
renderCharacter(167);
renderCharacter(ca);
t->begin();
i += 1;
continue;
}
int colorN = 16; int colorN = 16;
if(( ca >= L'0' ) && (ca <= L'9')) colorN = ca - L'0'; if(( ca >= L'0' ) && (ca <= L'9')) colorN = ca - L'0';
else if(( ca >= L'a' ) && (ca <= L'f')) colorN = (ca - L'a') + 10; 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) 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 else
{ {
noise = false; noise = false;
if (colorN < 0 || colorN > 15) colorN = 15; if (colorN < 0 || colorN > 15) colorN = 15;
if (dropShadow) colorN += 16; if (dropShadow) colorN += 16;
int color = colors[colorN]; int color = colors[colorN];
glColor3f((color >> 16) / 255.0F, ((color >> 8) & 255) / 255.0F, (color & 255) / 255.0F); glColor3f((color >> 16) / 255.0F, ((color >> 8) & 255) / 255.0F, (color & 255) / 255.0F);
} }
i += 1; i += 1;
continue; continue;
} }
@ -247,8 +355,10 @@ void Font::draw(const wstring &str, bool dropShadow)
c = newc; c = newc;
} }
renderCharacter(c); addCharacterQuad(c);
} }
t->end();
} }
void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow)
@ -282,15 +392,29 @@ int Font::width(const wstring& str)
if (c == 167) if (c == 167)
{ {
// Ignore the character used to define coloured text if (i + 1 < cleanStr.length() && isSectionFormatCode(cleanStr[i+1]))
++i; ++i;
}
else else
{ {
len += charWidths[167];
if (i + 1 < cleanStr.length())
len += charWidths[static_cast<unsigned>(cleanStr[++i])];
}
}
else
len += charWidths[c]; 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; return len;
} }
@ -467,7 +591,7 @@ void Font::setBidirectional(bool bidirectional)
bool Font::AllCharactersValid(const wstring &str) 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); wchar_t c = str.at(i);
@ -512,15 +636,15 @@ void Font::renderFakeCB(IntBuffer *ib)
float uo = (0.0f) / 128.0f; float uo = (0.0f) / 128.0f;
float vo = (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(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((float)(0 + s), (float)( 0 + s), (float)( 0), (float)( (ix + s) / 128.0f + uo), (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((float)(0 + s), (float)( 0), (float)( 0), (float)( (ix + s) / 128.0f + uo), (float)( iy / 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((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), 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, // target.colorBlit(texture, x + xo, y, color, ix, iy,
// charWidths[chars[i]], 8); // charWidths[chars[i]], 8);
t->end(); t->end();
glTranslatef((float)charWidths[i], 0, 0); glTranslatef(static_cast<float>(charWidths[i]), 0, 0);
} }
else else
{ {

View file

@ -21,6 +21,12 @@ private:
float xPos; float xPos;
float yPos; 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 enforceUnicodeSheet; // use unicode sheet for ascii
bool bidirectional; // use bidi to flip strings bool bidirectional; // use bidi to flip strings
@ -41,9 +47,12 @@ public:
private: private:
void renderCharacter(wchar_t c); // 4J added 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: public:
void drawShadow(const wstring& str, int x, int y, int color); 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 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); 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, bool dropShadow);
void draw(const wstring& str, int x, int y, int color, 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 int MapCharacter(wchar_t c); // 4J added
bool CharacterExists(wchar_t c); // 4J added bool CharacterExists(wchar_t c); // 4J added
public: public:
int width(const wstring& str); int width(const wstring& str);
int widthLiteral(const wstring& str); // width without skipping § codes (for chat input)
wstring sanitize(const wstring& str); wstring sanitize(const wstring& str);
void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param

View file

@ -745,7 +745,12 @@ void GameRenderer::renderItemInHand(float a, int eye)
{ {
turnOnLightLayer(a); turnOnLightLayer(a);
PIXBeginNamedEvent(0,"Item in hand render"); PIXBeginNamedEvent(0,"Item in hand render");
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
itemInHandRenderer->render(a); itemInHandRenderer->render(a);
glDepthMask(true);
glDisable(GL_BLEND);
PIXEndNamedEvent(); PIXEndNamedEvent();
turnOffLightLayer(a); turnOffLightLayer(a);
} }
@ -1169,8 +1174,6 @@ void GameRenderer::render(float a, bool bFirst)
lastNsTime = System::nanoTime(); lastNsTime = System::nanoTime();
ApplyGammaPostProcess();
if (!mc->options->hideGui || mc->screen != NULL) if (!mc->options->hideGui || mc->screen != NULL)
{ {
mc->gui->render(a, mc->screen != NULL, xMouse, yMouse); 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); if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a);
} }
ApplyGammaPostProcess();
} }
void GameRenderer::renderLevel(float a) void GameRenderer::renderLevel(float a)
@ -1351,7 +1355,7 @@ void GameRenderer::DisableUpdateThread()
#endif #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 // 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; if (until == 0) break;
__int64 diff = until - System::nanoTime(); int64_t diff = until - System::nanoTime();
if (diff < 0) break; if (diff < 0) break;
if (diff > 1000000000) break; if (diff > 1000000000) break;
} while (true); } while (true);

View file

@ -115,8 +115,8 @@ public:
void setupCamera(float a, int eye); void setupCamera(float a, int eye);
private: private:
void renderItemInHand(float a, int eye); void renderItemInHand(float a, int eye);
__int64 lastActiveTime; int64_t lastActiveTime;
__int64 lastNsTime; int64_t lastNsTime;
// 4J - changes brought forward from 1.8.2 // 4J - changes brought forward from 1.8.2
bool _updateLightTexture; bool _updateLightTexture;
public: public:
@ -133,7 +133,7 @@ private:
public: public:
void render(float a, bool bFirst); // 4J added bFirst void render(float a, bool bFirst); // 4J added bFirst
void renderLevel(float a); void renderLevel(float a);
void renderLevel(float a, __int64 until); void renderLevel(float a, int64_t until);
private: private:
Random *random; Random *random;
int rainSoundTime; int rainSoundTime;

View file

@ -846,17 +846,29 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
MemSect(31); MemSect(31);
if (minecraft->options->renderDebug) 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(); 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); if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff); font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", debugLeft, debugTop, 0xffffff);
font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff); font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), debugLeft, debugTop + 12, 0xffffff);
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff); font->drawShadow(minecraft->gatherStats1(), debugLeft, debugTop + 22, 0xffffff);
font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff); font->drawShadow(minecraft->gatherStats2(), debugLeft, debugTop + 32, 0xffffff);
font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff); font->drawShadow(minecraft->gatherStats3(), debugLeft, debugTop + 42, 0xffffff);
font->drawShadow(minecraft->gatherStats4(), iSafezoneXHalf+2, 32 + 40, 0xffffff); font->drawShadow(minecraft->gatherStats4(), debugLeft, debugTop + 52, 0xffffff);
// TERRAIN FEATURES // TERRAIN FEATURES
int iYPos=82; int iYPos = debugTop + 62;
if(minecraft->level->dimension->id==0) 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_Village] = L"Village: ";
wfeature[eTerrainFeature_Ravine] = L"Ravine: "; 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]; 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"] "; 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++ ) for( int i = eTerrainFeature_Stronghold; i < (int) eTerrainFeature_Count; i++ )
{ {
font->drawShadow(wfeature[i], iSafezoneXHalf + 2, iYPos, 0xffffff);
iYPos+=10; 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 xBlockPos = floor(minecraft->player->x);
double yBlockPos = floor(minecraft->player->y); double yBlockPos = floor(minecraft->player->y);
double zBlockPos = floor(minecraft->player->z); 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"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)), iSafezoneXHalf+2, iYPos + 8 * 1, 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), iSafezoneXHalf+2, iYPos + 8 * 2, 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), iSafezoneXHalf+2, iYPos + 8 * 3, 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; iYPos += 8*4;
int px = Mth::floor(minecraft->player->x); 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()); Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource());
drawString( drawString(
font, 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(); 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); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
// 4J Stu - We have moved the chat text to a xui #if 0 // defined(_WINDOWS64) // Temporarily disable this chat in favor of iggy chat until we have better visual parity
#if 0
glPushMatrix(); glPushMatrix();
// 4J-PB we need to move this up a bit because we've moved the quick select glTranslatef(0.0f, static_cast<float>(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 - 3 + 22) - 24.0f, 0.0f);
//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);
// 4J-PB - we need gui messages for each of the possible 4 splitscreen players
if(bDisplayGui) if(bDisplayGui)
{ {
int iPad=minecraft->player->GetXboxPad(); 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 < 0) t = 0;
if (t > 1) t = 1; if (t > 1) t = 1;
t = t * t; t = t * t;
int alpha = (int) (255 * t); int alpha = static_cast<int>(255 * t);
if (isChatting) alpha = 255; if (isChatting) alpha = 255;
if (alpha > 0) if (alpha > 0)
{ {
int x = iSafezoneXHalf+2; int x = iSafezoneXHalf+2;
int y = -((int)i) * 9; int y = -(static_cast<int>(i)) * 9;
if(bTwoPlayerSplitscreen) if(bTwoPlayerSplitscreen)
{ {
y+= iHeightOffset; y+= iHeightOffset;
} }
wstring msg = guiMessages[iPad][i].string; 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); this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24);
glEnable(GL_BLEND); glEnable(GL_BLEND);
font->drawShadow(msg, iSafezoneXHalf+4, y, 0xffffff + (alpha << 24)); font->drawShadow(msg, iSafezoneXHalf+4, y, 0xffffff + (alpha << 24));
} }
} }
@ -1455,7 +1473,7 @@ void Gui::displayClientMessage(int messageId, int iPad)
} }
// 4J Added // 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; int height = minecraft->height;
// This causes us to cover xScale*dataLength pixels in the horizontal // 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); 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 - aVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + 0.5f), (float)( height + 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); 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 - bVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 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); 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; int height = minecraft->height;
@ -1539,8 +1557,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int
Tesselator *t = Tesselator::getInstance(); Tesselator *t = Tesselator::getInstance();
t->begin(GL_LINES); t->begin(GL_LINES);
__int64 thisVal = 0; int64_t thisVal = 0;
__int64 topVal = 0; int64_t topVal = 0;
for (int i = 0; i < dataLength; i++) for (int i = 0; i < dataLength; i++)
{ {
thisVal = 0; thisVal = 0;

View file

@ -67,6 +67,6 @@ public:
float getJukeboxOpacity(int iPad); float getJukeboxOpacity(int iPad);
// 4J Added // 4J Added
void renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataAScale, int dataAWarning, __int64 *dataB, float dataBScale, int dataBWarning); 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 (*func)(unsigned int dataPos, unsigned int dataSource) ); void renderStackedGraph(int dataPos, int dataLength, int dataSources, int64_t (*func)(unsigned int dataPos, unsigned int dataSource) );
}; };

View file

@ -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); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(r, g, b, a); glColor4f(r, g, b, a);
t->begin(); t->begin();
t->vertex((float)(x0), (float)( y1), (float)( 0)); t->vertex(static_cast<float>(x0), static_cast<float>(y1), static_cast<float>(0));
t->vertex((float)(x1), (float)( y1), (float)( 0)); t->vertex(static_cast<float>(x1), static_cast<float>(y1), static_cast<float>(0));
t->vertex((float)(x1), (float)( y0), (float)( 0)); t->vertex(static_cast<float>(x1), static_cast<float>(y0), static_cast<float>(0));
t->vertex((float)(x0), (float)( y0), (float)( 0)); t->vertex(static_cast<float>(x0), static_cast<float>(y0), static_cast<float>(0));
t->end(); t->end();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND); 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(); Tesselator *t = Tesselator::getInstance();
t->begin(); t->begin();
t->color(r1, g1, b1, a1); t->color(r1, g1, b1, a1);
t->vertex((float)(x1), (float)( y0), blitOffset); t->vertex(static_cast<float>(x1), static_cast<float>(y0), blitOffset);
t->vertex((float)(x0), (float)( y0), blitOffset); t->vertex(static_cast<float>(x0), static_cast<float>(y0), blitOffset);
t->color(r2, g2, b2, a2); t->color(r2, g2, b2, a2);
t->vertex((float)(x0), (float)( y1), blitOffset); t->vertex(static_cast<float>(x0), static_cast<float>(y1), blitOffset);
t->vertex((float)(x1), (float)( y1), blitOffset); t->vertex(static_cast<float>(x1), static_cast<float>(y1), blitOffset);
t->end(); t->end();
glShadeModel(GL_FLAT); 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); 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) void GuiComponent::blit(int x, int y, int sx, int sy, int w, int h)
{ {
float us = 1 / 256.0f; 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; 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 // 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 // 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; dx /= Gui::currentGuiScaleFactor;
float dy = extraShift / 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) // 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 // 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 fx = (floorf(static_cast<float>(x) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
float fy = (floorf((float)y * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; float fy = (floorf(static_cast<float>(y) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
float fw = (floorf((float)w * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; float fw = (floorf(static_cast<float>(w) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor;
float fh = (floorf((float)h * 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 + 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, (float)( blitOffset), (float)( (sx + w) * us), (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, (float)( blitOffset), (float)( (sx + w) * us), (float)( (sy + 0) * 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, (float)( blitOffset), (float)( (sx + 0) * us), (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(); t->end();
} }

View file

@ -15,5 +15,6 @@ public:
GuiComponent(); // 4J added GuiComponent(); // 4J added
void drawCenteredString(Font *font, const wstring& str, int x, int y, int color); 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 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); void blit(int x, int y, int sx, int sy, int w, int h);
}; };

View file

@ -767,6 +767,9 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
glPushMatrix(); glPushMatrix();
glTranslatef((float)-xOff, (float)-yOff, (float)-zOff); glTranslatef((float)-xOff, (float)-yOff, (float)-zOff);
if (layer == 1)
glDepthMask(false);
#ifdef __PSVITA__ #ifdef __PSVITA__
// AP - also set the camera position so we can work out if a chunk is fogged or not // 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); 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__ #endif // __PS3__
glPopMatrix(); glPopMatrix();
if (layer == 1)
glDepthMask(true);
mc->gameRenderer->turnOffLightLayer(alpha); // 4J - brought forward from 1.8.2 mc->gameRenderer->turnOffLightLayer(alpha); // 4J - brought forward from 1.8.2
#else #else
@ -2076,9 +2083,9 @@ bool LevelRenderer::updateDirtyChunks()
if( bAtomic || (index == 0) ) if( bAtomic || (index == 0) )
{ {
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z); //PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
// static __int64 totalTime = 0; // static int64_t totalTime = 0;
// static __int64 countTime = 0; // static int64_t countTime = 0;
// __int64 startTime = System::currentTimeMillis(); // int64_t startTime = System::currentTimeMillis();
//app.DebugPrintf("Rebuilding permaChunk %d\n", index); //app.DebugPrintf("Rebuilding permaChunk %d\n", index);
@ -2087,7 +2094,7 @@ bool LevelRenderer::updateDirtyChunks()
if(index !=0) 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 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); // totalTime += (endTime - startTime);
// countTime++; // countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime); // printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
@ -2126,11 +2133,11 @@ bool LevelRenderer::updateDirtyChunks()
static Chunk permaChunk; static Chunk permaChunk;
permaChunk.makeCopyForRebuild(chunk); permaChunk.makeCopyForRebuild(chunk);
LeaveCriticalSection(&m_csDirtyChunks); LeaveCriticalSection(&m_csDirtyChunks);
// static __int64 totalTime = 0; // static int64_t totalTime = 0;
// static __int64 countTime = 0; // static int64_t countTime = 0;
// __int64 startTime = System::currentTimeMillis(); // int64_t startTime = System::currentTimeMillis();
permaChunk.rebuild(); permaChunk.rebuild();
// __int64 endTime = System::currentTimeMillis(); // int64_t endTime = System::currentTimeMillis();
// totalTime += (endTime - startTime); // totalTime += (endTime - startTime);
// countTime++; // countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime); // printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);

View file

@ -271,7 +271,7 @@ public:
XLockFreeStack<int> dirtyChunksLockFreeStack; XLockFreeStack<int> dirtyChunksLockFreeStack;
bool dirtyChunkPresent; 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 static const int FORCE_DIRTY_CHUNK_CHECK_PERIOD_MS = 125; // decreased from 250 to 125 - updated by detectiveren
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS

View file

@ -52,12 +52,12 @@ public:
virtual ~LocalPlayer(); virtual ~LocalPlayer();
int m_iScreenSection; // assuming 4player splitscreen for now, or -1 for single player 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 // player tick, and a button press and release combo can be missed in the minecraft::tick
__uint64 ullDpad_last; uint64_t ullDpad_last;
__uint64 ullDpad_this; uint64_t ullDpad_this;
__uint64 ullDpad_filtered; uint64_t ullDpad_filtered;
// 4J-PB - moved these in from the minecraft structure, since they are per player things for splitscreen // 4J-PB - moved these in from the minecraft structure, since they are per player things for splitscreen
//int ticks; //int ticks;

View file

@ -23,7 +23,7 @@ void MinecartRenderer::render(shared_ptr<Entity> _cart, double x, double y, doub
bindTexture(cart); bindTexture(cart);
__int64 seed = cart->entityId * 493286711l; int64_t seed = cart->entityId * 493286711l;
seed = seed * seed * 4392167121l + seed * 98761; seed = seed * seed * 4392167121l + seed * 98761;
float xo = ((((seed >> 16) & 0x7) + 0.5f) / 8.0f - 0.5f) * 0.004f; float xo = ((((seed >> 16) & 0x7) + 0.5f) / 8.0f - 0.5f) * 0.004f;

View file

@ -52,6 +52,7 @@
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h" #include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
#include "..\Minecraft.World\net.minecraft.world.item.h" #include "..\Minecraft.World\net.minecraft.world.item.h"
#include "..\Minecraft.World\Minecraft.World.h" #include "..\Minecraft.World\Minecraft.World.h"
#include "Windows64\Windows64_Xuid.h"
#include "ClientConnection.h" #include "ClientConnection.h"
#include "..\Minecraft.World\HellRandomLevelSource.h" #include "..\Minecraft.World\HellRandomLevelSource.h"
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h" #include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
@ -84,10 +85,10 @@
#define DISABLE_LEVELTICK_THREAD #define DISABLE_LEVELTICK_THREAD
Minecraft *Minecraft::m_instance = NULL; Minecraft *Minecraft::m_instance = NULL;
__int64 Minecraft::frameTimes[512]; int64_t Minecraft::frameTimes[512];
__int64 Minecraft::tickTimes[512]; int64_t Minecraft::tickTimes[512];
int Minecraft::frameTimePos = 0; int Minecraft::frameTimePos = 0;
__int64 Minecraft::warezTime = 0; int64_t Minecraft::warezTime = 0;
File Minecraft::workDir = File(L""); File Minecraft::workDir = File(L"");
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -634,7 +635,7 @@ void Minecraft::run()
return; return;
} }
__int64 lastTime = System::currentTimeMillis(); int64_t lastTime = System::currentTimeMillis();
int frames = 0; int frames = 0;
while (running) while (running)
@ -659,7 +660,7 @@ void Minecraft::run()
timer->advanceTime(); timer->advanceTime();
} }
__int64 beforeTickTime = System::nanoTime(); int64_t beforeTickTime = System::nanoTime();
for (int i = 0; i < timer->ticks; i++) for (int i = 0; i < timer->ticks; i++)
{ {
ticks++; ticks++;
@ -671,7 +672,7 @@ void Minecraft::run()
// setScreen(new LevelConflictScreen()); // setScreen(new LevelConflictScreen());
// } // }
} }
__int64 tickDuraction = System::nanoTime() - beforeTickTime; int64_t tickDuraction = System::nanoTime() - beforeTickTime;
checkGlError(L"Pre render"); checkGlError(L"Pre render");
TileRenderer::fancy = options->fancyGraphics; TileRenderer::fancy = options->fancyGraphics;
@ -1038,6 +1039,19 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
PlayerUID playerXUIDOnline = INVALID_XUID; PlayerUID playerXUIDOnline = INVALID_XUID;
ProfileManager.GetXUID(idx,&playerXUIDOffline,false); ProfileManager.GetXUID(idx,&playerXUIDOffline,false);
ProfileManager.GetXUID(idx,&playerXUIDOnline,true); 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]->setXuid(playerXUIDOffline);
localplayers[idx]->setOnlineXuid(playerXUIDOnline); localplayers[idx]->setOnlineXuid(playerXUIDOnline);
localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx)); localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx));
@ -1226,7 +1240,7 @@ void Minecraft::applyFrameMouseLook()
void Minecraft::run_middle() void Minecraft::run_middle()
{ {
static __int64 lastTime = 0; static int64_t lastTime = 0;
static bool bFirstTimeIntoGame = true; static bool bFirstTimeIntoGame = true;
static bool bAutosaveTimerSet=false; static bool bAutosaveTimerSet=false;
static unsigned int uiAutosaveTimer=0; static unsigned int uiAutosaveTimer=0;
@ -1485,7 +1499,7 @@ void Minecraft::run_middle()
} }
// Utility keys always work regardless of KBM active state // 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; localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_PAUSEMENU;
app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i); app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i);
@ -1508,7 +1522,7 @@ void Minecraft::run_middle()
} }
#endif #endif
#ifndef _FINAL_BUILD #if _DEBUG // ndef _FINAL_BUILD // Disable conflicting debug functionality in release builds
if( app.DebugSettingsOn() && app.GetUseDPadForDebug() ) if( app.DebugSettingsOn() && app.GetUseDPadForDebug() )
{ {
localplayers[i]->ullDpad_last = 0; localplayers[i]->ullDpad_last = 0;
@ -1790,7 +1804,7 @@ void Minecraft::run_middle()
timer->advanceTime(); timer->advanceTime();
} }
//__int64 beforeTickTime = System::nanoTime(); //int64_t beforeTickTime = System::nanoTime();
for (int i = 0; i < timer->ticks; i++) for (int i = 0; i < timer->ticks; i++)
{ {
bool bLastTimerTick = ( i == ( timer->ticks - 1 ) ); bool bLastTimerTick = ( i == ( timer->ticks - 1 ) );
@ -1876,7 +1890,7 @@ void Minecraft::run_middle()
// CompressedTileStorage::tick(); // 4J added // CompressedTileStorage::tick(); // 4J added
// SparseDataStorage::tick(); // 4J added // SparseDataStorage::tick(); // 4J added
} }
//__int64 tickDuraction = System::nanoTime() - beforeTickTime; //int64_t tickDuraction = System::nanoTime() - beforeTickTime;
MemSect(31); MemSect(31);
checkGlError(L"Pre render"); checkGlError(L"Pre render");
MemSect(0); MemSect(0);
@ -2081,14 +2095,14 @@ void Minecraft::emergencySave()
setLevel(NULL); setLevel(NULL);
} }
void Minecraft::renderFpsMeter(__int64 tickTime) void Minecraft::renderFpsMeter(int64_t tickTime)
{ {
int nsPer60Fps = 1000000000l / 60; int nsPer60Fps = 1000000000l / 60;
if (lastTimer == -1) if (lastTimer == -1)
{ {
lastTimer = System::nanoTime(); lastTimer = System::nanoTime();
} }
__int64 now = System::nanoTime(); int64_t now = System::nanoTime();
Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime; Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime;
Minecraft::frameTimes[(Minecraft::frameTimePos++) & (Minecraft::frameTimes_length - 1)] = now - lastTimer; Minecraft::frameTimes[(Minecraft::frameTimePos++) & (Minecraft::frameTimes_length - 1)] = now - lastTimer;
lastTimer = now; lastTimer = now;
@ -2120,7 +2134,7 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0)); t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0));
t->end(); t->end();
__int64 totalTime = 0; int64_t totalTime = 0;
for (int i = 0; i < Minecraft::frameTimes_length; i++) for (int i = 0; i < Minecraft::frameTimes_length; i++)
{ {
totalTime += Minecraft::frameTimes[i]; totalTime += Minecraft::frameTimes[i];
@ -2150,8 +2164,8 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
t->color(0xff000000 + cc * 256); t->color(0xff000000 + cc * 256);
} }
__int64 time = Minecraft::frameTimes[i] / 200000; int64_t time = Minecraft::frameTimes[i] / 200000;
__int64 time2 = Minecraft::tickTimes[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 - time + 0.5f), (float)( 0));
t->vertex((float)(i + 0.5f), (float)( height + 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--; if (player->missTime > 0) player->missTime--;
#ifdef _DEBUG_MENUS_ENABLED #ifdef _DEBUG//_MENUS_ENABLED // disable DPad cheats on release builds
if(app.DebugSettingsOn()) if(app.DebugSettingsOn())
{ {
#ifndef __PSVITA__ #ifndef __PSVITA__
@ -3745,7 +3759,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
player->drop(); player->drop();
} }
__uint64 ullButtonsPressed=player->ullButtonsPressed; uint64_t ullButtonsPressed=player->ullButtonsPressed;
bool selected = false; bool selected = false;
#ifdef __PSVITA__ #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 // player doesn't have an online UID, set it from the player name
playerXUIDOnline.setForAdhoc(); 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 #endif
player->setXuid(playerXUIDOffline); player->setXuid(playerXUIDOffline);
player->setOnlineXuid(playerXUIDOnline); player->setOnlineXuid(playerXUIDOnline);
@ -4481,6 +4508,18 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
PlayerUID playerXUIDOnline = INVALID_XUID; PlayerUID playerXUIDOnline = INVALID_XUID;
ProfileManager.GetXUID(iTempPad,&playerXUIDOffline,false); ProfileManager.GetXUID(iTempPad,&playerXUIDOffline,false);
ProfileManager.GetXUID(iTempPad,&playerXUIDOnline,true); 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->setXuid(playerXUIDOffline);
player->setOnlineXuid(playerXUIDOnline); player->setOnlineXuid(playerXUIDOnline);
player->setIsGuest( ProfileManager.IsGuest(iTempPad) ); player->setIsGuest( ProfileManager.IsGuest(iTempPad) );
@ -4776,7 +4815,7 @@ void Minecraft::delayTextureReload()
reloadTextures = true; reloadTextures = true;
} }
__int64 Minecraft::currentTimeMillis() int64_t Minecraft::currentTimeMillis()
{ {
return System::currentTimeMillis();//(Sys.getTime() * 1000) / Sys.getTimerResolution(); return System::currentTimeMillis();//(Sys.getTime() * 1000) / Sys.getTimerResolution();
} }

View file

@ -170,11 +170,11 @@ private:
LevelStorageSource *levelSource; LevelStorageSource *levelSource;
public: public:
static const int frameTimes_length = 512; static const int frameTimes_length = 512;
static __int64 frameTimes[frameTimes_length]; static int64_t frameTimes[frameTimes_length];
static const int tickTimes_length = 512; static const int tickTimes_length = 512;
static __int64 tickTimes[tickTimes_length]; static int64_t tickTimes[tickTimes_length];
static int frameTimePos; static int frameTimePos;
static __int64 warezTime; static int64_t warezTime;
private: private:
int rightClickDelay; int rightClickDelay;
public: public:
@ -230,9 +230,9 @@ private:
// String grabHugeScreenshot(File workDir2, int width, int height, int ssWidth, int ssHeight); // 4J - removed // String grabHugeScreenshot(File workDir2, int width, int height, int ssWidth, int ssHeight); // 4J - removed
// 4J - per player thing? // 4J - per player thing?
__int64 lastTimer; int64_t lastTimer;
void renderFpsMeter(__int64 tickTime); void renderFpsMeter(int64_t tickTime);
public: public:
void stop(); void stop();
// 4J removed // 4J removed
@ -253,7 +253,7 @@ public:
//bool isRaining ; //bool isRaining ;
// 4J - Moved to per player // 4J - Moved to per player
//__int64 lastTickTime; //int64_t lastTickTime;
private: private:
// 4J- per player? // 4J- per player?
@ -300,7 +300,7 @@ public:
static int maxSupportedTextureSize(); static int maxSupportedTextureSize();
void delayTextureReload(); void delayTextureReload();
static __int64 currentTimeMillis(); static int64_t currentTimeMillis();
#ifdef _DURANGO #ifdef _DURANGO
static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad);

View file

@ -68,15 +68,15 @@
//4J Added //4J Added
MinecraftServer *MinecraftServer::server = NULL; MinecraftServer *MinecraftServer::server = NULL;
bool MinecraftServer::setTimeAtEndOfTick = false; bool MinecraftServer::setTimeAtEndOfTick = false;
__int64 MinecraftServer::setTime = 0; int64_t MinecraftServer::setTime = 0;
bool MinecraftServer::setTimeOfDayAtEndOfTick = false; bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
__int64 MinecraftServer::setTimeOfDay = 0; int64_t MinecraftServer::setTimeOfDay = 0;
bool MinecraftServer::m_bPrimaryPlayerSignedOut=false; bool MinecraftServer::m_bPrimaryPlayerSignedOut=false;
bool MinecraftServer::s_bServerHalted=false; bool MinecraftServer::s_bServerHalted=false;
bool MinecraftServer::s_bSaveOnExitAnswered=false; bool MinecraftServer::s_bSaveOnExitAnswered=false;
#ifdef _ACK_CHUNK_SEND_THROTTLING #ifdef _ACK_CHUNK_SEND_THROTTLING
bool MinecraftServer::s_hasSentEnoughPackets = false; bool MinecraftServer::s_hasSentEnoughPackets = false;
__int64 MinecraftServer::s_tickStartTime = 0; int64_t MinecraftServer::s_tickStartTime = 0;
vector<INetworkPlayer *> MinecraftServer::s_sentTo; vector<INetworkPlayer *> MinecraftServer::s_sentTo;
#else #else
int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueuePlayerIndex = 0;
@ -581,7 +581,7 @@ MinecraftServer::~MinecraftServer()
DeleteCriticalSection(&m_consoleInputCS); 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 // 4J - removed
#if 0 #if 0
@ -692,7 +692,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
// TODO: Stop loading, add error message. // 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 levelName = (initData && !initData->levelName.empty()) ? initData->levelName : GetDedicatedServerString(settings, L"level-name", L"world");
wstring levelTypeString; wstring levelTypeString;
@ -736,10 +736,10 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
#if 0 #if 0
wstring levelSeedString = settings->getString(L"level-seed", L""); wstring levelSeedString = settings->getString(L"level-seed", L"");
__int64 levelSeed = (new Random())->nextLong(); int64_t levelSeed = (new Random())->nextLong();
if (levelSeedString.length() > 0) if (levelSeedString.length() > 0)
{ {
long newSeed = _fromString<__int64>(levelSeedString); long newSeed = _fromString<int64_t>(levelSeedString);
if (newSeed != 0) { if (newSeed != 0) {
levelSeed = newSeed; levelSeed = newSeed;
} }
@ -866,7 +866,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
DeleteCriticalSection(&m_postProcessCS); 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 // 4J - TODO - do with new save stuff
// if (storageSource->requiresConversion(name)) // if (storageSource->requiresConversion(name))
@ -1016,7 +1016,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
m_postUpdateThread->Run(); m_postUpdateThread->Run();
__int64 startTime = System::currentTimeMillis(); int64_t startTime = System::currentTimeMillis();
// 4J Stu - Added this to temporarily make starting games on vita faster // 4J Stu - Added this to temporarily make starting games on vita faster
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -1046,7 +1046,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
csf->closeHandle(fe); csf->closeHandle(fe);
} }
__int64 lastTime = System::currentTimeMillis(); int64_t lastTime = System::currentTimeMillis();
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld())
{ {
@ -1074,7 +1074,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
} }
#if 0 #if 0
__int64 lastStorageTickTime = System::currentTimeMillis(); int64_t lastStorageTickTime = System::currentTimeMillis();
// Test code to enable full creation of levels at start up // Test code to enable full creation of levels at start up
int halfsidelen = ( i == 0 ) ? 27 : 9; int halfsidelen = ( i == 0 ) ? 27 : 9;
@ -1097,7 +1097,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
} }
} }
#else #else
__int64 lastStorageTickTime = System::currentTimeMillis(); int64_t lastStorageTickTime = System::currentTimeMillis();
Pos *spawnPos = level->getSharedSpawnPos(); Pos *spawnPos = level->getSharedSpawnPos();
int twoRPlusOne = r*2 + 1; int twoRPlusOne = r*2 + 1;
@ -1114,7 +1114,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
return false; return false;
} }
// printf(">>>%d %d %d\n",i,x,z); // 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) lastTime = now;
// if (now > lastTime + 1000) // if (now > lastTime + 1000)
{ {
@ -1679,7 +1679,7 @@ bool MinecraftServer::getForceGameType()
return forceGameType; return forceGameType;
} }
__int64 MinecraftServer::getCurrentTimeMillis() int64_t MinecraftServer::getCurrentTimeMillis()
{ {
return System::currentTimeMillis(); return System::currentTimeMillis();
} }
@ -1695,7 +1695,7 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout)
} }
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; 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; NetworkGameInitData *initData = NULL;
DWORD initSettings = 0; DWORD initSettings = 0;
@ -1728,18 +1728,18 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
} }
} }
__int64 lastTime = getCurrentTimeMillis(); int64_t lastTime = getCurrentTimeMillis();
__int64 unprocessedTime = 0; int64_t unprocessedTime = 0;
while (running && !s_bServerHalted) 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 - 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 // 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 //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; //if(m_isServerPaused) lastTime = now;
__int64 passedTime = now - lastTime; int64_t passedTime = now - lastTime;
if (passedTime > MS_PER_TICK * 40) if (passedTime > MS_PER_TICK * 40)
{ {
// logger.warning("Can't keep up! Did the system time change, or is the server overloaded?"); // 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 else
{ {
// int tickcount = 0; // int tickcount = 0;
// __int64 beforeall = System::currentTimeMillis(); // int64_t beforeall = System::currentTimeMillis();
while (unprocessedTime > MS_PER_TICK) while (unprocessedTime > MS_PER_TICK)
{ {
unprocessedTime -= MS_PER_TICK; unprocessedTime -= MS_PER_TICK;
chunkPacketManagement_PreTick(); chunkPacketManagement_PreTick();
// __int64 before = System::currentTimeMillis(); // int64_t before = System::currentTimeMillis();
tick(); tick();
// __int64 after = System::currentTimeMillis(); // int64_t after = System::currentTimeMillis();
// PIXReportCounter(L"Server time",(float)(after-before)); // PIXReportCounter(L"Server time",(float)(after-before));
chunkPacketManagement_PostTick(); chunkPacketManagement_PostTick();
} }
// __int64 afterall = System::currentTimeMillis(); // int64_t afterall = System::currentTimeMillis();
// PIXReportCounter(L"Server time all",(float)(afterall-beforeall)); // PIXReportCounter(L"Server time all",(float)(afterall-beforeall));
// PIXReportCounter(L"Server ticks",(float)tickcount); // 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); players->broadcastAll( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id);
} }
// #ifndef __PS3__ // #ifndef __PS3__
static __int64 stc = 0; static int64_t stc = 0;
__int64 st0 = System::currentTimeMillis(); int64_t st0 = System::currentTimeMillis();
PIXBeginNamedEvent(0,"Level tick %d",i); PIXBeginNamedEvent(0,"Level tick %d",i);
((Level *)level)->tick(); ((Level *)level)->tick();
__int64 st1 = System::currentTimeMillis(); int64_t st1 = System::currentTimeMillis();
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Update lights %d",i); PIXBeginNamedEvent(0,"Update lights %d",i);
__int64 st2 = System::currentTimeMillis(); int64_t st2 = System::currentTimeMillis();
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Entity tick %d",i); PIXBeginNamedEvent(0,"Entity tick %d",i);
// 4J added to stop ticking entities in levels when players are not in those levels. // 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(); level->getTracker()->tick();
PIXEndNamedEvent(); 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 ); // printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : %d\n", st1 - st0, st2 - st1, st3 - st2, st0 - stc );
stc = st0; stc = st0;
// #endif// __PS3__ // #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__ #if __PS3__
ShutdownManager::HasStarted(ShutdownManager::eServerThread ); ShutdownManager::HasStarted(ShutdownManager::eServerThread );
@ -2286,7 +2286,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
void MinecraftServer::chunkPacketManagement_DidSendTo(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 ) if( ( currentTime - s_tickStartTime ) >= MAX_TICK_TIME_FOR_PACKET_SENDS )
{ {

View file

@ -27,14 +27,14 @@ class CommandDispatcher;
typedef struct _LoadSaveDataThreadParam typedef struct _LoadSaveDataThreadParam
{ {
LPVOID data; LPVOID data;
__int64 fileSize; int64_t fileSize;
const wstring saveName; 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; } LoadSaveDataThreadParam;
typedef struct _NetworkGameInitData typedef struct _NetworkGameInitData
{ {
__int64 seed; int64_t seed;
LoadSaveDataThreadParam *saveData; LoadSaveDataThreadParam *saveData;
DWORD settings; DWORD settings;
LevelGenerationOptions *levelGen; LevelGenerationOptions *levelGen;
@ -133,9 +133,9 @@ public:
~MinecraftServer(); ~MinecraftServer();
private: private:
// 4J Added - LoadSaveDataThreadParam // 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); 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 setProgress(const wstring& status, int progress);
void endProgress(); void endProgress();
void saveAllChunks(); void saveAllChunks();
@ -171,13 +171,13 @@ public:
bool isUnderSpawnProtection(Level *level, int x, int y, int z, shared_ptr<Player> player); bool isUnderSpawnProtection(Level *level, int x, int y, int z, shared_ptr<Player> player);
void setForceGameType(bool forceGameType); void setForceGameType(bool forceGameType);
bool getForceGameType(); bool getForceGameType();
static __int64 getCurrentTimeMillis(); static int64_t getCurrentTimeMillis();
int getPlayerIdleTimeout(); int getPlayerIdleTimeout();
void setPlayerIdleTimeout(int playerIdleTimeout); void setPlayerIdleTimeout(int playerIdleTimeout);
public: public:
void halt(); void halt();
void run(__int64 seed, void *lpParameter); void run(int64_t seed, void *lpParameter);
void broadcastStartSavingPacket(); void broadcastStartSavingPacket();
void broadcastStopSavingPacket(); void broadcastStopSavingPacket();
@ -188,7 +188,7 @@ public:
void handleConsoleInput(const wstring& msg, ConsoleInputSource *source); void handleConsoleInput(const wstring& msg, ConsoleInputSource *source);
void handleConsoleInputs(); void handleConsoleInputs();
// void addTickable(Tickable tickable); // 4J removed // 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); static void HaltServer(bool bPrimaryPlayerSignedOut=false);
File *getFile(const wstring& name); File *getFile(const wstring& name);
@ -208,9 +208,9 @@ private:
static MinecraftServer *server; static MinecraftServer *server;
static bool setTimeOfDayAtEndOfTick; static bool setTimeOfDayAtEndOfTick;
static __int64 setTimeOfDay; static int64_t setTimeOfDay;
static bool setTimeAtEndOfTick; 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 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 static bool s_bServerHalted; // 4J Stu Added so that we can halt the server even before it's been created properly
@ -234,8 +234,8 @@ public:
public: public:
static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; } static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; }
static void SetTimeOfDay(__int64 time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; } static void SetTimeOfDay(int64_t time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; }
static void SetTime(__int64 time) { setTimeAtEndOfTick = true; setTime = time; } static void SetTime(int64_t time) { setTimeAtEndOfTick = true; setTime = time; }
C4JThread::Event* m_serverPausedEvent; C4JThread::Event* m_serverPausedEvent;
private: private:
@ -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 // 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 #ifdef _ACK_CHUNK_SEND_THROTTLING
static bool s_hasSentEnoughPackets; static bool s_hasSentEnoughPackets;
static __int64 s_tickStartTime; static int64_t s_tickStartTime;
static vector<INetworkPlayer *> s_sentTo; static vector<INetworkPlayer *> s_sentTo;
static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35; static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35;
#else #else

View file

@ -789,7 +789,7 @@ void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard)
this->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 // 4J: We send daylight cycle rule with host options so don't need this
/*if (newTime < 0) /*if (newTime < 0)

View file

@ -94,7 +94,7 @@ public:
virtual void createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag); virtual void createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag);
virtual void setScoreboard(Scoreboard *scoreboard); 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 // 4J Stu - Added so we can have multiple local connections
void addClientConnection(ClientConnection *c) { connections.push_back( c ); } void addClientConnection(ClientConnection *c) { connections.push_back( c ); }

View file

@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #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) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long 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) #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) #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__) #elif defined(__RADCELL__)

View file

@ -326,7 +326,7 @@ RADDEFSTART
typedef CHAR *LPSTR, *PSTR; typedef CHAR *LPSTR, *PSTR;
#ifdef IS_WIN64 #ifdef IS_WIN64
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; typedef unsigned long long ULONG_PTR, *PULONG_PTR;
#else #else
#ifdef _Wp64 #ifdef _Wp64
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300

View file

@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #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) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long 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) #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) #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__) #elif defined(__RADCELL__)

Some files were not shown because too many files have changed in this diff Show more