Updated to latest main branch, redid my implementation of c++23 manually to avoid accidental grammar issues

This commit is contained in:
Racc 2026-03-07 16:26:58 +00:00
parent ebf33e4a83
commit 16257641a7
1106 changed files with 6233 additions and 4524 deletions

1
.gitignore vendored
View file

@ -436,3 +436,4 @@ Minecraft.Client/Saves/
# Visual Studio Per-User Config
*.user
/out

View file

@ -51,6 +51,7 @@ target_include_directories(MinecraftClient PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/include"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/Sentient/Include"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/x64headers"
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
)
target_compile_definitions(MinecraftClient PRIVATE
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>

View file

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

View file

@ -400,7 +400,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
else
{
int width = Math::_max(font->width(name), 120);
wstring msg = I18n::get(L"achievement.requirements", ach->requirements->name);
wstring msg = I18n::get(L"achievement.requires", ach->requirements->name);
int height = font->wordWrapHeight(msg, width);
fillGradient(x - 3, y - 3, x + width + 3, y + height + 12 + 3, 0xc0000000, 0xc0000000);
font->drawWordWrap(msg, x, y + 12, width, 0xff705050);

View file

@ -830,8 +830,9 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
// 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)
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
{
BYTE smallId = static_cast<BYTE>(i);
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
if (np == NULL)
continue;

View file

@ -133,7 +133,9 @@ enum eGameSetting
{
eGameSetting_MusicVolume=0,
eGameSetting_SoundFXVolume,
eGameSetting_RenderDistance,
eGameSetting_Gamma,
eGameSetting_FOV,
eGameSetting_Difficulty,
eGameSetting_Sensitivity_InGame,
eGameSetting_Sensitivity_InMenu,

View file

@ -65,8 +65,8 @@ typedef struct
// In-Menu sensitivity
unsigned char ucMenuSensitivity;
unsigned char ucInterfaceOpacity;
unsigned char ucPad02;//2 bytes of padding added here
unsigned char usPad03;
unsigned char ucPad02; // 1 uint8_t padding
unsigned char ucFov;
// Adding another bitmask flag for more settings for 1.8.2
unsigned int uiBitmaskValues; // 0x00000001 - eGameSetting_Clouds - on

View file

@ -25,7 +25,7 @@
#include <vector>
#include <memory>
#include <mutex>
#include "..\Filesystem\Filesystem.h"
#include <lce_filesystem\lce_filesystem.h>
#ifdef __ORBIS__
#include <audioout.h>
@ -64,9 +64,9 @@ void SoundEngine::playMusicTick() {};
#else
#ifdef _WINDOWS64
const char SoundEngine::m_szSoundPath[] = {"Windows64Media\\Sound\\"};
const char SoundEngine::m_szMusicPath[] = {"music\\"};
const char SoundEngine::m_szRedistName[] = {"redist64"};
char SoundEngine::m_szSoundPath[]={"Windows64Media\\Sound\\"};
char SoundEngine::m_szMusicPath[]={"music\\"};
char SoundEngine::m_szRedistName[]={"redist64"};
#elif defined _DURANGO
char SoundEngine::m_szSoundPath[]={"Sound\\"};
char SoundEngine::m_szMusicPath[]={"music\\"};
@ -187,7 +187,7 @@ void SoundEngine::init(Options* pOptions)
m_bSystemMusicPlaying = false;
app.DebugPrintf("---miniaudio initialized\n");
return;
}
@ -265,7 +265,6 @@ void SoundEngine::updateMiniAudio()
finalVolume = 1.0f;
ma_sound_set_volume(&s->sound, finalVolume);
ma_sound_set_pitch(&s->sound, s->info.pitch);
if (s->info.bIs3D)
@ -471,67 +470,64 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
char finalPath[256];
sprintf_s(finalPath, "%s.wav", basePath);
if (!FileExists(finalPath))
{
int count = 0;
const char* extensions[] = { ".ogg", ".wav", ".mp3" };
size_t extCount = sizeof(extensions) / sizeof(extensions[0]);
bool found = false;
for (size_t i = 1; i < 32; i++)
{
char numberedFolder[256];
sprintf_s(numberedFolder, "%s%d", basePath, i);
DWORD attr = GetFileAttributesA(numberedFolder);
if (attr != INVALID_FILE_ATTRIBUTES &&
(attr & FILE_ATTRIBUTE_DIRECTORY))
{
count++;
}
else
{
break;
}
}
char chosenFolder[256];
if (count == 0)
{
sprintf_s(chosenFolder, "%s", basePath);
}
else
{
int chosen = (rand() % count) + 1;
sprintf_s(chosenFolder, "%s%d", basePath, chosen);
}
char searchPattern[256];
sprintf_s(searchPattern, "%s\\*.wav", chosenFolder);
WIN32_FIND_DATAA findData;
HANDLE hFind = FindFirstFileA(searchPattern, &findData);
const char* extensions[] = { ".ogg", ".wav", ".mp3" };
size_t extCount = sizeof(extensions) / sizeof(extensions[0]);
bool found = false;
for (size_t i = 0; i < extCount; i++)
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
{
char basePlusExt[256];
sprintf_s(basePlusExt, "%s%s", basePath, extensions[extIdx]);
DWORD attr = GetFileAttributesA(basePlusExt);
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
{
sprintf_s(searchPattern, "%s\\*%s", chosenFolder, extensions[i]);
hFind = FindFirstFileA(searchPattern, &findData);
if (hFind != INVALID_HANDLE_VALUE)
sprintf_s(finalPath, "%s", basePlusExt);
found = true;
break;
}
}
if (!found)
{
int count = 0;
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
{
for (size_t i = 1; i < 32; i++)
{
found = true;
break;
char numberedPath[256];
sprintf_s(numberedPath, "%s%d%s", basePath, i, extensions[extIdx]);
DWORD attr = GetFileAttributesA(numberedPath);
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
{
count = i;
}
}
}
if (hFind == INVALID_HANDLE_VALUE)
{
app.DebugPrintf("No sound files found in %s\n", chosenFolder);
return;
}
sprintf_s(finalPath, "%s\\%s", chosenFolder, findData.cFileName);
FindClose(hFind);
if (count > 0)
{
int chosen = (rand() % count) + 1;
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
{
char numberedPath[256];
sprintf_s(numberedPath, "%s%d%s", basePath, chosen, extensions[extIdx]);
DWORD attr = GetFileAttributesA(numberedPath);
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
{
sprintf_s(finalPath, "%s", numberedPath);
found = true;
break;
}
}
if (!found)
{
sprintf_s(finalPath, "%s%d.wav", basePath, chosen);
}
}
}
MiniAudioSound* s = new MiniAudioSound();
@ -649,6 +645,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
float finalVolume = volume * m_MasterEffectsVolume;
if (finalVolume > 1.0f)
finalVolume = 1.0f;
printf("UI Sound volume set to %f\nEffects volume: %f\n", finalVolume, m_MasterEffectsVolume);
ma_sound_set_volume(&s->sound, finalVolume);
ma_sound_set_pitch(&s->sound, pitch);

View file

@ -148,10 +148,10 @@ private:
ma_sound m_musicStream;
bool m_musicStreamActive;
static const char m_szSoundPath[];
static const char m_szMusicPath[];
static const char m_szRedistName[];
static const char *m_szStreamFileA[eStream_Max];
static char m_szSoundPath[];
static char m_szMusicPath[];
static char m_szRedistName[];
static const char *m_szStreamFileA[eStream_Max];
AUDIO_LISTENER m_ListenerA[MAX_LOCAL_PLAYERS];
int m_validListenerCount;

View file

@ -6,14 +6,14 @@
const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
{
L"mob.chicken", // eSoundType_MOB_CHICKEN_AMBIENT
L"mob.chickenhurt", // eSoundType_MOB_CHICKEN_HURT
L"mob.chickenplop", // eSoundType_MOB_CHICKENPLOP
L"mob.cow", // eSoundType_MOB_COW_AMBIENT
L"mob.cowhurt", // eSoundType_MOB_COW_HURT
L"mob.pig", // eSoundType_MOB_PIG_AMBIENT
L"mob.pigdeath", // eSoundType_MOB_PIG_DEATH
L"mob.sheep", // eSoundType_MOB_SHEEP_AMBIENT
L"mob.chicken.say", // eSoundType_MOB_CHICKEN_AMBIENT
L"mob.chicken.hurt", // eSoundType_MOB_CHICKEN_HURT
L"mob.chicken.plop", // eSoundType_MOB_CHICKENPLOP
L"mob.cow.say", // eSoundType_MOB_COW_AMBIENT
L"mob.cow.hurt", // eSoundType_MOB_COW_HURT
L"mob.pig.say", // eSoundType_MOB_PIG_AMBIENT
L"mob.pig.death", // eSoundType_MOB_PIG_DEATH
L"mob.sheep.say", // eSoundType_MOB_SHEEP_AMBIENT
L"mob.wolf.growl", // eSoundType_MOB_WOLF_GROWL
L"mob.wolf.whine", // eSoundType_MOB_WOLF_WHINE
L"mob.wolf.panting", // eSoundType_MOB_WOLF_PANTING
@ -43,15 +43,15 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
L"mob.silverfish.step", // eSoundType_MOB_SILVERFISH_STEP,
L"mob.skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
L"mob.skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
L"mob.spider", // eSoundType_MOB_SPIDER_AMBIENT,
L"mob.spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
L"mob.spider.say", // eSoundType_MOB_SPIDER_AMBIENT,
L"mob.spider.death", // eSoundType_MOB_SPIDER_DEATH,
L"mob.slime", // eSoundType_MOB_SLIME,
L"mob.slimeattack", // eSoundType_MOB_SLIME_ATTACK,
L"mob.creeper", // eSoundType_MOB_CREEPER_HURT,
L"mob.creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
L"mob.zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
L"mob.zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
L"mob.zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
L"mob.slime.attack", // eSoundType_MOB_SLIME_ATTACK,
L"mob.creeper.say", // eSoundType_MOB_CREEPER_HURT,
L"mob.creeper.death", // eSoundType_MOB_CREEPER_DEATH,
L"mob.zombie.say", // eSoundType_MOB_ZOMBIE_AMBIENT,
L"mob.zombie.hurt", // eSoundType_MOB_ZOMBIE_HURT,
L"mob.zombie.death", // eSoundType_MOB_ZOMBIE_DEATH,
L"mob.zombie.wood", // eSoundType_MOB_ZOMBIE_WOOD,
L"mob.zombie.woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
L"mob.zombie.metal", // eSoundType_MOB_ZOMBIE_METAL,
@ -86,7 +86,7 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
L"random.door_close", // eSoundType_RANDOM_DOOR_CLOSE,
L"ambient.weather.rain", // eSoundType_AMBIENT_WEATHER_RAIN,
L"ambient.weather.thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
L"ambient.cave.cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
L"ambient.cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
#ifdef _XBOX
L"ambient.cave.cave2", // eSoundType_CAVE_CAVE2 - removed the two sounds that were at 192k in the first ambient cave event
#endif
@ -210,9 +210,9 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
L"mob.horse.soft", //eSoundType_MOB_HORSE_SOFT,
L"mob.horse.jump", //eSoundType_MOB_HORSE_JUMP,
L"mob.witch.idle", //eSoundType_MOB_WITCH_IDLE, <--- missing
L"mob.witch.hurt", //eSoundType_MOB_WITCH_HURT, <--- missing
L"mob.witch.death", //eSoundType_MOB_WITCH_DEATH, <--- missing
L"mob.witch.ambient", //eSoundType_MOB_WITCH_IDLE,
L"mob.witch.hurt", //eSoundType_MOB_WITCH_HURT,
L"mob.witch.death", //eSoundType_MOB_WITCH_DEATH,
L"mob.slime.big", //eSoundType_MOB_SLIME_BIG,
L"mob.slime.small", //eSoundType_MOB_SLIME_SMALL,

View file

@ -199,7 +199,7 @@ use a specific one you will need to specify the device ID in the configuration,
config.capture.pDeviceID = pMyCaptureDeviceID; // Only if requesting a capture, duplex or loopback device.
```
To retrieve the device ID you will need to perform device enumeration, however this requirements the
To retrieve the device ID you will need to perform device enumeration, however this requires the
use of a new concept called the "context". Conceptually speaking the context sits above the device.
There is one context to many devices. The purpose of the context is to represent the backend at a
more global level and to perform operations outside the scope of an individual device. Mainly it is
@ -396,7 +396,7 @@ The start/stop time needs to be specified based on the absolute timer which is c
engine. The current global time in PCM frames can be retrieved with
`ma_engine_get_time_in_pcm_frames()`. The engine's global time can be changed with
`ma_engine_set_time_in_pcm_frames()` for synchronization purposes if required. Note that scheduling
a start time still requirements an explicit call to `ma_sound_start()` before anything will play:
a start time still requires an explicit call to `ma_sound_start()` before anything will play:
```c
ma_sound_set_start_time_in_pcm_frames(&sound, ma_engine_get_time_in_pcm_frames(&engine) + (ma_engine_get_sample_rate(&engine) * 2);
@ -480,7 +480,7 @@ symbol for `ActivateAudioInterfaceAsync()`.
The macOS build should compile cleanly without the need to download any dependencies nor link to
any libraries or frameworks. The iOS build needs to be compiled as Objective-C and will need to
link the relevant frameworks but should compile cleanly out of the box with Xcode. Compiling
through the command line requirements linking to `-lpthread` and `-lm`.
through the command line requires linking to `-lpthread` and `-lm`.
Due to the way miniaudio links to frameworks at runtime, your application may not pass Apple's
notarization process. To fix this there are two options. The first is to compile with
@ -502,13 +502,13 @@ See this discussion for more info: https://github.com/mackron/miniaudio/issues/2
2.3. Linux
----------
The Linux build only requirements linking to `-ldl`, `-lpthread` and `-lm`. You do not need any
The Linux build only requires linking to `-ldl`, `-lpthread` and `-lm`. You do not need any
development packages. You may need to link with `-latomic` if you're compiling for 32-bit ARM.
2.4. BSD
--------
The BSD build only requirements linking to `-lpthread` and `-lm`. NetBSD uses audio(4), OpenBSD uses
The BSD build only requires linking to `-lpthread` and `-lm`. NetBSD uses audio(4), OpenBSD uses
sndio and FreeBSD uses OSS. You may need to link with `-latomic` if you're compiling for 32-bit
ARM.
@ -517,7 +517,7 @@ ARM.
------------
AAudio is the highest priority backend on Android. This should work out of the box without needing
any kind of compiler configuration. Support for AAudio starts with Android 8 which means older
versions will fall back to OpenSL|ES which requirements API level 16+.
versions will fall back to OpenSL|ES which requires API level 16+.
There have been reports that the OpenSL|ES backend fails to initialize on some Android based
devices due to `dlopen()` failing to open "libOpenSLES.so". If this happens on your platform
@ -581,7 +581,7 @@ To run locally, you'll need to use emrun:
+----------------------------------+--------------------------------------------------------------------+
| MA_NO_NULL | Disables the null backend. |
+----------------------------------+--------------------------------------------------------------------+
| MA_ENABLE_ONLY_SPECIFIC_BACKENDS | Disables all backends by default and requirements `MA_ENABLE_*` to |
| MA_ENABLE_ONLY_SPECIFIC_BACKENDS | Disables all backends by default and requires `MA_ENABLE_*` to |
| | enable specific backends. |
+----------------------------------+--------------------------------------------------------------------+
| MA_ENABLE_WASAPI | Used in conjunction with MA_ENABLE_ONLY_SPECIFIC_BACKENDS to |
@ -1467,7 +1467,7 @@ can be useful to schedule a sound to start or stop:
ma_sound_set_stop_time_in_pcm_frames(&sound, ma_engine_get_time_in_pcm_frames(&engine) + (ma_engine_get_sample_rate(&engine) * 2));
```
Note that scheduling a start time still requirements an explicit call to `ma_sound_start()` before
Note that scheduling a start time still requires an explicit call to `ma_sound_start()` before
anything will play.
The time is specified in global time which is controlled by the engine. You can get the engine's
@ -3674,7 +3674,7 @@ BSD
15.4. UWP
---------
- UWP only supports default playback and capture devices.
- UWP requirements the Microphone capability to be enabled in the application's manifest (Package.appxmanifest):
- UWP requires the Microphone capability to be enabled in the application's manifest (Package.appxmanifest):
```
<Package ...>
@ -3791,8 +3791,8 @@ extern "C" {
typedef signed int ma_int32;
typedef unsigned int ma_uint32;
#if defined(_MSC_VER) && !defined(__clang__)
typedef signed __int64 ma_int64;
typedef unsigned __int64 ma_uint64;
typedef signed long long ma_int64;
typedef unsigned long long ma_uint64;
#else
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
#pragma GCC diagnostic push
@ -7275,7 +7275,7 @@ easier, some helper callbacks are available. If the backend uses a blocking read
backend uses a callback for data delivery, that callback must call `ma_device_handle_backend_data_callback()` from within its callback.
This allows miniaudio to then process any necessary data conversion and then pass it to the miniaudio data callback.
If the backend requirements absolute flexibility with its data delivery, it can optionally implement the `onDeviceDataLoop()` callback
If the backend requires absolute flexibility with its data delivery, it can optionally implement the `onDeviceDataLoop()` callback
which will allow it to implement the logic that will run on the audio thread. This is much more advanced and is completely optional.
The audio thread should run data delivery logic in a loop while `ma_device_get_state() == ma_device_state_started` and no errors have been
@ -11249,7 +11249,7 @@ struct ma_sound
float* pProcessingCache; /* Will be null if pDataSource is null. */
ma_uint32 processingCacheFramesRemaining;
ma_uint32 processingCacheCap;
ma_bool8 ownsDataSource;
ma_bool8 ownsDataSource;
/*
We're declaring a resource manager data source object here to save us a malloc when loading a
@ -11301,7 +11301,7 @@ typedef struct
ma_uint32 defaultVolumeSmoothTimeInPCMFrames; /* Defaults to 0. Controls the default amount of smoothing to apply to volume changes to sounds. High values means more smoothing at the expense of high latency (will take longer to reach the new volume). */
ma_uint32 preMixStackSizeInBytes; /* A stack is used for internal processing in the node graph. This allows you to configure the size of this stack. Smaller values will reduce the maximum depth of your node graph. You should rarely need to modify this. */
ma_allocation_callbacks allocationCallbacks;
ma_bool32 noAutoStart; /* When set to true, requirements an explicit call to ma_engine_start(). This is false by default, meaning the engine will be started automatically in ma_engine_init(). */
ma_bool32 noAutoStart; /* When set to true, requires an explicit call to ma_engine_start(). This is false by default, meaning the engine will be started automatically in ma_engine_init(). */
ma_bool32 noDevice; /* When set to true, don't create a default device. ma_engine_read_pcm_frames() can be called manually to read data. */
ma_mono_expansion_mode monoExpansionMode; /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
ma_vfs* pResourceManagerVFS; /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not NULL. */
@ -11596,7 +11596,7 @@ IMPLEMENTATION
#include <sys/time.h> /* select() (used for ma_sleep()). */
#include <time.h> /* For nanosleep() */
#include <unistd.h>
#include <unistd.h>
#endif
/* For fstat(), etc. */
@ -11729,7 +11729,7 @@ IMPLEMENTATION
#endif
#if _MSC_VER >= 1600 && (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219)
static MA_INLINE unsigned __int64 ma_xgetbv(int reg)
static MA_INLINE unsigned long long ma_xgetbv(int reg)
{
return _xgetbv(reg);
}
@ -11813,7 +11813,7 @@ static MA_INLINE ma_bool32 ma_has_avx()
#if defined(_AVX_) || defined(__AVX__)
return MA_TRUE; /* If the compiler is allowed to freely generate AVX code we can assume support. */
#else
/* AVX requirements both CPU and OS support. */
/* AVX requires both CPU and OS support. */
#if defined(MA_NO_CPUID) || defined(MA_NO_XGETBV)
return MA_FALSE;
#else
@ -11847,7 +11847,7 @@ static MA_INLINE ma_bool32 ma_has_avx2(void)
#if defined(_AVX2_) || defined(__AVX2__)
return MA_TRUE; /* If the compiler is allowed to freely generate AVX2 code we can assume support. */
#else
/* AVX2 requirements both CPU and OS support. */
/* AVX2 requires both CPU and OS support. */
#if defined(MA_NO_CPUID) || defined(MA_NO_XGETBV)
return MA_FALSE;
#else
@ -17622,7 +17622,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
(void)stackSize; /* Suppress unused parameter warning. */
}
#endif
if (scheduler != -1) {
int priorityMin = sched_get_priority_min(scheduler);
@ -23061,7 +23061,7 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device
CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE);
{
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
}
}
if (CoInitializeResult == S_OK || CoInitializeResult == S_FALSE) { ma_CoUninitialize(pContext); }
if (FAILED(hr)) { /* <-- This is checking the call above to ma_CoCreateInstance(). */
@ -29687,7 +29687,7 @@ static ma_result ma_device_start__alsa(ma_device* pDevice)
}
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
/*
/*
When data is written to the device we wait for the device to get ready to receive data with poll(). In my testing
I have observed that poll() can sometimes block forever unless the device is started explicitly with snd_pcm_start()
or some data is written with snd_pcm_writei().
@ -30346,13 +30346,13 @@ PulseAudio. In PulseAudio, the data callback will *only* be called if you wrote
writing data, and if you don't have anything to write, just write silence. That's fine until you want to drain the stream. You see, if
you're continuously writing data to the stream, the stream will never get drained! That means in order to drain the stream, you need to
*not* write data to it! But remember, when you don't write data to the stream, the callback won't get fired again! Why is draining
important? Because that's how we've defined stopping to work in miniaudio. In miniaudio, stopping the device requirements it to be drained
before returning from ma_device_stop(). So we've stopped the device, which requirements us to drain, but draining requirements us to *not* write
important? Because that's how we've defined stopping to work in miniaudio. In miniaudio, stopping the device requires it to be drained
before returning from ma_device_stop(). So we've stopped the device, which requires us to drain, but draining requires us to *not* write
data to the stream (or else it won't ever complete draining), but not writing to the stream means the callback won't get fired again!
This becomes a problem when stopping and then restarting the device. When the device is stopped, it's drained, which requirements us to *not*
This becomes a problem when stopping and then restarting the device. When the device is stopped, it's drained, which requires us to *not*
write anything to the stream. But then, since we didn't write anything to it, the write callback will *never* get called again if we just
resume the stream naively. This means that starting the stream requirements us to write data to the stream from outside the callback. This
resume the stream naively. This means that starting the stream requires us to write data to the stream from outside the callback. This
disconnect is something PulseAudio has got seriously wrong - there should only ever be a single source of data delivery, that being the
callback. (I have tried using `pa_stream_flush()` to trigger the write callback to fire, but this just doesn't work for some reason.)
@ -35996,7 +35996,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
#endif
}
status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat));
if (status != noErr) {
((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit);
@ -39310,7 +39310,7 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
(void)error;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream));
/*
When we get an error, we'll assume that the stream is in an erroneous state and needs to be restarted. From the documentation,
we cannot do this from the error callback. Therefore we are going to use an event thread for the AAudio backend to do this
@ -39322,13 +39322,13 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
else {
job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE);
job.data.device.aaudio.reroute.pDevice = pDevice;
if (pStream == pDevice->aaudio.pStreamCapture) {
job.data.device.aaudio.reroute.deviceType = ma_device_type_capture;
} else {
job.data.device.aaudio.reroute.deviceType = ma_device_type_playback;
}
result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job);
if (result != MA_SUCCESS) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n");
@ -39925,7 +39925,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
/* We got disconnected! Retry a few times, until we find a connected device! */
iAttempt = 0;
while (iAttempt++ < maxAttempts) {
while (iAttempt++ < maxAttempts) {
/* Device tearing down? No need to reroute! */
if (ma_atomic_bool32_get(&pDevice->aaudio.isTearingDown)) {
result = MA_SUCCESS; /* Caller should continue as normal. */
@ -40023,7 +40023,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
break;
}
}
return result;
}
@ -42076,7 +42076,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co
}
#else
{
/* ScriptProcessorNode. This path requirements us to do almost everything in JS, but we'll do as much as we can in C. */
/* ScriptProcessorNode. This path requires us to do almost everything in JS, but we'll do as much as we can in C. */
ma_uint32 deviceIndex;
ma_uint32 channels;
ma_uint32 sampleRate;
@ -56784,7 +56784,7 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co
/*
Before doing any processing we need to determine how many frames we should try processing
this iteration, for both input and output. The resampler requirements us to perform format and
this iteration, for both input and output. The resampler requires us to perform format and
channel conversion before passing any data into it. If we get our input count wrong, we'll
end up performing redundant pre-processing. This isn't the end of the world, but it does
result in some inefficiencies proportionate to how far our estimates are off.
@ -61704,7 +61704,7 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf
/* Not implemented. Fall back to seek/tell/seek. */
ma_int64 cursor;
ma_int64 sizeInBytes;
result = ma_default_vfs_tell(pVFS, file, &cursor);
if (result != MA_SUCCESS) {
return result;
@ -75444,7 +75444,7 @@ static void ma_data_source_node_process_pcm_frames(ma_node* pNode, const float**
MA_ASSERT(frameCount > 0);
if (ma_data_source_get_data_format(pDataSourceNode->pDataSource, &format, &channels, NULL, NULL, 0) == MA_SUCCESS) { /* <-- Don't care about sample rate here. */
/* The node graph system requirements samples be in floating point format. This is checked in ma_data_source_node_init(). */
/* The node graph system requires samples be in floating point format. This is checked in ma_data_source_node_init(). */
MA_ASSERT(format == ma_format_f32);
(void)format; /* Just to silence some static analysis tools. */
@ -76413,7 +76413,7 @@ static ma_node_vtable g_ma_delay_node_vtable =
NULL,
1, /* 1 input channels. */
1, /* 1 output channel. */
MA_NODE_FLAG_CONTINUOUS_PROCESSING /* Delay requirements continuous processing to ensure the tail get's processed. */
MA_NODE_FLAG_CONTINUOUS_PROCESSING /* Delay requires continuous processing to ensure the tail get's processed. */
};
MA_API ma_result ma_delay_node_init(ma_node_graph* pNodeGraph, const ma_delay_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_delay_node* pDelayNode)
@ -76937,7 +76937,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float
if (pSound->processingCacheFramesRemaining > 0) {
MA_MOVE_MEMORY(pSound->pProcessingCache, ma_offset_pcm_frames_ptr_f32(pSound->pProcessingCache, frameCountIn, dataSourceChannels), pSound->processingCacheFramesRemaining * ma_get_bytes_per_frame(ma_format_f32, dataSourceChannels));
}
totalFramesRead += (ma_uint32)frameCountOut; /* Safe cast. */
if (result != MA_SUCCESS || ma_sound_at_end(pSound)) {
@ -78439,7 +78439,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con
if (pSound->processingCacheCap == 0) {
pSound->processingCacheCap = 512;
}
pSound->pProcessingCache = (float*)ma_calloc(pSound->processingCacheCap * ma_get_bytes_per_frame(ma_format_f32, engineNodeConfig.channelsIn), &pEngine->allocationCallbacks);
if (pSound->pProcessingCache == NULL) {
ma_engine_node_uninit(&pSound->engineNode, &pEngine->allocationCallbacks);
@ -78471,7 +78471,7 @@ MA_API ma_result ma_sound_init_from_file_internal(ma_engine* pEngine, const ma_s
ma_resource_manager_pipeline_notifications notifications;
/*
The engine requirements knowledge of the channel count of the underlying data source before it can
The engine requires knowledge of the channel count of the underlying data source before it can
initialize the sound. Therefore, we need to make the resource manager wait until initialization
of the underlying data source to be initialized so we can get access to the channel count. To
do this, the MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT is forced.
@ -78766,7 +78766,7 @@ MA_API ma_result ma_sound_stop_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint
return MA_INVALID_ARGS;
}
/* Stopping with a fade out requirements us to schedule the stop into the future by the fade length. */
/* Stopping with a fade out requires us to schedule the stop into the future by the fade length. */
ma_sound_set_stop_time_with_fade_in_pcm_frames(pSound, ma_engine_get_time_in_pcm_frames(ma_sound_get_engine(pSound)) + fadeLengthInFrames, fadeLengthInFrames);
return MA_SUCCESS;

View file

@ -353,7 +353,7 @@ extern int stb_vorbis_get_frame_short (stb_vorbis *f, int num_c, shor
extern int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float *buffer, int num_floats);
extern int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, int num_samples);
// gets num_samples samples, not necessarily on a frame boundary--this requirements
// gets num_samples samples, not necessarily on a frame boundary--this requires
// buffering so you have to supply the buffers. DOES NOT APPLY THE COERCION RULES.
// Returns the number of samples stored per channel; it may be less than requested
// at the end of the file. If there are no more samples in the file, returns 0.
@ -362,7 +362,7 @@ extern int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buf
extern int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short *buffer, int num_shorts);
extern int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, int num_samples);
#endif
// gets num_samples samples, not necessarily on a frame boundary--this requirements
// gets num_samples samples, not necessarily on a frame boundary--this requires
// buffering so you have to supply the buffers. Applies the coercion rules above
// to produce 'channels' channels. Returns the number of samples stored per channel;
// it may be less than requested at the end of the file. If there are no more
@ -446,7 +446,7 @@ enum STBVorbisError
// STB_VORBIS_NO_FAST_SCALED_FLOAT
// does not use a fast float-to-int trick to accelerate float-to-int on
// most platforms which requirements endianness be defined correctly.
// most platforms which requires endianness be defined correctly.
//#define STB_VORBIS_NO_FAST_SCALED_FLOAT
@ -503,7 +503,7 @@ enum STBVorbisError
// STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH
// If the 'fast huffman' search doesn't succeed, then stb_vorbis falls
// back on binary searching for the correct one. This requirements storing
// back on binary searching for the correct one. This requires storing
// extra tables with the huffman codes in sorted order. Defining this
// symbol trades off space for speed by forcing a linear search in the
// non-fast case, except for "sparse" codebooks.
@ -541,7 +541,7 @@ enum STBVorbisError
// STB_VORBIS_NO_DEFER_FLOOR
// Normally we only decode the floor without synthesizing the actual
// full curve. We can instead synthesize the curve immediately. This
// requirements more memory and is very likely slower, so I don't think
// requires more memory and is very likely slower, so I don't think
// you'd ever want to do it except for debugging.
// #define STB_VORBIS_NO_DEFER_FLOOR
@ -1066,7 +1066,7 @@ static float float32_unpack(uint32 x)
// increasing frequencies--they rely on the lengths being sorted;
// this makes for a very simple generation algorithm.
// vorbis allows a huffman table with non-sorted lengths. This
// requirements a more sophisticated construction, since symbols in
// requires a more sophisticated construction, since symbols in
// order do not map to huffman codes "in order".
static void add_entry(Codebook *c, uint32 huff_code, int symbol, int count, int len, uint32 *values)
{
@ -1198,7 +1198,7 @@ static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values)
// #1: sort a different data structure that says who they correspond to
// #2: for each sorted entry, search the original list to find who corresponds
// #3: for each original entry, find the sorted entry
// #1 requirements extra storage, #2 is slow, #3 can use binary search!
// #1 requires extra storage, #2 is slow, #3 can use binary search!
for (i=0; i < len; ++i) {
int huff_len = c->sparse ? lengths[values[i]] : lengths[i];
if (include_in_sort(c,huff_len)) {
@ -2325,7 +2325,7 @@ void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype)
}
#elif 0
// transform to use a slow dct-iv; this is STILL basically trivial,
// but only requirements half as many ops
// but only requires half as many ops
void dct_iv_slow(float *buffer, int n)
{
float mcos[16384];
@ -3491,7 +3491,7 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
if (!prev)
// there was no previous packet, so this data isn't valid...
// this isn't entirely true, only the would-have-overlapped data
// isn't valid, but this seems to be what the spec requirements
// isn't valid, but this seems to be what the spec requires
return 0;
// truncate a short frame
@ -3515,7 +3515,7 @@ static int vorbis_pump_first_frame(stb_vorbis *f)
static int is_whole_packet_present(stb_vorbis *f)
{
// make sure that we have the packet available before continuing...
// this requirements a full ogg parse, but we know we can fetch from f->stream
// this requires a full ogg parse, but we know we can fetch from f->stream
// instead of coding this out explicitly, we could save the current read state,
// read the next packet with get8() until end-of-packet, check f->eof, then

View file

@ -153,7 +153,7 @@ public:
virtual void* Alloc(size_t size)
{
size = Align(size, 4); // 4 byte align the memory
size = Align(size, 4); // 4 uint8_t align the memory
assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space
void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory
m_currentOffset += size;

View file

@ -5,7 +5,7 @@
unordered_map<wstring,eMinecraftColour> ColourTable::s_colourNamesMap;
const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
{
{
L"NOTSET",
L"Foliage_Evergreen",

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@ typedef struct _JoinFromInviteData
DWORD dwUserIndex; // dwUserIndex
DWORD dwLocalUsersMask; // dwUserMask
const INVITE_INFO *pInviteInfo; // pInviteInfo
}
}
JoinFromInviteData;
class Player;
@ -55,7 +55,7 @@ class Merchant;
class CMinecraftAudio;
class CMinecraftApp
class CMinecraftApp
#ifdef _XBOX
: public CXuiModule
@ -92,7 +92,7 @@ public:
#ifdef _EXTENDED_ACHIEVEMENTS
/* 4J-JEV:
* We need more space in the profile data because of the new achievements and statistics
* We need more space in the profile data because of the new achievements and statistics
* necessary for the new expanded achievement set.
*/
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
@ -164,7 +164,7 @@ public:
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
@ -282,7 +282,7 @@ public:
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal);
void ActionDebugMask(int iPad, bool bSetAllClear=false);
//
//
bool IsLocalMultiplayerAvailable();
// for sign in change monitoring
@ -359,7 +359,7 @@ public:
// Texture Pack Data files (icon, banner, comparison shot & text)
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
void RemoveMemoryTPDFile(int iConfig);
void RemoveMemoryTPDFile(int iConfig);
bool IsFileInTPD(int iConfig);
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
int GetTPDSize() {return m_MEM_TPD.size();}
@ -444,7 +444,7 @@ private:
static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
void HandleButtonPresses(int iPad);
@ -472,7 +472,7 @@ private:
static unsigned int m_uiLastSignInData;
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT];
// For promo work
@ -517,7 +517,7 @@ private:
eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
eXuiAction m_eGlobalXuiAction;
eXuiAction m_eGlobalXuiAction;
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
eXuiServerAction m_eGlobalXuiServerAction;
@ -541,20 +541,20 @@ private:
// Trial timer
float m_fTrialTimerStart,mfTrialPausedTime;
typedef struct TimeInfo
{
LARGE_INTEGER qwTime;
LARGE_INTEGER qwAppTime;
{
LARGE_INTEGER qwTime;
LARGE_INTEGER qwAppTime;
float fAppTime;
float fElapsedTime;
float fSecsPerTick;
} TIMEINFO;
float fAppTime;
float fElapsedTime;
float fSecsPerTick;
} TIMEINFO;
TimeInfo m_Time;
protected:
static const int MAX_TIPS_GAMETIP = 50;
static const int MAX_TIPS_TRIVIATIP = 20;
static const int MAX_TIPS_GAMETIP = 50;
static const int MAX_TIPS_TRIVIATIP = 20;
static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP];
static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP];
static Random *TipRandom;
@ -606,7 +606,7 @@ public:
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
#else
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile);
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, uint64_t, uint64_t, WCHAR *, unsigned int, int, WCHAR *pDataFile);
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
@ -634,7 +634,7 @@ private:
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs
static unordered_map<string,DLC_INFO * > DLCInfo;
static unordered_map<string,DLC_INFO * > DLCInfo;
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
#elif defined(_DURANGO)
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
@ -729,7 +729,7 @@ public:
// World seed from png image
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
unsigned int CreateImageTextData(PBYTE bTextMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
// Game rules
GameRuleManager m_gameRules;
@ -773,7 +773,7 @@ public:
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
int GetDLCInfoTexturesOffersCount();
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
DLC_INFO *GetDLCInfo(int iIndex);
DLC_INFO *GetDLCInfo(int iIndex);
DLC_INFO *GetDLCInfo(char *);
DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID);
@ -935,5 +935,5 @@ private:
#endif
};
//singleton
//singleton
//extern CMinecraftApp app;

View file

@ -26,8 +26,8 @@ PBYTE DLCAudioFile::getData(DWORD &dwBytes)
return m_pbData;
}
const WCHAR *DLCAudioFile::wchTypeNamesA[] =
{
const WCHAR *DLCAudioFile::wchTypeNamesA[]=
{
L"CUENAME",
L"CREDIT",
};

View file

@ -28,7 +28,7 @@ public:
e_AudioParamType_Max,
};
static const WCHAR *wchTypeNamesA[e_AudioParamType_Max];
static const WCHAR *wchTypeNamesA[e_AudioParamType_Max];
DLCAudioFile(const wstring &path);

View file

@ -7,8 +7,8 @@
#include "..\..\Minecraft.h"
#include "..\..\TexturePackRepository.h"
const WCHAR *DLCManager::wchTypeNamesA[] =
{
const WCHAR *DLCManager::wchTypeNamesA[]=
{
L"DISPLAYNAME",
L"THEMENAME",
L"FREE",

View file

@ -48,7 +48,7 @@ public:
e_DLCParamType_Max,
};
static const WCHAR *wchTypeNamesA[e_DLCParamType_Max];
static const WCHAR *wchTypeNamesA[e_DLCParamType_Max];
private:
vector<DLCPack *> m_packs;

View file

@ -19,17 +19,17 @@ private:
ConsoleSchematicFile::ESchematicRotation m_rotation;
int m_dimension;
__int64 m_totalBlocksChanged;
__int64 m_totalBlocksChangedLighting;
int64_t m_totalBlocksChanged;
int64_t m_totalBlocksChangedLighting;
bool m_completed;
void updateLocationBox();
public:
public:
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
~ApplySchematicRuleDefinition();
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);

View file

@ -38,7 +38,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
dos->writeInt(m_zSize);
byteArray ba(new BYTE[ m_data.length ], m_data.length);
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
m_data.data, m_data.length);
dos->writeInt(ba.length);
@ -71,13 +71,13 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
m_ySize = dis->readInt();
m_zSize = dis->readInt();
int compressedSize = dis->readInt();
int compressedSize = dis->readInt();
byteArray compressedBuffer(compressedSize);
dis->readFully(compressedBuffer);
if(m_data.data != NULL)
{
delete [] m_data.data;
delete [] m_data.data;
m_data.data = NULL;
}
@ -145,7 +145,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
double z = pos->get(2)->data;
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
{
{
x = ((IntTag *) eTag->get(L"TileX") )->data;
y = ((IntTag *) eTag->get(L"TileY") )->data;
z = ((IntTag *) eTag->get(L"TileZ") )->data;
@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
delete tag;
}
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
@ -281,7 +281,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// blockData[i] = Tile::endStone_Id;
// }
//}
PIXBeginNamedEvent(0,"Setting Block data");
chunk->setBlockData(blockData);
PIXEndNamedEvent();
@ -323,7 +323,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so
// we can do the sort of lighting that might propagate out of the chunk.
__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
int64_t ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
@ -445,7 +445,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
if ( teCopy != NULL )
{
{
CompoundTag *teData = new CompoundTag();
te->save(teData);
@ -478,7 +478,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
for (auto it = m_entities.begin(); it != m_entities.end();)
{
Vec3 *source = it->first;
double targetX = source->x;
double targetY = source->y + destinationBox->y0;
double targetZ = source->z;
@ -498,7 +498,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
if( e->GetType() == eTYPE_PAINTING )
{
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
double tileX = painting->xTile;
double tileZ = painting->zTile;
schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ);
@ -511,7 +511,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
else if( e->GetType() == eTYPE_ITEM_FRAME )
{
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
double tileX = frame->xTile;
double tileZ = frame->zTile;
schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ);
@ -559,7 +559,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
zStart-=1;
else if(zStart < 0 && zStart%2 !=0)
zStart-=1;
// We want the end to be odd to have a total size that is even
if(xEnd > 0 && xEnd%2 == 0)
xEnd+=1;
@ -613,7 +613,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
// Every x is a whole row
for(int xPos = xStart; xPos < xStart + xSize; ++xPos)
{
{
int xc = xPos >> 4;
int x0 = xPos - xc * 16;
@ -622,7 +622,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
if (x1 > 16) x1 = 16;
for(int zPos = zStart; zPos < zStart + zSize;)
{
{
int zc = zPos >> 4;
int z0 = zStart - zc * 16;
@ -713,11 +713,11 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
}
// 4J-JEV: Changed to check for instances of minecarts and hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and eTYPE_MINECART
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
{
CompoundTag *eTag = new CompoundTag();
if( e->save(eTag) )
{
{
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos");
pos->get(0)->data -= xStart;
@ -725,7 +725,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
pos->get(2)->data -= zStart;
if( e->instanceof(eTYPE_HANGING_ENTITY) )
{
{
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
@ -766,7 +766,7 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data,
// skyLightP += skyLightData.length;
// return;
//}
bool bHasLower, bHasUpper;
bHasLower = bHasUpper = false;
int lowerY0, lowerY1, upperY0, upperY1;

View file

@ -58,7 +58,7 @@ private:
vector<shared_ptr<TileEntity> > m_tileEntities;
vector< pair<Vec3 *, CompoundTag *> > m_entities;
public:
public:
byteArray m_data;
public:
@ -72,8 +72,8 @@ public:
void save(DataOutputStream *dos);
void load(DataInputStream *dis);
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
int64_t applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);

View file

@ -14,7 +14,7 @@ public:
typedef struct _ValueType
{
union{
__int64 i64;
int64_t i64;
int i;
char c;
bool b;
@ -44,7 +44,7 @@ public:
virtual ~GameRule();
Connection *getConnection() { return m_connection; }
ValueType getParameter(const wstring &parameterName);
void setParameter(const wstring &parameterName,ValueType value);
GameRuleDefinition *getGameRuleDefinition();

View file

@ -13,7 +13,7 @@
#include "GameRuleManager.h"
const WCHAR *GameRuleManager::wchTagNameA[] =
{
{
L"", // eGameRuleType_Root
L"MapOptions", // eGameRuleType_LevelGenerationOptions
L"ApplySchematic", // eGameRuleType_ApplySchematic
@ -35,7 +35,7 @@ const WCHAR *GameRuleManager::wchTagNameA[] =
};
const WCHAR *GameRuleManager::wchAttrNameA[] =
{
{
L"descriptionName", // eGameRuleAttr_descriptionName
L"promptName", // eGameRuleAttr_promptName
L"dataTag", // eGameRuleAttr_dataTag
@ -385,7 +385,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
// Read File.
// version_number
__int64 version = dis.readShort();
int64_t version = dis.readShort();
unsigned char compressionType = 0;
if(version == 0)
{

View file

@ -24,7 +24,7 @@ class WstringLookup;
class GameRuleManager
{
public:
static const WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
static const WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
static const WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count];
static const short version_number = 2;

View file

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

View file

@ -19,7 +19,7 @@ class GrSource
public:
// 4J-JEV:
// Moved all this here; I didn't like that all this header information
// was being mixed in with all the game information as they have
// was being mixed in with all the game information as they have
// completely different lifespans.
virtual bool requiresTexturePack()=0;
@ -146,7 +146,7 @@ public:
private:
// This should match the "MapOptionsRule" definition in the XML schema
__int64 m_seed;
int64_t m_seed;
bool m_useFlatWorld;
Pos *m_spawnPos;
int m_bHasBeenInCreative;
@ -171,13 +171,13 @@ public:
~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType();
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
virtual void getChildren(vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
__int64 getLevelSeed();
int64_t getLevelSeed();
int getLevelHasBeenInCreative();
Pos *getSpawnPos();
bool getuseFlatWorld();
@ -190,7 +190,7 @@ public:
private:
void clearSchematics();
public:
public:
ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen);
public:
@ -211,7 +211,7 @@ public:
void loadBaseSaveData();
static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
// 4J-JEV:
// ApplySchematicRules contain limited state
// which needs to be reset BEFORE a new game starts.

View file

@ -45,8 +45,8 @@
CGameNetworkManager g_NetworkManager;
CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager;
__int64 CGameNetworkManager::messageQueue[512];
__int64 CGameNetworkManager::byteQueue[512];
int64_t CGameNetworkManager::messageQueue[512];
int64_t CGameNetworkManager::byteQueue[512];
int CGameNetworkManager::messageQueuePos = 0;
CGameNetworkManager::CGameNetworkManager()
@ -194,7 +194,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
ProfileManager.SetDeferredSignoutEnabled(true);
#endif
__int64 seed = 0;
int64_t seed = 0;
if(lpParameter != NULL)
{
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
@ -287,7 +287,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
}
}
static __int64 sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
static int64_t sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
ServerStoppedCreate(false);
if( g_NetworkManager.IsHost() )
{
@ -929,7 +929,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
{
__int64 seed = 0;
int64_t seed = 0;
if(lpParameter != NULL)
{
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;

View file

@ -100,11 +100,11 @@ public:
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
void ForceFriendsSessionRefresh();
// Session joining and leaving
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
bool LeaveGame(bool bMigrateHost);
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
@ -113,13 +113,13 @@ public:
void ResetLeavingGame();
// Threads
bool IsNetworkThreadRunning();
static int RunNetworkGameThreadProc( void* lpParameter );
static int ServerThreadProc( void* lpParameter );
static int ExitAndJoinFromInviteThreadProc( void* lpParam );
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result);
static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad);
@ -130,7 +130,7 @@ public:
static void _LeaveGame();
static int ChangeSessionTypeThreadProc( void* lpParam );
// System flags
// System flags
void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
@ -145,8 +145,8 @@ public:
void ServerStoppedCreate(bool create); // Create the signal
void ServerStopped(); // Signal that we are ready
void ServerStoppedWait(); // Wait for the signal
void ServerStoppedDestroy(); // Destroy signal
void ServerStoppedWait(); // Wait for the signal
void ServerStoppedDestroy(); // Destroy signal
bool ServerStoppedValid(); // Is non-NULL
#ifdef __PSVITA__
@ -164,9 +164,9 @@ public:
// Used for debugging output
static const int messageQueue_length = 512;
static __int64 messageQueue[messageQueue_length];
static int64_t messageQueue[messageQueue_length];
static const int byteQueue_length = 512;
static __int64 byteQueue[byteQueue_length];
static int64_t byteQueue[byteQueue_length];
static int messageQueuePos;
// Methods called from PlatformNetworkManager

View file

@ -8,6 +8,8 @@
#include "..\..\Windows64\Windows64_Xuid.h"
#include "..\..\Minecraft.h"
#include "..\..\User.h"
#include "..\..\MinecraftServer.h"
#include "..\..\PlayerList.h"
#include <iostream>
#endif
@ -238,15 +240,33 @@ void CPlatformNetworkManagerStub::DoWork()
qnetPlayer->m_resolvedXuid = INVALID_XUID;
qnetPlayer->m_gamertag[0] = 0;
qnetPlayer->SetCustomDataValue(0);
WinsockNetLayer::PushFreeSmallId(disconnectedSmallId);
if (IQNet::s_playerCount > 1)
IQNet::s_playerCount--;
}
// Always return smallId to the free pool so it can be reused (game may have already cleared the slot).
WinsockNetLayer::PushFreeSmallId(disconnectedSmallId);
// Clear O(1) socket lookup so GetSocketForSmallId stays fast (s_connections never shrinks).
WinsockNetLayer::ClearSocketForSmallId(disconnectedSmallId);
// Clear chunk visibility flags for this system so rejoin gets fresh chunk state.
SystemFlagRemoveBySmallId((int)disconnectedSmallId);
}
}
#endif
}
bool CPlatformNetworkManagerStub::CanAcceptMoreConnections()
{
#ifdef _WINDOWS64
MinecraftServer* server = MinecraftServer::getInstance();
if (server == NULL) return true;
PlayerList* list = server->getPlayerList();
if (list == NULL) return true;
return (unsigned int)list->players.size() < (unsigned int)list->getMaxPlayers();
#else
return true;
#endif
}
int CPlatformNetworkManagerStub::GetPlayerCount()
{
return m_pIQNet->GetPlayerCount();
@ -581,6 +601,7 @@ CPlatformNetworkManagerStub::PlayerFlags::PlayerFlags(INetworkPlayer *pNetworkPl
this->flags = new unsigned char [ count / 8 ];
memset( this->flags, 0, count / 8 );
this->count = count;
this->m_smallId = (pNetworkPlayer && pNetworkPlayer->IsLocal()) ? 256 : (pNetworkPlayer ? (int)pNetworkPlayer->GetSmallId() : -1);
}
CPlatformNetworkManagerStub::PlayerFlags::~PlayerFlags()
{
@ -618,6 +639,23 @@ void CPlatformNetworkManagerStub::SystemFlagRemovePlayer(INetworkPlayer *pNetwor
}
}
// Clear chunk flags for a system when they disconnect (by smallId). Call even when we don't find the player,
// so we always clear and the smallId can be reused without stale "chunk seen" state.
void CPlatformNetworkManagerStub::SystemFlagRemoveBySmallId(int smallId)
{
if (smallId < 0) return;
for (unsigned int i = 0; i < m_playerFlags.size(); i++)
{
if (m_playerFlags[i]->m_smallId == smallId)
{
delete m_playerFlags[i];
m_playerFlags[i] = m_playerFlags.back();
m_playerFlags.pop_back();
return;
}
}
}
void CPlatformNetworkManagerStub::SystemFlagReset()
{
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
@ -734,7 +772,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
info->data.playerCount = lanSessions[i].playerCount;
info->data.maxPlayers = lanSessions[i].maxPlayers;
info->sessionId = (SessionID)((unsigned __int64)inet_addr(lanSessions[i].hostIP) | ((unsigned __int64)lanSessions[i].hostPort << 32));
info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32));
friendsSessions[0].push_back(info);
}

View file

@ -98,12 +98,14 @@ private:
INetworkPlayer *m_pNetworkPlayer;
unsigned char *flags;
unsigned int count;
int m_smallId;
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
~PlayerFlags();
};
vector<PlayerFlags *> m_playerFlags;
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
void SystemFlagRemoveBySmallId(int smallId);
void SystemFlagReset();
public:
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
@ -161,6 +163,9 @@ public:
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
virtual void ForceFriendsSessionRefresh();
// Win64: used by accept thread to reject connections when server is at max players (so we don't assign smallId > max).
bool CanAcceptMoreConnections();
public:
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
void NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer);

View file

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

View file

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

View file

@ -145,7 +145,7 @@ bool SQRNetworkPlayer::IsReady()
{
return ( ( m_flags & SNP_FLAG_READY_MASK ) == SNP_FLAG_READY_MASK );
}
PlayerUID SQRNetworkPlayer::GetUID()
{
return m_ISD.m_UID;
@ -224,7 +224,7 @@ void SQRNetworkPlayer::SendData( SQRNetworkPlayer *pPlayerTarget, const void *da
{
AckFlags ackFlags = ack ? e_flag_AckRequested : e_flag_AckNotRequested;
// Our network is connected as a star. If we are the host, then we can send to any remote player. If we're a client, we can send only to the host.
// The host can also send to other local players, but this doesn't need to go through Rudp.
// The host can also send to other local players, but this doesn't need to go through Rudp.
if( m_host )
{
if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_LOCAL ) )
@ -286,7 +286,7 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
sendBlock.end = NULL;
sendBlock.current = NULL;
sendBlock.ack = ackFlags;
m_sendQueue.push(sendBlock);
m_sendQueue.push(sendBlock);
}
else
{
@ -299,13 +299,13 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
sendBlock.current = sendBlock.start;
sendBlock.ack = ackFlags;
memcpy( sendBlock.start, dataCurrent, dataSize);
m_sendQueue.push(sendBlock);
m_sendQueue.push(sendBlock);
dataRemaining -= dataSize;
dataCurrent += dataSize;
}
}
m_totalBytesInSendQueue += dataSize;
m_totalBytesInSendQueue += dataSize;
// if the queue had something in it already, then the UDP callback will fire and call SendMoreInternal
// so we don't call it here, to avoid a deadlock
@ -343,7 +343,7 @@ int SQRNetworkPlayer::WriteDataPacket(const void* data, int dataSize, AckFlags a
// nothing was sent!
}
else
{
{
assert(ret==packetSize || ret > headerSize); // we must make sure we've sent the entire packet or the header and some data at least
ret -= headerSize;
if(ackFlags == e_flag_AckRequested)
@ -443,7 +443,7 @@ void SQRNetworkPlayer::ReadAck()
#ifndef _CONTENT_PACKAGE
#ifdef PRINT_ACK_STATS
__int64 timeTaken = System::currentTimeMillis() - m_ackStats[0];
int64_t timeTaken = System::currentTimeMillis() - m_ackStats[0];
if(timeTaken < m_minAckTime)
m_minAckTime = timeTaken;
if(timeTaken > m_maxAckTime)
@ -525,7 +525,7 @@ void SQRNetworkPlayer::SendMoreInternal()
{
keepSending = true;
}
}
}
else if( ( ret >= 0 ) || ( ret == sc_wouldBlockFlag ) )
{
@ -543,7 +543,7 @@ void SQRNetworkPlayer::SendMoreInternal()
// Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent
remainingBytes = dataSize;
}
m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes;
m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes;
}
}
} while (keepSending);

View file

@ -68,11 +68,11 @@ class SQRNetworkPlayer
};
#ifndef _CONTENT_PACKAGE
std::vector<__int64> m_ackStats;
std::vector<int64_t> m_ackStats;
int m_minAckTime;
int m_maxAckTime;
int m_totalAcks;
__int64 m_totalAckTime;
int64_t m_totalAckTime;
int m_averageAckTime;
#endif
@ -89,7 +89,7 @@ class SQRNetworkPlayer
{
public:
unsigned char m_smallId; // Id to uniquely and permanently identify this player between machines - assigned by the server
PlayerUID m_UID;
PlayerUID m_UID;
};
SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID);
@ -114,7 +114,7 @@ class SQRNetworkPlayer
int WriteDataPacket(const void* data, int dataSize, AckFlags ackFlags);
void ReadAck();
void WriteAck();
int GetOutstandingAckCount();
int GetSendQueueSizeBytes();
int GetSendQueueSizeMessages();

View file

@ -25,11 +25,11 @@ static SceRemoteStorageStatus statParams;
// {
// app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n");
// }
//
//
// void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
// {
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
//
//
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
// }
@ -193,7 +193,7 @@ ESavePlatform SonyRemoteStorage::getSavePlatform()
}
__int64 SonyRemoteStorage::getSaveSeed()
int64_t SonyRemoteStorage::getSaveSeed()
{
if(m_getInfoStatus != e_infoFound)
return 0;
@ -223,9 +223,9 @@ const char* SonyRemoteStorage::getRemoteSaveFilename()
int SonyRemoteStorage::getSaveFilesize()
{
if(m_getInfoStatus == e_infoFound)
if(m_getInfoStatus == e_infoFound)
{
return m_remoteFileInfo->fileSize;
return m_remoteFileInfo->fileSize;
}
return 0;
}
@ -288,9 +288,9 @@ bool SonyRemoteStorage::saveIsAvailable()
if(m_getInfoStatus != e_infoFound)
return false;
#ifdef __PS3__
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
#elif defined __PSVITA__
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
#else // __ORBIS__
return true;
#endif
@ -320,7 +320,7 @@ int SonyRemoteStorage::getDataProgress()
int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize;
__int64 time = System::currentTimeMillis();
int64_t time = System::currentTimeMillis();
int elapsedSecs = (time - m_startTime) / 1000;
float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
@ -341,15 +341,15 @@ bool SonyRemoteStorage::shutdown()
if(m_bInitialised)
{
int ret = sceRemoteStorageTerm();
if(ret >= 0)
if(ret >= 0)
{
app.DebugPrintf("Term request done \n");
m_bInitialised = false;
free(m_memPoolBuffer);
m_memPoolBuffer = NULL;
return true;
}
else
}
else
{
app.DebugPrintf("Error in Term request: 0x%x \n", ret);
return false;
@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10);
int64_t iSeed = strtoll(seed,NULL,10);
SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
@ -433,7 +433,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
char descDataVersion[9];
sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion);
memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10);
int64_t iSeed = strtoll(seed,NULL,10);
SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
@ -468,7 +468,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
{
char hexString[9];
ZeroMemory(hexString,9);
ZeroMemory(hexString,9);
memcpy(hexString, hexBytes,8);
uint32_t u32Val = 0;
@ -481,7 +481,7 @@ uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes)
{
char hexString[17];
ZeroMemory(hexString,17);
ZeroMemory(hexString,17);
memcpy(hexString, hexBytes,16);
uint64_t u64Val = 0;

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "..\..\Common\Network\Sony\sceRemoteStorage\header\sceRemoteStorage.h"
@ -43,7 +43,7 @@ public:
char m_saveFileDesc[128];
class DescriptionData
{
{
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
public:
char m_platform[4];
@ -54,7 +54,7 @@ public:
};
class DescriptionData_V2
{
{
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
public:
char m_platformNone[4]; // set to no platform, to indicate we're using the newer version of the data
@ -73,7 +73,7 @@ public:
public:
int m_descDataVersion;
ESavePlatform m_savePlatform;
__int64 m_seed;
int64_t m_seed;
uint32_t m_hostOptions;
uint32_t m_texturePack;
uint32_t m_saveVersion;
@ -115,7 +115,7 @@ public:
const char* getLocalFilename();
const char* getSaveNameUTF8();
ESavePlatform getSavePlatform();
__int64 getSaveSeed();
int64_t getSaveSeed();
unsigned int getSaveHostOptions();
unsigned int getSaveTexturePack();
@ -140,7 +140,7 @@ public:
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
static int setDataThread(void* lpParam);
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
protected:
const char* getRemoteSaveFilename();
@ -154,7 +154,7 @@ protected:
unsigned int m_thumbnailDataSize;
C4JThread* m_SetDataThread;
PSAVE_INFO m_setDataSaveInfo;
__int64 m_startTime;
int64_t m_startTime;
bool m_bAborting;
bool m_bTransferStarted;

View file

@ -97,12 +97,12 @@ int32_t sceRemoteStorageGetStatus(const SceRemoteStorageStatusReqParams & params
/// Gets section of data from a file specified.
///
/// Gets section of data from a file specified. The amount of data requested can be of any size. To request this information the name of file, the number of bytes and
/// the byte to start reading along with a buffer to store such data must be provided.
/// the uint8_t to start reading along with a buffer to store such data must be provided.
/// Metadata information of the file, as description or visibility, will be provided only in the case the first amount of bytes for the file are requested (offset = 0).
/// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageData pointer must be a pointer to a valid
/// location in memory until the callback is called as the output information will be stored in such location.
///
/// @param params The structure containing the file name to read, the start byte to start reading and the amount of bytes to read.
/// @param params The structure containing the file name to read, the start uint8_t to start reading and the amount of bytes to read.
/// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called.
///
/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.

View file

@ -45,6 +45,8 @@ private:
bool m_wineMode = false;
D3D11_VIEWPORT m_customViewport;
bool m_useCustomViewport = false;
UINT m_gammaTexWidth = 0;
UINT m_gammaTexHeight = 0;
struct GammaCBData
{

View file

@ -2,7 +2,7 @@
#include "TutorialTask.h"
// A tutorial task that requirements each of the task to be completed in order until the last one is complete.
// A tutorial task that requires each of the task to be completed in order until the last one is complete.
// If an earlier task that was complete is now not complete then it's hint should be shown.
class ProcedureCompoundTask : public TutorialTask
{

View file

@ -1379,8 +1379,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
{
int currentIndex = getCurrentIndex(m_eCurrSection) - getSectionStartOffset(m_eCurrSection);
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
if (bSlotHasItem)
bool bcanPlaySound = !isSlotEmpty(m_eCurrSection, currentIndex);
if (bcanPlaySound)
ui.PlayUISFX(eSFX_Press);
}
}
@ -1390,8 +1390,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
{
int currentIndex = getCurrentIndex(m_eCurrSection) - getSectionStartOffset(m_eCurrSection);
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
if (bSlotHasItem)
bool bcanPlaySound = !isSlotEmpty(m_eCurrSection, currentIndex);
if (bcanPlaySound)
ui.PlayUISFX(eSFX_Press);
}
//
@ -1486,12 +1486,26 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
}
break;
case ACTION_MENU_UP:
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_UP);
break;
}
#endif
{
//ui.PlayUISFX(eSFX_Focus);
m_eCurrTapState = eTapStateUp;
}
break;
case ACTION_MENU_DOWN:
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_DOWN);
break;
}
#endif
{
//ui.PlayUISFX(eSFX_Focus);
m_eCurrTapState = eTapStateDown;

View file

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

View file

@ -47,7 +47,7 @@ void UIComponent_Panorama::tick()
EnterCriticalSection(&pMinecraft->m_setLevelCS);
if(pMinecraft->level!=NULL)
{
__int64 i64TimeOfDay =0;
int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0)
{
@ -104,7 +104,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
IggyPlayerDrawTilesStart ( getMovie() );
m_renderWidth = tileWidth;
m_renderHeight = tileHeight;
IggyPlayerDrawTile ( getMovie() ,
@ -112,7 +112,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
tileYStart ,
tileXStart + tileWidth ,
tileYStart + tileHeight ,
0 );
0 );
IggyPlayerDrawTilesEnd ( getMovie() );
}
else

View file

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

View file

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

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 );
}
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
{
IggyDataValue result;

View file

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

View file

@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
return success;
}
void UIControl_SpaceIndicatorBar::init(UIString label, int id, __int64 min, __int64 max)
void UIControl_SpaceIndicatorBar::init(UIString label, int id, int64_t min, int64_t max)
{
m_label = label;
m_id = id;
@ -61,11 +61,11 @@ void UIControl_SpaceIndicatorBar::reset()
setSaveGameOffset(0.0f);
}
void UIControl_SpaceIndicatorBar::addSave(__int64 size)
void UIControl_SpaceIndicatorBar::addSave(int64_t size)
{
float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min);
m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) );
m_sizeAndOffsets.push_back( pair<int64_t, float>(size, startPercent) );
m_currentTotal += size;
setTotalSize(m_currentTotal);
@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
{
if(index >= 0 && index < m_sizeAndOffsets.size())
{
pair<__int64,float> values = m_sizeAndOffsets[index];
pair<int64_t,float> values = m_sizeAndOffsets[index];
setSaveSize(values.first);
setSaveGameOffset(values.second);
}
@ -86,7 +86,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
}
}
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size)
{
m_currentSave = size;
@ -99,7 +99,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value );
}
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size)
void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size)
{
float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);

View file

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

View file

@ -5,6 +5,15 @@
UIControl_TextInput::UIControl_TextInput()
{
m_bHasFocus = false;
m_bHasCaret = false;
m_bCaretChecked = false;
#ifdef _WINDOWS64
m_bDirectEditing = false;
m_iCursorPos = 0;
m_iCharLimit = 0;
m_iDirectEditCooldown = 0;
m_iCaretBlinkTimer = 0;
#endif
}
bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
@ -16,6 +25,7 @@ bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, co
m_textName = registerFastName(L"text");
m_funcChangeState = registerFastName(L"ChangeState");
m_funcSetCharLimit = registerFastName(L"SetCharLimit");
m_funcSetCaretIndex = registerFastName(L"SetCaretIndex");
return success;
}
@ -81,3 +91,197 @@ void UIControl_TextInput::SetCharLimit(int iLimit)
value[0].number = iLimit;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCharLimit , 1 , value );
}
void UIControl_TextInput::setCaretVisible(bool visible)
{
if (!m_parentScene || !m_parentScene->getMovie())
return;
// Check once whether this SWF's FJ_TextInput actually has a m_mcCaret child.
// IggyValuePathMakeNameRef always succeeds (creates a ref to undefined),
// so we validate by trying to read a property from the resolved path.
if (!m_bCaretChecked)
{
IggyValuePath caretPath;
if (IggyValuePathMakeNameRef(&caretPath, getIggyValuePath(), "m_mcCaret"))
{
rrbool test = false;
IggyResult res = IggyValueGetBooleanRS(&caretPath, m_nameVisible, NULL, &test);
m_bHasCaret = (res == 0);
}
else
{
m_bHasCaret = false;
}
m_bCaretChecked = true;
}
if (!m_bHasCaret)
return;
IggyValuePath caretPath;
if (IggyValuePathMakeNameRef(&caretPath, getIggyValuePath(), "m_mcCaret"))
{
IggyValueSetBooleanRS(&caretPath, m_nameVisible, NULL, visible);
}
}
void UIControl_TextInput::setCaretIndex(int index)
{
if (!m_parentScene || !m_parentScene->getMovie())
return;
IggyDataValue result;
IggyDataValue value[1];
value[0].type = IGGY_DATATYPE_number;
value[0].number = index;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCaretIndex , 1 , value );
}
#ifdef _WINDOWS64
void UIControl_TextInput::beginDirectEdit(int charLimit)
{
const wchar_t* current = getLabel();
m_editBuffer = current ? current : L"";
m_textBeforeEdit = m_editBuffer;
m_iCursorPos = (int)m_editBuffer.length();
m_iCharLimit = charLimit;
m_bDirectEditing = true;
m_iDirectEditCooldown = 0;
m_iCaretBlinkTimer = 0;
g_KBMInput.ClearCharBuffer();
setCaretVisible(true);
setCaretIndex(m_iCursorPos);
}
UIControl_TextInput::EDirectEditResult UIControl_TextInput::tickDirectEdit()
{
if (m_iDirectEditCooldown > 0)
m_iDirectEditCooldown--;
if (!m_bDirectEditing)
{
setCaretVisible(false);
return eDirectEdit_Continue;
}
// Enforce caret visibility and position every tick — setLabel() and Flash
// focus changes can reset both at any time.
setCaretVisible(true);
setCaretIndex(m_iCursorPos);
// For SWFs without m_mcCaret, insert '_' at the cursor position.
// All characters remain visible — '_' sits between them like a cursor.
if (!m_bHasCaret)
{
wstring display = m_editBuffer;
display.insert(m_iCursorPos, 1, L'_');
setLabel(display.c_str());
}
EDirectEditResult result = eDirectEdit_Continue;
bool changed = false;
// Consume typed characters from the KBM buffer
wchar_t ch;
while (g_KBMInput.ConsumeChar(ch))
{
if (ch == 0x08) // Backspace
{
if (m_iCursorPos > 0)
{
m_editBuffer.erase(m_iCursorPos - 1, 1);
m_iCursorPos--;
changed = true;
}
}
else if (ch == 0x0D) // Enter — confirm edit
{
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
setLabel(m_editBuffer.c_str(), true);
setCaretVisible(false);
return eDirectEdit_Confirmed;
}
else if (m_iCharLimit <= 0 || (int)m_editBuffer.length() < m_iCharLimit)
{
m_editBuffer.insert(m_iCursorPos, 1, ch);
m_iCursorPos++;
changed = true;
}
}
// Arrow keys, Home, End, Delete for cursor movement
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
{
m_iCursorPos--;
setCaretIndex(m_iCursorPos);
}
if (g_KBMInput.IsKeyPressed(VK_RIGHT) && m_iCursorPos < (int)m_editBuffer.length())
{
m_iCursorPos++;
setCaretIndex(m_iCursorPos);
}
if (g_KBMInput.IsKeyPressed(VK_HOME))
{
m_iCursorPos = 0;
setCaretIndex(m_iCursorPos);
}
if (g_KBMInput.IsKeyPressed(VK_END))
{
m_iCursorPos = (int)m_editBuffer.length();
setCaretIndex(m_iCursorPos);
}
if (g_KBMInput.IsKeyPressed(VK_DELETE) && m_iCursorPos < (int)m_editBuffer.length())
{
m_editBuffer.erase(m_iCursorPos, 1);
changed = true;
}
// Escape — cancel edit and restore original text
if (g_KBMInput.IsKeyPressed(VK_ESCAPE))
{
m_editBuffer = m_textBeforeEdit;
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
setLabel(m_editBuffer.c_str());
setCaretVisible(false);
return eDirectEdit_Cancelled;
}
if (changed)
{
if (m_bHasCaret)
{
setLabel(m_editBuffer.c_str());
setCaretIndex(m_iCursorPos);
}
// SWFs without caret: the cursor block above already updates the label every tick
}
return eDirectEdit_Continue;
}
void UIControl_TextInput::cancelDirectEdit()
{
if (m_bDirectEditing)
{
m_editBuffer = m_textBeforeEdit;
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
setLabel(m_editBuffer.c_str(), true);
setCaretVisible(false);
}
}
void UIControl_TextInput::confirmDirectEdit()
{
if (m_bDirectEditing)
{
m_bDirectEditing = false;
setLabel(m_editBuffer.c_str(), true);
setCaretVisible(false);
}
}
#endif

View file

@ -6,7 +6,20 @@ class UIControl_TextInput : public UIControl_Base
{
private:
IggyName m_textName, m_funcChangeState, m_funcSetCharLimit;
IggyName m_funcSetCaretIndex;
bool m_bHasFocus;
bool m_bHasCaret;
bool m_bCaretChecked;
#ifdef _WINDOWS64
bool m_bDirectEditing;
wstring m_textBeforeEdit;
wstring m_editBuffer;
int m_iCursorPos;
int m_iCharLimit;
int m_iDirectEditCooldown;
int m_iCaretBlinkTimer;
#endif
public:
UIControl_TextInput();
@ -19,4 +32,24 @@ public:
virtual void setFocus(bool focus);
void SetCharLimit(int iLimit);
void setCaretVisible(bool visible);
void setCaretIndex(int index);
#ifdef _WINDOWS64
enum EDirectEditResult
{
eDirectEdit_Continue,
eDirectEdit_Confirmed,
eDirectEdit_Cancelled,
};
void beginDirectEdit(int charLimit = 0);
EDirectEditResult tickDirectEdit();
void cancelDirectEdit();
void confirmDirectEdit();
bool isDirectEditing() const { return m_bDirectEditing; }
int getDirectEditCooldown() const { return m_iDirectEditCooldown; }
const wstring& getEditBuffer() const { return m_editBuffer; }
#endif
};

View file

@ -3,6 +3,7 @@
#include "UI.h"
#include "UIScene.h"
#include "UIControl_Slider.h"
#include "UIControl_TexturePackList.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
#include "..\..\LocalPlayer.h"
#include "..\..\DLCTexturePack.h"
@ -143,7 +144,7 @@ extern "C" void *__real_malloc(size_t t);
extern "C" void __real_free(void *t);
#endif
__int64 UIController::iggyAllocCount = 0;
int64_t UIController::iggyAllocCount = 0;
static unordered_map<void *,size_t> allocations;
static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned )
{
@ -237,6 +238,8 @@ UIController::UIController()
m_winUserIndex = 0;
m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1;
m_mouseClickConsumedByScene = false;
m_bMouseHoverHorizontalList = false;
m_lastHoverMouseX = -1;
m_lastHoverMouseY = -1;
m_accumulatedTicks = 0;
@ -499,7 +502,7 @@ void UIController::tick()
}
// Clear out the cached movie file data
__int64 currentTime = System::currentTimeMillis();
int64_t currentTime = System::currentTimeMillis();
for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
{
if(it->second.m_expiry < currentTime)
@ -608,7 +611,7 @@ void UIController::loadSkins()
IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinName)
{
IggyLibrary lib = IGGY_INVALID_LIBRARY;
// 4J Stu - We need to load the platformskin before the normal skin, as the normal skin requirements some elements from the platform skin
// 4J Stu - We need to load the platformskin before the normal skin, as the normal skin requires some elements from the platform skin
if(!skinPath.empty() && app.hasArchiveFile(skinPath))
{
byteArray baFile = app.getArchiveFile(skinPath);
@ -619,7 +622,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN
IggyMemoryUseInfo memoryInfo;
rrbool res;
int iteration = 0;
__int64 totalStatic = 0;
int64_t totalStatic = 0;
while(res = IggyDebugGetMemoryUseInfo ( NULL ,
lib ,
"" ,
@ -750,7 +753,7 @@ void UIController::CleanUpSkinReload()
byteArray UIController::getMovieData(const wstring &filename)
{
// Cache everything we load in the current tick
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
int64_t targetTime = System::currentTimeMillis() + (1000LL * 60);
auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() )
{
@ -784,40 +787,36 @@ void UIController::tickInput()
#endif
{
#ifdef _WINDOWS64
m_mouseClickConsumedByScene = false;
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{
UIScene *pScene = NULL;
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)
// Search by layer priority across all groups (layer-first).
// Tooltip layer is skipped because it holds non-interactive
// overlays (button hints, timer) that should never capture mouse.
// Old group-first order found those tooltips on eUIGroup_Fullscreen
// before reaching in-game menus on eUIGroup_Player1.
static const EUILayer mouseLayers[] = {
#ifndef _CONTENT_PACKAGE
eUILayer_Debug,
#endif
eUILayer_Error,
eUILayer_Alert,
eUILayer_Popup,
eUILayer_Fullscreen,
eUILayer_Scene,
};
for (int l = 0; l < _countof(mouseLayers) && !pScene; ++l)
{
pScene = m_groups[grp]->GetTopScene(eUILayer_Debug);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Tooltips);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Error);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Alert);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Popup);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Fullscreen);
if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Scene);
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)
{
pScene = m_groups[grp]->GetTopScene(mouseLayers[l]);
}
}
if (pScene && pScene->getMovie())
{
Iggy *movie = pScene->getMovie();
int rawMouseX = g_KBMInput.GetMouseX();
int rawMouseY = g_KBMInput.GetMouseY();
F32 mouseX = (F32)rawMouseX;
F32 mouseY = (F32)rawMouseY;
extern HWND g_hWnd;
if (g_hWnd)
{
RECT rc;
GetClientRect(g_hWnd, &rc);
int winW = rc.right - rc.left;
int winH = rc.bottom - rc.top;
if (winW > 0 && winH > 0)
{
mouseX = mouseX * (m_fScreenWidth / (F32)winW);
mouseY = mouseY * (m_fScreenHeight / (F32)winH);
}
}
// Only update hover focus when the mouse has actually moved,
// so that mouse-wheel scrolling can change list selection
@ -826,43 +825,21 @@ void UIController::tickInput()
m_lastHoverMouseX = rawMouseX;
m_lastHoverMouseY = rawMouseY;
if (mouseMoved)
// Convert mouse to scene/movie coordinates
F32 sceneMouseX = (F32)rawMouseX;
F32 sceneMouseY = (F32)rawMouseY;
{
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
IggyFocusableObject focusables[64];
S32 numFocusables = 0;
IggyPlayerGetFocusableObjects(movie, &currentFocus, focusables, 64, &numFocusables);
if (numFocusables > 0 && numFocusables <= 64)
extern HWND g_hWnd;
RECT rc;
if (g_hWnd && GetClientRect(g_hWnd, &rc))
{
IggyFocusHandle hitObject = IGGY_FOCUS_NULL;
for (S32 i = 0; i < numFocusables; ++i)
int winW = rc.right - rc.left;
int winH = rc.bottom - rc.top;
if (winW > 0 && winH > 0)
{
if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 &&
mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1)
{
hitObject = focusables[i].object;
break;
}
sceneMouseX = sceneMouseX * ((F32)pScene->getRenderWidth() / (F32)winW);
sceneMouseY = sceneMouseY * ((F32)pScene->getRenderHeight() / (F32)winH);
}
if (hitObject != currentFocus)
{
IggyPlayerSetFocusRS(movie, hitObject, 0);
}
}
}
// Convert mouse to scene/movie coordinates for slider hit testing
F32 sceneMouseX = mouseX;
F32 sceneMouseY = mouseY;
{
S32 displayWidth = 0, displayHeight = 0;
pScene->GetParentLayer()->getRenderDimensions(displayWidth, displayHeight);
if (displayWidth > 0 && displayHeight > 0)
{
sceneMouseX = mouseX * ((F32)pScene->getRenderWidth() / (F32)displayWidth);
sceneMouseY = mouseY * ((F32)pScene->getRenderHeight() / (F32)displayHeight);
}
}
@ -876,6 +853,110 @@ void UIController::tickInput()
panelOffsetY = pMainPanel->getYPos();
}
// Mouse hover — hit test against C++ control bounds.
// Simple controls use SetFocusToElement; list controls
// use their own SetTouchFocus for Flash-side hit testing.
if (mouseMoved)
{
m_bMouseHoverHorizontalList = false;
vector<UIControl *> *controls = pScene->GetControls();
if (controls)
{
int hitControlId = -1;
S32 hitArea = INT_MAX;
UIControl *hitCtrl = NULL;
for (size_t i = 0; i < controls->size(); ++i)
{
UIControl *ctrl = (*controls)[i];
if (!ctrl || ctrl->getHidden() || !ctrl->getVisible() || ctrl->getId() < 0)
continue;
UIControl::eUIControlType type = ctrl->getControlType();
if (type != UIControl::eButton && type != UIControl::eTextInput &&
type != UIControl::eCheckBox && type != UIControl::eSlider &&
type != UIControl::eButtonList && type != UIControl::eTexturePackList)
continue;
// If the scene has an active panel (e.g. tab menus),
// skip controls that aren't children of that panel.
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue;
ctrl->UpdateControl();
S32 cx = ctrl->getXPos() + panelOffsetX;
S32 cy = ctrl->getYPos() + panelOffsetY;
S32 cw = ctrl->getWidth();
S32 ch = ctrl->getHeight();
// TexturePackList origin is where the slot area starts,
// not the top-left of the whole control — use GetRealHeight.
if (type == UIControl::eTexturePackList)
ch = ((UIControl_TexturePackList *)ctrl)->GetRealHeight();
if (cw <= 0 || ch <= 0)
continue;
if (sceneMouseX >= cx && sceneMouseX <= cx + cw &&
sceneMouseY >= cy && sceneMouseY <= cy + ch)
{
if (type == UIControl::eButtonList)
{
// ButtonList manages focus internally via Flash —
// pass mouse coords so it can highlight the right item.
((UIControl_ButtonList *)ctrl)->SetTouchFocus(
(S32)sceneMouseX, (S32)sceneMouseY, false);
hitControlId = -1;
hitArea = INT_MAX;
hitCtrl = NULL;
break; // ButtonList takes priority
}
if (type == UIControl::eTexturePackList)
{
// TexturePackList expects coords relative to its origin.
UIControl_TexturePackList *pList = (UIControl_TexturePackList *)ctrl;
pScene->SetFocusToElement(ctrl->getId());
pList->SetTouchFocus(
(S32)(sceneMouseX - cx), (S32)(sceneMouseY - cy), false);
m_bMouseHoverHorizontalList = true;
hitControlId = -1;
hitArea = INT_MAX;
hitCtrl = NULL;
break;
}
S32 area = cw * ch;
if (area < hitArea)
{
hitControlId = ctrl->getId();
hitArea = area;
hitCtrl = ctrl;
if (type == UIControl::eSlider)
m_bMouseHoverHorizontalList = true;
}
}
}
if (hitControlId >= 0 && pScene->getControlFocus() != hitControlId)
{
// During direct editing, don't let hover move focus
// away to other TextInputs (e.g. sign lines).
if (hitCtrl && hitCtrl->getControlType() == UIControl::eTextInput
&& pScene->isDirectEditBlocking())
{
// Skip — keep focus on the actively-edited input
}
else
{
pScene->SetFocusToElement(hitControlId);
// TextInput: SetFocusToElement triggers ChangeState which
// shows the caret. Hide it immediately — the render pass
// happens after both tickInput and scene tick, so no flicker.
if (hitCtrl && hitCtrl->getControlType() == UIControl::eTextInput)
{
((UIControl_TextInput *)hitCtrl)->setCaretVisible(false);
}
}
}
}
}
bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT);
bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT);
@ -890,12 +971,51 @@ void UIController::tickInput()
vector<UIControl *> *controls = pScene->GetControls();
if (controls)
{
// Set Iggy dispatch focus for TextInput on click (not hover)
// so ACTION_MENU_OK targets the correct text field.
for (size_t i = 0; i < controls->size(); ++i)
{
UIControl *ctrl = (*controls)[i];
if (!ctrl || ctrl->getControlType() != UIControl::eTextInput || !ctrl->getVisible())
continue;
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue;
ctrl->UpdateControl();
S32 cx = ctrl->getXPos() + panelOffsetX;
S32 cy = ctrl->getYPos() + panelOffsetY;
S32 cw = ctrl->getWidth();
S32 ch = ctrl->getHeight();
if (cw > 0 && ch > 0 &&
sceneMouseX >= cx && sceneMouseX <= cx + cw &&
sceneMouseY >= cy && sceneMouseY <= cy + ch)
{
Iggy *movie = pScene->getMovie();
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
IggyFocusableObject focusables[64];
S32 numFocusables = 0;
IggyPlayerGetFocusableObjects(movie, &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)
{
UIControl *ctrl = (*controls)[i];
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
continue;
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue;
UIControl_Slider *pSlider = (UIControl_Slider *)ctrl;
pSlider->UpdateControl();
S32 cx = pSlider->getXPos() + panelOffsetX;
@ -942,6 +1062,12 @@ void UIController::tickInput()
m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1;
}
// Let the scene handle mouse clicks for custom navigation (e.g. crafting slots)
if (leftPressed && m_mouseDraggingSliderId < 0)
{
m_mouseClickConsumedByScene = pScene->handleMouseClick(sceneMouseX, sceneMouseY);
}
}
}
#endif
@ -967,7 +1093,7 @@ void UIController::handleInput()
}
#ifdef __PSVITA__
//CD - Vita requirements key press 40 - select [MINECRAFT_ACTION_GAME_INFO]
//CD - Vita requires key press 40 - select [MINECRAFT_ACTION_GAME_INFO]
handleKeyPress(iPad, MINECRAFT_ACTION_GAME_INFO);
#endif
}
@ -1206,7 +1332,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
if ((key == ACTION_MENU_OK || key == ACTION_MENU_A) && !g_KBMInput.IsMouseGrabbed())
{
if (m_mouseDraggingSliderId < 0)
if (m_mouseDraggingSliderId < 0 && !m_mouseClickConsumedByScene)
{
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT)) { pressed = true; down = true; }
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT)) { released = true; down = false; }
@ -1214,6 +1340,14 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
}
}
// Right click → ACTION_MENU_X (pick up half stack in inventory)
if (key == ACTION_MENU_X && !g_KBMInput.IsMouseGrabbed())
{
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_RIGHT)) { pressed = true; down = true; }
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_RIGHT)) { released = true; down = false; }
if (!pressed && !released && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)) { down = true; }
}
// Scroll wheel for list scrolling — only consume the wheel value when the
// action key actually matches, so the other direction isn't lost.
if (!g_KBMInput.IsMouseGrabbed() && (key == ACTION_MENU_OTHER_STICK_UP || key == ACTION_MENU_OTHER_STICK_DOWN))
@ -1231,6 +1365,16 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
pressed = true;
down = true;
}
// Remap scroll wheel to navigation actions. Use LEFT/RIGHT when
// hovering a horizontal list (e.g. TexturePackList), UP/DOWN otherwise.
if (pressed && g_KBMInput.IsKBMActive())
{
if (m_bMouseHoverHorizontalList)
key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_LEFT : ACTION_MENU_RIGHT;
else
key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_UP : ACTION_MENU_DOWN;
}
}
}
#endif
@ -1297,8 +1441,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
//!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) &&
key == ACTION_MENU_STICK_PRESS)
{
__int64 totalStatic = 0;
__int64 totalDynamic = 0;
int64_t totalStatic = 0;
int64_t totalDynamic = 0;
app.DebugPrintf(app.USER_SR, "********************************\n");
app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n");
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
@ -1307,8 +1451,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
}
for(unsigned int i = 0; i < eLibrary_Count; ++i)
{
__int64 libraryStatic = 0;
__int64 libraryDynamic = 0;
int64_t libraryStatic = 0;
int64_t libraryDynamic = 0;
if(m_iggyLibraries[i] != IGGY_INVALID_LIBRARY)
{
@ -1723,6 +1867,7 @@ void UIController::unregisterSubstitutionTexture(const wstring &textureName, boo
bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer, EUIGroup group)
{
static bool bSeenUpdateTextThisSession = false;
#if 0 // Disable since we don't use this
// If you're navigating to the multigamejoinload, and the player hasn't seen the updates message yet, display it now
// display this message the first 3 times
if((scene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0))
@ -1730,6 +1875,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI
scene=eUIScene_NewUpdateMessage;
bSeenUpdateTextThisSession=true;
}
#endif
// if you're trying to navigate to the inventory,the crafting, pause or game info or any of the trigger scenes and there's already a menu up (because you were pressing a few buttons at the same time) then ignore the navigate
if(GetMenuDisplayed(iPad))
@ -2335,7 +2481,7 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal)
void UIController::PlayUISFX(ESoundEffect eSound)
{
__uint64 time = System::currentTimeMillis();
uint64_t time = System::currentTimeMillis();
// Don't play multiple SFX on the same tick
// (prevents horrible sounds when programmatically setting multiple checkboxes)

View file

@ -16,7 +16,7 @@ class UIControl;
class UIController : public IUIController
{
public:
static __int64 iggyAllocCount;
static int64_t iggyAllocCount;
// MGH - added to prevent crash loading Iggy movies while the skins were being reloaded
static CRITICAL_SECTION ms_reloadSkinCS;
@ -30,7 +30,7 @@ private:
CRITICAL_SECTION m_navigationLock;
static const int UI_REPEAT_KEY_DELAY_MS = 300; // How long from press until the first repeat
static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats
static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats
DWORD m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1];
float m_fScreenWidth;
@ -50,7 +50,7 @@ private:
eFont_Korean,
};
// 4J-JEV: It's important that currentFont == targetFont, unless updateCurrentLanguage is going to be called.
EFont m_eCurrentFont, m_eTargetFont;
@ -76,7 +76,7 @@ private:
// 4J-PB - ui element type for PSVita touch control
#ifdef __PSVITA__
typedef struct
typedef struct
{
UIControl *pControl;
S32 x1,y1,x2,y2;
@ -141,7 +141,7 @@ private:
C4JRender::eViewportType m_currentRenderViewport;
bool m_bCustomRenderPosition;
static DWORD m_dwTrialTimerLimitSecs;
unordered_map<wstring, byteArray> m_substitutionTextures;
@ -149,7 +149,7 @@ private:
typedef struct _CachedMovieData
{
byteArray m_ba;
__int64 m_expiry;
int64_t m_expiry;
} CachedMovieData;
unordered_map<wstring, CachedMovieData> m_cachedMovieData;
@ -164,6 +164,8 @@ private:
unsigned int m_winUserIndex;
EUIScene m_mouseDraggingSliderScene;
int m_mouseDraggingSliderId;
bool m_mouseClickConsumedByScene;
bool m_bMouseHoverHorizontalList;
int m_lastHoverMouseX;
int m_lastHoverMouseY;
//bool m_bSysUIShowing;
@ -171,7 +173,7 @@ private:
C4JThread *m_reloadSkinThread;
bool m_navigateToHomeOnReload;
int m_accumulatedTicks;
__uint64 m_lastUiSfx; // Tracks time (ms) of last UI sound effect
uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect
D3D11_RECT m_customRenderingClearRect;
@ -215,7 +217,7 @@ protected:
void postInit();
public:
public:
CRITICAL_SECTION m_Allocatorlock;
void SetupFont();
bool PendingFontChange();
@ -247,7 +249,7 @@ private:
void tickInput();
void handleInput();
void handleKeyPress(unsigned int iPad, unsigned int key);
protected:
static rrbool RADLINK ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call );
@ -317,7 +319,7 @@ private:
public:
void CloseAllPlayersScenes();
void CloseUIScenes(int iPad, bool forceIPad = false);
virtual bool IsPauseMenuDisplayed(int iPad);
virtual bool IsContainerMenuDisplayed(int iPad);
virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad);

View file

@ -81,7 +81,7 @@ void UIGroup::tick()
}
// Handle deferred update focus
if (m_updateFocusStateCountdown > 0)
if (m_updateFocusStateCountdown > 0)
{
m_updateFocusStateCountdown--;
if (m_updateFocusStateCountdown == 0)_UpdateFocusState();
@ -233,7 +233,7 @@ void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
}
}
// FOCUS
// FOCUS
// Check that a layer may recieve focus, specifically that there is no infocus layer above
bool UIGroup::RequestFocus(UILayer* layerPtr)
@ -389,16 +389,16 @@ unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr)
// can't get here...
return 0;
}
void UIGroup::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
void UIGroup::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{
__int64 groupStatic = 0;
__int64 groupDynamic = 0;
int64_t groupStatic = 0;
int64_t groupDynamic = 0;
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group);
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
{
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n",i);
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n",i);
}
app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n", groupStatic, groupDynamic);
@ -412,7 +412,7 @@ int UIGroup::getCommandBufferList()
return m_commandBufferList;
}
// Returns the first scene of given type if it exists, NULL otherwise
// Returns the first scene of given type if it exists, NULL otherwise
UIScene *UIGroup::FindScene(EUIScene sceneType)
{
UIScene *pScene = NULL;

View file

@ -19,10 +19,10 @@ private:
UIScene_HUD *m_hud;
C4JRender::eViewportType m_viewportType;
EUIGroup m_group;
int m_iPad;
bool m_bMenuDisplayed;
bool m_bPauseMenuDisplayed;
bool m_bContainerMenuDisplayed;
@ -88,7 +88,7 @@ public:
void SetViewportType(C4JRender::eViewportType type);
C4JRender::eViewportType GetViewportType();
virtual void HandleDLCMountingComplete();
virtual void HandleDLCInstalled();
#ifdef _XBOX_ONE
@ -99,15 +99,15 @@ public:
bool IsFullscreenGroup();
void handleUnlockFullVersion();
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
unsigned int GetLayerIndex(UILayer* layerPtr);
int getCommandBufferList();
UIScene *FindScene(EUIScene sceneType);
private:
private:
void _UpdateFocusState();
void updateStackStates();
};

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

View file

@ -66,12 +66,12 @@ public:
// INPUT
void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
#ifdef __PSVITA__
#ifdef __PSVITA__
// Current active scene
UIScene *getCurrentScene();
#endif
// FOCUS
bool updateFocusState(bool allowedFocus = false);
public:
@ -87,7 +87,7 @@ public:
void handleUnlockFullVersion();
UIScene *FindScene(EUIScene sceneType);
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
};

View file

@ -234,7 +234,7 @@ void UIScene::initialiseMovie()
m_bUpdateOpacity = true;
}
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
void UIScene::SetFocusToElement(int iID)
{
IggyDataValue result;
@ -329,11 +329,11 @@ void UIScene::loadMovie()
}
byteArray baFile = ui.getMovieData(moviePath.c_str());
__int64 beforeLoad = ui.iggyAllocCount;
int64_t beforeLoad = ui.iggyAllocCount;
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
__int64 afterLoad = ui.iggyAllocCount;
int64_t afterLoad = ui.iggyAllocCount;
IggyPlayerInitializeAndTickRS ( swf );
__int64 afterTick = ui.iggyAllocCount;
int64_t afterTick = ui.iggyAllocCount;
if(!swf)
{
@ -362,8 +362,8 @@ void UIScene::loadMovie()
IggyMemoryUseInfo memoryInfo;
rrbool res;
int iteration = 0;
__int64 totalStatic = 0;
__int64 totalDynamic = 0;
int64_t totalStatic = 0;
int64_t totalDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL ,
0 ,
@ -406,15 +406,15 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
}
}
void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{
if(!swf) return;
IggyMemoryUseInfo memoryInfo;
rrbool res;
int iteration = 0;
__int64 sceneStatic = 0;
__int64 sceneDynamic = 0;
int64_t sceneStatic = 0;
int64_t sceneDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL ,
"" ,
@ -447,6 +447,19 @@ void UIScene::tick()
IggyPlayerTickRS( swf );
m_hasTickedOnce = true;
}
#ifdef _WINDOWS64
{
vector<UIControl_TextInput*> inputs;
getDirectEditInputs(inputs);
for (size_t i = 0; i < inputs.size(); i++)
{
UIControl_TextInput::EDirectEditResult result = inputs[i]->tickDirectEdit();
if (result != UIControl_TextInput::eDirectEdit_Continue)
onDirectEditFinished(inputs[i], result);
}
}
#endif
}
UIControl* UIScene::GetMainPanel()
@ -454,6 +467,113 @@ UIControl* UIScene::GetMainPanel()
return NULL;
}
#ifdef _WINDOWS64
bool UIScene::isDirectEditBlocking()
{
vector<UIControl_TextInput*> inputs;
getDirectEditInputs(inputs);
for (size_t i = 0; i < inputs.size(); i++)
{
if (inputs[i]->isDirectEditing() || inputs[i]->getDirectEditCooldown() > 0)
return true;
}
return false;
}
bool UIScene::handleMouseClick(F32 x, F32 y)
{
S32 panelOffsetX = 0, panelOffsetY = 0;
UIControl *pMainPanel = GetMainPanel();
if (pMainPanel)
{
pMainPanel->UpdateControl();
panelOffsetX = pMainPanel->getXPos();
panelOffsetY = pMainPanel->getYPos();
}
// Click-outside-to-deselect: confirm any active direct edit if
// the click landed outside the editing text input.
{
vector<UIControl_TextInput*> deInputs;
getDirectEditInputs(deInputs);
for (size_t i = 0; i < deInputs.size(); i++)
{
if (!deInputs[i]->isDirectEditing())
continue;
deInputs[i]->UpdateControl();
S32 cx = deInputs[i]->getXPos() + panelOffsetX;
S32 cy = deInputs[i]->getYPos() + panelOffsetY;
S32 cw = deInputs[i]->getWidth();
S32 ch = deInputs[i]->getHeight();
if (!(cw > 0 && ch > 0 && x >= cx && x <= cx + cw && y >= cy && y <= cy + ch))
{
deInputs[i]->confirmDirectEdit();
onDirectEditFinished(deInputs[i], UIControl_TextInput::eDirectEdit_Confirmed);
}
}
}
vector<UIControl *> *controls = GetControls();
if (!controls) return false;
// Hit-test controls and pick the smallest-area match to handle
// overlapping Flash bounds correctly without sacrificing precision.
int bestId = -1;
S32 bestArea = INT_MAX;
UIControl *bestCtrl = NULL;
for (size_t i = 0; i < controls->size(); ++i)
{
UIControl *ctrl = (*controls)[i];
if (!ctrl || ctrl->getHidden() || !ctrl->getVisible() || ctrl->getId() < 0)
continue;
UIControl::eUIControlType type = ctrl->getControlType();
if (type != UIControl::eButton && type != UIControl::eTextInput &&
type != UIControl::eCheckBox)
continue;
if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue;
ctrl->UpdateControl();
S32 cx = ctrl->getXPos() + panelOffsetX;
S32 cy = ctrl->getYPos() + panelOffsetY;
S32 cw = ctrl->getWidth();
S32 ch = ctrl->getHeight();
if (cw <= 0 || ch <= 0)
continue;
if (x >= cx && x <= cx + cw && y >= cy && y <= cy + ch)
{
S32 area = cw * ch;
if (area < bestArea)
{
bestArea = area;
bestId = ctrl->getId();
bestCtrl = ctrl;
}
}
}
if (bestId >= 0 && bestCtrl)
{
if (bestCtrl->getControlType() == UIControl::eCheckBox)
{
UIControl_CheckBox *cb = (UIControl_CheckBox *)bestCtrl;
bool newState = !cb->IsChecked();
cb->setChecked(newState);
handleCheckboxToggled((F64)bestId, newState);
}
else
{
handlePress((F64)bestId, 0);
}
return true;
}
return false;
}
#endif
void UIScene::addTimer(int id, int ms)
{
@ -534,12 +654,13 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene)
// update the button positions since they may have changed
UpdateSceneControls();
// mark the button as removed
control->setHidden(true);
// remove it from the touchboxes
ui.TouchBoxRebuild(control->getParentScene());
#endif
// mark the button as removed so hover/touch hit-tests skip it
control->setHidden(true);
}
void UIScene::slideLeft()
@ -900,6 +1021,25 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released
app.DebugPrintf("UI WARNING: Ignoring input as game action does not translate to an Iggy keycode\n");
return;
}
#ifdef _WINDOWS64
// If a navigation key is pressed with no focused element, focus the first
// available one so arrow keys work even when the mouse is over empty space.
if(pressed && (iggyKeyCode == IGGY_KEYCODE_UP || iggyKeyCode == IGGY_KEYCODE_DOWN ||
iggyKeyCode == IGGY_KEYCODE_LEFT || iggyKeyCode == IGGY_KEYCODE_RIGHT))
{
IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
IggyFocusableObject focusables[64];
S32 numFocusables = 0;
IggyPlayerGetFocusableObjects(swf, &currentFocus, focusables, 64, &numFocusables);
if(currentFocus == IGGY_FOCUS_NULL && numFocusables > 0)
{
IggyPlayerSetFocusRS(swf, focusables[0].object, 0);
return;
}
}
#endif
IggyEvent keyEvent;
// 4J Stu - Keyloc is always standard as we don't care about shift/alt
IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard );

View file

@ -6,6 +6,7 @@ using namespace std;
#include "UIEnums.h"
#include "UIControl_Base.h"
#include "UIControl_TextInput.h"
class ItemRenderer;
class UILayer;
@ -16,22 +17,26 @@ class UILayer;
virtual bool mapElementsAndNames() \
{ \
parentClass::mapElementsAndNames(); \
IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() );
IggyValuePath *currentRoot = IggyPlayerRootPath ( getMovie() ); \
UIControl *_mapPanel = NULL;
#define UI_END_MAP_ELEMENTS_AND_NAMES() \
return true; \
}
#define UI_MAP_ELEMENT( var, name) \
{ var.setupControl(this, currentRoot , name ); m_controls.push_back(&var); }
{ var.setupControl(this, currentRoot , name ); var.m_pParentPanel = _mapPanel; m_controls.push_back(&var); }
#define UI_BEGIN_MAP_CHILD_ELEMENTS( parent ) \
{ \
IggyValuePath *lastRoot = currentRoot; \
currentRoot = parent.getIggyValuePath();
UIControl *_lastPanel = _mapPanel; \
currentRoot = parent.getIggyValuePath(); \
_mapPanel = &parent;
#define UI_END_MAP_CHILD_ELEMENTS() \
currentRoot = lastRoot; \
_mapPanel = _lastPanel; \
}
#define UI_MAP_NAME( var, name ) \
@ -40,7 +45,7 @@ class UILayer;
class UIScene
{
friend class UILayer;
public:
public:
IggyValuePath *m_rootPath;
private:
@ -80,7 +85,7 @@ public:
protected:
ESceneResolution m_loadedResolution;
bool m_bIsReloading;
bool m_bFocussedOnce;
@ -96,7 +101,7 @@ protected:
public:
virtual Iggy *getMovie() { return swf; }
void destroyMovie();
virtual void reloadMovie(bool force = false);
virtual bool needsReloaded();
@ -129,7 +134,7 @@ private:
void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo);
public:
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic);
void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
public:
UIScene(int iPad, UILayer *parentLayer);
@ -141,8 +146,10 @@ public:
virtual void tick();
IggyName registerFastName(const wstring &name);
#if defined(__PSVITA__) || defined(_WINDOWS64)
void SetFocusToElement(int iID);
#endif
#ifdef __PSVITA__
void SetFocusToElement(int iID);
void UpdateSceneControls();
#endif
protected:
@ -162,7 +169,7 @@ public:
void gainFocus();
void loseFocus();
virtual void updateTooltips();
virtual void updateComponents() {}
virtual void handleGainFocus(bool navBack);
@ -177,6 +184,19 @@ public:
// returns main panel if controls are not living in the root
virtual UIControl* GetMainPanel();
#ifdef _WINDOWS64
// Direct edit support: scenes override to register their text inputs.
// Base class handles tickDirectEdit in tick(), click-outside-to-deselect
// in handleMouseClick(), and provides isDirectEditBlocking() for guards.
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs) {}
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result) {}
bool isDirectEditBlocking();
// Mouse click dispatch. Hit-tests C++ controls and picks the smallest-area
// match, then calls handlePress. Override for custom behaviour (e.g. crafting).
virtual bool handleMouseClick(F32 x, F32 y);
#endif
void removeControl( UIControl_Base *control, bool centreScene);
void slideLeft();
void slideRight();
@ -193,7 +213,7 @@ public:
protected:
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
bool m_cacheSlotRenders;
bool m_needsCacheRendered;
int m_expectedCachedSlotCount;
@ -269,7 +289,7 @@ public:
protected:
#ifdef _DURANGO
#ifdef _DURANGO
virtual long long getDefaultGtcButtons() { return _360_GTC_BACK; }
#endif

View file

@ -96,6 +96,19 @@ void UIScene_AnvilMenu::tick()
{
UIScene_AbstractContainerMenu::tick();
#ifdef _WINDOWS64
// Live update: sync item name per-keystroke while editing (like Java edition)
if (m_textInputAnvil.isDirectEditing())
{
const wstring& buf = m_textInputAnvil.getEditBuffer();
if (buf != m_itemName)
{
m_itemName = buf;
updateItemName();
}
}
#endif
handleTick();
}
@ -306,26 +319,67 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection)
return control;
}
#ifdef _WINDOWS64
void UIScene_AnvilMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
inputs.push_back(&m_textInputAnvil);
}
void UIScene_AnvilMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
m_itemName = input->getEditBuffer();
updateItemName();
}
#endif
int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
{
// 4J HEG - No reason to set value if keyboard was cancelled
UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam;
pClass->setIgnoreInput(false);
if (bRes)
{
#ifdef _WINDOWS64
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t));
Win64_GetKeyboardText(pchText, 128);
pClass->setEditNameValue((wchar_t *)pchText);
pClass->m_itemName = (wchar_t *)pchText;
pClass->updateItemName();
#else
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText);
pClass->setEditNameValue((wchar_t *)pchText);
pClass->m_itemName = (wchar_t *)pchText;
pClass->updateItemName();
#endif
}
return 0;
}
void UIScene_AnvilMenu::handleEditNamePressed()
{
#ifdef _WINDOWS64
if (isDirectEditBlocking())
return;
if (g_KBMInput.IsKBMActive())
{
m_textInputAnvil.beginDirectEdit(30);
}
else
{
setIgnoreInput(true);
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_TITLE_RENAME);
kbData.defaultText = m_textInputAnvil.getLabel();
kbData.maxChars = 30;
kbData.callback = &UIScene_AnvilMenu::KeyboardCompleteCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
}
#else
setIgnoreInput(true);
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
int language = XGetLanguage();
@ -337,13 +391,13 @@ void UIScene_AnvilMenu::handleEditNamePressed()
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
break;
default:
// 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended);
break;
}
#else
InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
#endif
}
void UIScene_AnvilMenu::setEditNameValue(const wstring &name)
@ -357,6 +411,8 @@ void UIScene_AnvilMenu::setEditNameEditable(bool enabled)
void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
{
if (!getMovie()) return;
IggyDataValue result;
IggyDataValue value[2];
@ -375,6 +431,8 @@ void UIScene_AnvilMenu::showCross(bool show)
{
if(m_showingCross != show)
{
if (!getMovie()) return;
IggyDataValue result;
IggyDataValue value[1];

View file

@ -55,6 +55,10 @@ protected:
virtual UIControl *getSection(ESceneSection eSection);
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
#endif
static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes);
virtual void handleEditNamePressed();
virtual void setEditNameValue(const wstring &name);

View file

@ -4,6 +4,9 @@
#include "..\..\MultiplayerLocalPlayer.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "UIScene_CraftingMenu.h"
#ifdef _WINDOWS64
#include "..\..\Windows64\Iggy\gdraw\gdraw_d3d11.h"
#endif
#ifdef __PSVITA__
#define GAME_CRAFTING_TOUCHUPDATE_TIMER_ID 0
@ -12,6 +15,11 @@
UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
#ifdef _WINDOWS64
m_hSlotBoundsValid = false;
m_hSlotX0 = m_hSlotY0 = m_hSlotY1 = 0;
m_hSlotSpacing = 0;
#endif
m_bIgnoreKeyPresses = false;
CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData;
@ -254,12 +262,14 @@ wstring UIScene_CraftingMenu::getMoviePath()
}
}
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
UIControl* UIScene_CraftingMenu::GetMainPanel()
{
return &m_controlMainPanel;
}
#endif
#ifdef __PSVITA__
void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
{
// perform action on release
@ -375,7 +385,7 @@ void UIScene_CraftingMenu::handleTimerComplete(int id)
{
if(id == GAME_CRAFTING_TOUCHUPDATE_TIMER_ID)
{
// we cannot rebuild touch boxes in an iggy callback because it requirements further iggy calls
// we cannot rebuild touch boxes in an iggy callback because it requires further iggy calls
GetMainPanel()->UpdateControl();
ui.TouchBoxRebuild(this);
killTimer(GAME_CRAFTING_TOUCHUPDATE_TIMER_ID);
@ -383,6 +393,85 @@ void UIScene_CraftingMenu::handleTimerComplete(int id)
}
#endif
#ifdef _WINDOWS64
bool UIScene_CraftingMenu::handleMouseClick(F32 x, F32 y)
{
if (!m_hSlotBoundsValid || m_hSlotSpacing <= 0)
return false;
// Tab click — tabs sit directly above the H slot row. We derive their
// bounds from the H slot positions cached in customDraw, since the Vita
// TouchPanel controls are full-screen overlays with unusable bounds.
int maxTabs = (m_iContainerType == RECIPE_TYPE_3x3) ? m_iMaxGroup3x3 : m_iMaxGroup2x2;
F32 slotHeight = m_hSlotY1 - m_hSlotY0;
F32 tabRowY0 = (m_hSlotY0 * 0.75f) - slotHeight * 1.55f;
F32 tabRowY1 = tabRowY0 + (slotHeight * 1.7f);
F32 tabRowWidth = m_hSlotSpacing * m_iCraftablesMaxHSlotC;
F32 tabWidth = tabRowWidth / maxTabs;
if (tabWidth > 0 && x >= m_hSlotX0 && x < m_hSlotX0 + tabRowWidth &&
y >= tabRowY0 && y < tabRowY1)
{
int iTab = (int)((x - m_hSlotX0) / tabWidth);
if (iTab >= 0 && iTab < maxTabs && iTab != m_iGroupIndex)
{
showTabHighlight(m_iGroupIndex, false);
m_iGroupIndex = iTab;
showTabHighlight(m_iGroupIndex, true);
m_iCurrentSlotHIndex = 0;
m_iCurrentSlotVIndex = 1;
CheckRecipesAvailable();
iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1;
iVSlotIndexA[1] = 0;
iVSlotIndexA[2] = 1;
ui.PlayUISFX(eSFX_Focus);
UpdateVerticalSlots();
UpdateHighlight();
setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex]));
}
return true;
}
// H slot click — select or craft
F32 rowWidth = m_hSlotSpacing * m_iCraftablesMaxHSlotC;
if (x >= m_hSlotX0 && x < m_hSlotX0 + rowWidth &&
y >= m_hSlotY0 && y < m_hSlotY1)
{
int iNewSlot = (int)((x - m_hSlotX0) / m_hSlotSpacing);
if (iNewSlot >= 0 && iNewSlot < m_iCraftablesMaxHSlotC)
{
// Only interact with populated slots
if (CanBeMadeA[iNewSlot].iCount == 0)
return true;
if (iNewSlot == m_iCurrentSlotHIndex)
{
// Click on already-selected slot — craft the item
handleKeyDown(m_iPad, ACTION_MENU_A, false);
}
else
{
int iOldHSlot = m_iCurrentSlotHIndex;
m_iCurrentSlotHIndex = iNewSlot;
m_iCurrentSlotVIndex = 1;
iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1;
iVSlotIndexA[1] = 0;
iVSlotIndexA[2] = 1;
UpdateVerticalSlots();
UpdateHighlight();
if (CanBeMadeA[iOldHSlot].iCount > 0)
setShowCraftHSlot(iOldHSlot, true);
ui.PlayUISFX(eSFX_Focus);
}
return true;
}
}
// Consume all mouse clicks so misses don't generate ACTION_MENU_A
// and accidentally craft. Only blocks mouse-originated presses.
return true;
}
#endif
void UIScene_CraftingMenu::handleReload()
{
m_slotListInventory.addSlots(CRAFTING_INVENTORY_SLOT_START,CRAFTING_INVENTORY_SLOT_END - CRAFTING_INVENTORY_SLOT_START);
@ -478,6 +567,32 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
{
decorations = false;
int iIndex = slotId - CRAFTING_H_SLOT_START;
#ifdef _WINDOWS64
// Cache H slot SWF-space positions from the custom draw transform matrix
if (iIndex == 0 || iIndex == 1)
{
F32 mat[16];
gdraw_D3D11_CalculateCustomDraw_4J(region, mat);
// Matrix to SWF coords (same formula as setupCustomDrawMatrices)
F32 sw = (F32)getRenderWidth();
F32 sh = (F32)getRenderHeight();
F32 swfX = sw * (1.0f + mat[3]) / 2.0f;
F32 swfY = sh * (1.0f - mat[7]) / 2.0f;
if (iIndex == 0)
{
m_hSlotX0 = swfX;
m_hSlotY0 = swfY;
// Slot visual height from matrix scale and region height
F32 slotH = sh * (-mat[5]) / 2.0f * region->y1;
m_hSlotY1 = swfY + slotH;
}
else
{
m_hSlotSpacing = swfX - m_hSlotX0;
m_hSlotBoundsValid = (m_hSlotSpacing > 0);
}
}
#endif
if(m_hSlotsInfo[iIndex].show)
{
item = m_hSlotsInfo[iIndex].item;

View file

@ -66,10 +66,19 @@ public:
#ifdef __PSVITA__
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
virtual UIControl* GetMainPanel();
virtual void handleTouchBoxRebuild();
virtual void handleTimerComplete(int id);
#endif
#if defined(__PSVITA__) || defined(_WINDOWS64)
virtual UIControl* GetMainPanel();
#endif
#ifdef _WINDOWS64
virtual bool handleMouseClick(F32 x, F32 y);
// Cached from customDraw — H slot bounding boxes in SWF space
F32 m_hSlotX0, m_hSlotY0, m_hSlotY1;
F32 m_hSlotSpacing; // x distance between slot 0 and slot 1
bool m_hSlotBoundsValid;
#endif
protected:
UIControl m_controlMainPanel;
@ -97,7 +106,7 @@ protected:
ETouchInput_TouchPanel_5,
ETouchInput_TouchPanel_6,
ETouchInput_CraftingHSlots,
ETouchInput_Count,
};
UIControl_Touch m_TouchInput[ETouchInput_Count];

View file

@ -58,11 +58,11 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_labelTexturePackDescription.init(L"");
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]));
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]));
m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty));
m_MoreOptionsParams.bGenerateOptions=TRUE;
m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bFlatWorld=FALSE;
m_MoreOptionsParams.bBonusChest=FALSE;
m_MoreOptionsParams.bPVP = TRUE;
@ -84,10 +84,6 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_iGameModeId = GameType::SURVIVAL->getId();
m_pDLCPack = NULL;
m_bRebuildTouchBoxes = false;
#ifdef _WINDOWS64
m_bDirectEditing = false;
m_iDirectEditCooldown = 0;
#endif
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
// 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it.
@ -95,7 +91,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_MoreOptionsParams.bOnlineSettingChangedBySystem=false;
// 4J-PB - Removing this so that we can attempt to create an online game on PS3 when we are a restricted child account
// It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online,
// It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online,
// instead of just greying out the online setting in the More Options
// #ifdef __PS3__
// if(ProfileManager.IsSignedInLive( m_iPad ))
@ -128,9 +124,9 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
{
// The profile settings say Online, but either the player is offline, or they are not allowed to play online
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
}
}
}
// Set up online game checkbox
bool bOnlineGame = m_MoreOptionsParams.bOnlineGame;
m_checkboxOnline.SetEnable(true);
@ -293,53 +289,6 @@ void UIScene_CreateWorldMenu::tick()
{
UIScene::tick();
#ifdef _WINDOWS64
if (m_iDirectEditCooldown > 0)
m_iDirectEditCooldown--;
if (m_bDirectEditing)
{
wchar_t ch;
bool changed = false;
while (g_KBMInput.ConsumeChar(ch))
{
if (ch == 0x08) // backspace
{
if (!m_worldName.empty())
{
m_worldName.pop_back();
changed = true;
}
}
else if (ch == 0x0D) // enter - confirm
{
m_bDirectEditing = false;
m_iDirectEditCooldown = 4; // absorb the matching ACTION_MENU_OK that follows
m_editWorldName.setLabel(m_worldName.c_str());
}
else if ((int)m_worldName.length() < 25)
{
m_worldName += ch;
changed = true;
}
}
// Escape cancels and restores the original name
if (m_bDirectEditing && g_KBMInput.IsKeyPressed(VK_ESCAPE))
{
m_worldName = m_worldNameBeforeEdit;
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
else if (changed)
{
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
}
#endif
if(m_iSetTexturePackDescription >= 0 )
{
@ -393,7 +342,7 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept)
{
pClass->m_MoreOptionsParams.bOnlineGame=false;
pClass->checkStateAndStartGame();
@ -403,11 +352,24 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
#endif
#ifdef _WINDOWS64
void UIScene_CreateWorldMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
inputs.push_back(&m_editWorldName);
}
void UIScene_CreateWorldMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
m_worldName = input->getEditBuffer();
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
#endif
void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) { handled = true; return; }
if (isDirectEditBlocking()) { handled = true; return; }
#endif
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
@ -431,7 +393,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() )
{
UINT uiIDA[1] = { IDS_CONFIRM_OK };
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
}
#endif
@ -442,7 +404,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
case ACTION_MENU_OTHER_STICK_UP:
case ACTION_MENU_OTHER_STICK_DOWN:
sendInputToMovie(key, repeat, pressed, released);
bool bOnlineGame = m_checkboxOnline.IsChecked();
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame)
{
@ -464,7 +426,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) return;
if (isDirectEditBlocking()) return;
#endif
//CD - Added for audio
@ -476,7 +438,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{
m_bIgnoreInput=true;
#ifdef _WINDOWS64
if (Win64_IsControllerConnected())
if (!g_KBMInput.IsKBMActive())
{
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD);
@ -488,11 +450,8 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
}
else
{
// PC without controller: edit the name field directly in-place.
m_bIgnoreInput = false; // Don't block input - m_bDirectEditing is the guard
m_worldNameBeforeEdit = m_worldName;
m_bDirectEditing = true;
g_KBMInput.ClearCharBuffer();
m_bIgnoreInput = false;
m_editWorldName.beginDirectEdit(25);
}
#else
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
@ -502,16 +461,20 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
case eControl_GameModeToggle:
switch(m_iGameModeId)
{
case 0: // Survival
case 0: // Creative
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE));
m_iGameModeId = GameType::CREATIVE->getId();
m_bGameModeCreative = true;
break;
case 1: // Creative
case 1: // Adventure
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE));
m_iGameModeId = GameType::ADVENTURE->getId();
m_bGameModeCreative = false;
break;
case 2: // Survival
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL));
m_iGameModeId = GameType::SURVIVAL->getId();
m_bGameModeCreative = false;
break;
};
break;
case eControl_MoreOptions:
@ -614,7 +577,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
if(m_MoreOptionsParams.dwTexturePack!=0)
{
// texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack;
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();
@ -666,7 +629,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this);
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this);
#endif
#if defined _XBOX_ONE || defined __ORBIS__
@ -693,7 +656,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue)
m_sliderDifficulty.handleSliderMove(value);
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value]));
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value]));
m_sliderDifficulty.setLabel(TempString);
break;
}
@ -702,7 +665,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue)
void UIScene_CreateWorldMenu::handleTimerComplete(int id)
{
#ifdef __PSVITA__
// we cannot rebuild touch boxes in an iggy callback because it requirements further iggy calls
// we cannot rebuild touch boxes in an iggy callback because it requires further iggy calls
if(m_bRebuildTouchBoxes)
{
GetMainPanel()->UpdateControl();
@ -740,7 +703,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
m_MoreOptionsParams.bInviteOnly = FALSE;
m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE;
}
m_checkboxOnline.SetEnable(bMultiplayerAllowed);
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
@ -774,7 +737,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
PBYTE pbImageData=NULL;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
ListInfo.fEnabled = TRUE;
ListInfo.fEnabled = TRUE;
ListInfo.iData = m_iConfigA[i];
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
@ -832,7 +795,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
bool isOnlineGame = m_MoreOptionsParams.bOnlineGame;
int iPadNotSignedInLive = -1;
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
{
if (ProfileManager.IsSignedIn(i) && (i == primaryPad || isLocalMultiplayerAvailable))
@ -884,7 +847,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
}
else
{
{
// Not signed in to PSN
UINT uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
@ -940,7 +903,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param);
@ -955,7 +918,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
#endif
if(m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == TRUE)
{
{
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
@ -1028,7 +991,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param);
@ -1091,8 +1054,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param);
@ -1165,14 +1128,14 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
// start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
__int64 seedValue = 0;
int64_t seedValue = 0;
NetworkGameInitData *param = new NetworkGameInitData();
param->levelName = wWorldName;
if (wSeed.length() != 0)
{
__int64 value = 0;
int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value
@ -1191,7 +1154,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
//If the input string is a numerical value, convert it to a number
if( isNumber )
value = _fromString<__int64>(wSeed);
value = _fromString<int64_t>(wSeed);
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 )
@ -1235,7 +1198,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(eGameHostOption_HostCanFly,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges );
app.SetGameHostOption(eGameHostOption_MobGriefing, pClass->m_MoreOptionsParams.bMobGriefing);
app.SetGameHostOption(eGameHostOption_KeepInventory, pClass->m_MoreOptionsParams.bKeepInventory);
app.SetGameHostOption(eGameHostOption_DoMobSpawning, pClass->m_MoreOptionsParams.bDoMobSpawning);
@ -1243,8 +1206,8 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(eGameHostOption_DoTileDrops, pClass->m_MoreOptionsParams.bDoTileDrops);
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, pClass->m_MoreOptionsParams.bNaturalRegeneration);
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, pClass->m_MoreOptionsParams.bDoDaylightCycle);
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
#ifdef _LARGE_WORLDS
app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN
pClass->m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1);
@ -1407,7 +1370,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
}
}
else
{
{
pClass->m_bIgnoreInput = false;
}
return 0;
@ -1418,7 +1381,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
{
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept)
{
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
@ -1463,7 +1426,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad());
}
else
{
{
#if defined( __ORBIS__) || defined(__PSVITA__)
bool isOnlineGame = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
if(isOnlineGame)
@ -1493,7 +1456,7 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam;
pClass->m_bIgnoreInput = false;
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept)
{
SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad);
}
@ -1505,28 +1468,28 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
// {
// int32_t iResult;
// UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam;
//
//
// // continue offline, or upsell PS Plus?
// if(result==C4JStorage::EMessage_ResultDecline)
// if(result==C4JStorage::EMessage_ResultDecline)
// {
// // upsell psplus
// int32_t iResult=sceNpCommerceDialogInitialize();
//
//
// SceNpCommerceDialogParam param;
// sceNpCommerceDialogParamInitialize(&param);
// param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
// param.userId = ProfileManager.getUserID(pClass->m_iPad);
//
//
// iResult=sceNpCommerceDialogOpen(&param);
// }
// else if(result==C4JStorage::EMessage_ResultAccept)
// else if(result==C4JStorage::EMessage_ResultAccept)
// {
// // continue offline
// pClass->m_MoreOptionsParams.bOnlineGame=false;
// pClass->checkStateAndStartGame();
// }
//
//
// pClass->m_bIgnoreInput=false;
// return 0;
// }

View file

@ -51,11 +51,6 @@ private:
DLCPack * m_pDLCPack;
bool m_bRebuildTouchBoxes;
#ifdef _WINDOWS64
bool m_bDirectEditing;
wstring m_worldNameBeforeEdit;
int m_iDirectEditCooldown;
#endif
public:
UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer);
@ -83,6 +78,10 @@ protected:
public:
// INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
#endif
private:
void StartSharedLaunchFlow();

View file

@ -123,7 +123,7 @@ void UIScene_CreativeMenu::handleTimerComplete(int id)
{
if(id == GAME_CREATIVE_TOUCHUPDATE_TIMER_ID)
{
// we cannot rebuild touch boxes in an iggy callback because it requirements further iggy calls
// we cannot rebuild touch boxes in an iggy callback because it requires further iggy calls
GetMainPanel()->UpdateControl();
ui.TouchBoxRebuild(this);
killTimer(GAME_CREATIVE_TOUCHUPDATE_TIMER_ID);

View file

@ -41,8 +41,72 @@ wstring UIScene_DebugCreateSchematic::getMoviePath()
return L"DebugCreateSchematic";
}
UIControl_TextInput* UIScene_DebugCreateSchematic::getTextInputForControl(eControls ctrl)
{
switch (ctrl)
{
case eControl_Name: return &m_textInputName;
case eControl_StartX: return &m_textInputStartX;
case eControl_StartY: return &m_textInputStartY;
case eControl_StartZ: return &m_textInputStartZ;
case eControl_EndX: return &m_textInputEndX;
case eControl_EndY: return &m_textInputEndY;
case eControl_EndZ: return &m_textInputEndZ;
default: return NULL;
}
}
#ifdef _WINDOWS64
void UIScene_DebugCreateSchematic::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
inputs.push_back(&m_textInputName);
inputs.push_back(&m_textInputStartX);
inputs.push_back(&m_textInputStartY);
inputs.push_back(&m_textInputStartZ);
inputs.push_back(&m_textInputEndX);
inputs.push_back(&m_textInputEndY);
inputs.push_back(&m_textInputEndZ);
}
void UIScene_DebugCreateSchematic::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
wstring value = input->getEditBuffer();
int iVal = 0;
if (!value.empty())
iVal = _fromString<int>(value);
if (input == &m_textInputName)
{
if (!value.empty())
swprintf(m_data->name, 64, L"%ls", value.c_str());
else
swprintf(m_data->name, 64, L"schematic");
}
else if (input == &m_textInputStartX) m_data->startX = iVal;
else if (input == &m_textInputStartY) m_data->startY = iVal;
else if (input == &m_textInputStartZ) m_data->startZ = iVal;
else if (input == &m_textInputEndX) m_data->endX = iVal;
else if (input == &m_textInputEndY) m_data->endY = iVal;
else if (input == &m_textInputEndZ) m_data->endZ = iVal;
}
bool UIScene_DebugCreateSchematic::handleMouseClick(F32 x, F32 y)
{
UIScene::handleMouseClick(x, y);
return true; // always consume to prevent Iggy re-entry on empty space
}
#endif
void UIScene_DebugCreateSchematic::tick()
{
UIScene::tick();
}
void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
switch(key)
@ -67,6 +131,9 @@ void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, b
void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
{
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId)
{
case eControl_Create:
@ -112,8 +179,28 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
case eControl_EndX:
case eControl_EndY:
case eControl_EndZ:
m_keyboardCallbackControl = (eControls)((int)controlId);
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
{
m_keyboardCallbackControl = (eControls)((int)controlId);
#ifdef _WINDOWS64
if (g_KBMInput.IsKBMActive())
{
UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl);
if (input) input->beginDirectEdit(25);
}
else
{
UIKeyboardInitData kbData;
kbData.title = L"Enter something";
kbData.defaultText = L"";
kbData.maxChars = 25;
kbData.callback = &UIScene_DebugCreateSchematic::KeyboardCompleteCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
}
#else
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
}
break;
};
}
@ -138,9 +225,15 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b
{
UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam;
#ifdef _WINDOWS64
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t));
Win64_GetKeyboardText(pchText, 128);
#else
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText);
#endif
if(pchText[0]!=0)
{

View file

@ -24,6 +24,7 @@ private:
ConsoleSchematicFile::XboxSchematicInitParam *m_data;
public:
UIScene_DebugCreateSchematic(int iPad, void *initData, UILayer *parentLayer);
@ -58,8 +59,14 @@ protected:
UI_END_MAP_ELEMENTS_AND_NAMES()
virtual wstring getMoviePath();
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
virtual bool handleMouseClick(F32 x, F32 y);
#endif
public:
virtual void tick();
// INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
@ -68,6 +75,7 @@ protected:
virtual void handleCheckboxToggled(F64 controlId, bool selected);
private:
UIControl_TextInput* getTextInputForControl(eControls ctrl);
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
};
#endif

View file

@ -23,8 +23,10 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
Minecraft *pMinecraft = Minecraft::GetInstance();
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)pMinecraft->gameRenderer->GetFovVal());
m_sliderFov.init(TempString,eControl_FOV,0,100,(int)pMinecraft->gameRenderer->GetFovVal());
int fovSliderVal = app.GetGameSettings(m_iPad, eGameSetting_FOV);
int fovDeg = 70 + fovSliderVal * 40 / 100;
swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", fovDeg);
m_sliderFov.init(TempString,eControl_FOV,0,100,fovSliderVal);
float currentTime = pMinecraft->level->getLevelData()->getGameTime() % 24000;
swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime);
@ -273,10 +275,15 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue)
case eControl_FOV:
{
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->gameRenderer->SetFovVal((float)currentValue);
int v = (int)currentValue;
if (v < 0) v = 0;
if (v > 100) v = 100;
int fovDeg = 70 + v * 40 / 100;
pMinecraft->gameRenderer->SetFovVal((float)fovDeg);
app.SetGameSettings(m_iPad, eGameSetting_FOV, v);
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)currentValue);
swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", fovDeg);
m_sliderFov.setLabel(TempString);
}
break;

View file

@ -31,19 +31,19 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camX);
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camX);
m_textInputX.init(TempString, eControl_CamX);
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camY);
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camY);
m_textInputY.init(TempString, eControl_CamY);
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camZ);
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camZ);
m_textInputZ.init(TempString, eControl_CamZ);
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_yRot);
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_yRot);
m_textInputYRot.init(TempString, eControl_YRot);
swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_elev);
swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_elev);
m_textInputElevation.init(TempString, eControl_Elevation);
m_checkboxLockPlayer.init(L"Lock Player", eControl_LockPlayer, app.GetFreezePlayers());
@ -55,6 +55,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer
m_labelCamY.init(L"CamY");
m_labelCamZ.init(L"CamZ");
m_labelYRotElev.init(L"Y-Rot & Elevation (Degs)");
}
wstring UIScene_DebugSetCamera::getMoviePath()
@ -62,8 +63,59 @@ wstring UIScene_DebugSetCamera::getMoviePath()
return L"DebugSetCamera";
}
#ifdef _WINDOWS64
UIControl_TextInput* UIScene_DebugSetCamera::getTextInputForControl(eControls ctrl)
{
switch (ctrl)
{
case eControl_CamX: return &m_textInputX;
case eControl_CamY: return &m_textInputY;
case eControl_CamZ: return &m_textInputZ;
case eControl_YRot: return &m_textInputYRot;
case eControl_Elevation: return &m_textInputElevation;
default: return NULL;
}
}
void UIScene_DebugSetCamera::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
inputs.push_back(&m_textInputX);
inputs.push_back(&m_textInputY);
inputs.push_back(&m_textInputZ);
inputs.push_back(&m_textInputYRot);
inputs.push_back(&m_textInputElevation);
}
void UIScene_DebugSetCamera::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
wstring value = input->getEditBuffer();
double val = 0;
if (!value.empty()) val = _fromString<double>(value);
if (input == &m_textInputX) currentPosition->m_camX = val;
else if (input == &m_textInputY) currentPosition->m_camY = val;
else if (input == &m_textInputZ) currentPosition->m_camZ = val;
else if (input == &m_textInputYRot) currentPosition->m_yRot = val;
else if (input == &m_textInputElevation) currentPosition->m_elev = val;
}
bool UIScene_DebugSetCamera::handleMouseClick(F32 x, F32 y)
{
UIScene::handleMouseClick(x, y);
return true; // always consume to prevent Iggy re-entry on empty space
}
#endif
void UIScene_DebugSetCamera::tick()
{
UIScene::tick();
}
void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
#ifdef _WINDOWS64
if (isDirectEditBlocking()) { handled = true; return; }
#endif
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
switch(key)
@ -88,11 +140,14 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pr
void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
{
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId)
{
case eControl_Teleport:
app.SetXuiServerAction( ProfileManager.GetPrimaryPad(),
eXuiServerAction_SetCameraLocation,
eXuiServerAction_SetCameraLocation,
(void *)currentPosition);
break;
case eControl_CamX:
@ -100,8 +155,26 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId)
case eControl_CamZ:
case eControl_YRot:
case eControl_Elevation:
m_keyboardCallbackControl = (eControls)((int)controlId);
m_keyboardCallbackControl = (eControls)((int)controlId);
#ifdef _WINDOWS64
if (g_KBMInput.IsKBMActive())
{
UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl);
if (input) input->beginDirectEdit(25);
}
else
{
UIKeyboardInitData kbData;
kbData.title = L"Enter value";
kbData.defaultText = L"";
kbData.maxChars = 25;
kbData.callback = &UIScene_DebugSetCamera::KeyboardCompleteCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
}
#else
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
break;
};
}
@ -119,9 +192,13 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected)
int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
{
UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam;
uint16_t pchText[2048];//[128];
ZeroMemory(pchText, 2048/*128*/ * sizeof(uint16_t) );
uint16_t pchText[2048];
ZeroMemory(pchText, 2048 * sizeof(uint16_t));
#ifdef _WINDOWS64
Win64_GetKeyboardText(pchText, 2048);
#else
InputManager.GetText(pchText);
#endif
if(pchText[0]!=0)
{

View file

@ -26,6 +26,9 @@ private:
FreezePlayerParam *fpp;
eControls m_keyboardCallbackControl;
#ifdef _WINDOWS64
UIControl_TextInput* getTextInputForControl(eControls ctrl);
#endif
public:
UIScene_DebugSetCamera(int iPad, void *initData, UILayer *parentLayer);
@ -54,6 +57,12 @@ protected:
UI_END_MAP_ELEMENTS_AND_NAMES()
virtual wstring getMoviePath();
virtual void tick();
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
virtual bool handleMouseClick(F32 x, F32 y);
#endif
public:
// INPUT

View file

@ -753,7 +753,7 @@ void UIScene_HUD::handleTimerComplete(int id)
float opacity = pGui->getOpacity(m_iPad, i);
if( opacity > 0 )
{
#ifdef _WINDOWS64
#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);

View file

@ -121,7 +121,7 @@ void UIScene_HelpAndOptionsMenu::updateComponents()
void UIScene_HelpAndOptionsMenu::handleReload()
{
#ifdef _FINAL_BUILD
#ifndef _DEBUG // def _FINAL_BUILD // disable debug settings in release builds
removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);
#else
if(!app.DebugSettingsOn()) removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);

View file

@ -61,7 +61,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
if(m_editingSelf)
{
#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
#ifndef _DEBUG // (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
removeControl( &m_checkboxes[eControl_Op], true );
#else
m_checkboxes[eControl_Op].init(L"DEBUG: Creative",eControl_Op,Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode));
@ -254,7 +254,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload()
if(m_editingSelf)
{
#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
#ifndef _DEBUG //(defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
removeControl( &m_checkboxes[eControl_Op], true );
#endif
@ -348,7 +348,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
if(m_editingSelf)
{
#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
#ifndef _DEBUG // (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
#else
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode,m_checkboxes[eControl_Op].IsChecked());
#endif

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

View file

@ -532,6 +532,48 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
break;
}
if( exitReasonStringId == -1 )
{
Minecraft* pMinecraft = Minecraft::GetInstance();
int primaryPad = ProfileManager.GetPrimaryPad();
if( pMinecraft->m_connectionFailed[primaryPad] )
{
switch( pMinecraft->m_connectionFailedReason[primaryPad] )
{
case DisconnectPacket::eDisconnect_LoginTooLong:
exitReasonStringId = IDS_DISCONNECTED_LOGIN_TOO_LONG;
break;
case DisconnectPacket::eDisconnect_ServerFull:
exitReasonStringId = IDS_DISCONNECTED_SERVER_FULL;
break;
case DisconnectPacket::eDisconnect_Kicked:
exitReasonStringId = IDS_DISCONNECTED_KICKED;
break;
case DisconnectPacket::eDisconnect_NoUGC_AllLocal:
exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL;
break;
case DisconnectPacket::eDisconnect_NoUGC_Single_Local:
exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL;
break;
case DisconnectPacket::eDisconnect_NoFlying:
exitReasonStringId = IDS_DISCONNECTED_FLYING;
break;
case DisconnectPacket::eDisconnect_Quitting:
exitReasonStringId = IDS_DISCONNECTED_SERVER_QUIT;
break;
case DisconnectPacket::eDisconnect_OutdatedServer:
exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD;
break;
case DisconnectPacket::eDisconnect_OutdatedClient:
exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD;
break;
default:
exitReasonStringId = IDS_CONNECTION_LOST_SERVER;
break;
}
}
}
if( exitReasonStringId == -1 )
{
ui.NavigateBack(pClass->m_iPad);

View file

@ -163,6 +163,12 @@ void UIScene_Keyboard::tick()
{
UIScene::tick();
// Sync our buffer from Flash so we pick up changes made via controller/on-screen buttons.
// Without this, switching between controller and keyboard would use stale text.
const wchar_t* flashText = m_KeyboardTextInput.getLabel();
if (flashText)
m_win64TextBuffer = flashText;
// Accumulate physical keyboard chars into our own buffer, then push to Flash via setLabel.
// This bypasses Iggy's focus system (char events only route to the focused element).
// The char buffer is cleared on open so Enter/clicks from the triggering action don't leak in.

View file

@ -126,4 +126,4 @@ void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId)
app.CheckGameSettingsChanged(true, m_iPad);
}
}
}

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)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
//app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
@ -334,7 +337,9 @@ void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S
}
}
}
#endif
#if defined(__PSVITA__) || defined(_WINDOWS64)
UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel()
{
if(m_tabIndex == 0)
@ -546,11 +551,16 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
{
UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam;
pClass->m_bIgnoreInput=false;
// 4J HEG - No reason to set value if keyboard was cancelled
if (bRes)
{
#ifdef _WINDOWS64
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t));
Win64_GetKeyboardText(pchText, 128);
pClass->m_editSeed.setLabel((wchar_t *)pchText);
pClass->m_params->seed = (wchar_t *)pchText;
#else
#ifdef __PSVITA__
//CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH]
uint16_t pchText[2048];
ZeroMemory(pchText, 2048 * sizeof(uint16_t) );
#else
@ -560,18 +570,52 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b
InputManager.GetText(pchText);
pClass->m_editSeed.setLabel((wchar_t *)pchText);
pClass->m_params->seed = (wchar_t *)pchText;
#endif
}
return 0;
}
#ifdef _WINDOWS64
void UIScene_LaunchMoreOptionsMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
inputs.push_back(&m_editSeed);
}
void UIScene_LaunchMoreOptionsMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
if (result == UIControl_TextInput::eDirectEdit_Confirmed)
m_params->seed = input->getEditBuffer();
}
#endif
void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId)
{
case eControl_EditSeed:
{
#ifdef _WINDOWS64
if (g_KBMInput.IsKBMActive())
{
m_editSeed.beginDirectEdit(60);
}
else
{
m_bIgnoreInput = true;
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD_SEED);
kbData.defaultText = m_editSeed.getLabel();
kbData.maxChars = 60;
kbData.callback = &UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
}
#else
m_bIgnoreInput=true;
#ifdef __PS3__
int language = XGetLanguage();
@ -583,12 +627,12 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
break;
default:
// 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended);
break;
}
#else
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
#endif
}
break;

View file

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

View file

@ -968,7 +968,7 @@ void UIScene_LoadMenu::handleTouchBoxRebuild()
void UIScene_LoadMenu::handleTimerComplete(int id)
{
#ifdef __PSVITA__
// we cannot rebuild touch boxes in an iggy callback because it requirements further iggy calls
// we cannot rebuild touch boxes in an iggy callback because it requires further iggy calls
if(m_bRebuildTouchBoxes)
{
GetMainPanel()->UpdateControl();

View file

@ -16,7 +16,7 @@ private:
};
static int m_iDifficultyTitleSettingA[4];
UIControl m_controlMainPanel;
UIControl_Label m_labelGameName, m_labelSeed, m_labelCreatedMode;
UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld;
@ -43,7 +43,7 @@ private:
LevelGenerationOptions *m_levelGen;
DLCPack * m_pDLCPack;
int m_iSaveGameInfoIndex;
int m_CurrentDifficulty;
bool m_bGameModeCreative;
@ -58,7 +58,7 @@ private:
bool m_bRequestQuadrantSignin;
bool m_bIsCorrupt;
bool m_bThumbnailGetFailed;
__int64 m_seed;
int64_t m_seed;
wstring m_levelName;
#ifdef __PS3__
@ -73,7 +73,7 @@ private:
bool m_bRebuildTouchBoxes;
public:
UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLayer);
virtual void updateTooltips();
virtual void updateComponents();
@ -107,7 +107,7 @@ private:
#ifdef _DURANGO
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
#endif
static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
static void StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask);
static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner);

View file

@ -1051,7 +1051,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo()
m_pSaveDetails=StorageManager.ReturnSavesInfo();
if(m_pSaveDetails==NULL)
{
C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, NULL, this, const_cast<char *>("save")); // needs to be casted as we dont have the library the function derives from as part of the build
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,const_cast<char*>("save"));
}
#if TO_BE_IMPLEMENTED
@ -1168,6 +1168,43 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr
LaunchSaveTransfer();
}
}
#endif
#ifdef _WINDOWS64
// Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL)
if(pressed && !repeat && ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled())
{
if(DoesSavesListHaveFocus() && (m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC))
{
m_bIgnoreInput = true;
if(StorageManager.EnoughSpaceForAMinSaveGame())
{
UINT uiIDA[3];
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_TITLE_RENAMESAVE;
uiIDA[2]=IDS_TOOLTIPS_DELETESAVE;
ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, 3, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this);
}
else
{
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this);
}
ui.PlayUISFX(eSFX_Press);
}
else if(DoesMashUpWorldHaveFocus() && (m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX))
{
LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1);
if(!levelGen->isTutorial() && levelGen->requiresTexturePack())
{
m_bIgnoreInput = true;
app.HideMashupPackWorld(m_iPad, levelGen->getRequiredTexturePackId());
m_iState = e_SavesRepopulateAfterMashupHide;
}
ui.PlayUISFX(eSFX_Press);
}
}
#endif
break;
case ACTION_MENU_Y:
@ -2134,7 +2171,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save
// Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str());
__int64 fileSize = saveFile->length();
int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile);
byteArray ba(fileSize);
fis.read(ba);
@ -2198,7 +2235,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null
StorageManager.SetSaveTitle(wSaveName);
__int64 fileSize = cloudFile.length();
int64_t fileSize = cloudFile.length();
FileInputStream fis(cloudFile);
byteArray ba(fileSize);
fis.read(ba);
@ -2394,7 +2431,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS
kbData.maxChars = 25;
kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback;
kbData.lpParam = pClass;
kbData.pcMode = !Win64_IsControllerConnected();
kbData.pcMode = g_KBMInput.IsKBMActive();
ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData);
}
#elif defined _DURANGO
@ -3542,7 +3579,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
bool bHostOptionsRead = false;
unsigned int uiHostOptions = 0;
DWORD dwTexturePack;
__int64 seedVal;
int64_t seedVal;
char szSeed[50];
ZeroMemory(szSeed,50);

View file

@ -2,6 +2,7 @@
#include "UI.h"
#include "UIScene_SettingsGraphicsMenu.h"
#include "..\..\Minecraft.h"
#include "..\..\Options.h"
#include "..\..\GameRenderer.h"
namespace
@ -31,6 +32,24 @@ namespace
}
}
int UIScene_SettingsGraphicsMenu::LevelToDistance(int level)
{
static const int table[6] = {2,4,8,16,32,64};
if(level < 0) level = 0;
if(level > 5) level = 5;
return table[level];
}
int UIScene_SettingsGraphicsMenu::DistanceToLevel(int dist)
{
static const int table[6] = {2,4,8,16,32,64};
for(int i = 0; i < 6; i++){
if(table[i] == dist)
return i;
}
return 3;
}
UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
@ -45,13 +64,17 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD
WCHAR TempString[256];
swprintf((WCHAR*)TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance));
m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,5,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)));
swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma));
m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma));
int initialFov = clampFov((int)(pMinecraft->gameRenderer->GetFovVal() + 0.5f));
swprintf((WCHAR*)TempString, 256, L"FOV: %d", initialFov);
m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, fovToSliderValue((float)initialFov));
int initialFovSlider = app.GetGameSettings(m_iPad, eGameSetting_FOV);
int initialFovDeg = sliderValueToFov(initialFovSlider);
swprintf((WCHAR*)TempString, 256, L"FOV: %d", initialFovDeg);
m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, initialFovSlider);
swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity));
m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity));
@ -167,6 +190,21 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal
int value = (int)currentValue;
switch((int)sliderId)
{
case eControl_RenderDistance:
{
m_sliderRenderDistance.handleSliderMove(value);
int dist = LevelToDistance(value);
app.SetGameSettings(m_iPad,eGameSetting_RenderDistance,dist);
Minecraft* mc = Minecraft::GetInstance();
mc->options->viewDistance = 3 - value;
swprintf((WCHAR*)TempString,256,L"Render Distance: %d",dist);
m_sliderRenderDistance.setLabel(TempString);
}
break;
case eControl_Gamma:
m_sliderGamma.handleSliderMove(value);
@ -182,6 +220,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal
Minecraft* pMinecraft = Minecraft::GetInstance();
int fovValue = sliderValueToFov(value);
pMinecraft->gameRenderer->SetFovVal((float)fovValue);
app.SetGameSettings(m_iPad, eGameSetting_FOV, value);
WCHAR TempString[256];
swprintf((WCHAR*)TempString, 256, L"FOV: %d", fovValue);
m_sliderFOV.setLabel(TempString);

View file

@ -1,6 +1,8 @@
#pragma once
#include "UIScene.h"
#include "Common/UI/UIControl_CheckBox.h"
#include "Common/UI/UIControl_Slider.h"
class UIScene_SettingsGraphicsMenu : public UIScene
{
@ -10,17 +12,19 @@ private:
eControl_Clouds,
eControl_BedrockFog,
eControl_CustomSkinAnim,
eControl_RenderDistance,
eControl_Gamma,
eControl_FOV,
eControl_InterfaceOpacity
};
UIControl_CheckBox m_checkboxClouds, m_checkboxBedrockFog, m_checkboxCustomSkinAnim; // Checkboxes
UIControl_Slider m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity; // Sliders
UIControl_Slider m_sliderRenderDistance, m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity; // Sliders
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_ELEMENT( m_checkboxClouds, "Clouds")
UI_MAP_ELEMENT( m_checkboxBedrockFog, "BedrockFog")
UI_MAP_ELEMENT( m_checkboxCustomSkinAnim, "CustomSkinAnim")
UI_MAP_ELEMENT( m_sliderRenderDistance, "RenderDistance")
UI_MAP_ELEMENT( m_sliderGamma, "Gamma")
UI_MAP_ELEMENT(m_sliderFOV, "FOV")
UI_MAP_ELEMENT( m_sliderInterfaceOpacity, "InterfaceOpacity")
@ -45,4 +49,8 @@ public:
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
virtual void handleSliderMove(F64 sliderId, F64 currentValue);
static int LevelToDistance(int dist);
static int DistanceToLevel(int dist);
};

View file

@ -18,6 +18,12 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer
m_bConfirmed = false;
m_bIgnoreInput = false;
m_iSignCursorFrame = 0;
#ifdef _WINDOWS64
m_iActiveDirectEditLine = -1;
m_bNeedsInitialEdit = true;
m_bSkipTickNav = false;
#endif
m_buttonConfirm.init(app.GetString(IDS_DONE), eControl_Confirm);
m_labelMessage.init(app.GetString(IDS_EDIT_SIGN_MESSAGE));
@ -53,6 +59,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer
UIScene_SignEntryMenu::~UIScene_SignEntryMenu()
{
m_sign->SetSelectedLine(-1);
m_parentLayer->removeComponent(eUIComponent_MenuBackground);
}
@ -77,6 +84,79 @@ void UIScene_SignEntryMenu::tick()
{
UIScene::tick();
#ifdef _WINDOWS64
// On first tick, auto-start editing line 1 if KBM is active (Java-style flow)
if (m_bNeedsInitialEdit)
{
m_bNeedsInitialEdit = false;
if (g_KBMInput.IsKBMActive())
{
SetFocusToElement(eControl_Line1);
m_iActiveDirectEditLine = 0;
m_textInputLines[0].beginDirectEdit(15);
}
}
// UP/DOWN navigation — must happen after tickDirectEdit (so typed chars are consumed)
// and before sign cursor update (so the cursor is correct for this frame's render)
// m_bSkipTickNav prevents double-processing when handleInput auto-started editing this frame
if (m_iActiveDirectEditLine >= 0 && !m_bSkipTickNav)
{
int navDir = 0;
if (g_KBMInput.IsKeyPressed(VK_DOWN)) navDir = 1;
else if (g_KBMInput.IsKeyPressed(VK_UP)) navDir = -1;
if (navDir != 0)
{
int newLine = m_iActiveDirectEditLine + navDir;
if (newLine >= eControl_Line1 && newLine <= eControl_Line4)
{
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
SetFocusToElement(newLine);
m_iActiveDirectEditLine = newLine;
m_textInputLines[newLine].beginDirectEdit(15);
}
else if (navDir > 0)
{
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
SetFocusToElement(eControl_Confirm);
m_iActiveDirectEditLine = -1;
}
}
}
m_bSkipTickNav = false;
if (m_iActiveDirectEditLine >= 0 && !m_textInputLines[m_iActiveDirectEditLine].isDirectEditing())
m_iActiveDirectEditLine = -1;
#endif
// Blinking > text < cursor on the 3D sign
m_iSignCursorFrame++;
if (m_iSignCursorFrame / 6 % 2 == 0)
{
#ifdef _WINDOWS64
if (m_iActiveDirectEditLine >= 0)
m_sign->SetSelectedLine(m_iActiveDirectEditLine);
else
#endif
{
int focusedLine = -1;
for (int i = eControl_Line1; i <= eControl_Line4; i++)
{
if (controlHasFocus(i))
{
focusedLine = i;
break;
}
}
m_sign->SetSelectedLine(focusedLine);
}
}
else
{
m_sign->SetSelectedLine(-1);
}
if(m_bConfirmed)
{
m_bConfirmed = false;
@ -107,6 +187,9 @@ void UIScene_SignEntryMenu::tick()
void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
if(m_bConfirmed || m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (isDirectEditBlocking()) { handled = true; return; }
#endif
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
@ -132,31 +215,124 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre
#ifdef __ORBIS__
case ACTION_MENU_TOUCHPAD_PRESS:
#endif
sendInputToMovie(key, repeat, pressed, released);
handled = true;
break;
case ACTION_MENU_UP:
case ACTION_MENU_DOWN:
sendInputToMovie(key, repeat, pressed, released);
#ifdef _WINDOWS64
// Auto-start editing if focus moved to a line (e.g. UP from Confirm)
if (g_KBMInput.IsKBMActive())
{
for (int i = eControl_Line1; i <= eControl_Line4; i++)
{
if (controlHasFocus(i))
{
m_iActiveDirectEditLine = i;
m_textInputLines[i].beginDirectEdit(15);
m_bSkipTickNav = true;
break;
}
}
}
#endif
handled = true;
break;
}
}
#ifdef _WINDOWS64
void UIScene_SignEntryMenu::getDirectEditInputs(vector<UIControl_TextInput*> &inputs)
{
for (int i = 0; i < 4; i++)
inputs.push_back(&m_textInputLines[i]);
}
void UIScene_SignEntryMenu::onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result)
{
int line = -1;
for (int i = 0; i < 4; i++)
{
if (input == &m_textInputLines[i]) { line = i; break; }
}
if (line != m_iActiveDirectEditLine) return;
if (result == UIControl_TextInput::eDirectEdit_Confirmed)
{
int newLine = line + 1;
if (newLine <= eControl_Line4)
{
SetFocusToElement(newLine);
m_iActiveDirectEditLine = newLine;
m_textInputLines[newLine].beginDirectEdit(15);
}
else
{
m_iActiveDirectEditLine = -1;
m_bConfirmed = true;
}
}
else if (result == UIControl_TextInput::eDirectEdit_Cancelled)
{
m_iActiveDirectEditLine = -1;
wstring temp = L"";
for (int j = 0; j < 4; j++)
m_sign->SetMessage(j, temp);
navigateBack();
ui.PlayUISFX(eSFX_Back);
}
}
bool UIScene_SignEntryMenu::handleMouseClick(F32 x, F32 y)
{
if (m_iActiveDirectEditLine >= 0)
{
// During direct edit, only the Done button is clickable.
// Hit-test it manually — all other clicks are consumed but ignored.
m_buttonConfirm.UpdateControl();
S32 cx = m_buttonConfirm.getXPos();
S32 cy = m_buttonConfirm.getYPos();
S32 cw = m_buttonConfirm.getWidth();
S32 ch = m_buttonConfirm.getHeight();
if (cw > 0 && ch > 0 && x >= cx && x <= cx + cw && y >= cy && y <= cy + ch)
{
m_textInputLines[m_iActiveDirectEditLine].confirmDirectEdit();
m_iActiveDirectEditLine = -1;
m_bConfirmed = true;
}
return true;
}
return UIScene::handleMouseClick(x, y);
}
#endif
int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
{
// 4J HEG - No reason to set value if keyboard was cancelled
UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam;
pClass->m_bIgnoreInput = false;
if (bRes)
{
#ifdef _WINDOWS64
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t));
Win64_GetKeyboardText(pchText, 128);
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText);
#else
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText);
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText);
#endif
}
return 0;
}
void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
{
#ifdef _WINDOWS64
if (isDirectEditBlocking()) return;
#endif
switch((int)controlId)
{
case eControl_Confirm:
@ -170,6 +346,28 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
case eControl_Line4:
{
m_iEditingLine = (int)controlId;
#ifdef _WINDOWS64
if (g_KBMInput.IsKBMActive())
{
// Only start editing from keyboard (Enter on focused line), not mouse clicks
if (!g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT))
{
m_iActiveDirectEditLine = m_iEditingLine;
m_textInputLines[m_iEditingLine].beginDirectEdit(15);
}
}
else
{
m_bIgnoreInput = true;
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_SIGN_TITLE);
kbData.defaultText = m_textInputLines[m_iEditingLine].getLabel();
kbData.maxChars = 15;
kbData.callback = &UIScene_SignEntryMenu::KeyboardCompleteCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen);
}
#else
m_bIgnoreInput = true;
#ifdef _XBOX_ONE
// 4J-PB - Xbox One uses the Windows virtual keyboard, and doesn't have the Xbox 360 Latin keyboard type, so we can't restrict the input set to alphanumeric. The closest we get is the emailSmtpAddress type.
@ -187,6 +385,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
}
#else
InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet);
#endif
#endif
}
break;

View file

@ -21,6 +21,12 @@ private:
int m_iEditingLine;
bool m_bConfirmed;
bool m_bIgnoreInput;
int m_iSignCursorFrame;
#ifdef _WINDOWS64
int m_iActiveDirectEditLine;
bool m_bNeedsInitialEdit;
bool m_bSkipTickNav;
#endif
UIControl_Button m_buttonConfirm;
UIControl_Label m_labelMessage;
@ -50,6 +56,11 @@ protected:
public:
// INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
#ifdef _WINDOWS64
virtual void getDirectEditInputs(vector<UIControl_TextInput*> &inputs);
virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result);
virtual bool handleMouseClick(F32 x, F32 y);
#endif
protected:
void handlePress(F64 controlId, F64 childId);

View file

@ -13,8 +13,8 @@
//#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1
#define SKIN_SELECT_MAX_DEFAULTS 2
const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[] =
{
const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
{
L"USE LOCALISED VERSION", // Server selected
L"Steve",
L"Tennis Steve",

View file

@ -6,7 +6,7 @@
class UIScene_SkinSelectMenu : public UIScene
{
private:
static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
// 4J Stu - How many to show on each side of the main control
static const BYTE sidePreviewControls = 4;

View file

@ -55,7 +55,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData;
m_MoreOptionsParams.bGenerateOptions=TRUE;
m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bFlatWorld=FALSE;
m_MoreOptionsParams.bBonusChest=FALSE;
m_MoreOptionsParams.bPVP = TRUE;
@ -96,7 +96,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
{
// The profile settings say Online, but either the player is offline, or they are not allowed to play online
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
}
}
}
m_ButtonGameMode.SetText(app.GetString(IDS_GAMEMODE_SURVIVAL));
@ -104,7 +104,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty);
m_SliderDifficulty.SetValue(m_CurrentDifficulty);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
m_SliderDifficulty.SetText(TempString);
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
@ -135,7 +135,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_NewWorld.SetEnable(true);
m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH);
wstring wWorldName = m_EditWorldName.GetText();
// set the caret to the end of the default text
@ -148,7 +148,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
XuiSetTimer(m_hObj,GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME);
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
// 4J-PB - Load up any texture pack data we have locally in the XZP
@ -176,7 +176,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i)
@ -189,7 +189,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
if(dwImageBytes > 0 && pbImageData)
{
ListInfo.fEnabled = TRUE;
ListInfo.fEnabled = TRUE;
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
if(pDLCTexPack)
{
@ -297,7 +297,7 @@ HRESULT CScene_MultiGameCreate::OnDestroy()
app.RemoveMemoryTPDFile(app.TMSFileA[i].iConfig);
}
}
app.FreeLocalTMSFiles(eTMSFileType_TexturePack);
return S_OK;
@ -338,7 +338,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// DLC might have been corrupt
if(ullOfferID_Full!=0LL)
{
{
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF);
UINT uiIDA[3];
@ -374,7 +374,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// if the profile data has been changed, then force a profile write (we save the online/invite/friends of friends settings)
// It seems we're allowed to break the 5 minute rule if it's the result of a user action
// check the checkboxes
// Only save the online setting if the user changed it - we may change it because we're offline, but don't want that saved
if(!m_MoreOptionsParams.bOnlineSettingChangedBySystem)
{
@ -389,15 +389,15 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
if(m_MoreOptionsParams.dwTexturePack!=0)
{
// texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
if(pTexturePack==NULL)
{
// corrupt DLC so set it to the default textures
m_MoreOptionsParams.dwTexturePack=0;
}
else
{
{
m_pDLCPack=pTexturePack->getDLCPack();
// do we have a license?
if(m_pDLCPack && !m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
@ -439,11 +439,11 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
return S_OK;
}
}
}
}
}
if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE)
{
{
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
@ -478,7 +478,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && noUGC )
{
m_bIgnoreInput = false;
@ -495,7 +495,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
}
}
else if(hObjPressed==m_MoreOptions)
{
{
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_LaunchMoreOptionsMenu,&m_MoreOptionsParams);
}
else if(hObjPressed == m_ButtonGameMode)
@ -527,7 +527,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
if(result==C4JStorage::EMessage_ResultAccept)
{
if(ProfileManager.IsSignedIn(iPad))
{
{
ULONGLONG ullIndexA[1];
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
@ -542,7 +542,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
// the license change coming in when the offer has been installed will cause this scene to refresh
// the license change coming in when the offer has been installed will cause this scene to refresh
}
}
else
@ -592,7 +592,7 @@ int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPa
}
else
{
// This is called from a storage manager thread... need to set up thread storage for IntCache as CreateGame requirements this to search for a suitable seed if we haven't set a seed.
// This is called from a storage manager thread... need to set up thread storage for IntCache as CreateGame requires this to search for a suitable seed if we haven't set a seed.
IntCache::CreateNewThreadStorage();
CreateGame(pScene, 0);
IntCache::ReleaseThreadStorage();
@ -629,12 +629,12 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot
// Enable the done button when we have all of the necessary information
wstring wWorldName = m_EditWorldName.GetText();
BOOL bHasWorldName = ( wWorldName.length()!=0);
m_NewWorld.SetEnable(bHasWorldName);
m_NewWorld.SetEnable(bHasWorldName);
}
else if(hObjSource==m_SliderDifficulty.GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
m_SliderDifficulty.SetText(TempString);
}
@ -656,11 +656,11 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo
HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
{
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
switch(pTimer->nId)
{
case GAME_CREATE_ONLINE_TIMER_ID:
{
bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
@ -693,7 +693,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
}
}
break;
case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID:
{
// also check for any new texture packs info being available
@ -718,7 +718,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
PBYTE pbImageData=NULL;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
ListInfo.fEnabled = TRUE;
ListInfo.fEnabled = TRUE;
ListInfo.iData = m_iConfigA[i];
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
@ -734,7 +734,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
bool bAllDone=true;
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
{
if(m_iConfigA[i]!=-1)
if(m_iConfigA[i]!=-1)
{
bAllDone = false;
}
@ -756,7 +756,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
{
CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam;
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept)
{
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
@ -780,7 +780,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && noUGC )
{
pClass->m_bIgnoreInput = false;
@ -791,7 +791,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
}
else
{
// This is called from a storage manager thread... need to set up thread storage for IntCache as CreateGame requirements this to search for a suitable seed if we haven't set a seed.
// This is called from a storage manager thread... need to set up thread storage for IntCache as CreateGame requires this to search for a suitable seed if we haven't set a seed.
IntCache::CreateNewThreadStorage();
CreateGame(pClass, 0);
IntCache::ReleaseThreadStorage();
@ -816,7 +816,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
if(ProfileManager.IsSignedIn(iPad))
{
DWORD dwLocalUsersMask = 0;
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
bool noPrivileges = false;
@ -835,7 +835,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && (noPrivileges || noUGC) )
{
if( noUGC )
@ -863,7 +863,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
}
}
else
{
{
pClass->m_bIgnoreInput = false;
pClass->SetShow( TRUE );
}
@ -884,7 +884,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// create the world and launch
wstring wWorldName = pClass->m_EditWorldName.GetText();
StorageManager.ResetSaveData();
// Make our next save default to the name of the level
StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str());
@ -904,11 +904,11 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
__int64 seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
int64_t seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
if (wSeed.length() != 0)
{
__int64 value = 0;
int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value
@ -923,7 +923,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
//If the input string is a numerical value, convert it to a number
if( isNumber )
value = _fromString<__int64>(wSeed);
value = _fromString<int64_t>(wSeed);
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 )
@ -948,7 +948,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
param->seed = seedValue;
param->saveData = NULL;
param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack;
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->skins->selectTexturePackById(pClass->m_MoreOptionsParams.dwTexturePack);
//pMinecraft->skins->updateUI();
@ -956,7 +956,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty);
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,pClass->m_MoreOptionsParams.bAllowFriendsOfFriends);
app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(pClass->m_iPad,eGameSetting_GamertagsVisible)?1:0);
app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(pClass->m_iPad,eGameSetting_BedrockFog)?1:0);
// CXuiList listObject;
@ -999,7 +999,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionStart( XUIMessageTransition *pTransi
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{
{
m_SliderDifficulty.SetValueDisplay(FALSE);
}
@ -1015,7 +1015,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionEnd( XUIMessageTransition *pTransiti
{
}
else if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{
{
if(m_bSetup && m_texturePackDescDisplayed)
{
XUITimeline *timeline;
@ -1054,7 +1054,7 @@ HRESULT CScene_MultiGameCreate::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotif
if(hObjSource == m_pTexturePacksList->m_hObj)
{
UpdateTexturePackDescription(pNotifySelChangedData->iItem);
// 4J-JEV: Removed expand description check, taken care of elsewhere.
}
@ -1205,9 +1205,9 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
StorageManager.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CScene_MultiGameCreate::TexturePackDialogReturned,this,app.GetStringTable());
}
// do set the texture pack id, and on the user pressing create world, check they have it
// do set the texture pack id, and on the user pressing create world, check they have it
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
return ;
return ;
}
else
{
@ -1221,7 +1221,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel();
// Exit with or without saving
// Decline means install full version of the texture pack in this dialog
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
{
// we need to enable background downloading for the DLC
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
@ -1248,7 +1248,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
}
}
}
}
pClass->m_bIgnoreInput=false;
return 0;
@ -1274,12 +1274,12 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCInstalled()
}
HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
{
{
// refill the texture pack list
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i)
@ -1292,7 +1292,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
if(dwImageBytes > 0 && pbImageData)
{
ListInfo.fEnabled = TRUE;
ListInfo.fEnabled = TRUE;
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;

View file

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

View file

@ -36,7 +36,7 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
MapChildControls();
// Display the tooltips
HRESULT hr = S_OK;
HRESULT hr = S_OK;
CXuiElement xuiElement = m_hObj;
HXUIOBJ hTemp;
@ -169,7 +169,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
// make sure there's not a mount going on before using the textures
if(bCheckTexturePack && app.DLCInstallProcessCompleted() )
{
{
TexturePack *tPack = pMinecraft->skins->getSelected();
if(tPack->getId()!=app.GetRequiredTexturePackID())
@ -186,7 +186,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID());
// probably had background downloads enabled, so turn them off
// probably had background downloads enabled, so turn them off
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
}
else
@ -223,7 +223,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
{
if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
{
int iGuiScale;
int iGuiScale;
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@ -234,7 +234,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen);
}
m_BossHealthGroup[i].SetShow(TRUE);
m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@ -364,7 +364,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
break;
}
}
}
}
m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() );
m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() );
@ -468,15 +468,15 @@ void CXuiSceneBase::_TickAllBaseScenes()
XUIMessage xuiMsg;
CustomMessage_TickScene( &xuiMsg );
XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg );
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0;
if(bDisplayGui && pMinecraft->localplayers[i] != NULL)
{
XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
}
else
{
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
}
}
}
@ -495,18 +495,18 @@ HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID )
{
ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX );
XUIRect xuiRect, xuiRectSmall;
HRESULT hr=S_OK;
LPCWSTR pString=NULL;
float fWidth,fHeight;
// Want to be able to show just a button (for RB LB)
if(iTextID>=0)
{
pString=app.GetString(iTextID);
}
if(hTooltipText[iPad][uiTooltip]==NULL)
{
HXUIOBJ hObj=NULL;
@ -514,7 +514,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]);
}
if(hTooltipTextSmall[iPad][uiTooltip]==NULL)
{
HXUIOBJ hObj=NULL;
@ -525,8 +525,8 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
if(iTextID>=0)
{
hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight);
@ -537,7 +537,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall);
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight);
@ -749,7 +749,7 @@ HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB,
m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB );
m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB );
m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX );
@ -860,7 +860,7 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
if(bShow && pMinecraft->level!=NULL)
{
__int64 i64TimeOfDay =0;
int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0)
{
@ -945,11 +945,11 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
int nStart, nEnd;
// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart );
// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd );
// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart );
XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd );
XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
return S_OK;
}
@ -960,7 +960,7 @@ HRESULT CXuiSceneBase::_HidePressStart()
HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
{
WCHAR wcAutosaveCountdown[100];
WCHAR wcAutosaveCountdown[100];
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
m_TrialTimer.SetText(wcAutosaveCountdown);
return S_OK;
@ -974,7 +974,7 @@ HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal)
HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{
WCHAR wcTime[20];
WCHAR wcTime[20];
DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
@ -982,7 +982,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{
dwTimeTicks=m_dwTrialTimerLimitSecs;
}
dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks;
#ifndef _CONTENT_PACKAGE
@ -1038,7 +1038,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad)
HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position )
{
// turn off the empty quadrant logo
if(m_hEmptyQuadrantLogo!=NULL)
if(m_hEmptyQuadrantLogo!=NULL)
{
XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE);
}
@ -1086,12 +1086,12 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE);
}
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
{
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
{
//640x480 ->1280x720
scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f;
XuiElementSetScale(m_hObj, &scale);
return S_OK;
}
@ -1127,7 +1127,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// No position adjustment
case e_BaseScene_Fullscreen:
tooltipsPos.x=SAFEZONE_HALF_WIDTH;
tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
crouchIconPos.x=SAFEZONE_HALF_WIDTH;
crouchIconPos.y=SAFEZONE_HALF_HEIGHT;
fBackWidth=XUI_BASE_SCENE_WIDTH;
@ -1303,7 +1303,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants
if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
(RenderManager.IsHiDef() || RenderManager.IsWidescreen()) )
{
D3DXVECTOR3 selectedItemPos;
@ -1328,17 +1328,17 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// The move applies to the whole scene, so we'll need to move tooltips back in some cases
selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f);
// Adjust selectedItemPos based on what gui is displayed
// 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
// 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
float fYOffset=0.0f;
unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2;
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
// SURVIVAL MODE - Move up further because of hearts, shield and xp
@ -1353,7 +1353,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -94.0f;
break;
}
}
}
else
{
@ -1368,7 +1368,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -58.0f;
break;
}
}
}
@ -1425,14 +1425,14 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// 4J-PB - If it's in split screen vertical, adjust the position
// Adjust selectedItemPos based on what gui is displayed
if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right))
{
{
float scale=0.5f;
selectedItemPos.y -= (scale * 88.0f);
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
selectedItemPos.y -= (scale * 80.0f);
}
// 4J-PB - selected the gui scale based on the slider settings
unsigned char ucGuiScale;
float fYOffset=0.0f;
@ -1455,7 +1455,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = 85.0f;
break;
}
}
selectedItemPos.y+=fYOffset;
}
@ -1606,7 +1606,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
{
{
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
{
wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad));
@ -1621,7 +1621,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
}
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
{
{
XuiElementSetShow(m_hGamerTagA[iPad],bDisplay);
// set the opacity of the gamertag
@ -1712,11 +1712,11 @@ void CXuiSceneBase::_HideAllGameUIElements()
m_uiSelectedItemOpacityCountDown[i] = 0;
m_selectedItemA[i].SetShow(FALSE);
m_selectedItemSmallA[i].SetShow(FALSE);
m_BossHealthGroup[i].SetShow(FALSE);
m_bossHealthVisible[i] = FALSE;
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
_DisplayGamertag(i,FALSE);
}
@ -1845,12 +1845,12 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
if( i>0 && lastVisible!=-1 )
{
float width, height;
XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPos.x += width + m_iTooltipSpacingGap;
XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPosSmall.x += width + m_iTooltipSpacingGapSmall;
}
@ -1948,15 +1948,15 @@ HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, i
}
else
{
// does the tooltip need to change?
// does the tooltip need to change?
if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate)
{
CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] );
}
}
CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true );
}
}
}
return S_OK;
}
@ -2067,14 +2067,14 @@ HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScen
}
HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
{
{
EBaseScenePosition padPositions[XUSER_MAX_COUNT];
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
padPositions[idx] = e_BaseScene_NotSet;
}
Minecraft *pMinecraft = Minecraft::GetInstance();
// If the game is not started (or is being held paused for a bit) then display all scenes fullscreen
@ -2134,7 +2134,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
padPositions[idx] = e_BaseScene_Right;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
padPositions[idx] = e_BaseScene_Top_Left;
padPositions[idx] = e_BaseScene_Top_Left;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
padPositions[idx] = e_BaseScene_Top_Right;
@ -2168,7 +2168,7 @@ void CXuiSceneBase::UpdateSelectedItemPos(int iPad)
CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad);
}
HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
{
return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad);
}

View file

@ -7,7 +7,7 @@
//#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1
#define SKIN_SELECT_MAX_DEFAULTS 2
WCHAR *CScene_SkinSelect::wchDefaultNamesA[]=
const WCHAR *CScene_SkinSelect::wchDefaultNamesA[]=
{
L"USE LOCALISED VERSION", // Server selected
L"Steve",

View file

@ -12,7 +12,7 @@ class CXuiCtrlMinecraftSkinPreview;
class CScene_SkinSelect : public CXuiSceneImpl
{
private:
static WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
// 4J Stu - How many to show on each side of the main control
static const BYTE sidePreviewControls = 4;

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