This commit is contained in:
Tropical 2026-04-11 17:11:48 +00:00 committed by GitHub
commit a2e50b3023
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1052 changed files with 10269 additions and 26072 deletions

View file

@ -1,16 +1,21 @@
# MARK: build configuration
project(
'4jcraft',
['cpp', 'c'],
version: '0.1.0',
meson_version: '>= 1.3',
default_options: [
'cpp_std=c++23',
'warning_level=0',
'buildtype=debugoptimized', # for now
'unity=on', # merge source files per target
'unity_size=8', # TODO: mess around with this
'b_pch=true', # precompiled headers
],
'4jcraft',
['cpp', 'c'],
version: '0.1.0',
meson_version: '>= 1.3',
default_options: [
'cpp_std=c++20',
'warning_level=0',
'unity=on', # merge source files per target
'unity_size=8', # TODO: mess around with this
'buildtype=debug',
'b_pch=true', # precompiled headers
'default_library=static', # static linkage to subprojects
# 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld)
# 'b_ndebug=if-release', # drop assert() in --buildtype=release
],
)
pymod = import('python')
@ -18,31 +23,33 @@ python = pymod.find_installation('python3', required: true)
cc = meson.get_compiler('cpp')
global_cpp_args = []
global_cpp_defs = [
'-DSPLIT_SAVES',
'-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS',
'-D_DEBUG_MENUS_ENABLED',
'-D_DEBUG',
'-D_FORTIFY_SOURCE=2',
'-DDEBUG',
'-DSPLIT_SAVES',
'-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS',
'-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h)
]
if host_machine.system() == 'linux'
global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__']
# Debug-only defines: keep for debug + debugoptimized so iteration is unchanged.
# --buildtype=release strips them so shipping builds don't carry debug logging,
# debug menu UI, or assert-driven sanity checks.
if get_option('buildtype') in ['debug', 'debugoptimized']
global_cpp_defs += [
'-D_DEBUG',
'-DDEBUG',
'-D_DEBUG_MENUS_ENABLED',
]
endif
if get_option('renderer') == 'gles'
global_cpp_defs += ['-DGLES']
gl_dep = dependency('glesv2', required: true)
glu_dep = dependency('', required: false)
else
gl_dep = dependency('gl', required: true)
glu_dep = dependency('glu', required: true)
if get_option('buildtype') == 'debugoptimized'
global_cpp_defs += ['-D_FORTIFY_SOURCE=2']
endif
# MARK: meson options
if get_option('enable_vsync')
global_cpp_defs += ['-DENABLE_VSYNC']
global_cpp_defs += ['-DENABLE_VSYNC']
endif
if get_option('classic_panorama')
@ -50,43 +57,52 @@ if get_option('classic_panorama')
endif
if get_option('enable_frame_profiler')
global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
endif
if get_option('ui_backend') == 'shiggy'
global_cpp_defs += ['-D_ENABLEIGGY']
global_cpp_defs += ['-D_ENABLEIGGY']
endif
if get_option('ui_backend') == 'java'
global_cpp_defs += '-DENABLE_JAVA_GUIS'
global_cpp_defs += '-DENABLE_JAVA_GUIS'
endif
if get_option('occlusion_culling') == 'off'
global_cpp_defs += ['-DOCCLUSION_MODE_NONE']
elif get_option('occlusion_culling') == 'frustum'
global_cpp_defs += ['-DOCCLUSION_MODE_FRUSTUM']
elif get_option('occlusion_culling') == 'bfs'
global_cpp_defs += ['-DOCCLUSION_MODE_BFS', '-DUSE_OCCLUSION_CULLING']
elif get_option('occlusion_culling') == 'hardware'
global_cpp_defs += ['-DOCCLUSION_MODE_HARDWARE', '-DUSE_OCCLUSION_CULLING']
endif
add_project_arguments(global_cpp_defs, language: ['cpp', 'c'])
global_cpp_args = [
'-Wshift-count-overflow',
'-pipe',
]
add_project_arguments(global_cpp_args, language: 'cpp')
sdl2_dep = dependency('sdl2')
thread_dep = dependency('threads')
dl_dep = cc.find_library('dl', required: true)
glm_dep = dependency('glm')
stb = subproject('stb').get_variable('stb_inc')
stb_dep = declare_dependency(include_directories: stb)
simdutf_dep = dependency('simdutf',
fallback: ['simdutf', 'simdutf_dep'],
default_options: ['utf8=true', 'utf16=true', 'utf32=true']
)
miniaudio_dep = dependency('miniaudio')
subdir('targets/util')
subdir('targets/java')
subdir('targets/nbt')
subdir('targets/platform')
# MARK: platform configuration
if host_machine.system() in ['linux', 'windows']
platform_fs_dep = platform_fs_std_dep
platform_game_dep = platform_game_stub_dep
platform_input_dep = platform_input_sdl2_dep
platform_leaderboard_dep = platform_leaderboard_stub_dep
platform_network_dep = platform_network_stub_dep
platform_profile_dep = platform_profile_stub_dep
platform_renderer_dep = platform_renderer_gl_dep
platform_sound_dep = platform_sound_miniaudio_dep
platform_storage_dep = platform_storage_stub_dep
platform_thread_dep = platform_thread_dep # standardized backend (for now)
app_platform_sources = files('targets/app/desktop/main.cpp')
endif
subdir('targets/resources')
subdir('targets/minecraft')
subdir('targets/app')

View file

@ -40,3 +40,10 @@ option(
value: 'frustum',
description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
)
option(
'enable_mimalloc',
type: 'feature',
value: 'auto',
description: 'Link mimalloc as the malloc implementation. Requires libmimalloc-dev.',
)

183
scripts/format.py Normal file
View file

@ -0,0 +1,183 @@
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
DEFAULT_EXTENSIONS = {
".c",
".cc",
".cpp",
".cxx",
".h",
".hh",
".hpp",
".hxx",
".inl",
".ipp",
}
DEFAULT_JOBS = os.cpu_count() or 4
DEFAULT_TIMEOUT = 10
# ansi escapes
RESET = "\033[0m" if sys.stdout.isatty() else ""
GREEN = "\033[32m" if sys.stdout.isatty() else ""
YELLOW = "\033[33m" if sys.stdout.isatty() else ""
RED = "\033[31m" if sys.stdout.isatty() else ""
BOLD = "\033[1m" if sys.stdout.isatty() else ""
def format_file(path, clang_format, extra_args, timeout):
cmd = [clang_format, "-i"]
cmd += extra_args
cmd.append(str(path))
try:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
timeout=timeout,
)
if result.returncode != 0:
msg = (result.stderr or result.stdout or "non-zero exit code").strip()
return ("error", str(path), msg)
return ("ok", str(path), None)
except subprocess.TimeoutExpired:
return ("timeout", str(path), f"exceeded {timeout}s timeout")
except FileNotFoundError:
return ("error", str(path), f"'{clang_format}' not found — is it installed?")
except Exception as exc:
return ("error", str(path), str(exc))
def find_files(root, extensions, exclude_dirs):
found = []
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = [d for d in dirnames if d not in exclude_dirs]
for fname in filenames:
if Path(fname).suffix.lower() in extensions:
found.append(Path(dirpath) / fname)
return sorted(found)
def main():
p = argparse.ArgumentParser(
description="Recursively runs clang-format on C/C++ files.",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
p.add_argument("directory", nargs="?", default=".", type=Path)
p.add_argument(
"--clang-format",
default="clang-format",
metavar="BIN",
help="Path to the clang-format executable. (default: clang-format)",
)
p.add_argument(
"-j",
"--jobs",
type=int,
default=DEFAULT_JOBS,
metavar="N",
help=f"Number of parallel workers. (default: {DEFAULT_JOBS})",
)
p.add_argument(
"--timeout",
type=int,
default=DEFAULT_TIMEOUT,
metavar="SECS",
help=f"Per-file timeout in seconds. (default: {DEFAULT_TIMEOUT})",
)
p.add_argument(
"--extensions",
nargs="+",
metavar="EXT",
help="File extensions to process (including the dot)."
f"(default: {' '.join(sorted(DEFAULT_EXTENSIONS))})",
)
p.add_argument(
"--exclude",
nargs="*",
default=[],
metavar="DIR",
help="Directory names to skip during traversal (e.g. build third_party).",
)
p.add_argument(
"--clang-format-args",
nargs=argparse.REMAINDER,
default=[],
metavar="...",
)
args = p.parse_args()
root = args.directory.resolve()
if not root.is_dir():
print(f"{RED}Error:{RESET} '{root}' is not a directory.", file=sys.stderr)
return 1
extensions = (
{e if e.startswith(".") else f".{e}" for e in args.extensions}
if args.extensions
else DEFAULT_EXTENSIONS
)
exclude_dirs = set(args.exclude)
files = find_files(root, extensions, exclude_dirs)
if not files:
print(f"{YELLOW}No source files found.{RESET}")
return 0
total = len(files)
print(f"Found {BOLD}{total}{RESET} file(s).")
counters = {"ok": 0, "timeout": 0, "error": 0}
completed = 0
with ThreadPoolExecutor(max_workers=args.jobs) as pool:
futures = {
pool.submit(
format_file,
f,
args.clang_format,
args.clang_format_args,
args.timeout,
): f
for f in files
}
for future in as_completed(futures):
status, path_str, error = future.result()
counters[status] += 1
completed += 1
rel = os.path.relpath(path_str, root)
if status == "ok":
tag = f"{GREEN}[ OK ]{RESET}"
elif status == "timeout":
tag = f"{YELLOW}[ TIMEOUT ]{RESET}"
else:
tag = f"{RED}[ ERROR ]{RESET}"
progress = f"[{completed:>{len(str(total))}}/{total}]"
line = f"{progress} {tag} {rel}"
if error:
line += f"\n {RED}{error}{RESET}"
print(line)
print()
print(f"{BOLD}Summary{RESET}")
print(f"Total: {total}")
print(f"{GREEN}OK: {counters['ok']}{RESET}")
if counters["timeout"]:
print(f"{YELLOW}Timeout: {counters['timeout']}{RESET}")
if counters["error"]:
print(f"{RED}Error: {counters['error']}{RESET}")
return 1 if (counters["timeout"] or counters["error"]) else 0
if __name__ == "__main__":
sys.exit(main())

97
scripts/list_sources.py Normal file
View file

@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""Enumerate C/C++ source files for a meson target.
Replaces the run_command('sh', '-c', 'find ...') hack in
targets/{minecraft,app}/meson.build. Run this whenever source files are
added or removed and commit the regenerated *_sources.txt files.
Usage:
python3 scripts/list_sources.py
Each module's sources.txt is generated relative to its meson source dir.
"""
import os
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
# Module configuration: (output_path, scan_root, [exclude_basenames]).
# Paths in the output file are relative to the directory containing the
# meson.build that reads it.
MODULES = [
{
"name": "minecraft",
"output": REPO_ROOT / "targets" / "minecraft" / "sources.txt",
"scan_root": REPO_ROOT / "targets" / "minecraft",
"rel_to": REPO_ROOT / "targets" / "minecraft",
"exclude": {
"DurangoStats.cpp", # Durango-specific
# Incomplete / unused
"SkyIslandDimension.cpp",
"MemoryChunkStorage.cpp",
"MemoryLevelStorage.cpp",
"MemoryLevelStorageSource.cpp",
"NbtSlotFile.cpp",
"ZonedChunkStorage.cpp",
"ZoneFile.cpp",
"ZoneIo.cpp",
"LevelConflictException.cpp",
"SurvivalMode.cpp",
"CreativeMode.cpp",
"GameMode.cpp",
"DemoMode.cpp",
},
},
{
"name": "app_common",
"output": REPO_ROOT / "targets" / "app" / "common_sources.txt",
"scan_root": REPO_ROOT / "targets" / "app" / "common",
"rel_to": REPO_ROOT / "targets" / "app",
"exclude": {
"UIScene_InGameSaveManagementMenu.cpp",
},
},
{
"name": "app_linux",
"output": REPO_ROOT / "targets" / "app" / "linux_sources.txt",
"scan_root": REPO_ROOT / "targets" / "app" / "linux",
"rel_to": REPO_ROOT / "targets" / "app",
"exclude": set(),
},
]
EXTENSIONS = (".cpp", ".c")
def collect(scan_root: Path, rel_to: Path, exclude: set[str]) -> list[str]:
out: list[str] = []
for dirpath, _dirnames, filenames in os.walk(scan_root):
for name in filenames:
if not name.endswith(EXTENSIONS):
continue
if name in exclude:
continue
full = Path(dirpath) / name
out.append(str(full.relative_to(rel_to)))
out.sort()
return out
def main() -> int:
for mod in MODULES:
sources = collect(mod["scan_root"], mod["rel_to"], mod["exclude"])
body = "\n".join(sources) + "\n"
out_path: Path = mod["output"]
previous = out_path.read_text() if out_path.exists() else ""
if previous == body:
print(f"{mod['name']}: {len(sources)} files (unchanged)")
else:
out_path.write_text(body)
print(f"{mod['name']}: {len(sources)} files (regenerated {out_path.relative_to(REPO_ROOT)})")
return 0
if __name__ == "__main__":
sys.exit(main())

View file

@ -3,7 +3,3 @@ c = 'clang'
cpp = 'clang++'
c_ld = 'lld'
cpp_ld = 'lld'
[built-in options]
cpp_args = ['-stdlib=libc++']
cpp_link_args = ['-stdlib=libc++']

12
subprojects/glew.wrap Normal file
View file

@ -0,0 +1,12 @@
[wrap-file]
directory = glew-2.2.0
source_url = http://downloads.sourceforge.net/glew/glew-2.2.0.tgz
source_filename = glew-2.2.0.tgz
source_hash = d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1
patch_filename = glew_2.2.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/glew_2.2.0-2/get_patch
patch_hash = df7bc80456da53f83e93e89ca5035d04cdff19a836c956887a684b2bee16eb9b
wrapdb_version = 2.2.0-2
[provide]
glew = glew_dep

13
subprojects/glm.wrap Normal file
View file

@ -0,0 +1,13 @@
[wrap-file]
directory = glm-1.0.1
source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz
source_filename = glm-1.0.1.tar.gz
source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c
patch_filename = glm_1.0.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch
patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz
wrapdb_version = 1.0.1-1
[provide]
glm = glm_dep

View file

@ -1,6 +1,6 @@
project('simdutf',
'cpp',
default_options: ['cpp_std=c++23'],
default_options: ['cpp_std=c++20'],
version: '8.2.0',
meson_version: '>= 1.1',
license: ['MIT'],

View file

@ -1,3 +1,7 @@
project('stb', 'c')
stb_inc = include_directories('.')
stb_dep = declare_dependency(
include_directories: include_directories('.'),
)
meson.override_dependency('stb', stb_dep)

15
subprojects/sdl2.wrap Normal file
View file

@ -0,0 +1,15 @@
[wrap-file]
directory = SDL2-2.32.8
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-2.32.8.tar.gz
source_filename = SDL2-2.32.8.tar.gz
source_hash = 0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e
patch_filename = sdl2_2.32.8-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.32.8-1/get_patch
patch_hash = 5df17ea39ca418826db20e96bd821fa52b5718dac64b6225119fb6588c2744f0
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.32.8-1/SDL2-2.32.8.tar.gz
wrapdb_version = 2.32.8-1
[provide]
sdl2 = sdl2_dep
sdl2main = sdl2main_dep
sdl2_test = sdl2_test_dep

View file

@ -1,7 +1,7 @@
[wrap-git]
url = https://github.com/simdutf/simdutf.git
depth = 1
revision = v8.2.0
revision = fd476229424b40ae71a58dd5a205795c3d76b5f1
patch_directory = simdutf
[provide]

14
subprojects/zlib.wrap Normal file
View file

@ -0,0 +1,14 @@
[wrap-file]
directory = zlib-1.3.2
source_url = https://zlib.net/zlib-1.3.2.tar.xz
source_fallback_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_source/zlib-1.3.2.tar.xz
source_filename = zlib-1.3.2.tar.xz
source_hash = d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3
patch_filename = zlib_1.3.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_patch
patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.2-1/zlib_1.3.2-1_patch.zip
patch_hash = 5ae7a2e92f823df118cfb8c1b23d94e3117864392b3446581d669049b2fba6dd
wrapdb_version = 1.3.2-1
[provide]
dependency_names = zlib

View file

@ -1,48 +0,0 @@
# Network Code Implementation Notes
## Overview
The networking classes are organized as follows:
```
Game \
^ |
| |
+-----------------------------+-----------------------------+ |
| | |
v v |
Game Network Manager <--------------------------------> Network Player Interface |- platform independent layers
^ ^ |
| | |
v | |
Platform Network Manager Interface | |
^ | /
| |
v v \
Platform Network Manager Implementation(1) <------> Network Player Implementation (3) |
^ ^ |_ platform specific layers
| | |
v v |
Platform specific network code(2) Platform specific player code (4) /
```
### Notes
- In general the game should **only communicate with the `GameNetworkManager` and `NetworkPlayerInterface` APIs**, which provide a platform independent interface for networking functionality. The `GameNetworkManager` may in general have code which is aware of the game itself, but it *shouldn't have any platform-specific networking code*. It communicates with a platform specific implementation of a `PlatformNetworkManagerInterface` to achieve this.
- The platform specific layers shouldn't contain any general game code, as this is much better placed in the platform independent layers to avoid duplicating effort.
- Platform specific files for each platform for the numbered classes in the previous diagram are currently:
## Platform-Specific Files
The platform-specific implementations for each numbered class in the diagram:
| Class | Xbox 360 | Sony | Other |
|-------|---------------------------------|----------------------------|-----------------------|
| (1) | PlatformNetworkManagerXbox | PlatformNetworkManagerSony | PlatformNetworkManagerStub |
| (2) | Provided by QNET | SQRNetworkManager | Qnet stub* |
| (3) | NetworkPlayerXbox | NetworkPlayerSony | NetworkPlayerXbox |
| (4) | Provided by QNET | SQRNetworkPlayer | Qnet stub* |
\*Temporarily provided by `extra64.h`

View file

@ -1,27 +0,0 @@
========================================================================
Xbox 360 APPLICATION : Minecraft.Client Project Overview
========================================================================
AppWizard has created this Minecraft.Client application for you.
This file contains a summary of what you will find in each of the files that
make up your Minecraft.Client application.
Minecraft.Client.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
Minecraft.Client.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,26 +1,22 @@
#include "app/common/AppGameServices.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "java/Class.h" // eINSTANCEOF
#include "platform/game/game.h"
AppGameServices::AppGameServices(Game& game, IMenuService& menus)
: game_(game), menus_(menus) {}
// -- Strings --
const char* AppGameServices::getString(int id) {
return Game::GetString(id);
}
const char* AppGameServices::getString(int id) { return Game::GetString(id); }
// -- Debug settings --
bool AppGameServices::debugSettingsOn() {
return game_.DebugSettingsOn();
}
bool AppGameServices::debugSettingsOn() { return game_.DebugSettingsOn(); }
bool AppGameServices::debugArtToolsOn() {
return game_.DebugArtToolsOn();
}
bool AppGameServices::debugArtToolsOn() { return game_.DebugArtToolsOn(); }
unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) {
return game_.GetGameSettingsDebugMask(iPad, overridePlayer);
@ -34,9 +30,7 @@ bool AppGameServices::debugMobsDontTick() {
return game_.GetMobsDontTickEnabled();
}
bool AppGameServices::debugFreezePlayers() {
return game_.GetFreezePlayers();
}
bool AppGameServices::debugFreezePlayers() { return game_.GetFreezePlayers(); }
// -- Game host options --
@ -93,9 +87,7 @@ unsigned char AppGameServices::getGameSettings(int setting) {
// -- App time --
float AppGameServices::getAppTime() {
return game_.getAppTime();
}
float AppGameServices::getAppTime() { return game_.getAppTime(); }
// -- Game state --
@ -104,10 +96,14 @@ void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); }
bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); }
void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); }
bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); }
int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); }
int AppGameServices::getLocalPlayerCount() {
return game_.GetLocalPlayerCount();
}
bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); }
void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); }
int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); }
int64_t AppGameServices::secondsToAutosave() {
return game_.SecondsToAutosave();
}
void AppGameServices::setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) {
@ -115,9 +111,13 @@ void AppGameServices::setDisconnectReason(
}
void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); }
void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); }
void AppGameServices::unlockSaveNotification() {
game_.unlockSaveNotification();
}
bool AppGameServices::getResetNether() { return game_.GetResetNether(); }
bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); }
bool AppGameServices::getUseDPadForDebug() {
return game_.GetUseDPadForDebug();
}
bool AppGameServices::getWriteSavesToFolderEnabled() {
return game_.GetWriteSavesToFolderEnabled();
@ -127,9 +127,7 @@ bool AppGameServices::isLocalMultiplayerAvailable() {
return game_.IsLocalMultiplayerAvailable();
}
bool AppGameServices::dlcInstallPending() {
return game_.DLCInstallPending();
}
bool AppGameServices::dlcInstallPending() { return game_.DLCInstallPending(); }
bool AppGameServices::dlcInstallProcessCompleted() {
return game_.DLCInstallProcessCompleted();
@ -177,30 +175,15 @@ void AppGameServices::setAction(int iPad, eXuiAction action, void* param) {
game_.SetAction(iPad, action, param);
}
void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action,
void* param) {
game_.SetXuiServerAction(iPad, action, param);
}
eXuiAction AppGameServices::getXuiAction(int iPad) {
return game_.GetXuiAction(iPad);
}
eXuiServerAction AppGameServices::getXuiServerAction(int iPad) {
return game_.GetXuiServerAction(iPad);
}
void* AppGameServices::getXuiServerActionParam(int iPad) {
return game_.GetXuiServerActionParam(iPad);
}
void AppGameServices::setGlobalXuiAction(eXuiAction action) {
game_.SetGlobalXuiAction(action);
}
void AppGameServices::handleButtonPresses() {
game_.HandleButtonPresses();
}
void AppGameServices::handleButtonPresses() { game_.HandleButtonPresses(); }
void AppGameServices::setTMSAction(int iPad, eTMSAction action) {
game_.SetTMSAction(iPad, action);
@ -254,8 +237,7 @@ void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID,
game_.SetAnimOverrideBitmask(dwSkinID, bitmask);
}
unsigned int AppGameServices::getAnimOverrideBitmask(
std::uint32_t dwSkinID) {
unsigned int AppGameServices::getAnimOverrideBitmask(std::uint32_t dwSkinID) {
return game_.GetAnimOverrideBitmask(dwSkinID);
}
@ -267,9 +249,7 @@ std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) {
return Game::getSkinPathFromId(skinId);
}
bool AppGameServices::defaultCapeExists() {
return game_.DefaultCapeExists();
}
bool AppGameServices::defaultCapeExists() { return game_.DefaultCapeExists(); }
bool AppGameServices::isXuidNotch(PlayerUID xuid) {
return game_.isXuidNotch(xuid);
@ -284,19 +264,21 @@ bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) {
void AppGameServices::fatalLoadError() { game_.FatalLoadError(); }
void AppGameServices::setRichPresenceContext(int iPad, int contextId) {
game_.SetRichPresenceContext(iPad, contextId);
PlatformGame.SetRichPresenceContext(iPad, contextId);
}
void AppGameServices::captureSaveThumbnail() { game_.CaptureSaveThumbnail(); }
void AppGameServices::captureSaveThumbnail() {
PlatformGame.CaptureSaveThumbnail();
}
void AppGameServices::getSaveThumbnail(std::uint8_t** data,
unsigned int* size) {
game_.GetSaveThumbnail(data, size);
PlatformGame.GetSaveThumbnail(data, size);
}
void AppGameServices::readBannedList(int iPad, eTMSAction action,
bool bCallback) {
game_.ReadBannedList(iPad, action, bCallback);
PlatformGame.ReadBannedList(iPad, action, bCallback);
}
void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
@ -305,8 +287,7 @@ void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
}
unsigned int AppGameServices::getPlayerPrivileges(
std::uint8_t networkSmallId) {
unsigned int AppGameServices::getPlayerPrivileges(std::uint8_t networkSmallId) {
return game_.GetPlayerPrivileges(networkSmallId);
}
@ -334,9 +315,7 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type,
return game_.GetTerrainFeaturePosition(type, pX, pZ);
}
void AppGameServices::loadDefaultGameRules() {
game_.loadDefaultGameRules();
}
void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); }
// -- Archive / resources --
@ -363,24 +342,21 @@ const char* AppGameServices::getGameRulesString(const std::string& key) {
return game_.GetGameRulesString(key);
}
unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return game_.CreateImageTextData(textMetadata, seed, hasSeed,
uiHostOptions, uiTexturePackId);
unsigned int AppGameServices::createImageTextData(
std::uint8_t* textMetadata, int64_t seed, bool hasSeed,
unsigned int uiHostOptions, unsigned int uiTexturePackId) {
return game_.CreateImageTextData(textMetadata, seed, hasSeed, uiHostOptions,
uiTexturePackId);
}
std::string AppGameServices::getFilePath(std::uint32_t packId,
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint);
}
char* AppGameServices::getUniqueMapName() {
return game_.GetUniqueMapName();
}
char* AppGameServices::getUniqueMapName() { return game_.GetUniqueMapName(); }
void AppGameServices::setUniqueMapName(char* name) {
game_.SetUniqueMapName(name);
@ -390,9 +366,7 @@ unsigned int AppGameServices::getOpacityTimer(int iPad) {
return game_.GetOpacityTimer(iPad);
}
void AppGameServices::setOpacityTimer(int iPad) {
game_.SetOpacityTimer(iPad);
}
void AppGameServices::setOpacityTimer(int iPad) { game_.SetOpacityTimer(iPad); }
void AppGameServices::tickOpacityTimer(int iPad) {
game_.TickOpacityTimer(iPad);
@ -413,7 +387,7 @@ void AppGameServices::debugPrintf(const char* msg) {
// -- DLC --
DLCSkinFile* AppGameServices::getDLCSkinFile(const std::string& name) {
ISkinAssetData* AppGameServices::getSkinAssetData(const std::string& name) {
return game_.m_dlcManager.getSkinFile(name);
}
bool AppGameServices::dlcNeedsCorruptCheck() {
@ -423,8 +397,8 @@ unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) {
return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage);
}
bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed,
const std::string& path,
DLCPack* pack, bool fromArchive) {
const std::string& path, DLCPack* pack,
bool fromArchive) {
return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack,
fromArchive);
}
@ -435,7 +409,7 @@ void AppGameServices::dlcRemovePack(DLCPack* pack) {
// -- Game rules --
LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data,
unsigned int size) {
unsigned int size) {
return game_.m_gameRules.loadGameRules(data, size);
}
void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) {
@ -444,7 +418,8 @@ void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) {
void AppGameServices::unloadCurrentGameRules() {
game_.m_gameRules.unloadCurrentGameRules();
}
void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
void AppGameServices::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
game_.m_gameRules.setLevelGenerationOptions(levelGen);
}

View file

@ -4,6 +4,7 @@
class Game;
class IMenuService;
class ISkinAssetData;
class AppGameServices : public IGameServices {
public:
@ -22,8 +23,7 @@ public:
// -- Game host options --
unsigned int getGameHostOption(eGameHostOption option) override;
void setGameHostOption(eGameHostOption option,
unsigned int value) override;
void setGameHostOption(eGameHostOption option, unsigned int value) override;
// -- Level generation --
LevelGenerationOptions* getLevelGenerationOptions() override;
@ -76,11 +76,7 @@ public:
// -- UI dispatch --
void setAction(int iPad, eXuiAction action, void* param) override;
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param) override;
eXuiAction getXuiAction(int iPad) override;
eXuiServerAction getXuiServerAction(int iPad) override;
void* getXuiServerActionParam(int iPad) override;
void setGlobalXuiAction(eXuiAction action) override;
void handleButtonPresses() override;
void setTMSAction(int iPad, eTMSAction action) override;
@ -113,8 +109,7 @@ public:
void setRichPresenceContext(int iPad, int contextId) override;
void captureSaveThumbnail() override;
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override;
void readBannedList(int iPad, eTMSAction action,
bool bCallback) override;
void readBannedList(int iPad, eTMSAction action, bool bCallback) override;
void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) override;
@ -139,13 +134,12 @@ public:
int getHTMLColour(eMinecraftColour colour) override;
std::string getEntityName(EntityTypeId type) override;
const char* getGameRulesString(const std::string& key) override;
unsigned int createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) override;
std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder,
std::string mountPoint) override;
bool bAddDataFolder,
std::string mountPoint) override;
char* getUniqueMapName() override;
void setUniqueMapName(char* name) override;
unsigned int getOpacityTimer(int iPad) override;
@ -157,17 +151,16 @@ public:
void debugPrintf(const char* msg) override;
// -- DLC --
DLCSkinFile* getDLCSkinFile(const std::string& name) override;
ISkinAssetData* getSkinAssetData(const std::string& name) override;
bool dlcNeedsCorruptCheck() override;
unsigned int dlcCheckForCorrupt(bool showMessage) override;
bool dlcReadDataFile(unsigned int& filesProcessed,
const std::string& path, DLCPack* pack,
bool fromArchive) override;
bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path,
DLCPack* pack, bool fromArchive) override;
void dlcRemovePack(DLCPack* pack) override;
// -- Game rules --
LevelGenerationOptions* loadGameRules(std::uint8_t* data,
unsigned int size) override;
unsigned int size) override;
void saveGameRules(std::uint8_t** data, unsigned int* size) override;
void unloadCurrentGameRules() override;
void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override;

View file

@ -1,135 +0,0 @@
#pragma once
// 4J Stu - For non-splitscreen menus, default to this screen
#define DEFAULT_XUI_MENU_USER 0
#define MULTITHREAD_ENABLE
#define MAX_CAPENAME_SIZE 32
#define MAX_BANNERNAME_SIZE 32
#define MAX_TMSFILENAME_SIZE 40
#define MAX_TYPE_SIZE 32
#define MAX_EXTENSION_TYPES 3
#define MAX_LOCAL_PLAYERS 4
// 4J Stu - Required for sentient reporting of whether the volume level has been
// changed or not
#define DEFAULT_VOLUME_LEVEL 100
#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3
#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004
#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008
#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030
#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040
#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080
#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100
#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200
#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400
#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800
#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000
#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000
#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000
#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000
#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000
#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000
#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000
#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE \
0x00700000 // 3 bits, 5 values (unset(0), classic(1), small(2), medium(3),
// large(4))
#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000
#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000
#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000
#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000
#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000
#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000
#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000
#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20
enum EGameHostOptionWorldSize {
e_worldSize_Unknown = 0,
e_worldSize_Classic,
e_worldSize_Small,
e_worldSize_Medium,
e_worldSize_Large
};
#define PROFILE_VERSION_8 10
#define PROFILE_VERSION_9 11
#define PROFILE_VERSION_10 12
// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms.
#define PROFILE_VERSION_11 13
// Java 1.6.4
#define PROFILE_VERSION_12 14
#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12
#define MAX_FAVORITE_SKINS \
10 // these are stored in the profile data so keep it small
// defines for game settings - uiBitmaskValues
#define GAMESETTING_CLOUDS 0x00000001
#define GAMESETTING_ONLINE 0x00000002
#define GAMESETTING_INVITEONLY 0x00000004
#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008
#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030
#define GAMESETTING_BEDROCKFOG 0x00000040
#define GAMESETTING_DISPLAYHUD 0x00000080
#define GAMESETTING_DISPLAYHAND 0x00000100
#define GAMESETTING_CUSTOMSKINANIM 0x00000200
#define GAMESETTING_DEATHMESSAGES 0x00000400
#define GAMESETTING_UISIZE 0x00001800
#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000
#define GAMESETTING_ANIMATEDCHARACTER 0x00008000
#define GAMESETTING_PS3EULAREAD 0x00010000
#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000
// defines for languages
#define MINECRAFT_LANGUAGE_DEFAULT 0x00
#define MINECRAFT_LANGUAGE_ENGLISH 0x01
#define MINECRAFT_LANGUAGE_JAPANESE 0x02
#define MINECRAFT_LANGUAGE_GERMAN 0x03
#define MINECRAFT_LANGUAGE_FRENCH 0x04
#define MINECRAFT_LANGUAGE_SPANISH 0x05
#define MINECRAFT_LANGUAGE_ITALIAN 0x06
#define MINECRAFT_LANGUAGE_KOREAN 0x07
#define MINECRAFT_LANGUAGE_TCHINESE 0x08
#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09
#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A
#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B
#define MINECRAFT_LANGUAGE_DUTCH 0x0C
#define MINECRAFT_LANGUAGE_FINISH 0x0D
#define MINECRAFT_LANGUAGE_SWEDISH 0x0E
#define MINECRAFT_LANGUAGE_DANISH 0x0F
#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10
#define MINECRAFT_LANGUAGE_POLISH 0x11
#define MINECRAFT_LANGUAGE_TURKISH 0x12
#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13
#define MINECRAFT_LANGUAGE_GREEK 0x14
/* Match these
const int XC_LANGUAGE_ENGLISH =1; const int XC_LANGUAGE_JAPANESE
=2; const int XC_LANGUAGE_GERMAN
=3; const int XC_LANGUAGE_FRENCH
=4; const int XC_LANGUAGE_SPANISH
=5; const int XC_LANGUAGE_ITALIAN
=6; const int XC_LANGUAGE_KOREAN
=7; const int XC_LANGUAGE_TCHINESE
=8; const int XC_LANGUAGE_PORTUGUESE =9; const int XC_LANGUAGE_BRAZILIAN
=10; const int XC_LANGUAGE_RUSSIAN
=11; const int XC_LANGUAGE_DUTCH
=12; const int XC_LANGUAGE_FINISH
=13; const int XC_LANGUAGE_SWEDISH
=14; const int XC_LANGUAGE_DANISH
=15; const int XC_LANGUAGE_NORWEGIAN =16; const int XC_LANGUAGE_POLISH
=17; const int XC_LANGUAGE_TURKISH
=18; const int XC_LANGUAGE_LATINAMERICANSPANISH =19;
const int XC_LANGUAGE_GREEK =20;
*/

View file

@ -2,15 +2,15 @@
#include <cstdint>
#include "platform/storage/storage.h"
#include "app/common/App_Defines.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/world/tutorial/TutorialEnum.h"
#include "platform/XboxStubs.h"
#include "platform/network/NetTypes.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/storage/storage.h"
typedef struct {
char* wchFilename;

View file

@ -3,14 +3,14 @@
#include <mutex>
#include <string>
#include "app/common/Game.h"
#include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/linux/LinuxGame.h"
#include "java/File.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/fs/fs.h"
#include "platform/PlatformTypes.h"
#include "platform/fs/fs.h"
ArchiveManager::ArchiveManager()
: m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {}
@ -18,14 +18,9 @@ ArchiveManager::ArchiveManager()
void ArchiveManager::loadMediaArchive() {
std::string mediapath = "";
#if _WINDOWS64
mediapath = "Common\\Media\\MediaWindows64.arc";
#elif __linux__
mediapath = "app/common/Media/MediaLinux.arc";
#endif
if (!mediapath.empty()) {
#if defined(__linux__)
std::string exeDirW = PlatformFilesystem.getBasePath().string();
std::string candidate = exeDirW + File::pathSeparator + mediapath;
if (File(candidate).exists()) {
@ -33,9 +28,6 @@ void ArchiveManager::loadMediaArchive() {
} else {
m_mediaArchive = new ArchiveFile(File(mediapath));
}
#else
m_mediaArchive = new ArchiveFile(File(mediapath));
#endif
}
}

View file

@ -0,0 +1,62 @@
#include "app/common/Audio/ConsoleSoundEngine.h"
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() {
return m_bIsPlayingStreamingCDMusic;
}
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() {
return m_bIsPlayingStreamingGameMusic;
}
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) {
m_bIsPlayingStreamingCDMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) {
m_bIsPlayingStreamingGameMusic = bVal;
}
bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; }
bool ConsoleSoundEngine::GetIsPlayingNetherMusic() {
return m_bIsPlayingNetherMusic;
}
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
m_bIsPlayingEndMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
m_bIsPlayingNetherMusic = bVal;
}
void ConsoleSoundEngine::tick() {
if (scheduledSounds.empty()) {
return;
}
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) {
ConsoleSoundEngine::ScheduledSound* next = *it;
next->delay--;
if (next->delay <= 0) {
play(next->iSound, next->x, next->y, next->z, next->volume,
next->pitch);
it = scheduledSounds.erase(it);
delete next;
} else {
++it;
}
}
}
void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z,
float volume, float pitch, int delayTicks) {
scheduledSounds.push_back(new ConsoleSoundEngine::ScheduledSound(
iSound, x, y, z, volume, pitch, delayTicks));
}
ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y,
float z, float volume,
float pitch, int delay) {
this->iSound = iSound;
this->x = x;
this->y = y;
this->z = z;
this->volume = volume;
this->pitch = pitch;
this->delay = delay;
}

View file

@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "minecraft/sounds/SoundTypes.h"
#include "SoundTypes.h"
class File;
@ -21,6 +21,11 @@ typedef struct {
class Options;
class Mob;
// Game-side sound engine interface. The concrete backend
// (app/common/Audio/SoundEngine) inherits from this and forwards into
// IPlatformSound. minecraft/ consumers see only the abstract base, so
// they don't have to drag the concrete backend (and its miniaudio
// pimpl) into their compilation units.
class ConsoleSoundEngine {
public:
ConsoleSoundEngine()
@ -29,6 +34,8 @@ public:
m_bIsPlayingEndMusic(false),
m_bIsPlayingNetherMusic(false) {}
virtual ~ConsoleSoundEngine() = default;
virtual void tick(std::shared_ptr<Mob>* players, float a) = 0;
virtual void destroy() = 0;
virtual void play(int iSound, float x, float y, float z, float volume,

View file

@ -1,24 +0,0 @@
#include "Consoles_SoundEngine.h"
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() {
return m_bIsPlayingStreamingCDMusic;
}
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() {
return m_bIsPlayingStreamingGameMusic;
}
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) {
m_bIsPlayingStreamingCDMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) {
m_bIsPlayingStreamingGameMusic = bVal;
}
bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; }
bool ConsoleSoundEngine::GetIsPlayingNetherMusic() {
return m_bIsPlayingNetherMusic;
}
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
m_bIsPlayingEndMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
m_bIsPlayingNetherMusic = bVal;
}

File diff suppressed because it is too large Load diff

View file

@ -4,13 +4,19 @@ class Options;
class C4JThread;
class Random;
#include <memory>
#include <string>
#include "app/common/App_Defines.h"
#include "app/common/Audio/Consoles_SoundEngine.h"
#include "app/linux/Iggy/include/rrCore.h"
#include "minecraft/sounds/SoundTypes.h"
#include "miniaudio.h"
#include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/Audio/SoundTypes.h"
#include "app/common/Iggy/include/rrCore.h"
#include "platform/PlatformTypes.h"
// Forward-declare the miniaudio backing state. The full struct lives in
// SoundEngine.cpp where miniaudio.h is actually included. This keeps
// miniaudio.h out of the 9 minecraft files that include SoundEngine.h
// via the 4j include chain.
struct SoundEngineMiniAudio;
constexpr float SFX_3D_MIN_DISTANCE = 1.0f;
constexpr float SFX_3D_MAX_DISTANCE = 16.0f;
@ -90,15 +96,15 @@ typedef struct {
char chName[64];
#endif
} AUDIO_INFO;
struct MiniAudioSound {
ma_sound sound;
AUDIO_INFO info;
bool active;
};
// MiniAudioSound's definition lives in SoundEngine.cpp alongside the
// miniaudio backend; consumers of this header don't need to see it.
class SoundEngine : public ConsoleSoundEngine {
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
public:
SoundEngine();
~SoundEngine();
virtual void destroy();
#if defined(_DEBUG)
void GetSoundName(char* szSoundName, int iSound);
@ -136,15 +142,15 @@ private:
float getMasterMusicVolume();
// platform specific functions
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers; }
#if defined(__linux__)
void updateMiniAudio();
#endif
int GetRandomishTrack(int iStart, int iEnd);
ma_engine m_engine;
ma_engine_config m_engineConfig;
ma_sound m_musicStream;
// Miniaudio engine + music stream PIMPL'd into SoundEngineMiniAudio,
// defined in SoundEngine.cpp. Owned via unique_ptr; the destructor
// is out-of-line so the unique_ptr instantiation can see the full
// type.
std::unique_ptr<SoundEngineMiniAudio> m_audio;
bool m_musicStreamActive;
static char m_szSoundPath[];

View file

@ -1,5 +1,5 @@
#include "Consoles_SoundEngine.h"
#include "minecraft/sounds/SoundTypes.h"
#include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/Audio/SoundTypes.h"
const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
@ -58,7 +58,7 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/cat/meow", // eSoundType_MOB_CAT_MEOW
// 4J-PB - correct the name of the event for hitting ocelots
"mob/cat/hitt", // eSoundType_MOB_CAT_HITT
// "mob.irongolem.throw", //
// "mob.irongolem.throw", //
// eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit",
//// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death",
//// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk",
@ -205,11 +205,11 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/horse/jump", // eSoundType_MOB_HORSE_JUMP,
"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <---
// missing
// missing
"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <---
// missing
// missing
"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <---
// missing
// missing
"mob/slime/big", // eSoundType_MOB_SLIME_BIG,
"mob/slime/small", // eSoundType_MOB_SLIME_SMALL,

View file

@ -29,8 +29,8 @@ void BannedListManager::invalidate(int iPad) {
}
}
void BannedListManager::addLevel(int iPad, PlayerUID xuid,
char* pszLevelName, bool bWriteToTMS) {
void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName,
bool bWriteToTMS) {
// we will have retrieved the banned level list from TMS, so add this one to
// it and write it back to TMS
@ -64,8 +64,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid,
// update telemetry too
}
bool BannedListManager::isInList(int iPad, PlayerUID xuid,
char* pszLevelName) {
bool BannedListManager::isInList(int iPad, PlayerUID xuid, char* pszLevelName) {
for (auto it = m_vBannedListA[iPad]->begin();
it != m_vBannedListA[iPad]->end(); ++it) {
PBANNEDLISTDATA pData = *it;
@ -126,6 +125,4 @@ void BannedListManager::setUniqueMapName(char* pszUniqueMapName) {
memcpy(m_pszUniqueMapName, pszUniqueMapName, 14);
}
char* BannedListManager::getUniqueMapName() {
return m_pszUniqueMapName;
}
char* BannedListManager::getUniqueMapName() { return m_pszUniqueMapName; }

View file

@ -7,17 +7,12 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h"
#include "app/common/Game.h"
#include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "util/StringHelpers.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
namespace {
constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2;

View file

@ -2,7 +2,7 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h"
#include "app/common/Game.h"
DLCCapeFile::DLCCapeFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Cape, path) {}

View file

@ -1,10 +1,10 @@
#include "DLCColourTableFile.h"
#include "DLCManager.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h"
#include "app/common/Game.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"

View file

@ -2,8 +2,8 @@
#include <sstream>
#include "app/common/Minecraft_Macros.h"
#include "app/common/DLC/DLCManager.h"
#include "minecraft/Minecraft_Macros.h"
DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) {
m_type = type;

View file

@ -1,7 +1,7 @@
#pragma once
#include "DLCFile.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
class DLCGameRules : public DLCFile {
public:

View file

@ -4,8 +4,8 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCGameRules.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
class StringTable;

View file

@ -4,7 +4,7 @@
#include <string>
#include "DLCGameRules.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
class StringTable;

View file

@ -2,7 +2,8 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Localisation/StringTable.h"
#include "app/common/Game.h"
#include "minecraft/locale/StringTable.h"
DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
@ -11,5 +12,6 @@ DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
void DLCLocalisationFile::addData(std::uint8_t* pbData,
std::uint32_t dataBytes) {
m_strings = new StringTable(pbData, dataBytes);
m_strings = new StringTable(
std::span<const std::uint8_t>(pbData, dataBytes), app.getLocale());
}

View file

@ -13,20 +13,19 @@
#include <unordered_map>
#include <utility>
#include "simdutf.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "DLCFile.h"
#include "DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "platform/fs/fs.h"
#include "util/StringHelpers.h"
#include "app/common/UI/ConsoleUIController.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/fs/fs.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "simdutf.h"
#include "strings.h"
#include "util/StringHelpers.h"
// 4jcraft, this is the size of wchar_t on disk
// the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16
@ -71,7 +70,8 @@ std::string getMountedDlcReadPath(const std::string& path) {
std::string readPath = path;
#if defined(_WINDOWS64)
const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str());
const std::string mountedPath =
PlatformStorage.GetMountedPath(path.c_str());
if (!mountedPath.empty()) {
readPath = mountedPath;
}
@ -240,7 +240,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
if (pack == nullptr) {
app.DebugPrintf(
"DLCManager: Attempting to find the index for a nullptr pack\n");
//assert(0);
// assert(0);
return foundIndex;
}
if (type != e_DLCType_All) {
@ -401,10 +401,12 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
// for details, read in the function below
#define DLC_PARAM_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData))
DLC_WSTRING((buf) + (off) + \
offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData))
#define DLC_DETAIL_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile))
DLC_WSTRING((buf) + (off) + \
offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile))
{
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte = 0;
@ -462,7 +464,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount);
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
}
// ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM);
// ulCurrentByte+=ulParameterCount *
// sizeof(IPlatformStorage::DLC_FILE_PARAM);
unsigned int uiFileCount;
DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte);
@ -477,7 +480,9 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp);
}
std::uint8_t* pbTemp =
&pbData[dwTemp]; //+ sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount;
&pbData
[dwTemp]; //+
// sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount;
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiFileCount; i++) {

View file

@ -3,50 +3,77 @@
#include <cstdint>
#include <string>
#include <vector>
#include "minecraft/world/level/dlc/DLCConstants.h"
class DLCPack;
class DLCSkinFile;
class DLCManager {
public:
enum EDLCType {
e_DLCType_Skin = 0,
e_DLCType_Cape,
e_DLCType_Texture,
e_DLCType_UIData,
e_DLCType_PackConfig,
e_DLCType_TexturePack,
e_DLCType_LocalisationData,
e_DLCType_GameRules,
e_DLCType_Audio,
e_DLCType_ColourTable,
e_DLCType_GameRulesHeader,
// Re-export the file-scope enums as nested type aliases so existing
// app-side call sites that use DLCManager::EDLCType /
// DLCManager::e_DLCType_Texture continue to compile. minecraft/-side
// call sites should use the namespaced names from DLCConstants.h
// directly.
using EDLCType = ::minecraft::dlc::EDLCType;
using EDLCParameterType = ::minecraft::dlc::EDLCParameterType;
e_DLCType_Max,
e_DLCType_All,
};
static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin;
static constexpr EDLCType e_DLCType_Cape = ::minecraft::dlc::e_DLCType_Cape;
static constexpr EDLCType e_DLCType_Texture =
::minecraft::dlc::e_DLCType_Texture;
static constexpr EDLCType e_DLCType_UIData =
::minecraft::dlc::e_DLCType_UIData;
static constexpr EDLCType e_DLCType_PackConfig =
::minecraft::dlc::e_DLCType_PackConfig;
static constexpr EDLCType e_DLCType_TexturePack =
::minecraft::dlc::e_DLCType_TexturePack;
static constexpr EDLCType e_DLCType_LocalisationData =
::minecraft::dlc::e_DLCType_LocalisationData;
static constexpr EDLCType e_DLCType_GameRules =
::minecraft::dlc::e_DLCType_GameRules;
static constexpr EDLCType e_DLCType_Audio =
::minecraft::dlc::e_DLCType_Audio;
static constexpr EDLCType e_DLCType_ColourTable =
::minecraft::dlc::e_DLCType_ColourTable;
static constexpr EDLCType e_DLCType_GameRulesHeader =
::minecraft::dlc::e_DLCType_GameRulesHeader;
static constexpr EDLCType e_DLCType_Max = ::minecraft::dlc::e_DLCType_Max;
static constexpr EDLCType e_DLCType_All = ::minecraft::dlc::e_DLCType_All;
// If you add to the Enum,then you need to add the array of type names
// These are the names used in the XML for the parameters
enum EDLCParameterType {
e_DLCParamType_Invalid = -1,
static constexpr EDLCParameterType e_DLCParamType_Invalid =
::minecraft::dlc::e_DLCParamType_Invalid;
static constexpr EDLCParameterType e_DLCParamType_DisplayName =
::minecraft::dlc::e_DLCParamType_DisplayName;
static constexpr EDLCParameterType e_DLCParamType_ThemeName =
::minecraft::dlc::e_DLCParamType_ThemeName;
static constexpr EDLCParameterType e_DLCParamType_Free =
::minecraft::dlc::e_DLCParamType_Free;
static constexpr EDLCParameterType e_DLCParamType_Credit =
::minecraft::dlc::e_DLCParamType_Credit;
static constexpr EDLCParameterType e_DLCParamType_Cape =
::minecraft::dlc::e_DLCParamType_Cape;
static constexpr EDLCParameterType e_DLCParamType_Box =
::minecraft::dlc::e_DLCParamType_Box;
static constexpr EDLCParameterType e_DLCParamType_Anim =
::minecraft::dlc::e_DLCParamType_Anim;
static constexpr EDLCParameterType e_DLCParamType_PackId =
::minecraft::dlc::e_DLCParamType_PackId;
static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour =
::minecraft::dlc::e_DLCParamType_NetherParticleColour;
static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour =
::minecraft::dlc::e_DLCParamType_EnchantmentTextColour;
static constexpr EDLCParameterType
e_DLCParamType_EnchantmentTextFocusColour =
::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour;
static constexpr EDLCParameterType e_DLCParamType_DataPath =
::minecraft::dlc::e_DLCParamType_DataPath;
static constexpr EDLCParameterType e_DLCParamType_PackVersion =
::minecraft::dlc::e_DLCParamType_PackVersion;
static constexpr EDLCParameterType e_DLCParamType_Max =
::minecraft::dlc::e_DLCParamType_Max;
e_DLCParamType_DisplayName = 0,
e_DLCParamType_ThemeName,
e_DLCParamType_Free, // identify free skins
e_DLCParamType_Credit, // legal credits for DLC
e_DLCParamType_Cape,
e_DLCParamType_Box,
e_DLCParamType_Anim,
e_DLCParamType_PackId,
e_DLCParamType_NetherParticleColour,
e_DLCParamType_EnchantmentTextColour,
e_DLCParamType_EnchantmentTextFocusColour,
e_DLCParamType_DataPath,
e_DLCParamType_PackVersion,
e_DLCParamType_Max,
};
const static char* wchTypeNamesA[e_DLCParamType_Max];
private:
@ -83,7 +110,7 @@ public:
EDLCType type = e_DLCType_All);
DLCSkinFile* getSkinFile(
const std::string& path); // Will hunt all packs of type skin to find
// the right skinfile
// the right skinfile
DLCPack* getPackContainingSkin(const std::string& path);
unsigned int getPackIndexContainingSkin(const std::string& path,

View file

@ -6,7 +6,6 @@
#include <sstream>
#include <utility>
#include "platform/profile/profile.h"
#include "DLCAudioFile.h"
#include "DLCCapeFile.h"
#include "DLCColourTableFile.h"
@ -15,13 +14,13 @@
#include "DLCLocalisationFile.h"
#include "DLCTextureFile.h"
#include "DLCUIDataFile.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "app/common/Game.h"
#include "minecraft/Console_Debug_enum.h"
#include "minecraft/locale/StringTable.h"
#include "platform/profile/profile.h"
#include "util/StringHelpers.h"
DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) {
@ -352,6 +351,6 @@ void DLCPack::UpdateLanguage() {
DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile(
DLCManager::e_DLCType_LocalisationData, "languages.loc");
StringTable* strTable = localisationFile->getStringTable();
strTable->ReloadStringTable();
strTable->ReloadStringTable(app.getLocale());
}
}

View file

@ -5,9 +5,9 @@
#include <unordered_map>
#include <vector>
#include "platform/PlatformTypes.h"
#include "DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "platform/PlatformTypes.h"
class DLCFile;
class DLCSkinFile;

View file

@ -3,12 +3,12 @@
#include <string.h>
#include <wchar.h>
#include "platform/renderer/renderer.h"
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h"
#include "app/common/Game.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h"
DLCSkinFile::DLCSkinFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Skin, path) {
@ -56,8 +56,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
int maximumChars = 55;
bool bIsSDMode =
!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen();
bool bIsSDMode = !PlatformRenderer.IsHiDef() &&
!PlatformRenderer.IsWidescreen();
if (bIsSDMode) {
maximumChars = 45;
@ -110,9 +110,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
SKIN_BOX* pSkinBox = new SKIN_BOX;
memset(pSkinBox, 0, sizeof(SKIN_BOX));
sscanf(value.c_str(), "%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
if (strcmp(wchBodyPart, "HEAD") == 0) {
pSkinBox->ePart = eBodyPart_Head;
@ -132,8 +132,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
m_AdditionalBoxes.push_back(pSkinBox);
} break;
case DLCManager::e_DLCParamType_Anim: {
sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask,
sizeof(unsigned int));
sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask);
uint32_t skinId = app.getSkinIdFromPath(m_path);
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
break;

View file

@ -6,10 +6,11 @@
#include "DLCFile.h"
#include "app/common/DLC/DLCManager.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/HumanoidModel.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/skins/ISkinAssetData.h"
class DLCSkinFile : public DLCFile {
class DLCSkinFile : public DLCFile, public ISkinAssetData {
private:
std::string m_displayName;
std::string m_themeName;
@ -21,15 +22,23 @@ private:
public:
DLCSkinFile(const std::string& path);
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
virtual void addParameter(DLCManager::EDLCParameterType type,
const std::string& value);
void addData(std::uint8_t* pbData, std::uint32_t dataBytes) override;
void addParameter(DLCManager::EDLCParameterType type,
const std::string& value) override;
std::string getParameterAsString(
DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
// ISkinAssetData
[[nodiscard]] std::uint32_t getSkinID() override {
return DLCFile::getSkinID();
}
[[nodiscard]] unsigned int getAnimOverrideBitmask() override {
return m_uiAnimOverrideBitmask;
}
[[nodiscard]] int getAdditionalBoxesCount() override;
[[nodiscard]] std::vector<SKIN_BOX*>* getAdditionalBoxes() override;
virtual std::string getParameterAsString(
DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
std::vector<SKIN_BOX*>* getAdditionalBoxes();
int getAdditionalBoxesCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask; }
bool isFree() { return m_bIsFree; }
};

View file

@ -2,7 +2,7 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h"
#include "app/common/Game.h"
DLCUIDataFile::DLCUIDataFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_UIData, path) {

View file

@ -1,22 +1,20 @@
#include "app/common/DLCController.h"
#include "app/common/Game.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/storage/storage.h"
#include "platform/profile/profile.h"
#include "platform/XboxStubs.h"
#include <cstring>
#include <mutex>
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "app/common/UI/ConsoleUIController.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/XboxStubs.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
DLCController::DLCController() {
m_pDLCFileBuffer = nullptr;
m_dwDLCFileSize = 0;
@ -76,10 +74,9 @@ bool DLCController::startInstallDLCProcess(int iPad) {
"--- DLCController::startInstallDLCProcess - "
"PlatformStorage.GetInstalledDLC\n");
PlatformStorage.GetInstalledDLC(
iPad, [this](int iInstalledC, int pad) {
return dlcInstalledCallback(iInstalledC, pad);
});
PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) {
return dlcInstalledCallback(iInstalledC, pad);
});
return true;
} else {
app.DebugPrintf(
@ -105,7 +102,7 @@ void DLCController::mountNextDLC(int iPad) {
[this](int pad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) {
return dlcMountedCallback(pad, dwErr, dwLicenceMask);
}) != ERROR_IO_PENDING) {
}) != 997 /* ERROR_IO_PENDING */) {
app.DebugPrintf("Failed to mount DLC %d for pad %d\n",
m_iTotalDLCInstalled, iPad);
++m_iTotalDLCInstalled;
@ -131,7 +128,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
#if defined(_WINDOWS64)
app.DebugPrintf("--- DLCController::dlcMountedCallback\n");
if (dwErr != ERROR_SUCCESS) {
if (dwErr != 0 /* ERROR_SUCCESS */) {
app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr);
app.m_dlcManager.incrementUnnamedCorruptCount();
} else {
@ -188,13 +185,11 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
void DLCController::handleDLC(DLCPack* pack) {
unsigned int dwFilesProcessed = 0;
#if defined(_WINDOWS64) || defined(__linux__)
std::vector<std::string> dlcFilenames;
#endif
PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames);
for (int i = 0; i < dlcFilenames.size(); i++) {
app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i],
pack);
pack);
}
if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack);
}
@ -229,7 +224,6 @@ SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) {
return vDLCCredits.at(iIndex);
}
#if defined(_WINDOWS64)
int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
int iGender, uint64_t ullOfferID_Full,
uint64_t ullOfferID_Trial,
@ -246,11 +240,11 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
pDLCData->uiSortIndex = uiSortIndex;
pDLCData->iConfig = iConfig;
if (pBannerName != "") {
wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
if (strcmp(pBannerName, "") != 0) {
strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
}
if (pDataFile[0] != 0) {
wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
strncpy(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
}
if (pType != nullptr) {
@ -277,19 +271,6 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
return hr;
}
#elif defined(__linux__)
int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
int iGender, uint64_t ullOfferID_Full,
uint64_t ullOfferID_Trial,
char* pFirstSkin,
unsigned int uiSortIndex, int iConfig,
char* pDataFile) {
fprintf(stderr,
"warning: DLCController::registerDLCData unimplemented for "
"platform `__linux__`\n");
return 0;
}
#endif
bool DLCController::getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) {
@ -314,8 +295,7 @@ bool DLCController::getDLCFullOfferIDForPackID(const int iPackID,
}
}
DLC_INFO* DLCController::getDLCInfoForTrialOfferID(
uint64_t ullOfferID_Trial) {
DLC_INFO* DLCController::getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) {
if (DLCInfo_Trial.size() > 0) {
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if (it == DLCInfo_Trial.end()) {
@ -437,12 +417,13 @@ bool DLCController::retrieveNextDLCContent() {
app.DebugPrintf("RetrieveNextDLCContent - type = %d\n",
pCurrent->dwType);
#endif
IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers(
PlatformProfile.GetPrimaryPad(),
[this](int iOfferC, std::uint32_t dwType, int pad) {
return dlcOffersReturned(iOfferC, dwType, pad);
},
pCurrent->dwType);
IPlatformStorage::EDLCStatus status =
PlatformStorage.GetDLCOffers(
PlatformProfile.GetPrimaryPad(),
[this](int iOfferC, std::uint32_t dwType, int pad) {
return dlcOffersReturned(iOfferC, dwType, pad);
},
pCurrent->dwType);
if (status == IPlatformStorage::EDLC_Pending) {
pCurrent->eState = e_DLC_ContentState_Retrieving;
} else {
@ -670,9 +651,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
return 1;
}
int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) {
int DLCController::tmsPPFileReturned(
void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) {
DLCController* pClass = (DLCController*)pParam;
{

View file

@ -8,8 +8,8 @@
#include "app/common/App_structs.h"
#include "app/common/DLC/DLCManager.h"
#include "platform/storage/storage.h"
#include "platform/XboxStubs.h"
#include "platform/storage/storage.h"
struct SCreditTextItemDef;
@ -36,9 +36,8 @@ public:
int iPad);
// DLC info registration
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t,
char*, unsigned int, int,
char* pDataFile);
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*,
unsigned int, int, char* pDataFile);
bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal);
bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal);

View file

@ -27,7 +27,6 @@ DebugOptions::DebugOptions() {
#if defined(_DEBUG_MENUS_ENABLED)
bool DebugOptions::debugArtToolsOn(unsigned int debugMask) {
return settingsOn() &&
(debugMask & (1L << eDebugSetting_ArtTools)) != 0;
return settingsOn() && (debugMask & (1L << eDebugSetting_ArtTools)) != 0;
}
#endif

View file

@ -1,6 +1,6 @@
#pragma once
#include "app/common/Console_Debug_enum.h"
#include "minecraft/Console_Debug_enum.h"
class DebugOptions {
public:

View file

@ -1,58 +1,5 @@
#include "minecraft/GameHostOptions.h"
#include "app/common/Game.h"
#include "platform/PlatformTypes.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h"
#include "app/common/App_structs.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "java/Class.h"
#include "java/File.h"
#include "java/Random.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/multiplayer/ClientConnection.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
#include "minecraft/client/multiplayer/MultiPlayerLevel.h"
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "minecraft/client/renderer/GameRenderer.h"
#include "minecraft/client/renderer/Textures.h"
#include "minecraft/client/renderer/entity/EntityRenderer.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/stats/StatsCounter.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "strings.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@ -72,24 +19,71 @@
#include <utility>
#include <vector>
#include "platform/input/input.h"
#include "app/common/App_structs.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/Localisation/StringTable.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/ConsoleUIController.h"
#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h"
#include "Minecraft_Macros.h"
#include "util/Timer.h"
#include "util/StringHelpers.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h"
#include "java/Class.h"
#include "java/File.h"
#include "java/Random.h"
#include "minecraft/Console_Debug_enum.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/GameTypes.h"
#include "minecraft/Minecraft_Macros.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
#include "minecraft/client/User.h"
#include "minecraft/client/gui/Gui.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/multiplayer/ClientConnection.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
#include "minecraft/client/multiplayer/MultiPlayerLevel.h"
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "minecraft/client/renderer/GameRenderer.h"
#include "minecraft/client/renderer/Textures.h"
#include "minecraft/client/renderer/entity/EntityRenderDispatcher.h"
#include "minecraft/client/renderer/entity/EntityRenderer.h"
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "minecraft/client/skins/DLCTexturePack.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/server/PlayerList.h"
#include "minecraft/server/level/ServerPlayer.h"
#include "minecraft/stats/StatsCounter.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "platform/PlatformTypes.h"
#include "platform/XboxStubs.h"
#include "platform/input/input.h"
#include "platform/network/NetTypes.h"
#include "platform/network/network.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "strings.h"
#include "util/StringHelpers.h"
#include "util/Timer.h"
class BeaconTileEntity;
class BrewingStandTileEntity;
@ -190,31 +184,14 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; }
// Load*Menu methods moved to MenuController
//////////////////////////////////////////////
// GAME SETTINGS
//////////////////////////////////////////////
// Skin/Cape/FavoriteSkin methods moved to SkinManager
// Mash-up pack worlds
///////////////////////////
//
// Remove the debug settings in the content package build
@ -222,16 +199,10 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; }
////////////////////////////
#if !defined(_DEBUG_MENUS_ENABLED)
#else
#endif
int Game::BannedLevelDialogReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
Game* pApp = (Game*)pParam;
@ -285,17 +256,10 @@ int Game::GetLocalPlayerCount(void) {
return iPlayerC;
}
// Installed DLC callback
// 4J-JEV: For the sake of clarity in DLCMountedCallback.
#if defined(_WINDOWS64)
#define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName)
#else
#define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName)
#endif
#undef CONTENT_DATA_DISPLAY_NAME
@ -327,7 +291,6 @@ int Game::GetLocalPlayerCount(void) {
// }
// }
// int Game::DLCReadCallback(void*
// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData)
// {
@ -366,8 +329,9 @@ void Game::UpdateTime() {
}
bool Game::isXuidDeadmau5(PlayerUID xuid) {
auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
auto it = DLCController::MojangData.find(
xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
if (it != DLCController::MojangData.end()) {
MOJANG_DATA* pMojangData = DLCController::MojangData[xuid];
if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) {
@ -380,16 +344,13 @@ bool Game::isXuidDeadmau5(PlayerUID xuid) {
void Game::StoreLaunchData() {}
void Game::ExitGame() {}
void Game::ExitGame() {
DebugPrintf("[Game] ExitGame AFTER START\n");
PlatformRenderer.Close();
}
// Invites
//////////////////////////////////////////////////////////////////////////
//
// FatalLoadError
@ -399,28 +360,21 @@ void Game::ExitGame() {}
// We have to assume that we've not been able to load the text for the game.
//
//////////////////////////////////////////////////////////////////////////
void Game::FatalLoadError() {}
void Game::FatalLoadError() {
DebugPrintf("FatalLoadError - asserting 0 and dying...\n");
assert(0);
}
// Game Host options
void Game::SetGameHostOption(eGameHostOption eVal,
unsigned int uiVal) {
void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) {
GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal);
}
unsigned int Game::GetGameHostOption(eGameHostOption eVal) {
return GameHostOptions::get(m_uiGameHostSettings, eVal);
}
void Game::processSchematics(LevelChunk* levelChunk) {
m_gameRules.processSchematics(levelChunk);
}
@ -429,12 +383,9 @@ void Game::processSchematicsLighting(LevelChunk* levelChunk) {
m_gameRules.processSchematicsLighting(levelChunk);
}
void Game::loadDefaultGameRules() {
m_gameRules.loadDefaultGameRules();
}
void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); }
void Game::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
m_gameRules.setLevelGenerationOptions(levelGen);
}
@ -442,16 +393,8 @@ const char* Game::GetGameRulesString(const std::string& key) {
return m_gameRules.GetGameRulesString(key);
}
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to
// MenuController
std::string Game::getEntityName(eINSTANCEOF type) {
switch (type) {
@ -507,12 +450,8 @@ std::string Game::getEntityName(eINSTANCEOF type) {
// m_dwContentTypeA moved to DLCController
int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid,
char* pSkin, char* pCape) {
int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin,
char* pCape) {
int32_t hr = 0;
eXUID eTempXuid = eXUID_Undefined;
MOJANG_DATA* pMojangData = nullptr;
@ -574,39 +513,12 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) {
return hr;
}
#if defined(_WINDOWS64)
#elif defined(__linux__)
#else
#endif
// DLC
// AUTOSAVE
void Game::SetAutosaveTimerTime(void) {
int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave);
int settingValue =
GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave);
m_saveManager.setAutosaveTimerTime(settingValue);
}
@ -642,7 +554,8 @@ bool Game::IsLocalMultiplayerAvailable() {
// #else
// for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
// {
// if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) ||
// if( (i!=userIndex) && (PlatformInput.IsPadConnected(i)
//||
// PlatformProfile.IsSignedIn(i)) )
// {
// iOtherConnectedControllers++;
@ -655,10 +568,8 @@ bool Game::IsLocalMultiplayerAvailable() {
// (moved to manager class)
std::string Game::getFilePath(std::uint32_t packId,
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
std::string Game::getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder, std::string mountPoint) {
std::string path =
getRootPath(packId, true, bAddDataFolder, mountPoint) + filename;
File f(path);
@ -690,9 +601,8 @@ std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\";
std::string titleUpdateTexturePackRoot = "CU\\DLC\\";
#endif
std::string Game::getRootPath(std::uint32_t packId,
bool allowOverride, bool bAddDataFolder,
std::string mountPoint) {
std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
bool bAddDataFolder, std::string mountPoint) {
std::string path = mountPoint;
if (allowOverride) {
switch (packId) {
@ -712,3 +622,5 @@ std::string Game::getRootPath(std::uint32_t packId,
return path + "\\";
}
}
Game app;

View file

@ -3,38 +3,38 @@
#include <cstdint>
#include <mutex>
#include "util/Timer.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "util/Timer.h"
// using namespace std;
#include "app/common/ArchiveManager.h"
#include "app/common/BannedListManager.h"
#include "app/common/DebugOptions.h"
#include "app/common/DLCController.h"
#include "app/common/GameSettingsManager.h"
#include "app/common/IPlatformGame.h"
#include "app/common/App_structs.h"
#include "app/common/ArchiveManager.h"
#include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/BannedListManager.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLCController.h"
#include "app/common/DebugOptions.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameSettingsManager.h"
#include "app/common/LocalizationManager.h"
#include "app/common/MenuController.h"
#include "app/common/NetworkController.h"
#include "app/common/SaveManager.h"
#include "app/common/SkinManager.h"
#include "app/common/TerrainFeatureManager.h"
#include "app/common/Audio/Consoles_SoundEngine.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Localisation/StringTable.h"
#include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/tutorial/TutorialEnum.h"
#include "platform/XboxStubs.h"
#include "platform/network/NetTypes.h"
// JoinFromInviteData moved to NetworkController.h
@ -62,7 +62,7 @@ class Merchant;
class CMinecraftAudio;
class Game : public IPlatformGame {
class Game {
public:
Game();
@ -145,7 +145,8 @@ public:
bool IsAppPaused();
void SetAppPaused(bool val);
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) {
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg,
int iPad) {
return m_gameSettingsManager.displaySavingMessage(eMsg, iPad);
}
bool GetGameStarted() { return m_bGameStarted; }
@ -169,7 +170,8 @@ public:
bool LoadEnchantingMenu(int iPad, std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level,
const std::string& name) {
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name);
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z,
level, name);
}
bool LoadFurnaceMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) {
@ -178,7 +180,8 @@ public:
bool LoadBrewingStandMenu(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand);
return m_menuController.loadBrewingStandMenu(iPad, inventory,
brewingStand);
}
bool LoadContainerMenu(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) {
@ -204,12 +207,14 @@ public:
}
bool LoadRepairingMenu(int iPad, std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) {
return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z);
return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y,
z);
}
bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader, Level* level,
const std::string& name) {
return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name);
return m_menuController.loadTradingMenu(iPad, inventory, trader, level,
name);
}
bool LoadCommandBlockMenu(
@ -227,7 +232,8 @@ public:
bool LoadHorseMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) {
return m_menuController.loadHorseMenu(iPad, inventory, container, horse);
return m_menuController.loadHorseMenu(iPad, inventory, container,
horse);
}
bool LoadBeaconMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) {
@ -242,38 +248,31 @@ public:
}
static const char* GetString(int iID);
StringTable* getStringTable() const { return m_localizationManager.getStringTable(); }
StringTable* getStringTable() const {
return m_localizationManager.getStringTable();
}
eGameMode GetGameMode() { return m_eGameMode; }
void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; }
eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); }
void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); }
eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); }
eXuiAction GetGlobalXuiAction() {
return m_menuController.getGlobalXuiAction();
}
void SetGlobalXuiAction(eXuiAction action) {
m_menuController.setGlobalXuiAction(action);
}
eXuiAction GetXuiAction(int iPad) {
return m_menuController.getXuiAction(iPad);
}
void SetAction(int iPad, eXuiAction action, void* param = nullptr) {
m_menuController.setAction(iPad, action, param);
}
void SetTMSAction(int iPad, eTMSAction action) {
m_menuController.setTMSAction(iPad, action);
}
eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); }
eXuiServerAction GetXuiServerAction(int iPad) {
return m_menuController.getXuiServerAction(iPad);
eTMSAction GetTMSAction(int iPad) {
return m_menuController.getTMSAction(iPad);
}
void* GetXuiServerActionParam(int iPad) {
return m_menuController.getXuiServerActionParam(iPad);
}
void SetXuiServerAction(int iPad, eXuiServerAction action,
void* param = nullptr) {
m_menuController.setXuiServerAction(iPad, action, param);
}
eXuiServerAction GetGlobalXuiServerAction() {
return m_menuController.getGlobalXuiServerAction();
}
void SetGlobalXuiServerAction(eXuiServerAction action) {
m_menuController.setGlobalXuiServerAction(action);
}
DisconnectPacket::eDisconnectReason GetDisconnectReason() {
return m_networkController.getDisconnectReason();
}
@ -281,10 +280,16 @@ public:
m_networkController.setDisconnectReason(bVal);
}
bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); }
void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); }
bool GetChangingSessionType() {
return m_networkController.getChangingSessionType();
}
void SetChangingSessionType(bool bVal) {
m_networkController.setChangingSessionType(bVal);
}
bool GetReallyChangingSessionType() { return m_networkController.getReallyChangingSessionType(); }
bool GetReallyChangingSessionType() {
return m_networkController.getReallyChangingSessionType();
}
void SetReallyChangingSessionType(bool bVal) {
m_networkController.setReallyChangingSessionType(bVal);
}
@ -340,19 +345,20 @@ public:
static int OldProfileVersionCallback(void* pParam, unsigned char* pucData,
const unsigned short usVersion,
const int iPad) {
return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad);
return GameSettingsManager::oldProfileVersionCallback(pParam, pucData,
usVersion, iPad);
}
static int DefaultOptionsCallback(void* pParam,
IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad);
static int DefaultOptionsCallback(
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings,
iPad);
}
int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return m_gameSettingsManager.setDefaultOptions(pSettings, iPad);
}
void SetRichPresenceContext(int iPad, int contextId) override = 0;
void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) {
m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal);
@ -376,7 +382,8 @@ public:
m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA);
}
void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) {
m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, GameSettingsA);
m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID,
GameSettingsA);
}
unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) {
return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA);
@ -427,9 +434,7 @@ public:
void SetOpacityTimer(int iPad) {
m_menuController.setOpacityTimer(iPad);
} // 6 seconds
void TickOpacityTimer(int iPad) {
m_menuController.tickOpacityTimer(iPad);
}
void TickOpacityTimer(int iPad) { m_menuController.tickOpacityTimer(iPad); }
public:
std::string GetPlayerSkinName(int iPad) {
@ -449,7 +454,8 @@ public:
}
void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false,
int iPad = XUSER_INDEX_ANY) {
m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad);
m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer,
iPad);
}
void ApplyGameSettingsChanged(int iPad) {
m_gameSettingsManager.applyGameSettingsChanged(iPad);
@ -462,7 +468,8 @@ public:
}
unsigned int GetGameSettingsDebugMask(int iPad = -1,
bool bOverridePlayer = false) {
return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer);
return m_gameSettingsManager.getGameSettingsDebugMask(iPad,
bOverridePlayer);
}
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) {
m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal);
@ -485,13 +492,15 @@ public:
static int SignoutExitWorldThreadProc(void* lpParameter) {
return NetworkController::signoutExitWorldThreadProc(lpParameter);
}
static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult result) {
return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result);
static int PrimaryPlayerSignedOutReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad,
result);
}
static int EthernetDisconnectReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult result) {
return NetworkController::ethernetDisconnectReturned(pParam, iPad, result);
static int EthernetDisconnectReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::ethernetDisconnectReturned(pParam, iPad,
result);
}
static void ProfileReadErrorCallback(void* pParam) {
NetworkController::profileReadErrorCallback(pParam);
@ -504,15 +513,20 @@ public:
static void NotificationsCallback(void* pParam,
std::uint32_t dwNotification,
unsigned int uiParam) {
NetworkController::notificationsCallback(pParam, dwNotification, uiParam);
NetworkController::notificationsCallback(pParam, dwNotification,
uiParam);
}
// for the ethernet being disconnected
static void LiveLinkChangeCallback(void* pParam, bool bConnected) {
NetworkController::liveLinkChangeCallback(pParam, bConnected);
}
bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); }
void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); }
bool GetLiveLinkRequired() {
return m_networkController.getLiveLinkRequired();
}
void SetLiveLinkRequired(bool required) {
m_networkController.setLiveLinkRequired(required);
}
#if defined(_DEBUG_MENUS_ENABLED)
bool DebugSettingsOn() { return m_debugOptions.settingsOn(); }
@ -523,11 +537,15 @@ public:
#endif
void SetDebugSequence(const char* pchSeq);
// bool UploadFileToGlobalStorage(int iQuadrant,
// IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile );
// IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile );
// Installed DLC - delegated to DLCController
bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); }
int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); }
bool StartInstallDLCProcess(int iPad) {
return m_dlcController.startInstallDLCProcess(iPad);
}
int dlcInstalledCallback(int iOfferC, int iPad) {
return m_dlcController.dlcInstalledCallback(iOfferC, iPad);
}
void HandleDLCLicenseChange();
int dlcMountedCallback(int iPad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) {
@ -536,11 +554,12 @@ public:
void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); }
void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); }
bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); }
bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); }
bool DLCInstallProcessCompleted() {
return m_dlcController.dlcInstallProcessCompleted();
}
void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); }
static int MarketplaceCountsCallback(void* pParam,
IPlatformStorage::DLC_TMS_DETAILS* details,
int iPad) {
static int MarketplaceCountsCallback(
void* pParam, IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) {
return DLCController::marketplaceCountsCallback(pParam, details, iPad);
}
@ -558,9 +577,7 @@ public:
virtual void StoreLaunchData();
virtual void ExitGame();
bool isXuidNotch(PlayerUID xuid) {
return m_skinManager.isXuidNotch(xuid);
}
bool isXuidNotch(PlayerUID xuid) { return m_skinManager.isXuidNotch(xuid); }
bool isXuidDeadmau5(PlayerUID xuid);
void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData,
@ -597,9 +614,7 @@ public:
return m_archiveManager.getTPConfigVal(pwchDataFile);
}
bool DefaultCapeExists() {
return m_skinManager.defaultCapeExists();
}
bool DefaultCapeExists() { return m_skinManager.defaultCapeExists(); }
// void InstallDefaultCape(); // attempt to install the default cape once
// per game launch
@ -607,11 +622,14 @@ public:
void ProcessInvite(std::uint32_t dwUserIndex,
std::uint32_t dwLocalUsersMask,
const INVITE_INFO* pInviteInfo) {
m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo);
m_networkController.processInvite(dwUserIndex, dwLocalUsersMask,
pInviteInfo);
}
// Add credits for DLC installed - delegated to DLCController
void AddCreditText(const char* lpStr) { m_dlcController.addCreditText(lpStr); }
void AddCreditText(const char* lpStr) {
m_dlcController.addCreditText(lpStr);
}
private:
std::unordered_map<PlayerUID, std::uint8_t*> m_GTS_Files;
@ -654,14 +672,16 @@ public:
bool m_bTutorialMode;
bool m_bIsAppPaused;
// m_bChangingSessionType and m_bReallyChangingSessionType moved to NetworkController
// m_bChangingSessionType and m_bReallyChangingSessionType moved to
// NetworkController
// trial, and trying to unlock full
// version on an upsell
void loadMediaArchive() { m_archiveManager.loadMediaArchive(); }
void loadStringTable() {
m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive());
m_localizationManager.loadStringTable(
m_archiveManager.getMediaArchive());
}
public:
@ -676,10 +696,10 @@ public:
}
private:
static int BannedLevelDialogReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult);
static int TexturePackDialogReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
static int BannedLevelDialogReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult);
static int TexturePackDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::texturePackDialogReturned(pParam, iPad, result);
}
@ -703,7 +723,8 @@ private:
eGameMode m_eGameMode; // single or multiplayer
// GameSettingsA reference alias into GameSettingsManager
GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = m_gameSettingsManager.GameSettingsA;
GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] =
m_gameSettingsManager.GameSettingsA;
// m_uiLastSignInData moved to NetworkController
@ -728,7 +749,6 @@ public:
}
private:
static int UnlockFullExitReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullExitReturned(pParam, iPad, result);
@ -737,8 +757,8 @@ private:
IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullSaveReturned(pParam, iPad, result);
}
static int UnlockFullInviteReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
static int UnlockFullInviteReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullInviteReturned(pParam, iPad, result);
}
static int TrialOverReturned(void* pParam, int iPad,
@ -751,21 +771,25 @@ private:
}
static int ExitAndJoinFromInviteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(
pParam, iPad, result);
}
static int ExitAndJoinFromInviteAndSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteAndSaveReturned(
pParam, iPad, result);
}
static int ExitAndJoinFromInviteDeclineSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(
pParam, iPad, result);
}
static int FatalErrorDialogReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result);
static int FatalErrorDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result);
static int WarningTrialTexturePackReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result);
return NetworkController::warningTrialTexturePackReturned(pParam, iPad,
result);
}
JoinFromInviteData& m_InviteData = m_networkController.m_InviteData;
@ -794,7 +818,7 @@ public:
return m_localizationManager.getHTMLFontSize(size);
}
std::string FormatHTMLString(int iPad, const std::string& desc,
int shadowColour = 0xFFFFFFFF) {
int shadowColour = 0xFFFFFFFF) {
return m_localizationManager.formatHTMLString(iPad, desc, shadowColour);
}
std::string GetActionReplacement(int iPad, unsigned char ucAction) {
@ -818,7 +842,8 @@ public:
}
static int ExitGameFromRemoteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result);
return MenuController::exitGameFromRemoteSaveDialogReturned(
pParam, iPad, result);
}
// XML
@ -840,10 +865,11 @@ public:
MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid);
static int32_t RegisterConfigValues(char* pType, int iValue);
static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, uint64_t e,
char* f, unsigned int g, int h,
static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d,
uint64_t e, char* f, unsigned int g, int h,
char* pDataFile) {
return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile);
return DLCController::registerDLCData(a, b, c, d, e, f, g, h,
pDataFile);
}
bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) {
@ -856,8 +882,12 @@ public:
return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full);
}
unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); }
SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); }
unsigned int GetDLCCreditsCount() {
return m_dlcController.getDLCCreditsCount();
}
SCreditTextItemDef* GetDLCCredits(int iIndex) {
return m_dlcController.getDLCCredits(iIndex);
}
// TMS
void ReadDLCFileFromTMS(int iPad, eTMSAction action,
@ -865,26 +895,15 @@ public:
void ReadXuidsFileFromTMS(int iPad, eTMSAction action,
bool bCallback = false);
// images for save thumbnail/social post
void CaptureSaveThumbnail() override = 0;
void GetSaveThumbnail(std::uint8_t** thumbnailData,
unsigned int* thumbnailSize) override = 0;
void ReleaseSaveThumbnail() override = 0;
void GetScreenshot(int iPad, std::uint8_t** screenshotData,
unsigned int* screenshotSize) override = 0;
void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false) override = 0;
// DLC data members moved to DLCController
// Sign-in info moved to NetworkController
public:
// void OverrideFontRenderer(bool set, bool immediate = true);
// void ToggleFontRenderer() {
// OverrideFontRenderer(!m_bFontRendererOverridden,false); }
BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA;
BANNEDLIST(&BannedListA)
[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA;
public:
void SetBanListCheck(int iPad, bool bVal) {
@ -902,7 +921,8 @@ public:
// m_uiOpacityCountDown moved to MenuController
// DLC flags moved to DLCController
// Host options - m_uiGameHostSettings moved to GameSettingsManager
unsigned int& m_uiGameHostSettings = m_gameSettingsManager.m_uiGameHostSettings;
unsigned int& m_uiGameHostSettings =
m_gameSettingsManager.m_uiGameHostSettings;
#if defined(_LARGE_WORLDS)
unsigned int m_GameNewWorldSize;
@ -945,13 +965,17 @@ public:
// World seed from png image - delegated to MenuController
void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes,
unsigned char* seedText, unsigned int& uiHostOptions,
bool& bHostOptionsRead, std::uint32_t& uiTexturePack) {
m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack);
bool& bHostOptionsRead,
std::uint32_t& uiTexturePack) {
m_menuController.getImageTextData(imageData, imageBytes, seedText,
uiHostOptions, bHostOptionsRead,
uiTexturePack);
}
unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId);
return m_menuController.createImageTextData(
textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId);
}
// Game rules
@ -979,7 +1003,8 @@ public:
void UpdatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerGamePrivileges) {
m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges);
m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex,
playerGamePrivileges);
}
short GetPlayerColour(std::uint8_t networkSmallId) {
return m_networkController.getPlayerColour(networkSmallId);
@ -994,7 +1019,9 @@ public:
bool bPromote = false) {
return m_dlcController.addDLCRequest(eContentType, bPromote);
}
bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); }
bool RetrieveNextDLCContent() {
return m_dlcController.retrieveNextDLCContent();
}
bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); }
int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) {
return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad);
@ -1010,26 +1037,45 @@ public:
return m_dlcController.dlcContentRetrieved(eType);
}
void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); }
void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); }
bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); }
void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); }
void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); }
void ClearAndResetDLCDownloadQueue() {
m_dlcController.clearAndResetDLCDownloadQueue();
}
bool RetrieveNextTMSPPContent() {
return m_dlcController.retrieveNextTMSPPContent();
}
void TickTMSPPFilesRetrieved() {
m_dlcController.tickTMSPPFilesRetrieved();
}
void ClearTMSPPFilesRetrieved() {
m_dlcController.clearTMSPPFilesRetrieved();
}
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType,
bool bPromote = false) {
return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote);
}
int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); }
int GetDLCInfoTexturesOffersCount() {
return m_dlcController.getDLCInfoTexturesOffersCount();
}
static int TMSPPFileReturned(void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) {
return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename);
return DLCController::tmsPPFileReturned(pParam, iPad, iUserData,
pFileData, szFilename);
}
DLC_INFO* GetDLCInfoTrialOffer(int iIndex) {
return m_dlcController.getDLCInfoTrialOffer(iIndex);
}
DLC_INFO* GetDLCInfoFullOffer(int iIndex) {
return m_dlcController.getDLCInfoFullOffer(iIndex);
}
DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { return m_dlcController.getDLCInfoTrialOffer(iIndex); }
DLC_INFO* GetDLCInfoFullOffer(int iIndex) { return m_dlcController.getDLCInfoFullOffer(iIndex); }
int GetDLCInfoTrialOffersCount() { return m_dlcController.getDLCInfoTrialOffersCount(); }
int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); }
int GetDLCInfoTrialOffersCount() {
return m_dlcController.getDLCInfoTrialOffersCount();
}
int GetDLCInfoFullOffersCount() {
return m_dlcController.getDLCInfoFullOffersCount();
}
bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) {
return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal);
}
@ -1046,8 +1092,10 @@ public:
// Download status members moved to DLCController
bool m_bCorruptSaveDeleted;
std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer;
unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize;
std::uint8_t*& m_pBannedListFileBuffer =
m_bannedListManager.m_pBannedListFileBuffer;
unsigned int& m_dwBannedListFileSize =
m_bannedListManager.m_dwBannedListFileSize;
public:
unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize;
@ -1090,14 +1138,6 @@ public:
return SkinManager::getSkinPathFromId(skinId);
}
int LoadLocalTMSFile(char* wchTMSFile) override = 0;
int LoadLocalTMSFile(char* wchTMSFile,
eFileExtensionType eExt) override = 0;
void FreeLocalTMSFiles(eTMSFileType eType) override = 0;
int GetLocalTMSFileIndex(char* wchTMSFile,
bool bFilenameIncludesExtension,
eFileExtensionType eEXT) override = 0;
virtual bool GetTMSGlobalFileListRead() { return true; }
virtual bool GetTMSDLCInfoRead() { return true; }
virtual bool GetTMSXUIDsFileRead() { return true; }
@ -1132,10 +1172,17 @@ private:
// 4J-PB - language and locale functions
public:
void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); }
void LocaleAndLanguageInit() {
m_localizationManager.localeAndLanguageInit();
}
void getLocale(std::vector<std::string>& vecWstrLocales) {
m_localizationManager.getLocale(vecWstrLocales);
}
[[nodiscard]] std::vector<std::string> getLocale() {
std::vector<std::string> v;
m_localizationManager.getLocale(v);
return v;
}
int get_eMCLang(char* pwchLocale) {
return m_localizationManager.get_eMCLang(pwchLocale);
}
@ -1143,24 +1190,18 @@ public:
return m_localizationManager.get_xcLang(pwchLocale);
}
void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); }
void SetTickTMSDLCFiles(bool bVal) {
m_dlcController.setTickTMSDLCFiles(bVal);
}
std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder,
std::string mountPoint = "TPACK:");
bool bAddDataFolder,
std::string mountPoint = "TPACK:");
private:
std::string getRootPath(std::uint32_t packId, bool allowOverride,
bool bAddDataFolder, std::string mountPoint);
bool bAddDataFolder, std::string mountPoint);
public:
#if defined(_WINDOWS64)
// CMinecraftAudio audio;
#else
#endif
};
// singleton
// extern CMinecraftApp app;
extern Game app;

View file

@ -2,57 +2,88 @@
#include "app/common/Game.h"
bool GameMenuService::openInventory(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) {
bool GameMenuService::openInventory(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
return game_.LoadInventoryMenu(iPad, player, navigateBack);
}
bool GameMenuService::openCreative(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) {
bool GameMenuService::openCreative(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
return game_.LoadCreativeMenu(iPad, player, navigateBack);
}
bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr<LocalPlayer> player) {
bool GameMenuService::openCrafting2x2(int iPad,
std::shared_ptr<LocalPlayer> player) {
return game_.LoadCrafting2x2Menu(iPad, player);
}
bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) {
bool GameMenuService::openCrafting3x3(int iPad,
std::shared_ptr<LocalPlayer> player,
int x, int y, int z) {
return game_.LoadCrafting3x3Menu(iPad, player, x, y, z);
}
bool GameMenuService::openEnchanting(int iPad, std::shared_ptr<Inventory> inventory, int x, int y, int z, Level* level, const std::string& name) {
bool GameMenuService::openEnchanting(int iPad,
std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level,
const std::string& name) {
return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name);
}
bool GameMenuService::openFurnace(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace) {
bool GameMenuService::openFurnace(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) {
return game_.LoadFurnaceMenu(iPad, inventory, furnace);
}
bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand) {
bool GameMenuService::openBrewingStand(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand);
}
bool GameMenuService::openContainer(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<Container> container) {
bool GameMenuService::openContainer(int iPad,
std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) {
return game_.LoadContainerMenu(iPad, inventory, container);
}
bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap) {
bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<DispenserTileEntity> trap) {
return game_.LoadTrapMenu(iPad, inventory, trap);
}
bool GameMenuService::openFireworks(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) {
bool GameMenuService::openFireworks(int iPad,
std::shared_ptr<LocalPlayer> player, int x,
int y, int z) {
return game_.LoadFireworksMenu(iPad, player, x, y, z);
}
bool GameMenuService::openSign(int iPad, std::shared_ptr<SignTileEntity> sign) {
return game_.LoadSignEntryMenu(iPad, sign);
}
bool GameMenuService::openRepairing(int iPad, std::shared_ptr<Inventory> inventory, Level* level, int x, int y, int z) {
bool GameMenuService::openRepairing(int iPad,
std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) {
return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z);
}
bool GameMenuService::openTrading(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level* level, const std::string& name) {
bool GameMenuService::openTrading(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader,
Level* level, const std::string& name) {
return game_.LoadTradingMenu(iPad, inventory, trader, level, name);
}
bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) {
bool GameMenuService::openCommandBlock(
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) {
return game_.LoadCommandBlockMenu(iPad, commandBlock);
}
bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<HopperTileEntity> hopper) {
bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper);
}
bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<MinecartHopper> hopper) {
bool GameMenuService::openHopperMinecart(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper);
}
bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Container> container, std::shared_ptr<EntityHorse> horse) {
bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) {
return game_.LoadHorseMenu(iPad, inventory, container, horse);
}
bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BeaconTileEntity> beacon) {
bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) {
return game_.LoadBeaconMenu(iPad, inventory, beacon);
}

View file

@ -40,9 +40,8 @@ public:
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) override;
bool openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) override;
bool openHopperMinecart(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) override;
bool openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) override;
bool openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) override;

View file

@ -5,7 +5,6 @@
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/StartFeature.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
@ -16,10 +15,11 @@
#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"

View file

@ -12,21 +12,21 @@
#include "app/common/DLC/DLCLocalisationFile.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "java/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "strings.h"
const char* GameRuleManager::wchTagNameA[] = {
@ -223,8 +223,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn,
unsigned int bStringTableSize = dis2.readInt();
std::vector<uint8_t> bStringTable(bStringTableSize);
dis2.read(bStringTable);
StringTable* strings =
new StringTable(bStringTable.data(), bStringTable.size());
StringTable* strings = new StringTable(bStringTable, app.getLocale());
// Read RuleFile.
std::vector<uint8_t> bRuleFile(content.size() - bStringTable.size());
@ -641,7 +640,7 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
}
void GameRuleManager::loadDefaultGameRules() {
#if !defined(__linux__)
#if 0
#if defined(_WINDOWS64)
File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck");
if (!packedTutorialFile.exists())
@ -657,6 +656,8 @@ void GameRuleManager::loadDefaultGameRules() {
app.GetString(IDS_TUTORIALSAVENAME));
}
#else
// 4jcraft: brought over from TU18 so the tutorial world loads from assets
// TODO clean this up
std::string fpTutorial = "Tutorial.pck";
if (app.getArchiveFileSize(fpTutorial) >= 0) {
DLCPack* pack = new DLCPack("", 0xffffffff);

View file

@ -8,9 +8,9 @@
#include <unordered_map>
#include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class LevelGenerationOptions;
class RootGameRulesDefinition;
@ -27,8 +27,6 @@ class DLCGameRulesHeader;
class File;
class LevelRuleset;
#define GAME_RULE_SAVENAME "requiredGameRules.grf"
// 4J-JEV:
#define LEVEL_GEN_ID int
#define LEVEL_GEN_ID_NULL 0

View file

@ -3,17 +3,17 @@
#include <algorithm>
#include <cmath>
#include "ConsoleSchematicFile.h"
#include "LevelGenerationOptions.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/phys/AABB.h"
#include "util/StringHelpers.h"
ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
LevelGenerationOptions* levelGenOptions) {

View file

@ -4,9 +4,9 @@
#include <optional>
#include <string>
#include "ConsoleSchematicFile.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/phys/AABB.h"
#include "minecraft/world/phys/Vec3.h"

View file

@ -1,10 +1,10 @@
#include "BiomeOverride.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
BiomeOverride::BiomeOverride() {
m_tile = 0;

View file

@ -4,8 +4,8 @@
#include <cstdint>
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class BiomeOverride : public GameRuleDefinition {
private:

View file

@ -4,20 +4,20 @@
#include <algorithm>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Direction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "util/StringHelpers.h"
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
m_x = m_y = m_z = 0;
@ -77,8 +77,8 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos,
dos->writeUTF(toWString(m_dimension));
}
void ConsoleGenerateStructure::addAttribute(
const std::string& attributeName, const std::string& attributeValue) {
void ConsoleGenerateStructure::addAttribute(const std::string& attributeName,
const std::string& attributeValue) {
if (attributeName.compare("x") == 0) {
int value = fromWString<int>(attributeValue);
m_x = value;

View file

@ -2,8 +2,8 @@
#include <string>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"

View file

@ -1,6 +1,6 @@
#pragma once
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class ConsoleGenerateStructureAction : public GameRuleDefinition {
public:

View file

@ -1,4 +1,4 @@
#include "LevelGenerationOptions.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include <limits.h>
#include <wchar.h>
@ -6,28 +6,27 @@
#include <unordered_set>
#include <utility>
#include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h"
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "app/common/GameRules/LevelGeneration/StartFeature.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "java/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/GameEnums.h"
#include "minecraft/Pos.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/phys/AABB.h"
#include "platform/fs/fs.h"
@ -441,8 +440,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
auto it = m_schematics.find(filename);
if (it != m_schematics.end()) {
#if !defined(_CONTENT_PACKAGE)
printf("We have already loaded schematic file %s\n",
filename.c_str());
printf("We have already loaded schematic file %s\n", filename.c_str());
#endif
it->second->incrementRefCount();
return it->second;
@ -471,8 +469,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
return schematic;
}
void LevelGenerationOptions::releaseSchematicFile(
const std::string& filename) {
void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) {
// 4J Stu - We don't want to delete them when done, but probably want to
// keep a set of active schematics for the current world
// auto it = m_schematics.find(filename);
@ -556,7 +553,7 @@ void LevelGenerationOptions::loadBaseSaveData() {
[this](int pad, std::uint32_t err, std::uint32_t lic) {
return onPackMounted(pad, err, lic);
},
"WPACK") != ERROR_IO_PENDING) {
"WPACK") != 997 /* ERROR_IO_PENDING */) {
// corrupt DLC
setLoadedData();
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",
@ -577,7 +574,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
uint32_t dwLicenceMask) {
LevelGenerationOptions* lgo = this;
lgo->m_bLoadingData = false;
if (dwErr != ERROR_SUCCESS) {
if (dwErr != 0 /* ERROR_SUCCESS */) {
// corrupt DLC
app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad,
dwErr);
@ -628,7 +625,8 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
auto readResult = PlatformFilesystem.readFile(
save.getPath(), pbData, dwFileSize);
if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) {
if (readResult.status !=
IPlatformFilesystem::ReadStatus::Ok) {
app.FatalLoadError();
}

View file

@ -2,7 +2,7 @@
#include <algorithm>
#include "LevelGenerationOptions.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
LevelGenerators::LevelGenerators() {}

View file

@ -1,10 +1,10 @@
#include "StartFeature.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
StartFeature::StartFeature() {
m_chunkX = 0;

View file

@ -3,8 +3,8 @@
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeature.h"
class StartFeature : public GameRuleDefinition {

View file

@ -1,12 +1,12 @@
#include "XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "util/StringHelpers.h"
XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() {
m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0;

View file

@ -1,8 +1,8 @@
#pragma once
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;

View file

@ -1,12 +1,12 @@
#include "XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "util/StringHelpers.h"
XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() {
m_x = m_y = m_z = m_tile = m_data = 0;

View file

@ -1,8 +1,8 @@
#pragma once
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;

View file

@ -4,17 +4,17 @@
#include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/TileEntity.h"
#include "util/StringHelpers.h"
XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() {
m_tile = Tile::chest_Id;

View file

@ -3,8 +3,8 @@
#include <string>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class AddItemRuleDefinition;
class StructurePiece;

View file

@ -4,9 +4,9 @@
#include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
@ -33,9 +33,8 @@ void XboxStructureActionPlaceSpawner::addAttribute(
if (attributeName.compare("entity") == 0) {
m_entityId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf(
"XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n",
m_entityId.c_str());
printf("XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n",
m_entityId.c_str());
#endif
} else {
XboxStructureActionPlaceBlock::addAttribute(attributeName,

View file

@ -2,8 +2,8 @@
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;

View file

@ -3,10 +3,7 @@
#include <algorithm>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/item/EnchantedBookItem.h"
#include "minecraft/world/item/Item.h"
@ -14,6 +11,9 @@
#include "minecraft/world/item/enchantment/Enchantment.h"
#include "minecraft/world/item/enchantment/EnchantmentCategory.h"
#include "minecraft/world/item/enchantment/EnchantmentInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() {
m_enchantmentId = m_enchantmentLevel = 0;

View file

@ -3,8 +3,8 @@
#include <memory>
#include <string>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class ItemInstance;

View file

@ -3,14 +3,14 @@
#include <algorithm>
#include "AddEnchantmentRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/item/Item.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
AddItemRuleDefinition::AddItemRuleDefinition() {
m_itemId = m_quantity = m_auxValue = m_dataTag = 0;

View file

@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class Container;
class AddEnchantmentRuleDefinition;

View file

@ -1,15 +1,15 @@
#include "CollectItemRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/network/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "util/StringHelpers.h"
CollectItemRuleDefinition::CollectItemRuleDefinition() {
m_itemId = 0;
@ -111,8 +111,7 @@ std::string CollectItemRuleDefinition::generateXml(
"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
"promptName=\"OPTIONAL\"";
if (item->getAuxValue() != 0)
xml +=
" auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
xml += " auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
if (item->get4JData() != 0)
xml += " dataTag=\"" + toWString<int>(item->get4JData()) + "\"";
xml += "/>\n";

View file

@ -3,9 +3,9 @@
#include <memory>
#include <string>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
class Pos;
class UseTileRuleDefinition;

View file

@ -4,13 +4,13 @@
#include <unordered_map>
#include <utility>
#include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "minecraft/network/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
void CompleteAllRuleDefinition::getChildren(
std::vector<GameRuleDefinition*>* children) {

View file

@ -3,7 +3,7 @@
#include <string>
#include "CompoundGameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class GameRule;
@ -25,8 +25,8 @@ public:
virtual bool onCollectItem(GameRule* rule,
std::shared_ptr<ItemInstance> item);
static std::string generateDescriptionString(
const std::string& description, void* data, int dataLength);
static std::string generateDescriptionString(const std::string& description,
void* data, int dataLength);
private:
void updateStatus(GameRule* rule);

View file

@ -7,14 +7,14 @@
#include <unordered_map>
#include <utility>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "util/StringHelpers.h"
CompoundGameRuleDefinition::CompoundGameRuleDefinition() {

View file

@ -2,9 +2,9 @@
#include <vector>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
class CompoundGameRuleDefinition : public GameRuleDefinition {
protected:

View file

@ -1,4 +1,4 @@
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include <assert.h>
#include <wchar.h>
@ -8,14 +8,14 @@
#include <utility>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "util/StringHelpers.h"
class Connection;
@ -66,7 +66,7 @@ GameRuleDefinition* GameRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n",
ruleType);
ruleType);
#endif
return nullptr;
}
@ -77,13 +77,13 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_descriptionId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter descriptionId=%s\n",
m_descriptionId.c_str());
m_descriptionId.c_str());
#endif
} else if (attributeName.compare("promptName") == 0) {
m_promptId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter m_promptId=%s\n",
m_promptId.c_str());
m_promptId.c_str());
#endif
} else if (attributeName.compare("dataTag") == 0) {
m_4JDataValue = fromWString<int>(attributeValue);
@ -92,9 +92,8 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_4JDataValue);
} else {
#ifndef _CONTENT_PACKAGE
printf(
"GameRuleDefinition: Attempted to add invalid attribute: %s\n",
attributeName.c_str());
printf("GameRuleDefinition: Attempted to add invalid attribute: %s\n",
attributeName.c_str());
#endif
}
}

View file

@ -1,9 +1,9 @@
#include "LevelRuleset.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h"
#include "app/common/Localisation/StringTable.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class AABB;

View file

@ -4,7 +4,7 @@
#include <vector>
#include "CompoundGameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class NamedAreaRuleDefinition;
class AABB;

View file

@ -2,11 +2,11 @@
#include <wchar.h>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
NamedAreaRuleDefinition::NamedAreaRuleDefinition() {
m_name = "";
@ -41,7 +41,7 @@ void NamedAreaRuleDefinition::addAttribute(const std::string& attributeName,
m_name = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("NamedAreaRuleDefinition: Adding parameter name=%s\n",
m_name.c_str());
m_name.c_str());
#endif
} else if (attributeName.compare("x0") == 0) {
m_area.x0 = fromWString<int>(attributeValue);

View file

@ -2,8 +2,8 @@
#include <string>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/phys/AABB.h"
class NamedAreaRuleDefinition : public GameRuleDefinition {

View file

@ -4,16 +4,16 @@
#include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Pos.h"
#include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/food/FoodData.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() {
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;

View file

@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class AddItemRuleDefinition;
class Pos;

View file

@ -1,10 +1,10 @@
#include "UseTileRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
UseTileRuleDefinition::UseTileRuleDefinition() {
m_tileId = -1;

View file

@ -3,9 +3,9 @@
#include <string>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/Pos.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class UseTileRuleDefinition : public GameRuleDefinition {
private:

View file

@ -1,5 +1,5 @@
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include <wchar.h>
@ -8,10 +8,9 @@
#include <unordered_map>
#include <utility>
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class Connection;
class ItemInstance;
@ -33,15 +32,14 @@ GameRule::ValueType GameRule::getParameter(const std::string& parameterName) {
if (m_parameters.find(parameterName) == m_parameters.end()) {
#ifndef _CONTENT_PACKAGE
printf("WARNING: Parameter %s was not set before being fetched\n",
parameterName.c_str());
parameterName.c_str());
assert(0);
#endif
}
return m_parameters[parameterName];
}
void GameRule::setParameter(const std::string& parameterName,
ValueType value) {
void GameRule::setParameter(const std::string& parameterName, ValueType value) {
if (m_parameters.find(parameterName) == m_parameters.end()) {
#ifndef _CONTENT_PACKAGE
printf("Adding parameter %s to GameRule\n", parameterName.c_str());

View file

@ -1,12 +1,15 @@
#include "app/common/GameSettingsManager.h"
#include <cstring>
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Game.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/common/UI/ConsoleUIController.h"
#include "minecraft/Console_Debug_enum.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/GameTypes.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/gui/Gui.h"
@ -17,15 +20,14 @@
#include "minecraft/client/skins/TexturePackRepository.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/server/PlayerList.h"
#include "minecraft/server/ServerAction.h"
#include "minecraft/server/level/ServerPlayer.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/level/tile/Tile.h"
#include "platform/input/input.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "app/common/Audio/SoundEngine.h"
#include <cstring>
GameSettingsManager::GameSettingsManager() {
memset(GameSettingsA, 0, sizeof(GameSettingsA));
@ -39,17 +41,10 @@ void GameSettingsManager::initGameSettings() {
// clear the flag to say the settings have changed
GameSettingsA[i]->bSettingsChanged = false;
#if defined(_WINDOWS64)
IPlatformProfile::PROFILESETTINGS* pProfileSettings =
PlatformProfile.GetDashboardProfileSettings(i);
memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS));
setDefaultOptions(pProfileSettings, i);
#else
IPlatformProfile::PROFILESETTINGS* pProfileSettings =
PlatformProfile.GetDashboardProfileSettings(i);
memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS));
setDefaultOptions(pProfileSettings, i);
#endif
}
}
@ -123,17 +118,16 @@ int GameSettingsManager::setDefaultOptions(
setGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0);
if (!app.GetGameStarted()) {
GameSettingsA[iPad]->ucLanguage =
MINECRAFT_LANGUAGE_DEFAULT;
GameSettingsA[iPad]->ucLocale =
MINECRAFT_LANGUAGE_DEFAULT;
GameSettingsA[iPad]->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT;
GameSettingsA[iPad]->ucLocale = MINECRAFT_LANGUAGE_DEFAULT;
}
return 0;
}
int GameSettingsManager::defaultOptionsCallback(
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) {
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
Game* pApp = (Game*)pParam;
pApp->DebugPrintf("Setting default options for player %d", iPad);
@ -194,8 +188,7 @@ int GameSettingsManager::oldProfileVersionCallback(
pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND;
pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM;
pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES;
pGameSettings->uiBitmaskValues |=
(GAMESETTING_UISIZE & 0x00000800);
pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800);
pGameSettings->uiBitmaskValues |=
(GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000);
pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER;
@ -283,8 +276,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
if (bInGame && g_NetworkManager.IsHost() &&
(iPad == PlatformProfile.GetPrimaryPad())) {
app.SetXuiServerAction(
iPad, eXuiServerAction_ServerSettingChanged_Difficulty);
MinecraftServer::getInstance()->queueServerAction(
minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
Difficulty});
}
} else {
app.DebugPrintf(
@ -309,30 +304,30 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
case eGameSetting_ControlSouthPaw:
if (GameSettingsA[iPad]->usBitmaskValues & 0x80) {
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX,
AXIS_MAP_RX);
AXIS_MAP_RX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY,
AXIS_MAP_RY);
AXIS_MAP_RY);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX,
AXIS_MAP_LX);
AXIS_MAP_LX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY,
AXIS_MAP_LY);
AXIS_MAP_LY);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0,
TRIGGER_MAP_1);
TRIGGER_MAP_1);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1,
TRIGGER_MAP_0);
TRIGGER_MAP_0);
} else {
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX,
AXIS_MAP_LX);
AXIS_MAP_LX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY,
AXIS_MAP_LY);
AXIS_MAP_LY);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX,
AXIS_MAP_RX);
AXIS_MAP_RX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY,
AXIS_MAP_RY);
AXIS_MAP_RY);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0,
TRIGGER_MAP_0);
TRIGGER_MAP_0);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1,
TRIGGER_MAP_1);
TRIGGER_MAP_1);
}
break;
case eGameSetting_SplitScreenVertical:
@ -350,8 +345,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
eGameHostOption_Gamertags,
((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1
: 0);
app.SetXuiServerAction(
iPad, eXuiServerAction_ServerSettingChanged_Gamertags);
MinecraftServer::getInstance()->queueServerAction(
minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
Gamertags});
PlayerList* players =
MinecraftServer::getInstance()->getPlayerList();
@ -407,8 +404,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
app.SetGameHostOption(
eGameHostOption_BedrockFog,
getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0);
app.SetXuiServerAction(
iPad, eXuiServerAction_ServerSettingChanged_BedrockFog);
MinecraftServer::getInstance()->queueServerAction(
minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
BedrockFog});
}
} break;
case eGameSetting_DisplayHUD:
@ -464,8 +463,7 @@ unsigned char GameSettingsManager::getMinecraftLanguage(int iPad) {
}
}
void GameSettingsManager::setMinecraftLocale(int iPad,
unsigned char ucLocale) {
void GameSettingsManager::setMinecraftLocale(int iPad, unsigned char ucLocale) {
GameSettingsA[iPad]->ucLocale = ucLocale;
GameSettingsA[iPad]->bSettingsChanged = true;
}
@ -1345,8 +1343,8 @@ void GameSettingsManager::setGameHostOption(unsigned int& uiHostSettings,
}
}
unsigned int GameSettingsManager::getGameHostOption(
unsigned int uiHostSettings, eGameHostOption eVal) {
unsigned int GameSettingsManager::getGameHostOption(unsigned int uiHostSettings,
eGameHostOption eVal) {
switch (eVal) {
case eGameHostOption_FriendsOfFriends:
return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS);

View file

@ -3,8 +3,8 @@
#include <cstdint>
#include "app/common/App_structs.h"
#include "platform/profile/profile.h"
#include "platform/XboxStubs.h"
#include "platform/profile/profile.h"
class GameSettingsManager {
public:
@ -14,9 +14,9 @@ public:
static int oldProfileVersionCallback(void* pParam, unsigned char* pucData,
const unsigned short usVersion,
const int iPad);
static int defaultOptionsCallback(void* pParam,
IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad);
static int defaultOptionsCallback(
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad);
int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad);
@ -64,7 +64,8 @@ public:
static void setActionConfirmed(void* param);
// Saving message
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad);
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg,
int iPad);
// Game settings array - public, referenced by Game via alias
GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT];

View file

@ -1,16 +1,15 @@
#include "app/common/App_Defines.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/ConsoleUIController.h"
#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
@ -28,10 +27,12 @@
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/stats/StatsCounter.h"
#include "platform/PlatformTypes.h"
#include "platform/game/game.h"
#include "platform/network/network.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "util/StringHelpers.h"
#include "app/common/Audio/SoundEngine.h"
#include "strings.h"
void Game::HandleXuiActions(void) {
eXuiAction eAction;
@ -215,8 +216,8 @@ void Game::HandleXuiActions(void) {
// app.CloseAllPlayersXuiScenes();
// Hide the other players scenes
ui.ShowOtherPlayersBaseScene(PlatformProfile.GetPrimaryPad(),
false);
ui.ShowOtherPlayersBaseScene(
PlatformProfile.GetPrimaryPad(), false);
// This just allows it to be shown
if (pMinecraft
@ -454,13 +455,13 @@ void Game::HandleXuiActions(void) {
for (int j = 0; j < XUSER_MAX_COUNT; j++) {
if (pMinecraft->localplayers[j]) {
if (g_NetworkManager.IsLocalGame()) {
app.SetRichPresenceContext(
PlatformGame.SetRichPresenceContext(
j, CONTEXT_GAME_STATE_BLANK);
PlatformProfile.SetCurrentGameActivity(
j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,
false);
} else {
app.SetRichPresenceContext(
PlatformGame.SetRichPresenceContext(
j, CONTEXT_GAME_STATE_BLANK);
PlatformProfile.SetCurrentGameActivity(
j, CONTEXT_PRESENCE_MULTIPLAYER, false);
@ -468,7 +469,8 @@ void Game::HandleXuiActions(void) {
}
}
} else {
app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK);
PlatformGame.SetRichPresenceContext(
i, CONTEXT_GAME_STATE_BLANK);
if (g_NetworkManager.IsLocalGame()) {
PlatformProfile.SetCurrentGameActivity(
i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,
@ -992,10 +994,12 @@ void Game::HandleXuiActions(void) {
// need to stop the streaming audio - by playing
// streaming audio from the default texture pack now
// reset the streaming sounds back to the normal ones
pMinecraft->soundEngine->SetStreamingSounds(
eStream_Overworld_Calm1, eStream_Overworld_piano3,
eStream_Nether1, eStream_Nether4,
eStream_end_dragon, eStream_end_end, eStream_CD_1);
static_cast<SoundEngine*>(pMinecraft->soundEngine)
->SetStreamingSounds(
eStream_Overworld_Calm1,
eStream_Overworld_piano3, eStream_Nether1,
eStream_Nether4, eStream_end_dragon,
eStream_end_end, eStream_CD_1);
pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1,
1);
@ -1148,7 +1152,8 @@ void Game::HandleXuiActions(void) {
} break;
case eAppAction_SetDefaultOptions:
SetAction(i, eAppAction_Idle);
SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param, i);
SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param,
i);
// if the profile data has been changed, then force a
// profile write It seems we're allowed to break the 5
@ -1211,10 +1216,11 @@ void Game::HandleXuiActions(void) {
case eAppAction_FailedToJoinNoPrivileges: {
unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
IPlatformStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
PlatformProfile.GetPrimaryPad());
IPlatformStorage::EMessageResult result =
ui.RequestErrorMessage(
IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
PlatformProfile.GetPrimaryPad());
if (result != IPlatformStorage::EMessage_Busy)
SetAction(i, eAppAction_Idle);
} break;

View file

@ -1,17 +1,20 @@
#define GDRAW_ASSERTS
#include "gdraw.h"
#include <GL/gl.h>
#include <dlfcn.h>
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#endif
#include <GL/glew.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "app/linux/Iggy/include/iggy.h"
#include "SDL_video.h"
#include "app/common/Iggy/include/iggy.h"
#ifndef _ENABLEIGGY
void* IggyGDrawMallocAnnotated(SINTa size, const char* file, int line) {
@ -38,23 +41,23 @@ void IggyDiscardVertexBufferCallback(void* owner, void* buf) {
}
#endif
static void* get_gl_proc(const char* name) {
void* p = SDL_GL_GetProcAddress(name);
if (!p) p = dlsym(RTLD_DEFAULT, name);
if (!p) {
char buf[256];
strncpy(buf, name, sizeof(buf) - 1);
buf[255] = '\0';
char* ext = strstr(buf, "ARB");
if (!ext) ext = strstr(buf, "EXT");
if (ext && ext == buf + strlen(buf) - 3) {
*ext = '\0';
p = SDL_GL_GetProcAddress(buf);
if (!p) p = dlsym(RTLD_DEFAULT, buf);
}
}
return p;
}
// static void* get_gl_proc(const char* name) {
// void* p = SDL_GL_GetProcAddress(name);
// if (!p) p = dlsym(RTLD_DEFAULT, name);
// if (!p) {
// char buf[256];
// strncpy(buf, name, sizeof(buf) - 1);
// buf[255] = '\0';
// char* ext = strstr(buf, "ARB");
// if (!ext) ext = strstr(buf, "EXT");
// if (ext && ext == buf + strlen(buf) - 3) {
// *ext = '\0';
// p = SDL_GL_GetProcAddress(buf);
// if (!p) p = dlsym(RTLD_DEFAULT, buf);
// }
// }
// return p;
// }
#define GDRAW_GL_EXTENSION_LIST \
/* identifier import procname */ \
@ -129,33 +132,33 @@ typedef gdraw_gl_resourcetype gdraw_resourcetype;
GDRAW_GL_EXTENSION_LIST
#undef GLE
typedef const GLubyte*(APIENTRYP PFNGLGETSTRINGIPROC_)(GLenum name,
typedef const GLubyte*(APIENTRY* PFNGLGETSTRINGIPROC_)(GLenum name,
GLuint index);
static PFNGLGETSTRINGIPROC_ gdraw_glGetStringi = NULL;
typedef void(APIENTRYP PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays);
typedef void(APIENTRYP PFNGLBINDVERTEXARRAYPROC_)(GLuint array);
typedef void(APIENTRY* PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays);
typedef void(APIENTRY* PFNGLBINDVERTEXARRAYPROC_)(GLuint array);
static PFNGLGENVERTEXARRAYSPROC_ gdraw_glGenVertexArrays = NULL;
static PFNGLBINDVERTEXARRAYPROC_ gdraw_glBindVertexArray = NULL;
static GLuint gdraw_vao = 0;
typedef void(APIENTRYP gdraw_vtxattrib_fn)(GLuint, GLint, GLenum, GLboolean,
typedef void(APIENTRY* gdraw_vtxattrib_fn)(GLuint, GLint, GLenum, GLboolean,
GLsizei, const void*);
static gdraw_vtxattrib_fn gdraw_real_vtxattrib = NULL;
static GLuint gdraw_screenvbo = 0;
static const void* gdraw_screenvbo_base = NULL;
static size_t gdraw_expected_vbo_size = 0;
typedef void(APIENTRYP gdraw_drawelements_fn)(GLenum mode, GLsizei count,
typedef void(APIENTRY* gdraw_drawelements_fn)(GLenum mode, GLsizei count,
GLenum type, const void* indices);
static gdraw_drawelements_fn gdraw_real_drawelements = NULL;
static GLuint gdraw_screenibo = 0;
typedef GLuint(APIENTRYP gdraw_createshader_fn)(GLenum);
typedef void(APIENTRYP gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**,
typedef GLuint(APIENTRY* gdraw_createshader_fn)(GLenum);
typedef void(APIENTRY* gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**,
const GLint*);
typedef void(APIENTRYP gdraw_compileshader_fn)(GLuint);
typedef void(APIENTRYP gdraw_linkprogram_fn)(GLuint);
typedef void(APIENTRY* gdraw_compileshader_fn)(GLuint);
typedef void(APIENTRY* gdraw_linkprogram_fn)(GLuint);
static gdraw_createshader_fn gdraw_real_createshader = NULL;
static gdraw_shadersource_fn gdraw_real_shadersource = NULL;
static gdraw_compileshader_fn gdraw_real_compileshader = NULL;
@ -163,30 +166,30 @@ static gdraw_linkprogram_fn gdraw_real_linkprogram = NULL;
// some core reject p0
typedef void(APIENTRYP gdraw_useprogram_fn)(GLuint);
typedef void(APIENTRY* gdraw_useprogram_fn)(GLuint);
static gdraw_useprogram_fn gdraw_real_useprogram = NULL;
static GLuint gdraw_null_program = 0;
typedef void(APIENTRYP gdraw_teximage2d_fn)(GLenum, GLint, GLint, GLsizei,
typedef void(APIENTRY* gdraw_teximage2d_fn)(GLenum, GLint, GLint, GLsizei,
GLsizei, GLint, GLenum, GLenum,
const void*);
typedef void(APIENTRYP gdraw_texsubimage2d_fn)(GLenum, GLint, GLint, GLint,
typedef void(APIENTRY* gdraw_texsubimage2d_fn)(GLenum, GLint, GLint, GLint,
GLsizei, GLsizei, GLenum, GLenum,
const void*);
static gdraw_teximage2d_fn gdraw_real_teximage2d = NULL;
static gdraw_texsubimage2d_fn gdraw_real_texsubimage2d = NULL;
#define TRY(ptr, arb, core) \
do { \
void* _p = get_gl_proc(core); \
if (!_p) _p = get_gl_proc(arb); \
*(void**)&(ptr) = _p; \
#define TRY(ptr, arb, core) \
do { \
void* _p = SDL_GL_GetProcAddress(core); \
if (!_p) _p = SDL_GL_GetProcAddress(arb); \
*(void**)&(ptr) = _p; \
} while (0)
static void load_extensions(void) {
// gl_shared requires ts shit ugh
#define GLE(id, import, procname) \
gl##id = (PFNGL##procname##PROC)get_gl_proc("gl" import);
gl##id = (PFNGL##procname##PROC)SDL_GL_GetProcAddress("gl" import);
GDRAW_GL_EXTENSION_LIST
#undef GLE
@ -248,26 +251,30 @@ static void load_extensions(void) {
// Save raw pointers before we #define over the names below
gdraw_real_vtxattrib =
(gdraw_vtxattrib_fn)get_gl_proc("glVertexAttribPointer");
(gdraw_vtxattrib_fn)SDL_GL_GetProcAddress("glVertexAttribPointer");
gdraw_real_createshader =
(gdraw_createshader_fn)get_gl_proc("glCreateShader");
(gdraw_createshader_fn)SDL_GL_GetProcAddress("glCreateShader");
gdraw_real_shadersource =
(gdraw_shadersource_fn)get_gl_proc("glShaderSource");
(gdraw_shadersource_fn)SDL_GL_GetProcAddress("glShaderSource");
gdraw_real_compileshader =
(gdraw_compileshader_fn)get_gl_proc("glCompileShader");
gdraw_real_linkprogram = (gdraw_linkprogram_fn)get_gl_proc("glLinkProgram");
gdraw_real_teximage2d = (gdraw_teximage2d_fn)get_gl_proc("glTexImage2D");
(gdraw_compileshader_fn)SDL_GL_GetProcAddress("glCompileShader");
gdraw_real_linkprogram =
(gdraw_linkprogram_fn)SDL_GL_GetProcAddress("glLinkProgram");
gdraw_real_teximage2d =
(gdraw_teximage2d_fn)SDL_GL_GetProcAddress("glTexImage2D");
gdraw_real_texsubimage2d =
(gdraw_texsubimage2d_fn)get_gl_proc("glTexSubImage2D");
gdraw_real_useprogram = (gdraw_useprogram_fn)get_gl_proc("glUseProgram");
(gdraw_texsubimage2d_fn)SDL_GL_GetProcAddress("glTexSubImage2D");
gdraw_real_useprogram =
(gdraw_useprogram_fn)SDL_GL_GetProcAddress("glUseProgram");
gdraw_real_drawelements =
(gdraw_drawelements_fn)get_gl_proc("glDrawElements");
(gdraw_drawelements_fn)SDL_GL_GetProcAddress("glDrawElements");
gdraw_glGetStringi = (PFNGLGETSTRINGIPROC_)get_gl_proc("glGetStringi");
gdraw_glGetStringi =
(PFNGLGETSTRINGIPROC_)SDL_GL_GetProcAddress("glGetStringi");
gdraw_glGenVertexArrays =
(PFNGLGENVERTEXARRAYSPROC_)get_gl_proc("glGenVertexArrays");
(PFNGLGENVERTEXARRAYSPROC_)SDL_GL_GetProcAddress("glGenVertexArrays");
gdraw_glBindVertexArray =
(PFNGLBINDVERTEXARRAYPROC_)get_gl_proc("glBindVertexArray");
(PFNGLBINDVERTEXARRAYPROC_)SDL_GL_GetProcAddress("glBindVertexArray");
if (gdraw_glGenVertexArrays && gdraw_glBindVertexArray && gdraw_vao == 0) {
gdraw_glGenVertexArrays(1, &gdraw_vao);
@ -688,7 +695,7 @@ static void gdraw_FramebufferRenderbufferSafe(GLenum target, GLenum attachment,
#define glFramebufferRenderbuffer_SAFE gdraw_FramebufferRenderbufferSafe
#define glFramebufferRenderbuffer glFramebufferRenderbuffer_SAFE
#include "app/windows/Iggy/gdraw/gdraw_gl_shared.inl"
#include "gdraw_gl_shared.inl"
#undef glVertexAttribPointer
#define glVertexAttribPointer gdraw_real_vtxattrib

View file

@ -1,9 +1,9 @@
#ifndef __LINUX_IGGY_GDRAW_H__
#define __LINUX_IGGY_GDRAW_H__
#include "app/linux/Iggy/include/rrCore.h"
#include "app/windows/Iggy/include/gdraw.h"
#include "app/windows/Iggy/include/iggy.h"
#include "app/common/Iggy/include/gdraw.h"
#include "app/common/Iggy/include/iggy.h"
#include "app/common/Iggy/include/rrCore.h"
#ifdef __cplusplus
extern "C" {

View file

@ -1533,4 +1533,4 @@ static char* vshader_vsglihud_arr[1][NUMFRAGMENTS_vshader_vsglihud] = {
static char** vshader_vsglihud(void) { return vshader_vsglihud_arr[0]; }
static char* vshader_vsglihud_vars[] = {"worldview", "material", "textmode",
NULL};
NULL};

View file

@ -2692,4 +2692,4 @@ void gdraw_GLx_(DestroyContext)(void) {
opengl_check();
free_gdraw();
}
}

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