diff --git a/meson.build b/meson.build index 72e6294dc..e98243b34 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/meson.options b/meson.options index 4dc73f322..c2ed70bfc 100644 --- a/meson.options +++ b/meson.options @@ -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.', +) diff --git a/scripts/copy_assets_to_client.py b/scripts/copy_assets_to_app.py similarity index 100% rename from scripts/copy_assets_to_client.py rename to scripts/copy_assets_to_app.py diff --git a/scripts/format.py b/scripts/format.py new file mode 100644 index 000000000..6819e4dad --- /dev/null +++ b/scripts/format.py @@ -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()) diff --git a/scripts/list_sources.py b/scripts/list_sources.py new file mode 100644 index 000000000..f0e8ebbe8 --- /dev/null +++ b/scripts/list_sources.py @@ -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()) diff --git a/scripts/llvm_native.txt b/scripts/llvm_native.txt index 256f052ad..17d5b1824 100644 --- a/scripts/llvm_native.txt +++ b/scripts/llvm_native.txt @@ -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++'] diff --git a/subprojects/glew.wrap b/subprojects/glew.wrap new file mode 100644 index 000000000..390dc9a33 --- /dev/null +++ b/subprojects/glew.wrap @@ -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 diff --git a/subprojects/glm.wrap b/subprojects/glm.wrap new file mode 100644 index 000000000..d75571ec0 --- /dev/null +++ b/subprojects/glm.wrap @@ -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 diff --git a/subprojects/packagefiles/simdutf/meson.build b/subprojects/packagefiles/simdutf/meson.build index 573d5d8b7..f4035adeb 100644 --- a/subprojects/packagefiles/simdutf/meson.build +++ b/subprojects/packagefiles/simdutf/meson.build @@ -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'], diff --git a/subprojects/packagefiles/stb/meson.build b/subprojects/packagefiles/stb/meson.build index aad077a49..a1e039357 100644 --- a/subprojects/packagefiles/stb/meson.build +++ b/subprojects/packagefiles/stb/meson.build @@ -1,3 +1,7 @@ project('stb', 'c') -stb_inc = include_directories('.') \ No newline at end of file +stb_dep = declare_dependency( + include_directories: include_directories('.'), +) + +meson.override_dependency('stb', stb_dep) \ No newline at end of file diff --git a/subprojects/sdl2.wrap b/subprojects/sdl2.wrap new file mode 100644 index 000000000..39031b2de --- /dev/null +++ b/subprojects/sdl2.wrap @@ -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 diff --git a/subprojects/simdutf.wrap b/subprojects/simdutf.wrap index 98153f2b7..47336fedf 100644 --- a/subprojects/simdutf.wrap +++ b/subprojects/simdutf.wrap @@ -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] diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 000000000..0626401ac --- /dev/null +++ b/subprojects/zlib.wrap @@ -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 diff --git a/targets/app/Network Implementation Notes.md b/targets/app/Network Implementation Notes.md deleted file mode 100644 index 13280a8bb..000000000 --- a/targets/app/Network Implementation Notes.md +++ /dev/null @@ -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` diff --git a/targets/app/ReadMe.txt b/targets/app/ReadMe.txt deleted file mode 100644 index f5f0faa17..000000000 --- a/targets/app/ReadMe.txt +++ /dev/null @@ -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. - -///////////////////////////////////////////////////////////////////////////// diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index e181f1b02..560fab883 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -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); } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index 51891379d..0cfb98a17 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -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; diff --git a/targets/app/common/App_Defines.h b/targets/app/common/App_Defines.h deleted file mode 100644 index f5d301268..000000000 --- a/targets/app/common/App_Defines.h +++ /dev/null @@ -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; -*/ diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index a128211e7..e138baded 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,15 +2,15 @@ #include -#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; diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 6ad335052..ce028bb31 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -3,14 +3,14 @@ #include #include +#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 } } diff --git a/targets/app/common/Audio/ConsoleSoundEngine.cpp b/targets/app/common/Audio/ConsoleSoundEngine.cpp new file mode 100644 index 000000000..289f46810 --- /dev/null +++ b/targets/app/common/Audio/ConsoleSoundEngine.cpp @@ -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; +} diff --git a/targets/app/common/Audio/Consoles_SoundEngine.h b/targets/app/common/Audio/ConsoleSoundEngine.h similarity index 88% rename from targets/app/common/Audio/Consoles_SoundEngine.h rename to targets/app/common/Audio/ConsoleSoundEngine.h index 9616dcfc2..10ef82eca 100644 --- a/targets/app/common/Audio/Consoles_SoundEngine.h +++ b/targets/app/common/Audio/ConsoleSoundEngine.h @@ -4,7 +4,7 @@ #include #include -#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* players, float a) = 0; virtual void destroy() = 0; virtual void play(int iSound, float x, float y, float z, float volume, diff --git a/targets/app/common/Audio/Consoles_SoundEngine.cpp b/targets/app/common/Audio/Consoles_SoundEngine.cpp deleted file mode 100644 index 57d54565b..000000000 --- a/targets/app/common/Audio/Consoles_SoundEngine.cpp +++ /dev/null @@ -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; -} diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 9be84139d..298124cc4 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -10,13 +10,9 @@ #include #include -#include "platform/PlatformTypes.h" -#include "app/common/App_Defines.h" -#include "app/common/Audio/Consoles_SoundEngine.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "platform/C4JThread.h" -#include "platform/fs/fs.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -24,8 +20,10 @@ #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" +#include "platform/thread/C4JThread.h" -#if defined(__linux__) #define STB_VORBIS_HEADER_ONLY #include "stb_vorbis.c" @@ -56,10 +54,6 @@ int strcasecmp(const char* a, const char* b) { #undef R #undef TRUE #undef FALSE -#endif -#if defined(_WINDOWS64) -#include "app/windows/WindowsGame.h" -#endif // ASSETS const char* SoundEngine::m_szStreamFileA[eStream_Max] = {"calm1", @@ -102,28 +96,36 @@ const char* SoundEngine::m_szStreamFileA[eStream_Max] = {"calm1", "strad", "ward", "where_are_we_now"}; -#if defined(__linux__) char SoundEngine::m_szSoundPath[] = {"app/common/Sound/"}; char SoundEngine::m_szMusicPath[] = {"app/common/"}; char SoundEngine::m_szRedistName[] = {"redist64"}; -#endif -#if defined(_WINDOWS64) -char SoundEngine::m_szSoundPath[] = {"Durango\\Sound\\"}; -char SoundEngine::m_szMusicPath[] = {"music\\"}; -char SoundEngine::m_szRedistName[] = {"redist64"}; -#endif // END ASSETS // Linux specific functions -#if defined(__linux__) -SoundEngine::SoundEngine() {} + +// PIMPL'd state for the miniaudio backend. Defined here so SoundEngine.h +// stays free of miniaudio.h. +struct SoundEngineMiniAudio { + ma_engine engine{}; + ma_engine_config engineConfig{}; + ma_sound musicStream{}; +}; + +struct MiniAudioSound { + ma_sound sound; + AUDIO_INFO info; + bool active; +}; + +SoundEngine::SoundEngine() + : m_audio(std::make_unique()) {} +SoundEngine::~SoundEngine() = default; std::vector m_activeSounds; void SoundEngine::init(Options* pOptions) { app.DebugPrintf("---SoundEngine::init\n"); random = new Random(); - memset(&m_engine, 0, sizeof(ma_engine)); - memset(&m_engineConfig, 0, sizeof(ma_engine_config)); + *m_audio = SoundEngineMiniAudio{}; m_musicStreamActive = false; m_StreamState = eMusicStreamState_Idle; m_iMusicDelay = 0; @@ -149,15 +151,16 @@ void SoundEngine::init(Options* pOptions) { sizeof(int) * (static_cast(eSoundType_MAX) + static_cast(eSFX_MAX))); memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT); - m_engineConfig = ma_engine_config_init(); - m_engineConfig.listenerCount = MAX_LOCAL_PLAYERS; + m_audio->engineConfig = ma_engine_config_init(); + m_audio->engineConfig.listenerCount = MAX_LOCAL_PLAYERS; - if (ma_engine_init(&m_engineConfig, &m_engine) != MA_SUCCESS) { + if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != + MA_SUCCESS) { app.DebugPrintf("Failed to initialize miniaudio engine\n"); return; } - ma_engine_set_volume(&m_engine, 1.0f); + ma_engine_set_volume(&m_audio->engine, 1.0f); m_MasterMusicVolume = 1.0f; m_MasterEffectsVolume = 1.0f; @@ -166,7 +169,7 @@ void SoundEngine::init(Options* pOptions) { m_bSystemMusicPlaying = false; } -void SoundEngine::destroy() { ma_engine_uninit(&m_engine); } +void SoundEngine::destroy() { ma_engine_uninit(&m_audio->engine); } void SoundEngine::play(int iSound, float x, float y, float z, float volume, float pitch) { @@ -177,9 +180,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, if (szId[i] == '.') szId[i] = '/'; std::string base = PlatformFilesystem.getBasePath().string() + "/"; - const char* roots[] = { - "Sound/Minecraft/", "app/common/Sound/Minecraft/", - "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; + const char* roots[] = {"Sound/Minecraft/", "app/common/Sound/Minecraft/", + "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; char finalPath[512] = {0}; bool found = false; @@ -222,8 +224,9 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, s->info.pitch = pitch; s->info.bIs3D = true; - if (ma_sound_init_from_file(&m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_TRUE); ma_sound_set_min_distance(&s->sound, 2.0f); ma_sound_set_max_distance(&s->sound, 48.0f); @@ -274,8 +277,9 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { s->info.pitch = pitch; s->info.bIs3D = false; - if (ma_sound_init_from_file(&m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_FALSE); ma_sound_set_volume(&s->sound, volume * m_MasterEffectsVolume); ma_sound_set_pitch(&s->sound, pitch); @@ -410,14 +414,15 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { const char* ext = strrchr(soundEngine->m_szStreamName, '.'); if (soundEngine->m_musicStreamActive) { - ma_sound_stop(&soundEngine->m_musicStream); - ma_sound_uninit(&soundEngine->m_musicStream); + ma_sound_stop(&soundEngine->m_audio->musicStream); + ma_sound_uninit(&soundEngine->m_audio->musicStream); soundEngine->m_musicStreamActive = false; } ma_result result = ma_sound_init_from_file( - &soundEngine->m_engine, soundEngine->m_szStreamName, - MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEngine->m_musicStream); + &soundEngine->m_audio->engine, soundEngine->m_szStreamName, + MA_SOUND_FLAG_STREAM, nullptr, nullptr, + &soundEngine->m_audio->musicStream); if (result != MA_SUCCESS) { app.DebugPrintf( @@ -427,8 +432,9 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { return 0; } - ma_sound_set_spatialization_enabled(&soundEngine->m_musicStream, MA_FALSE); - ma_sound_set_looping(&soundEngine->m_musicStream, MA_FALSE); + ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, + MA_FALSE); + ma_sound_set_looping(&soundEngine->m_audio->musicStream, MA_FALSE); soundEngine->m_musicStreamActive = true; @@ -445,27 +451,29 @@ void SoundEngine::playMusicTick() { return; } if (m_musicID != -1) { - std::string base = PlatformFilesystem.getBasePath().string() + "/"; + std::string base = + PlatformFilesystem.getBasePath().string() + "/"; bool isCD = (m_musicID >= m_iStream_CD_1); const char* folder = isCD ? "cds/" : "music/"; const char* track = m_szStreamFileA[m_musicID]; bool found = false; m_szStreamName[0] = '\0'; - const char* roots[] = {"app/common/music/", - "music/", "./"}; + const char* roots[] = {"app/common/music/", "music/", "./"}; for (const char* r : roots) { for (const char* e : {".ogg", ".mp3", ".wav"}) { // try with folder prefix (music/ or cds/) - snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s%s", base.c_str(), r, folder, - track, e); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s%s", base.c_str(), r, folder, track, + e); if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; } // try without folder prefix - snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s", base.c_str(), r, track, e); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s", base.c_str(), r, track, e); if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; @@ -503,19 +511,20 @@ void SoundEngine::playMusicTick() { } ma_sound_set_spatialization_enabled( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.bIs3D ? MA_TRUE : MA_FALSE); if (m_StreamingAudioInfo.bIs3D) { ma_sound_set_position( - &m_musicStream, m_StreamingAudioInfo.x, + &m_audio->musicStream, m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, m_StreamingAudioInfo.z); } - ma_sound_set_pitch(&m_musicStream, m_StreamingAudioInfo.pitch); + ma_sound_set_pitch(&m_audio->musicStream, + m_StreamingAudioInfo.pitch); ma_sound_set_volume( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.volume * getMasterMusicVolume()); - ma_sound_start(&m_musicStream); + ma_sound_start(&m_audio->musicStream); m_StreamState = eMusicStreamState_Playing; } @@ -531,8 +540,8 @@ void SoundEngine::playMusicTick() { case eMusicStreamState_Stop: if (m_musicStreamActive) { - ma_sound_stop(&m_musicStream); - ma_sound_uninit(&m_musicStream); + ma_sound_stop(&m_audio->musicStream); + ma_sound_uninit(&m_audio->musicStream); m_musicStreamActive = false; } SetIsPlayingStreamingCDMusic(false); @@ -591,7 +600,7 @@ void SoundEngine::playMusicTick() { // volume change required? if (m_musicStreamActive) ma_sound_set_volume( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.volume * fMusicVol); } else if (m_StreamingAudioInfo.bIs3D && m_validListenerCount > 1 && @@ -616,7 +625,7 @@ void SoundEngine::playMusicTick() { } } ma_sound_set_position( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.x - m_ListenerA[iClosest].vPosition.x, m_StreamingAudioInfo.y - m_ListenerA[iClosest].vPosition.y, m_StreamingAudioInfo.z - m_ListenerA[iClosest].vPosition.z); @@ -645,9 +654,9 @@ void SoundEngine::playMusicTick() { // check the status of the stream - this is for when a track completes // rather than is stopped by the user action - if (m_musicStreamActive && !ma_sound_is_playing(&m_musicStream) && - ma_sound_at_end(&m_musicStream)) { - ma_sound_uninit(&m_musicStream); + if (m_musicStreamActive && !ma_sound_is_playing(&m_audio->musicStream) && + ma_sound_at_end(&m_audio->musicStream)) { + ma_sound_uninit(&m_audio->musicStream); m_musicStreamActive = false; SetIsPlayingStreamingCDMusic(false); SetIsPlayingStreamingGameMusic(false); @@ -660,23 +669,24 @@ void SoundEngine::updateMiniAudio() { for (size_t i = 0; i < MAX_LOCAL_PLAYERS; i++) { if (m_ListenerA[i].bValid) { ma_engine_listener_set_position( - &m_engine, 0, m_ListenerA[i].vPosition.x, + &m_audio->engine, 0, m_ListenerA[i].vPosition.x, m_ListenerA[i].vPosition.y, m_ListenerA[i].vPosition.z); - ma_engine_listener_set_direction(&m_engine, 0, + ma_engine_listener_set_direction(&m_audio->engine, 0, m_ListenerA[i].vOrientFront.x, m_ListenerA[i].vOrientFront.y, m_ListenerA[i].vOrientFront.z); - ma_engine_listener_set_world_up(&m_engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, + 0.0f); break; } } } else { - ma_engine_listener_set_position(&m_engine, 0, 0.0f, 0.0f, 0.0f); - ma_engine_listener_set_direction(&m_engine, 0, 0.0f, 0.0f, 1.0f); - ma_engine_listener_set_world_up(&m_engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_position(&m_audio->engine, 0, 0.0f, 0.0f, 0.0f); + ma_engine_listener_set_direction(&m_audio->engine, 0, 0.0f, 0.0f, 1.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, 0.0f); } for (auto it = m_activeSounds.begin(); it != m_activeSounds.end();) { @@ -782,1050 +792,6 @@ void SoundEngine::tick(std::shared_ptr* players, float a) { m_validListenerCount = listenerCount; updateMiniAudio(); } -// Classic sound module -#else -void SoundEngine::init(Options* pOptions) { - app.DebugPrintf("---SoundEngine::init\n"); -#if defined(__DISABLE_MILES__) - return; -#endif - - char* redistpath; - -#if defined(_WINDOWS64) - redistpath = AIL_set_redist_directory(m_szRedistName); -#endif - - app.DebugPrintf("---SoundEngine::init - AIL_startup\n"); - S32 ret = AIL_startup(); - - int iNumberOfChannels = initAudioHardware(8); - - // Create a driver to render our audio - 44khz, 16 bit, - m_hDriver = AIL_open_digital_driver(44100, 16, MSS_MC_USE_SYSTEM_CONFIG, 0); - if (m_hDriver == 0) { - app.DebugPrintf("Couldn't open digital sound driver. (%s)\n", - AIL_last_error()); - AIL_shutdown(); - return; - } - app.DebugPrintf("---SoundEngine::init - driver opened\n"); - - AIL_set_event_error_callback(ErrorCallback); - - AIL_set_3D_rolloff_factor(m_hDriver, 1.0); - - // Create an event system tied to that driver - let Miles choose memory - // defaults. - // if (AIL_startup_event_system(m_hDriver, 0, 0, 0) == 0) - // 4J-PB - Durango complains that the default memory (64k)isn't enough - // Error: MilesEvent: Out of event system memory (pool passed to event - // system startup exhausted). AP - increased command buffer from the default - // 5K to 20K for Vita - - if (AIL_startup_event_system(m_hDriver, 1024 * 20, 0, 1024 * 128) == 0) { - app.DebugPrintf("Couldn't init event system (%s).\n", AIL_last_error()); - AIL_close_digital_driver(m_hDriver); - AIL_shutdown(); - app.DebugPrintf( - "---SoundEngine::init - AIL_startup_event_system failed\n"); - return; - } - char szBankName[255]; - strcpy((char*)szBankName, m_szSoundPath); - - strcat((char*)szBankName, "Minecraft.msscmp"); - - m_hBank = AIL_add_soundbank(szBankName, 0); - - if (m_hBank == nullptr) { - char* Error = AIL_last_error(); - app.DebugPrintf("Couldn't open soundbank: %s (%s)\n", szBankName, - Error); - AIL_close_digital_driver(m_hDriver); - AIL_shutdown(); - return; - } - - // #ifdef _DEBUG - HMSSENUM token = MSS_FIRST; - char const* Events[1] = {0}; - S32 EventCount = 0; - while (AIL_enumerate_events(m_hBank, &token, 0, &Events[0])) { - app.DebugPrintf(4, "%d - %s\n", EventCount, Events[0]); - - EventCount++; - } - // #endif - - U64 u64Result; - u64Result = AIL_enqueue_event_by_name("Minecraft/CacheSounds"); - - m_MasterMusicVolume = 1.0f; - m_MasterEffectsVolume = 1.0f; - - // AIL_set_variable_float(0,"UserEffectVol",1); - - m_bSystemMusicPlaying = false; - - m_openStreamThread = nullptr; -} - -// AP - moved to a separate function so it can be called from the mixer callback -// on Vita -void SoundEngine::updateMiles() { - if (m_validListenerCount == 1) { - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - // set the listener as the first player we find - if (m_ListenerA[i].bValid) { - AIL_set_listener_3D_position( - m_hDriver, m_ListenerA[i].vPosition.x, - m_ListenerA[i].vPosition.y, - -m_ListenerA[i] - .vPosition.z); // Flipped sign of z as Miles is - // expecting left handed coord system - AIL_set_listener_3D_orientation( - m_hDriver, -m_ListenerA[i].vOrientFront.x, - m_ListenerA[i].vOrientFront.y, - m_ListenerA[i].vOrientFront.z, 0, 1, - 0); // Flipped sign of z as Miles is expecting left handed - // coord system - break; - } - } - } else { - // 4J-PB - special case for splitscreen - // the shortest distance between any listener and a sound will be used - // to play a sound a set distance away down the z axis. The listener - // position will be set to 0,0,0, and the orientation will be facing - // down the z axis - - AIL_set_listener_3D_position(m_hDriver, 0, 0, 0); - AIL_set_listener_3D_orientation(m_hDriver, 0, 0, 1, 0, 1, 0); - } - - AIL_begin_event_queue_processing(); - - // Iterate over the sounds - S32 StartedCount = 0, CompletedCount = 0, TotalCount = 0; - HMSSENUM token = MSS_FIRST; - MILESEVENTSOUNDINFO SoundInfo; - int Playing = 0; - while (AIL_enumerate_sound_instances(0, &token, 0, 0, 0, &SoundInfo)) { - AUDIO_INFO* game_data = (AUDIO_INFO*)(SoundInfo.UserBuffer); - - if (SoundInfo.Status == MILESEVENT_SOUND_STATUS_PLAYING) { - Playing += 1; - } - - if (SoundInfo.Status != MILESEVENT_SOUND_STATUS_COMPLETE) { - // apply the master volume - // watch for the 'special' volume levels - bool isThunder = false; - if (game_data->volume == 10000.0f) { - isThunder = true; - } - if (game_data->volume > 1) { - game_data->volume = 1; - } - AIL_set_sample_volume_levels( - SoundInfo.Sample, game_data->volume * m_MasterEffectsVolume, - game_data->volume * m_MasterEffectsVolume); - - float distanceScaler = 16.0f; - switch (SoundInfo.Status) { - case MILESEVENT_SOUND_STATUS_PENDING: - // 4J-PB - causes the falloff to be calculated on the PPU - // instead of the SPU, and seems to resolve our distorted - // sound issue - AIL_register_falloff_function_callback( - SoundInfo.Sample, &custom_falloff_function); - - if (game_data->bIs3D) { - AIL_set_sample_is_3D(SoundInfo.Sample, 1); - - int iSound = game_data->iSound - eSFX_MAX; - switch (iSound) { - // Is this the Dragon? - case eSoundType_MOB_ENDERDRAGON_GROWL: - case eSoundType_MOB_ENDERDRAGON_MOVE: - case eSoundType_MOB_ENDERDRAGON_END: - case eSoundType_MOB_ENDERDRAGON_HIT: - distanceScaler = 100.0f; - break; - case eSoundType_FIREWORKS_BLAST: - case eSoundType_FIREWORKS_BLAST_FAR: - case eSoundType_FIREWORKS_LARGE_BLAST: - case eSoundType_FIREWORKS_LARGE_BLAST_FAR: - distanceScaler = 100.0f; - break; - case eSoundType_MOB_GHAST_MOAN: - case eSoundType_MOB_GHAST_SCREAM: - case eSoundType_MOB_GHAST_DEATH: - case eSoundType_MOB_GHAST_CHARGE: - case eSoundType_MOB_GHAST_FIREBALL: - distanceScaler = 30.0f; - break; - } - - // Set a special distance scaler for thunder, which we - // respond to by having no attenutation - if (isThunder) { - distanceScaler = 10000.0f; - } - } else { - AIL_set_sample_is_3D(SoundInfo.Sample, 0); - } - - AIL_set_sample_3D_distances(SoundInfo.Sample, - distanceScaler, 1, 0); - // set the pitch - if (!game_data->bUseSoundsPitchVal) { - AIL_set_sample_playback_rate_factor(SoundInfo.Sample, - game_data->pitch); - } - - if (game_data->bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to - // the nearest listener - use Manhattan Distance as - // the decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - game_data->x); - y = fabs(m_ListenerA[i].vPosition.y - - game_data->y); - z = fabs(m_ListenerA[i].vPosition.z - - game_data->z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so - // floats rather than casts to doubles should be - // fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(SoundInfo.Sample, 0, 0, - fDist); - - // app.DebugPrintf("Playing sound %d %f from nearest - // listener - // [%d]\n",SoundInfo.EventID,fDist,iClosestListener); - } else { - AIL_set_sample_3D_position( - SoundInfo.Sample, game_data->x, game_data->y, - -game_data->z); // Flipped sign of z as Miles - // is expecting left handed - // coord system - } - } - break; - - default: - if (game_data->bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to - // the nearest listener - use Manhattan Distance as - // the decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - game_data->x); - y = fabs(m_ListenerA[i].vPosition.y - - game_data->y); - z = fabs(m_ListenerA[i].vPosition.z - - game_data->z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - // our distances in the world aren't very big, so - // floats rather than casts to doubles should be - // fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(SoundInfo.Sample, 0, 0, - fDist); - - // app.DebugPrintf("Playing sound %d %f from nearest - // listener - // [%d]\n",SoundInfo.EventID,fDist,iClosestListener); - } else { - AIL_set_sample_3D_position( - SoundInfo.Sample, game_data->x, game_data->y, - -game_data->z); // Flipped sign of z as Miles - // is expecting left handed - // coord system - } - } - break; - } - } - } - AIL_complete_event_queue_processing(); -} - -// #define DISTORTION_TEST -#if defined(DISTORTION_TEST) -static float fVal = 0.0f; -#endif -///////////////////////////////////////////// -// -// tick -// -///////////////////////////////////////////// - -void SoundEngine::tick(std::shared_ptr* players, float a) { -#if defined(__DISABLE_MILES__) - return; -#endif - - // update the listener positions - int listenerCount = 0; -#if defined(DISTORTION_TEST) - float fX, fY, fZ; -#endif - if (players) { - bool bListenerPostionSet = false; - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (players[i] != nullptr) { - m_ListenerA[i].bValid = true; - F32 x, y, z; - x = players[i]->xo + (players[i]->x - players[i]->xo) * a; - y = players[i]->yo + (players[i]->y - players[i]->yo) * a; - z = players[i]->zo + (players[i]->z - players[i]->zo) * a; - - float yRot = players[i]->yRotO + - (players[i]->yRot - players[i]->yRotO) * a; - float yCos = - (float)cos(-yRot * Mth::DEG_TO_RAD - std::numbers::pi); - float ySin = - (float)sin(-yRot * Mth::DEG_TO_RAD - std::numbers::pi); - - // store the listener positions for splitscreen - m_ListenerA[i].vPosition.x = x; - m_ListenerA[i].vPosition.y = y; - m_ListenerA[i].vPosition.z = z; - - m_ListenerA[i].vOrientFront.x = ySin; - m_ListenerA[i].vOrientFront.y = 0; - m_ListenerA[i].vOrientFront.z = yCos; - - listenerCount++; - } else { - m_ListenerA[i].bValid = false; - } - } - } - - // If there were no valid players set, make up a default listener - if (listenerCount == 0) { - m_ListenerA[0].vPosition.x = 0; - m_ListenerA[0].vPosition.y = 0; - m_ListenerA[0].vPosition.z = 0; - m_ListenerA[0].vOrientFront.x = 0; - m_ListenerA[0].vOrientFront.y = 0; - m_ListenerA[0].vOrientFront.z = 1.0f; - listenerCount++; - } - m_validListenerCount = listenerCount; - - updateMiles(); -} -SoundEngine::SoundEngine() { - random = new Random(); - m_hStream = 0; - m_StreamState = eMusicStreamState_Idle; - m_iMusicDelay = 0; - m_validListenerCount = 0; - - m_bHeardTrackA = nullptr; - - // Start the streaming music playing some music from the overworld - SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3, - eStream_Nether1, eStream_Nether4, eStream_end_dragon, - eStream_end_end, eStream_CD_1); - - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - - m_StreamingAudioInfo.bIs3D = false; - m_StreamingAudioInfo.x = 0; - m_StreamingAudioInfo.y = 0; - m_StreamingAudioInfo.z = 0; - m_StreamingAudioInfo.volume = 1; - m_StreamingAudioInfo.pitch = 1; - - memset(CurrentSoundsPlaying, 0, sizeof(int) * (eSoundType_MAX + eSFX_MAX)); - memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT); -} - -void SoundEngine::destroy() {} -#if defined(_DEBUG) -void SoundEngine::GetSoundName(char* szSoundName, int iSound) { - strcpy((char*)szSoundName, "Minecraft/"); - std::string name = wchSoundNames[iSound]; - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); -} -#endif -///////////////////////////////////////////// -// -// play -// -///////////////////////////////////////////// -void SoundEngine::play(int iSound, float x, float y, float z, float volume, - float pitch) { - U8 szSoundName[256]; - - if (iSound == -1) { - app.DebugPrintf(6, "PlaySound with sound of -1 !!!!!!!!!!!!!!!\n"); - return; - } - - // AP removed old counting system. Now relying on Miles' Play Count Limit - /* // if we are already playing loads of this sounds ignore this one - if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) - { - // std::string name = wchSoundNames[iSound]; - // char *SoundName = (char *)ConvertSoundPathToName(name); - // app.DebugPrintf("Too many %s sounds playing!\n",SoundName); - return; - }*/ - - // if (iSound != eSoundType_MOB_IRONGOLEM_WALK) return; - - // build the name - strcpy((char*)szSoundName, "Minecraft/"); - -#if defined(DISTORTION_TEST) - std::string name = wchSoundNames[eSoundType_MOB_ENDERDRAGON_GROWL]; -#else - std::string name = wchSoundNames[iSound]; -#endif - - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); - - // app.DebugPrintf(6,"PlaySound - %d - %s - %s (%f %f %f, vol %f, pitch - //%f)\n",iSound, SoundName, szSoundName,x,y,z,volume,pitch); - - AUDIO_INFO AudioInfo; - AudioInfo.x = x; - AudioInfo.y = y; - AudioInfo.z = z; - AudioInfo.volume = volume; - AudioInfo.pitch = pitch; - AudioInfo.bIs3D = true; - AudioInfo.bUseSoundsPitchVal = false; - AudioInfo.iSound = iSound + eSFX_MAX; -#if defined(_DEBUG) - strncpy(AudioInfo.chName, (char*)szSoundName, 64); -#endif - - S32 token = AIL_enqueue_event_start(); - AIL_enqueue_event_buffer(&token, &AudioInfo, sizeof(AUDIO_INFO), 0); - AIL_enqueue_event_end_named(token, (char*)szSoundName); -} - -///////////////////////////////////////////// -// -// playUI -// -///////////////////////////////////////////// -void SoundEngine::playUI(int iSound, float volume, float pitch) { - U8 szSoundName[256]; - std::string name; - // we have some game sounds played as UI sounds... - // Not the best way to do this, but it seems to only be the portal sounds - - if (iSound >= eSFX_MAX) { - // AP removed old counting system. Now relying on Miles' Play Count - // Limit - /* // if we are already playing loads of this sounds ignore - this one - if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) - return;*/ - - // build the name - strcpy((char*)szSoundName, "Minecraft/"); - name = wchSoundNames[iSound]; - } else { - // AP removed old counting system. Now relying on Miles' Play Count - // Limit - /* // if we are already playing loads of this sounds ignore - this one if(CurrentSoundsPlaying[iSound]>MAX_SAME_SOUNDS_PLAYING) - return;*/ - - // build the name - strcpy((char*)szSoundName, "Minecraft/UI/"); - name = wchUISoundNames[iSound]; - } - - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); - // app.DebugPrintf("UI: Playing %s, volume %f, pitch - //%f\n",SoundName,volume,pitch); - - // app.DebugPrintf("PlaySound - %d - %s\n",iSound, SoundName); - - AUDIO_INFO AudioInfo; - memset(&AudioInfo, 0, sizeof(AUDIO_INFO)); - AudioInfo.volume = volume; // will be multiplied by the master volume - AudioInfo.pitch = pitch; - AudioInfo.bUseSoundsPitchVal = true; - if (iSound >= eSFX_MAX) { - AudioInfo.iSound = iSound + eSFX_MAX; - } else { - AudioInfo.iSound = iSound; - } -#if defined(_DEBUG) - strncpy(AudioInfo.chName, (char*)szSoundName, 64); -#endif - - // 4J-PB - not going to stop UI events happening based on the number of - // currently playing sounds - S32 token = AIL_enqueue_event_start(); - AIL_enqueue_event_buffer(&token, &AudioInfo, sizeof(AUDIO_INFO), 0); - AIL_enqueue_event_end_named(token, (char*)szSoundName); -} -///////////////////////////////////////////// -// -// playStreaming -// -///////////////////////////////////////////// -void SoundEngine::playStreaming(const std::string& name, float x, float y, - float z, float volume, float pitch, - bool bMusicDelay) { - // This function doesn't actually play a streaming sound, just sets states - // and an id for the music tick to play it Level audio will be played when a - // play with an empty name comes in CD audio will be played when a named - // stream comes in - - m_StreamingAudioInfo.x = x; - m_StreamingAudioInfo.y = y; - m_StreamingAudioInfo.z = z; - m_StreamingAudioInfo.volume = volume; - m_StreamingAudioInfo.pitch = pitch; - - if (m_StreamState == eMusicStreamState_Playing) { - m_StreamState = eMusicStreamState_Stop; - } else if (m_StreamState == eMusicStreamState_Opening) { - m_StreamState = eMusicStreamState_OpeningCancel; - } - - if (name.empty()) { - // music, or stop CD - m_StreamingAudioInfo.bIs3D = false; - - // we need a music id - // random delay of up to 3 minutes for music - m_iMusicDelay = random->nextInt( - 20 * 60 * 3); // random->nextInt(20 * 60 * 10) + 20 * 60 * 10; - -#if defined(_DEBUG) - m_iMusicDelay = 0; -#endif - Minecraft* pMinecraft = Minecraft::GetInstance(); - - bool playerInEnd = false; - bool playerInNether = false; - - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - if (playerInEnd) { - m_musicID = getMusicID(LevelData::DIMENSION_END); - } else if (playerInNether) { - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - } else { - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - } - } else { - // jukebox - m_StreamingAudioInfo.bIs3D = true; - m_musicID = getMusicID(name); - m_iMusicDelay = 0; - } -} -int SoundEngine::OpenStreamThreadProc(void* lpParameter) { -#if defined(__DISABLE_MILES__) - return 0; -#endif - SoundEngine* soundEngine = (SoundEngine*)lpParameter; - soundEngine->m_hStream = - AIL_open_stream(soundEngine->m_hDriver, soundEngine->m_szStreamName, 0); - return 0; -} -///////////////////////////////////////////// -// -// playMusicTick -// -///////////////////////////////////////////// -void SoundEngine::playMusicTick() { - // AP - vita will update the music during the mixer callback - playMusicUpdate(); -} - -// AP - moved to a separate function so it can be called from the mixer callback -// on Vita -void SoundEngine::playMusicUpdate() { - // return; - static bool firstCall = true; - static float fMusicVol = 0.0f; - if (firstCall) { - fMusicVol = getMasterMusicVolume(); - firstCall = false; - } - - switch (m_StreamState) { - case eMusicStreamState_Idle: - - // start a stream playing - if (m_iMusicDelay > 0) { - m_iMusicDelay--; - return; - } - - if (m_musicID != -1) { - // start playing it - - strcpy((char*)m_szStreamName, m_szMusicPath); - // are we using a mash-up pack? - // if(pMinecraft && !pMinecraft->skins->isUsingDefaultSkin() && - // pMinecraft->skins->getSelected()->hasAudio()) - if (Minecraft::GetInstance() - ->skins->getSelected() - ->hasAudio()) { - // It's a mash-up - need to use the DLC path for the music - TexturePack* pTexPack = - Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)pTexPack; - DLCPack* pack = pDLCTexPack->getDLCInfoParentPack(); - DLCAudioFile* dlcAudioFile = (DLCAudioFile*)pack->getFile( - DLCManager::e_DLCType_Audio, 0); - - app.DebugPrintf("Mashup pack \n"); - - // build the name - - // if the music ID is beyond the end of the texture pack - // music files, then it's a CD - if (m_musicID < m_iStream_CD_1) { - SetIsPlayingStreamingGameMusic(true); - SetIsPlayingStreamingCDMusic(false); - m_MusicType = eMusicType_Game; - m_StreamingAudioInfo.bIs3D = false; - - std::string& wstrSoundName = - dlcAudioFile->GetSoundName(m_musicID); - char szName[255]; - strncpy(szName, wstrSoundName.c_str(), 255); - - std::string strFile = - "TPACK:\\Data\\" + string(szName) + ".binka"; - std::string mountedPath = - PlatformStorage.GetMountedPath(strFile); - strcpy(m_szStreamName, mountedPath.c_str()); - } else { - SetIsPlayingStreamingGameMusic(false); - SetIsPlayingStreamingCDMusic(true); - m_MusicType = eMusicType_CD; - m_StreamingAudioInfo.bIs3D = true; - - // Need to adjust to index into the cds in the game's - // m_szStreamFileA - strcat((char*)m_szStreamName, "cds/"); - strcat((char*)m_szStreamName, - m_szStreamFileA[m_musicID - m_iStream_CD_1 + - eStream_CD_1]); - strcat((char*)m_szStreamName, ".binka"); - } - } else { - // 4J-PB - if this is a PS3 disc patch, we have to check if - // the music file is in the patch data - if (m_musicID < m_iStream_CD_1) { - SetIsPlayingStreamingGameMusic(true); - SetIsPlayingStreamingCDMusic(false); - m_MusicType = eMusicType_Game; - m_StreamingAudioInfo.bIs3D = false; - // build the name - strcat((char*)m_szStreamName, "music/"); - } else { - SetIsPlayingStreamingGameMusic(false); - SetIsPlayingStreamingCDMusic(true); - m_MusicType = eMusicType_CD; - m_StreamingAudioInfo.bIs3D = true; - // build the name - strcat((char*)m_szStreamName, "cds/"); - } - strcat((char*)m_szStreamName, m_szStreamFileA[m_musicID]); - strcat((char*)m_szStreamName, ".binka"); - } - - // std::string name = - // m_szStreamFileA[m_musicID];char*SoundName=(char - // *)ConvertSoundPathToName(name);strcat((char - // *)szStreamName,SoundName); - - app.DebugPrintf("Starting streaming - %s\n", m_szStreamName); - - // Don't actually open in this thread, as it can block for - // ~300ms. - m_openStreamThread = new C4JThread(OpenStreamThreadProc, this, - "OpenStreamThreadProc"); - m_openStreamThread->run(); - m_StreamState = eMusicStreamState_Opening; - } - break; - - case eMusicStreamState_Opening: - // If the open stream thread is complete, then we are ready to - // proceed to actually playing - if (!m_openStreamThread->isRunning()) { - delete m_openStreamThread; - m_openStreamThread = nullptr; - - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - - // 4J-PB - causes the falloff to be calculated on the PPU - // instead of the SPU, and seems to resolve our distorted sound - // issue - AIL_register_falloff_function_callback( - hSample, &custom_falloff_function); - - if (m_StreamingAudioInfo.bIs3D) { - AIL_set_sample_3D_distances( - hSample, 64.0f, 1, - 0); // Larger distance scaler for music discs - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to the - // nearest listener - use Manhattan Distance as the - // decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - m_StreamingAudioInfo.x); - y = fabs(m_ListenerA[i].vPosition.y - - m_StreamingAudioInfo.y); - z = fabs(m_ListenerA[i].vPosition.z - - m_StreamingAudioInfo.z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so floats - // rather than casts to doubles should be fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(hSample, 0, 0, fDist); - } else { - AIL_set_sample_3D_position( - hSample, m_StreamingAudioInfo.x, - m_StreamingAudioInfo.y, - -m_StreamingAudioInfo - .z); // Flipped sign of z as Miles is - // expecting left handed coord system - } - } else { - // clear the 3d flag on the stream after a jukebox finishes - // and streaming music starts - AIL_set_sample_is_3D(hSample, 0); - } - // set the pitch - app.DebugPrintf("Sample rate:%d\n", - AIL_sample_playback_rate(hSample)); - AIL_set_sample_playback_rate_factor(hSample, - m_StreamingAudioInfo.pitch); - // set the volume - AIL_set_sample_volume_levels( - hSample, - m_StreamingAudioInfo.volume * getMasterMusicVolume(), - m_StreamingAudioInfo.volume * getMasterMusicVolume()); - - AIL_start_stream(m_hStream); - - m_StreamState = eMusicStreamState_Playing; - } - break; - case eMusicStreamState_OpeningCancel: - if (!m_openStreamThread->isRunning()) { - delete m_openStreamThread; - m_openStreamThread = nullptr; - m_StreamState = eMusicStreamState_Stop; - } - break; - case eMusicStreamState_Stop: - // should gradually take the volume down in steps - AIL_pause_stream(m_hStream, 1); - AIL_close_stream(m_hStream); - m_hStream = 0; - SetIsPlayingStreamingCDMusic(false); - SetIsPlayingStreamingGameMusic(false); - m_StreamState = eMusicStreamState_Idle; - break; - case eMusicStreamState_Stopping: - break; - case eMusicStreamState_Play: - break; - case eMusicStreamState_Playing: - if (GetIsPlayingStreamingGameMusic()) { - // if(m_MusicInfo.pCue!=nullptr) - { - bool playerInEnd = false; - bool playerInNether = false; - Minecraft* pMinecraft = Minecraft::GetInstance(); - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - - if (playerInEnd && !GetIsPlayingEndMusic()) { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingEndMusic(true); - SetIsPlayingNetherMusic(false); - } else if (!playerInEnd && GetIsPlayingEndMusic()) { - if (playerInNether) { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingEndMusic(false); - SetIsPlayingNetherMusic(true); - } else { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = - getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingEndMusic(false); - SetIsPlayingNetherMusic(false); - } - } else if (playerInNether && !GetIsPlayingNetherMusic()) { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingNetherMusic(true); - SetIsPlayingEndMusic(false); - } else if (!playerInNether && GetIsPlayingNetherMusic()) { - if (playerInEnd) { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(true); - } else { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = - getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(false); - } - } - - // volume change required? - if (fMusicVol != getMasterMusicVolume()) { - fMusicVol = getMasterMusicVolume(); - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - // AIL_set_sample_3D_position( hSample, - // m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, - // m_StreamingAudioInfo.z ); - AIL_set_sample_volume_levels(hSample, fMusicVol, - fMusicVol); - } - } - } else { - // Music disc playing - if it's a 3D stream, then set the - // position - we don't have any streaming audio in the world - // that moves, so this isn't required unless we have more than - // one listener, and are setting the listening position to the - // origin and setting a fake position for the sound down the z - // axis - if (m_StreamingAudioInfo.bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - - // need to calculate the distance from the sound to the - // nearest listener - use Manhattan Distance as the - // decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - m_StreamingAudioInfo.x); - y = fabs(m_ListenerA[i].vPosition.y - - m_StreamingAudioInfo.y); - z = fabs(m_ListenerA[i].vPosition.z - - m_StreamingAudioInfo.z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so floats - // rather than casts to doubles should be fine - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(hSample, 0, 0, fDist); - } - } - } - - break; - - case eMusicStreamState_Completed: { - // random delay of up to 3 minutes for music - m_iMusicDelay = random->nextInt( - 20 * 60 * 3); // random->nextInt(20 * 60 * 10) + 20 * 60 * 10; - // Check if we have a local player in The Nether or in The End, and - // play that music if they are - Minecraft* pMinecraft = Minecraft::GetInstance(); - bool playerInEnd = false; - bool playerInNether = false; - - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - if (playerInEnd) { - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingEndMusic(true); - SetIsPlayingNetherMusic(false); - } else if (playerInNether) { - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingNetherMusic(true); - SetIsPlayingEndMusic(false); - } else { - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(false); - } - - m_StreamState = eMusicStreamState_Idle; - } break; - } - - // check the status of the stream - this is for when a track completes - // rather than is stopped by the user action - - if (m_hStream != 0) { - if (AIL_stream_status(m_hStream) == SMP_DONE) // SMP_DONE - { - AIL_close_stream(m_hStream); - m_hStream = 0; - SetIsPlayingStreamingCDMusic(false); - SetIsPlayingStreamingGameMusic(false); - - m_StreamState = eMusicStreamState_Completed; - } - } -} -F32 AILCALLBACK custom_falloff_function(HSAMPLE S, F32 distance, - F32 rolloff_factor, F32 min_dist, - F32 max_dist) { - F32 result; - - // This is now emulating the linear fall-off function that we used on the - // Xbox 360. The parameter which is passed as "max_dist" is the only one - // actually used, and is generally used as CurveDistanceScaler is used on - // XACT on the Xbox. A special value of 10000.0f is passed for thunder, - // which has no attenuation - - if (max_dist == 10000.0f) { - return 1.0f; - } - - result = 1.0f - (distance / max_dist); - if (result < 0.0f) result = 0.0f; - if (result > 1.0f) result = 1.0f; - - return result; -} -#endif // Universal, these functions shouldn't need platform specific // implementations @@ -1914,41 +880,3 @@ char* SoundEngine::ConvertSoundPathToName(const std::string& name, bool bConvertSpaces) { return nullptr; } - -void ConsoleSoundEngine::tick() { - if (scheduledSounds.empty()) { - return; - } - - for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) { - SoundEngine::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 SoundEngine::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; -} diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index 91b4ad585..701a92d36 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -4,13 +4,19 @@ class Options; class C4JThread; class Random; +#include #include -#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 m_audio; bool m_musicStreamActive; static char m_szSoundPath[]; diff --git a/targets/app/common/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp index 5b4bbe127..09fb95607 100644 --- a/targets/app/common/Audio/SoundNames.cpp +++ b/targets/app/common/Audio/SoundNames.cpp @@ -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, diff --git a/targets/minecraft/sounds/SoundTypes.h b/targets/app/common/Audio/SoundTypes.h similarity index 100% rename from targets/minecraft/sounds/SoundTypes.h rename to targets/app/common/Audio/SoundTypes.h diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp index fecd02beb..838530ad6 100644 --- a/targets/app/common/BannedListManager.cpp +++ b/targets/app/common/BannedListManager.cpp @@ -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; } diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index a74834c17..7a9c6ef1b 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -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; diff --git a/targets/app/common/DLC/DLCCapeFile.cpp b/targets/app/common/DLC/DLCCapeFile.cpp index bde677ee6..42559a1c8 100644 --- a/targets/app/common/DLC/DLCCapeFile.cpp +++ b/targets/app/common/DLC/DLCCapeFile.cpp @@ -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) {} diff --git a/targets/app/common/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp index af08ce99d..aaca55a6e 100644 --- a/targets/app/common/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -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" diff --git a/targets/app/common/DLC/DLCFile.cpp b/targets/app/common/DLC/DLCFile.cpp index 378bb6403..33e712c9c 100644 --- a/targets/app/common/DLC/DLCFile.cpp +++ b/targets/app/common/DLC/DLCFile.cpp @@ -2,8 +2,8 @@ #include -#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; diff --git a/targets/app/common/DLC/DLCGameRules.h b/targets/app/common/DLC/DLCGameRules.h index 3be9a70ea..fa31ee680 100644 --- a/targets/app/common/DLC/DLCGameRules.h +++ b/targets/app/common/DLC/DLCGameRules.h @@ -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: diff --git a/targets/app/common/DLC/DLCGameRulesHeader.cpp b/targets/app/common/DLC/DLCGameRulesHeader.cpp index e86ec21f7..12a7e19f0 100644 --- a/targets/app/common/DLC/DLCGameRulesHeader.cpp +++ b/targets/app/common/DLC/DLCGameRulesHeader.cpp @@ -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; diff --git a/targets/app/common/DLC/DLCGameRulesHeader.h b/targets/app/common/DLC/DLCGameRulesHeader.h index fa82416c7..cc1dc6468 100644 --- a/targets/app/common/DLC/DLCGameRulesHeader.h +++ b/targets/app/common/DLC/DLCGameRulesHeader.h @@ -4,7 +4,7 @@ #include #include "DLCGameRules.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" class StringTable; diff --git a/targets/app/common/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp index 2c79dca26..d6ef40067 100644 --- a/targets/app/common/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -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(pbData, dataBytes), app.getLocale()); } diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index bbf34088e..db04bcf38 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -13,20 +13,19 @@ #include #include -#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 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++) { diff --git a/targets/app/common/DLC/DLCManager.h b/targets/app/common/DLC/DLCManager.h index 41c534a5e..9f3ef0662 100644 --- a/targets/app/common/DLC/DLCManager.h +++ b/targets/app/common/DLC/DLCManager.h @@ -3,50 +3,77 @@ #include #include #include + +#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, diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 27630c9e6..d7e0f1714 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -6,7 +6,6 @@ #include #include -#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()); } } diff --git a/targets/app/common/DLC/DLCPack.h b/targets/app/common/DLC/DLCPack.h index 60c19d5bc..f225bdcd5 100644 --- a/targets/app/common/DLC/DLCPack.h +++ b/targets/app/common/DLC/DLCPack.h @@ -5,9 +5,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" +#include "platform/PlatformTypes.h" class DLCFile; class DLCSkinFile; diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index be8c44cac..4ac69aee0 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -3,12 +3,12 @@ #include #include -#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; diff --git a/targets/app/common/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h index 4e4d12389..81b3fdfde 100644 --- a/targets/app/common/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -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* getAdditionalBoxes() override; - virtual std::string getParameterAsString( - DLCManager::EDLCParameterType type); - virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); - std::vector* getAdditionalBoxes(); - int getAdditionalBoxesCount(); - unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask; } bool isFree() { return m_bIsFree; } }; diff --git a/targets/app/common/DLC/DLCUIDataFile.cpp b/targets/app/common/DLC/DLCUIDataFile.cpp index b799b548c..73c147893 100644 --- a/targets/app/common/DLC/DLCUIDataFile.cpp +++ b/targets/app/common/DLC/DLCUIDataFile.cpp @@ -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) { diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 13bfa6cf7..cb8bbe61f 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -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 #include +#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 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; { diff --git a/targets/app/common/DLCController.h b/targets/app/common/DLCController.h index fbec77634..2ef3a520b 100644 --- a/targets/app/common/DLCController.h +++ b/targets/app/common/DLCController.h @@ -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); diff --git a/targets/app/common/DebugOptions.cpp b/targets/app/common/DebugOptions.cpp index b8a7bd099..3f16e4d91 100644 --- a/targets/app/common/DebugOptions.cpp +++ b/targets/app/common/DebugOptions.cpp @@ -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 diff --git a/targets/app/common/DebugOptions.h b/targets/app/common/DebugOptions.h index de437d650..b8a922145 100644 --- a/targets/app/common/DebugOptions.h +++ b/targets/app/common/DebugOptions.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" class DebugOptions { public: diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 88b29a8d1..c10d5ed82 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -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 #include #include @@ -72,24 +19,71 @@ #include #include -#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; diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index f87d3cd04..a25cb6f0a 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -3,38 +3,38 @@ #include #include -#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, 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, std::shared_ptr furnace) { @@ -178,7 +180,8 @@ public: bool LoadBrewingStandMenu( int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { - return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand); + return m_menuController.loadBrewingStandMenu(iPad, inventory, + brewingStand); } bool LoadContainerMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container) { @@ -204,12 +207,14 @@ public: } bool LoadRepairingMenu(int iPad, std::shared_ptr 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, std::shared_ptr 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, std::shared_ptr container, std::shared_ptr 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, std::shared_ptr 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 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& vecWstrLocales) { m_localizationManager.getLocale(vecWstrLocales); } + [[nodiscard]] std::vector getLocale() { + std::vector 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; \ No newline at end of file +extern Game app; \ No newline at end of file diff --git a/targets/app/common/GameMenuService.cpp b/targets/app/common/GameMenuService.cpp index a264ed789..7ed1b82c1 100644 --- a/targets/app/common/GameMenuService.cpp +++ b/targets/app/common/GameMenuService.cpp @@ -2,57 +2,88 @@ #include "app/common/Game.h" -bool GameMenuService::openInventory(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openInventory(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadInventoryMenu(iPad, player, navigateBack); } -bool GameMenuService::openCreative(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openCreative(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadCreativeMenu(iPad, player, navigateBack); } -bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr player) { +bool GameMenuService::openCrafting2x2(int iPad, + std::shared_ptr player) { return game_.LoadCrafting2x2Menu(iPad, player); } -bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openCrafting3x3(int iPad, + std::shared_ptr player, + int x, int y, int z) { return game_.LoadCrafting3x3Menu(iPad, player, x, y, z); } -bool GameMenuService::openEnchanting(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::string& name) { +bool GameMenuService::openEnchanting(int iPad, + std::shared_ptr 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, std::shared_ptr furnace) { +bool GameMenuService::openFurnace(int iPad, + std::shared_ptr inventory, + std::shared_ptr furnace) { return game_.LoadFurnaceMenu(iPad, inventory, furnace); } -bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { +bool GameMenuService::openBrewingStand( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) { return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand); } -bool GameMenuService::openContainer(int iPad, std::shared_ptr inventory, std::shared_ptr container) { +bool GameMenuService::openContainer(int iPad, + std::shared_ptr inventory, + std::shared_ptr container) { return game_.LoadContainerMenu(iPad, inventory, container); } -bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, std::shared_ptr trap) { +bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) { return game_.LoadTrapMenu(iPad, inventory, trap); } -bool GameMenuService::openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openFireworks(int iPad, + std::shared_ptr player, int x, + int y, int z) { return game_.LoadFireworksMenu(iPad, player, x, y, z); } bool GameMenuService::openSign(int iPad, std::shared_ptr sign) { return game_.LoadSignEntryMenu(iPad, sign); } -bool GameMenuService::openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { +bool GameMenuService::openRepairing(int iPad, + std::shared_ptr 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, std::shared_ptr trader, Level* level, const std::string& name) { +bool GameMenuService::openTrading(int iPad, + std::shared_ptr inventory, + std::shared_ptr trader, + Level* level, const std::string& name) { return game_.LoadTradingMenu(iPad, inventory, trader, level, name); } -bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr commandBlock) { +bool GameMenuService::openCommandBlock( + int iPad, std::shared_ptr commandBlock) { return game_.LoadCommandBlockMenu(iPad, commandBlock); } -bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopperMinecart( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { +bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) { return game_.LoadHorseMenu(iPad, inventory, container, horse); } -bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { +bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) { return game_.LoadBeaconMenu(iPad, inventory, beacon); } diff --git a/targets/app/common/GameMenuService.h b/targets/app/common/GameMenuService.h index a864deb6e..744f38544 100644 --- a/targets/app/common/GameMenuService.h +++ b/targets/app/common/GameMenuService.h @@ -40,9 +40,8 @@ public: int iPad, std::shared_ptr commandBlock) override; bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) override; - bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) override; + bool openHopperMinecart(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) override; bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) override; diff --git a/targets/app/common/GameRules/ConsoleGameRules.h b/targets/app/common/GameRules/ConsoleGameRules.h index 765acff99..6f27b83d1 100644 --- a/targets/app/common/GameRules/ConsoleGameRules.h +++ b/targets/app/common/GameRules/ConsoleGameRules.h @@ -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" diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 9994fbd10..be4ca8b70 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -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 bStringTable(bStringTableSize); dis2.read(bStringTable); - StringTable* strings = - new StringTable(bStringTable.data(), bStringTable.size()); + StringTable* strings = new StringTable(bStringTable, app.getLocale()); // Read RuleFile. std::vector 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); diff --git a/targets/app/common/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h index 140ca4b52..002c9eb94 100644 --- a/targets/app/common/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -8,9 +8,9 @@ #include #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 diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index e4f6d4c04..6a4d1c8fb 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -3,17 +3,17 @@ #include #include -#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) { diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index 1faad1f73..3a0eaafae 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -4,9 +4,9 @@ #include #include -#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" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index 5e45f544b..3eca5ed55 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h index fc3918291..5dac30ab8 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h @@ -4,8 +4,8 @@ #include #include -#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: diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index ceffe7f90..122dd1222 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,20 +4,20 @@ #include -#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(attributeValue); m_x = value; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h index 9cb2008ab..12d82816f 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h @@ -2,8 +2,8 @@ #include #include -#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" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h index f8f1014a2..6634535dd 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h @@ -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: diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 8abce74f1..4dd8d39a0 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -1,4 +1,4 @@ -#include "LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include #include @@ -6,28 +6,27 @@ #include #include -#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(); } diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp index 2fad35ae8..8d9576209 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp @@ -2,7 +2,7 @@ #include -#include "LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" LevelGenerators::LevelGenerators() {} diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index fae469360..5a3c0f634 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.h b/targets/app/common/GameRules/LevelGeneration/StartFeature.h index de40a5ac2..cd0446609 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.h +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.h @@ -3,8 +3,8 @@ #include -#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 { diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index e956b4bcb..9651a4011 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h index 7eee4ccf0..e6da1f4f3 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h @@ -1,8 +1,8 @@ #pragma once #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index d1c19298f..5c8f82bde 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h index e217a9fa2..7745a3039 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h @@ -1,8 +1,8 @@ #pragma once #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 1c94d8997..a14a46bce 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,17 +4,17 @@ #include -#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; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h index e5735d057..790311c51 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h @@ -3,8 +3,8 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; class StructurePiece; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp index 2934b68b7..7d6770857 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp @@ -4,9 +4,9 @@ #include -#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, diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h index 7c0b7abeb..8b5304a57 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h @@ -2,8 +2,8 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 61a1336f2..55187a29e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,10 +3,7 @@ #include #include -#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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index cc69dd8de..5ef3b0e89 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -3,8 +3,8 @@ #include #include -#include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class ItemInstance; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 2503523bd..f6b77869f 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -3,14 +3,14 @@ #include #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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index b2391c6f5..e3b214884 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 93bf813c6..9bfaf0834 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -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(item->getAuxValue()) + "\""; + xml += " auxValue=\"" + toWString(item->getAuxValue()) + "\""; if (item->get4JData() != 0) xml += " dataTag=\"" + toWString(item->get4JData()) + "\""; xml += "/>\n"; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 4f956078c..ee8251192 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -3,9 +3,9 @@ #include #include -#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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index 70b001ab2..ed9107916 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -4,13 +4,13 @@ #include #include +#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* children) { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h index ef10f3721..ee100f28a 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h @@ -3,7 +3,7 @@ #include #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 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); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index b3cde7a2e..9a64816da 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -7,14 +7,14 @@ #include #include -#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() { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index 26b89124e..8f73b67dd 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -2,9 +2,9 @@ #include -#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: diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index 51c083dca..d759f5304 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -1,4 +1,4 @@ -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include #include @@ -8,14 +8,14 @@ #include #include -#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(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 } } diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index fe50e6dff..67342dfe7 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h index 4eaedd7b8..87ce549a5 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h @@ -4,7 +4,7 @@ #include #include "CompoundGameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class NamedAreaRuleDefinition; class AABB; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 170c2c6f3..768a7c3b8 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,11 +2,11 @@ #include -#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(attributeValue); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index b20e209c9..7bac12e77 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -2,8 +2,8 @@ #include -#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 { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index f4b38a3f7..508b22a58 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,16 +4,16 @@ #include -#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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index bb6943a31..5e4eb68cf 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index 8f18a0e56..4c5afe076 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -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; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index 273398dd8..8e9f6872d 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -3,9 +3,9 @@ #include -#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: diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index 4c933a1e3..77e58f556 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -1,5 +1,5 @@ -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRule.h" #include @@ -8,10 +8,9 @@ #include #include -#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()); diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 7cdafeeb8..8a4b5ec8c 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -1,12 +1,15 @@ #include "app/common/GameSettingsManager.h" +#include + +#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 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); diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index 293969b20..bad5dfbf9 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -3,8 +3,8 @@ #include #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]; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 909b0fdd9..3b100537c 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -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(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; diff --git a/targets/app/linux/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c similarity index 91% rename from targets/app/linux/Iggy/gdraw/gdraw.c rename to targets/app/common/Iggy/gdraw/gdraw.c index 8b9f716ea..45fc181a7 100644 --- a/targets/app/linux/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -1,17 +1,20 @@ #define GDRAW_ASSERTS #include "gdraw.h" - -#include -#include +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif +#include #include #include #include #include #include -#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 diff --git a/targets/app/linux/Iggy/gdraw/gdraw.h b/targets/app/common/Iggy/gdraw/gdraw.h similarity index 93% rename from targets/app/linux/Iggy/gdraw/gdraw.h rename to targets/app/common/Iggy/gdraw/gdraw.h index e8ab9566d..cc6a0d02a 100644 --- a/targets/app/linux/Iggy/gdraw/gdraw.h +++ b/targets/app/common/Iggy/gdraw/gdraw.h @@ -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" { diff --git a/targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl b/targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl similarity index 99% rename from targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl rename to targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl index e252efbb3..89899d295 100644 --- a/targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl +++ b/targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl @@ -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}; \ No newline at end of file diff --git a/targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl b/targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl similarity index 99% rename from targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl rename to targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl index 9b5be4efc..e08fd755b 100644 --- a/targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl +++ b/targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl @@ -2692,4 +2692,4 @@ void gdraw_GLx_(DestroyContext)(void) { opengl_check(); free_gdraw(); -} +} \ No newline at end of file diff --git a/targets/app/windows/Iggy/gdraw/gdraw_shared.inl b/targets/app/common/Iggy/gdraw/gdraw_shared.inl similarity index 99% rename from targets/app/windows/Iggy/gdraw/gdraw_shared.inl rename to targets/app/common/Iggy/gdraw/gdraw_shared.inl index 6fa38f455..fac66a23d 100644 --- a/targets/app/windows/Iggy/gdraw/gdraw_shared.inl +++ b/targets/app/common/Iggy/gdraw/gdraw_shared.inl @@ -2690,4 +2690,4 @@ static GDrawHandle* gdraw_res_alloc_begin(GDrawHandleCache* c, S32 size, return t; } -#endif +#endif \ No newline at end of file diff --git a/targets/app/linux/Stubs/iggy_stubs.h b/targets/app/common/Iggy/iggy_stubs.h similarity index 99% rename from targets/app/linux/Stubs/iggy_stubs.h rename to targets/app/common/Iggy/iggy_stubs.h index dc9d7a0d8..509f5ffd0 100644 --- a/targets/app/linux/Stubs/iggy_stubs.h +++ b/targets/app/common/Iggy/iggy_stubs.h @@ -3,10 +3,10 @@ #pragma once -#include "app/linux/Iggy/include/iggy.h" - -#include #include +#include + +#include "app/common/Iggy/include/iggy.h" #define STUBBED \ { \ diff --git a/targets/app/linux/Iggy/include/gdraw.h b/targets/app/common/Iggy/include/gdraw.h similarity index 100% rename from targets/app/linux/Iggy/include/gdraw.h rename to targets/app/common/Iggy/include/gdraw.h diff --git a/targets/app/linux/Iggy/include/iggy.h b/targets/app/common/Iggy/include/iggy.h similarity index 99% rename from targets/app/linux/Iggy/include/iggy.h rename to targets/app/common/Iggy/include/iggy.h index 23c441c61..3af8392d3 100644 --- a/targets/app/linux/Iggy/include/iggy.h +++ b/targets/app/common/Iggy/include/iggy.h @@ -10,6 +10,15 @@ #include "rrCore.h" // base data types, macros +// on windows, these will cause MSVC to shit itself due to thinking +// the stubbed iggy symbols are DLL-exported. +#ifndef _ENABLEIGGY +#undef RADEXPFUNC +#undef RADEXPLINK +#define RADEXPFUNC +#define RADEXPLINK +#endif + RADDEFSTART #ifndef IGGY_GDRAW_SHARED_TYPEDEF @@ -123,9 +132,10 @@ typedef enum IggyDatatype { /* Describes an AS3 datatype visible through iggy interface. */ #ifdef __RADWIN__ -#include -IDOCN typedef char IggyUTF16; +#include +IDOCN typedef char16_t IggyUTF16; #else +#include typedef const char16_t IggyUTF16; #endif diff --git a/targets/app/linux/Iggy/include/rrCore.h b/targets/app/common/Iggy/include/rrCore.h similarity index 100% rename from targets/app/linux/Iggy/include/rrCore.h rename to targets/app/common/Iggy/include/rrCore.h diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.cpp b/targets/app/common/Leaderboards/LeaderboardInterface.cpp deleted file mode 100644 index 979d7937b..000000000 --- a/targets/app/common/Leaderboards/LeaderboardInterface.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "LeaderboardInterface.h" - -#include - -#include "app/common/Leaderboards/LeaderboardManager.h" - -LeaderboardInterface::LeaderboardInterface(IPlatformLeaderboard* man) { - m_manager = man; - m_pending = false; - - m_filter = (IPlatformLeaderboard::EFilterMode)-1; - m_callback = nullptr; - m_difficulty = 0; - m_type = IPlatformLeaderboard::eStatsType_UNDEFINED; - m_startIndex = 0; - m_readCount = 0; - - m_manager->OpenSession(); -} - -LeaderboardInterface::~LeaderboardInterface() { - m_manager->CancelOperation(); - m_manager->CloseSession(); -} - -void LeaderboardInterface::ReadStats_Friends( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int startIndex, unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_Friends; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_myUID = myUID; - m_startIndex = startIndex; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::ReadStats_MyScore( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_MyScore; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_myUID = myUID; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::ReadStats_TopRank( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, unsigned int startIndex, - unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_TopRank; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_startIndex = startIndex; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::CancelOperation() { - m_manager->CancelOperation(); - m_pending = false; -} - -void LeaderboardInterface::tick() { - if (m_pending) m_pending = !callManager(); -} - -bool LeaderboardInterface::callManager() { - switch (m_filter) { - case IPlatformLeaderboard::eFM_Friends: - return m_manager->ReadStats_Friends(m_callback, m_difficulty, - m_type, m_myUID, m_startIndex, - m_readCount); - case IPlatformLeaderboard::eFM_MyScore: - return m_manager->ReadStats_MyScore(m_callback, m_difficulty, - m_type, m_myUID, m_readCount); - case IPlatformLeaderboard::eFM_TopRank: - return m_manager->ReadStats_TopRank( - m_callback, m_difficulty, m_type, m_startIndex, m_readCount); - default: - assert(false); - return true; - } -} \ No newline at end of file diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.h b/targets/app/common/Leaderboards/LeaderboardInterface.h deleted file mode 100644 index 0b689ba0a..000000000 --- a/targets/app/common/Leaderboards/LeaderboardInterface.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "platform/PlatformTypes.h" -#include "LeaderboardManager.h" - -// 4J-JEV: Simple interface for handling ReadStat failures. -class LeaderboardInterface { -private: - IPlatformLeaderboard* m_manager; - bool m_pending; - - // Arguments. - IPlatformLeaderboard::EFilterMode m_filter; - LeaderboardReadListener* m_callback; - int m_difficulty; - IPlatformLeaderboard::EStatsType m_type; - PlayerUID m_myUID; - unsigned int m_startIndex; - unsigned int m_readCount; - -public: - LeaderboardInterface(IPlatformLeaderboard* man); - ~LeaderboardInterface(); - - void ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int startIndex, unsigned int readCount); - void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int readCount); - void ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, - unsigned int startIndex, unsigned int readCount); - - void CancelOperation(); - - void tick(); - -private: - bool callManager(); -}; \ No newline at end of file diff --git a/targets/app/common/Leaderboards/LeaderboardManager.cpp b/targets/app/common/Leaderboards/LeaderboardManager.cpp deleted file mode 100644 index 894293a8f..000000000 --- a/targets/app/common/Leaderboards/LeaderboardManager.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "LeaderboardManager.h" - -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" - -const std::string LeaderboardManager::filterNames[eNumFilterModes] = { - "Friends", "MyScore", "TopRank"}; - -void LeaderboardManager::DeleteInstance() { - delete m_instance; - m_instance = nullptr; -} - -LeaderboardManager::LeaderboardManager() { - zeroReadParameters(); - - m_myXUID = INVALID_XUID; -} - -void LeaderboardManager::zeroReadParameters() { - m_difficulty = -1; - m_statsType = eStatsType_UNDEFINED; - m_readListener = nullptr; - m_startIndex = 0; - m_readCount = 0; - m_eFilterMode = eFM_UNDEFINED; -} - -bool LeaderboardManager::ReadStats_Friends(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int startIndex, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_eFilterMode = eFM_Friends; - return true; -} - -bool LeaderboardManager::ReadStats_MyScore(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_readCount = readCount; - - m_eFilterMode = eFM_MyScore; - return true; -} - -bool LeaderboardManager::ReadStats_TopRank(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_startIndex = startIndex; - m_readCount = readCount; - - m_eFilterMode = eFM_TopRank; - return true; -} - -void LeaderboardManager::printStats(ReadView& view) { - app.DebugPrintf( - "[LeaderboardManager] Printing stats:\n" - "\tnumQueries=%i\n", - view.m_numQueries); - - for (unsigned int i = 0; i < view.m_numQueries; i++) { - ReadScore score = view.m_queries[i]; - - app.DebugPrintf("\tname='%s'\n", - score.m_name.c_str()); - app.DebugPrintf("\trank='%i'\n", score.m_rank); - - app.DebugPrintf("\tstatsData=["); - for (int j = 0; j < score.m_statsSize; j++) - app.DebugPrintf(" %i", score.m_statsData[j]); - app.DebugPrintf("]\n"); - } -} - -bool DebugReadListener::OnStatsReadComplete( - IPlatformLeaderboard::eStatsReturn success, int numResults, - IPlatformLeaderboard::ViewOut results) { - app.DebugPrintf("[DebugReadListener] OnStatsReadComplete, %s:\n", - (success ? "success" : "FAILED")); - LeaderboardManager::printStats(results); - - return true; -} - -DebugReadListener* DebugReadListener::m_instance = new DebugReadListener(); diff --git a/targets/app/common/Leaderboards/LeaderboardManager.h b/targets/app/common/Leaderboards/LeaderboardManager.h deleted file mode 100644 index 6c65ec98b..000000000 --- a/targets/app/common/Leaderboards/LeaderboardManager.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include - -#include "platform/IPlatformLeaderboard.h" - -class LeaderboardManager : public IPlatformLeaderboard { -public: - static const std::string filterNames[eNumFilterModes]; - - LeaderboardManager(); - virtual ~LeaderboardManager() {} - - // Singleton - static IPlatformLeaderboard* Instance() { return m_instance; } - static void DeleteInstance(); - - // IPlatformLeaderboard pure virtuals - subclasses must implement: - // Tick, OpenSession, CloseSession, DeleteSession, WriteStats, - // FlushStats, CancelOperation, isIdle - - // Base implementations for read operations - bool ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - EStatsType type, PlayerUID myUID, - unsigned int startIndex, - unsigned int readCount) override; - bool ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - EStatsType type, PlayerUID myUID, - unsigned int readCount) override; - bool ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, - EStatsType type, unsigned int startIndex, - unsigned int readCount) override; - - static void printStats(ReadView& view); - -protected: - virtual void zeroReadParameters(); - - EFilterMode m_eFilterMode; - int m_difficulty; - EStatsType m_statsType; - LeaderboardReadListener* m_readListener; - PlayerUID m_myXUID; - unsigned int m_startIndex, m_readCount; - -private: - static LeaderboardManager* m_instance; -}; - -class DebugReadListener : public LeaderboardReadListener { -public: - bool OnStatsReadComplete(IPlatformLeaderboard::eStatsReturn ret, - int numResults, - IPlatformLeaderboard::ViewOut results) override; - static DebugReadListener* m_instance; -}; diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 761d1c628..b2c04b28c 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -6,24 +6,24 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/Localisation/StringTable.h" -#include "app/common/Colours/ColourTable.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/GameEnums.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" +#include "minecraft/locale/StringTable.h" +#include "platform/XboxStubs.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" -#include "platform/XboxStubs.h" #include "strings.h" #include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" -int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { - 20, 13, 20, 26}; +int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {20, 13, 20, 26}; TIPSTRUCT LocalizationManager::m_GameTipA[MAX_TIPS_GAMETIP] = { {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, @@ -77,9 +77,10 @@ void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { } std::string localisationFile = "languages.loc"; if (mediaArchive->hasFile(localisationFile)) { - std::vector locFile = - mediaArchive->getFile(localisationFile); - m_stringTable = new StringTable(locFile.data(), locFile.size()); + std::vector locFile = mediaArchive->getFile(localisationFile); + std::vector locales; + getLocale(locales); + m_stringTable = new StringTable(locFile, locales); } else { m_stringTable = nullptr; assert(false); @@ -345,8 +346,8 @@ std::string LocalizationManager::formatHTMLString( return text; } -std::string LocalizationManager::getActionReplacement( - int iPad, unsigned char ucAction) { +std::string LocalizationManager::getActionReplacement(int iPad, + unsigned char ucAction) { unsigned int input = PlatformInput.GetGameJoypadMaps( PlatformInput.GetJoypadMapVal(iPad), ucAction); @@ -505,8 +506,7 @@ std::string LocalizationManager::getIconReplacement(unsigned int uiIcon) { return result; } -void LocalizationManager::getLocale( - std::vector& vecWstrLocales) { +void LocalizationManager::getLocale(std::vector& vecWstrLocales) { std::vector locales; const unsigned int systemLanguage = XGetLanguage(); diff --git a/targets/app/common/LocalizationManager.h b/targets/app/common/LocalizationManager.h index d84689f75..920ba4c11 100644 --- a/targets/app/common/LocalizationManager.h +++ b/targets/app/common/LocalizationManager.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" #include "platform/XboxStubs.h" class ArchiveFile; @@ -22,7 +22,7 @@ public: const char* getString(int iID) const; std::string formatHTMLString(int iPad, const std::string& desc, - int shadowColour = 0xFFFFFFFF); + int shadowColour = 0xFFFFFFFF); std::string getActionReplacement(int iPad, unsigned char ucAction); std::string getVKReplacement(unsigned int uiVKey); std::string getIconReplacement(unsigned int uiIcon); diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index f4cfed459..b19059bc9 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -1,31 +1,30 @@ #include "app/common/MenuController.h" +#include +#include +#include +#include + #include "app/common/Game.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/UIScene_FullscreenProgress.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/ProgressRenderer.h" -#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.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 "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" - -#include -#include -#include -#include +#include "strings.h" unsigned char MenuController::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; @@ -37,7 +36,6 @@ MenuController::MenuController() { m_uiOpacityCountDown[i] = 0; } m_eGlobalXuiAction = eAppAction_Idle; - m_eGlobalXuiServerAction = eXuiServerAction_Idle; } void MenuController::setAction(int iPad, eXuiAction action, void* param) { @@ -274,9 +272,9 @@ bool MenuController::loadContainerMenu(int iPad, return success; } -bool MenuController::loadTrapMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr trap) { +bool MenuController::loadTrapMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr trap) { bool success = true; TrapScreenInput* initData = new TrapScreenInput(); @@ -295,8 +293,8 @@ bool MenuController::loadTrapMenu( return success; } -bool MenuController::loadSignEntryMenu( - int iPad, std::shared_ptr sign) { +bool MenuController::loadSignEntryMenu(int iPad, + std::shared_ptr sign) { bool success = true; SignEntryScreenInput* initData = new SignEntryScreenInput(); @@ -353,9 +351,9 @@ bool MenuController::loadTradingMenu(int iPad, return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -372,9 +370,9 @@ bool MenuController::loadHopperMenu( return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -412,9 +410,9 @@ bool MenuController::loadHorseMenu(int iPad, return success; } -bool MenuController::loadBeaconMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr beacon) { +bool MenuController::loadBeaconMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr beacon) { bool success = true; BeaconScreenInput* initData = new BeaconScreenInput(); @@ -498,7 +496,7 @@ int MenuController::remoteSaveThreadProc(void* lpParameter) { if (app.GetXuiAction(PlatformProfile.GetPrimaryPad()) != eAppAction_WaitRemoteServerSaveComplete) { - return ERROR_CANCELLED; + return 1223; // ERROR_CANCELLED } app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_Idle); @@ -634,9 +632,10 @@ void MenuController::getImageTextData(std::uint8_t* imageData, return; } -unsigned int MenuController::createImageTextData( - std::uint8_t* textMetadata, int64_t seed, bool hasSeed, - unsigned int uiHostOptions, unsigned int uiTexturePackId) { +unsigned int MenuController::createImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) { int iTextMetadataBytes = 0; if (hasSeed) { strcpy((char*)textMetadata, "4J_SEED"); diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index a5f157a63..f3fb04008 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -5,8 +5,8 @@ #include #include "app/common/App_structs.h" -#include "platform/storage/storage.h" #include "platform/XboxStubs.h" +#include "platform/storage/storage.h" class Player; class Inventory; @@ -48,8 +48,8 @@ public: bool loadCrafting2x2Menu(int iPad, std::shared_ptr player); bool loadCrafting3x3Menu(int iPad, std::shared_ptr player, int x, int y, int z); - bool loadFireworksMenu(int iPad, std::shared_ptr player, - int x, int y, int z); + bool loadFireworksMenu(int iPad, std::shared_ptr player, int x, + int y, int z); bool loadSignEntryMenu(int iPad, std::shared_ptr sign); bool loadRepairingMenu(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z); @@ -69,25 +69,8 @@ public: // Action management void setAction(int iPad, eXuiAction action, void* param = nullptr); eXuiAction getXuiAction(int iPad) { return m_eXuiAction[iPad]; } - void setXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr) { - m_eXuiServerAction[iPad] = action; - m_eXuiServerActionParam[iPad] = param; - } - eXuiServerAction getXuiServerAction(int iPad) { - return m_eXuiServerAction[iPad]; - } - void* getXuiServerActionParam(int iPad) { - return m_eXuiServerActionParam[iPad]; - } eXuiAction getGlobalXuiAction() { return m_eGlobalXuiAction; } void setGlobalXuiAction(eXuiAction action) { m_eGlobalXuiAction = action; } - eXuiServerAction getGlobalXuiServerAction() { - return m_eGlobalXuiServerAction; - } - void setGlobalXuiServerAction(eXuiServerAction action) { - m_eGlobalXuiServerAction = action; - } // TMS action void setTMSAction(int iPad, eTMSAction action) { @@ -96,18 +79,18 @@ public: eTMSAction getTMSAction(int iPad) { return m_eTMSAction[iPad]; } // Dialog callbacks - static int texturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int fatalErrorDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int texturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int fatalErrorDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int trialOverReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullExitReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int unlockFullInviteReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int unlockFullInviteReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Remote save static int remoteSaveThreadProc(void* lpParameter); @@ -140,9 +123,6 @@ private: eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; void* m_eXuiActionParam[XUSER_MAX_COUNT]; eXuiAction m_eGlobalXuiAction; - eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - void* m_eXuiServerActionParam[XUSER_MAX_COUNT]; - eXuiServerAction m_eGlobalXuiServerAction; unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 2a9dce74d..5c8bc0144 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -9,28 +9,14 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Network/PlatformNetworkManagerStub.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 "app/linux/Stubs/winapi_stubs.h" -#include "Socket.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" @@ -41,18 +27,31 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/crafting/FireworksRecipe.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/XboxStubs.h" +#include "platform/fs/fs.h" +#include "platform/game/game.h" +#include "platform/input/input.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" class FriendSessionInfo; class INVITE_INFO; @@ -61,6 +60,13 @@ class INVITE_INFO; CGameNetworkManager g_NetworkManager; IPlatformNetwork* CGameNetworkManager::s_pPlatformNetworkManager; +// minecraft/-side function accessor for INetworkService. +namespace minecraft::network::platform_internal { +::minecraft::network::INetworkService& NetworkService_get() { + return g_NetworkManager; +} +} // namespace minecraft::network::platform_internal + int64_t CGameNetworkManager::messageQueue[512]; int64_t CGameNetworkManager::byteQueue[512]; int CGameNetworkManager::messageQueuePos = 0; @@ -78,7 +84,7 @@ void CGameNetworkManager::Initialise() { LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column - s_pPlatformNetworkManager = new IPlatformNetworkStub(); + s_pPlatformNetworkManager = &PlatformNetwork; s_pPlatformNetworkManager->Initialise(this, flagIndexSize); m_bNetworkThreadRunning = false; m_bInitialised = true; @@ -342,7 +348,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, createdConnections.push_back(connection); int primaryPad = PlatformProfile.GetPrimaryPad(); - app.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(primaryPad, + CONTEXT_GAME_STATE_BLANK); if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there { @@ -373,7 +380,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, Socket* socket = pNetworkPlayer->GetSocket(); app.DebugPrintf( "Closing socket due to player %d not being signed in any " - "more\n"); + "more\n", + idx); if (!socket->close(false)) socket->close(true); continue; @@ -401,8 +409,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send(std::shared_ptr(new PreLoginPacket( - PlatformProfile.GetGamertag(idx)))); + connection->send(std::shared_ptr( + new PreLoginPacket(PlatformProfile.GetGamertag(idx)))); createdConnections.push_back(connection); @@ -444,7 +452,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break; if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) { - app.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(idx, + CONTEXT_GAME_STATE_BLANK); if (IsLocalGame()) PlatformProfile.SetCurrentGameActivity( idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); @@ -620,8 +629,8 @@ void CGameNetworkManager::SetSessionsUpdatedCallback( void CGameNetworkManager::GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) { - s_pPlatformNetworkManager->GetFullFriendSessionInfo( - foundSession, std::move(callback)); + s_pPlatformNetworkManager->GetFullFriendSessionInfo(foundSession, + std::move(callback)); } void CGameNetworkManager::ForceFriendsSessionRefresh() { @@ -711,14 +720,15 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( iPad, // dwUserIndex @@ -818,7 +828,8 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) { } } - C4JThread::setThreadName(static_cast(-1), "Minecraft Server thread"); + C4JThread::setThreadName(static_cast(-1), + "Minecraft Server thread"); Compression::UseDefaultThreadStorage(); OldChunkStorage::UseDefaultThreadStorage(); Entity::useSmallIds(); @@ -875,13 +886,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); - while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != - eXuiServerAction_Idle && - !MinecraftServer::serverHalted()) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - } - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + pServer->queueServerAction(minecraft::server::PauseServer{true}); // wait for the server to be in a non-ticking state pServer->m_serverPausedEvent->waitForSignal(C4JThread::kInfiniteTimeout); @@ -1008,8 +1013,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // Start the game again app.SetGameStarted(true); - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); app.SetChangingSessionType(false); app.SetReallyChangingSessionType(false); @@ -1218,7 +1223,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { g_NetworkManager.GetLocalPlayerByUserIndex(iPad); if (pNetworkPlayer == nullptr) continue; - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); if (multiplayer) { if (localgame) PlatformProfile.SetCurrentGameActivity( @@ -1241,7 +1246,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { void CGameNetworkManager::PlayerLeaving(INetworkPlayer* pNetworkPlayer) { if (pNetworkPlayer->IsLocal()) { PlatformProfile.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), - CONTEXT_PRESENCE_IDLE, false); + CONTEXT_PRESENCE_IDLE, false); } } @@ -1284,8 +1289,9 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, bool bContentRestricted = false; bool pccAllowed = true; bool pccFriendsAllowed = true; - PlatformProfile.AllowedPlayerCreatedContent( - PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + PlatformProfile.AllowedPlayerCreatedContent(PlatformProfile.GetPrimaryPad(), + false, &pccAllowed, + &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (noUGC) { @@ -1301,7 +1307,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // 4J-PB - it's possible there is no primary pad here, when accepting an // invite from the dashboard - // PlatformStorage.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + // PlatformStorage.RequestMessageBox( + // IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, // uiIDA,1,PlatformProfile.GetPrimaryPad(),nullptr,nullptr, // app.GetStringTable()); @@ -1371,7 +1378,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -1379,8 +1386,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( g_NetworkManager.SetLocalGame(false); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo); diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 9389b3f98..84ee1078b 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -4,16 +4,13 @@ #include #include #include -#if !defined(__linux__) -#include -#endif + +#include "minecraft/network/INetworkService.h" #include "platform/PlatformTypes.h" -#include "platform/IPlatformNetwork.h" -#include "platform/NetTypes.h" -#include "NetworkPlayerInterface.h" -#include "PlatformNetworkManagerStub.h" -#include "SessionInfo.h" -#include "platform/C4JThread.h" +#include "platform/network/IPlatformNetwork.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/thread/C4JThread.h" class ClientConnection; class Minecraft; @@ -21,17 +18,13 @@ class FriendSessionInfo; class INVITE_INFO; class INetworkPlayer; -const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; - // This class implements the game-side interface to the networking system. As // such, it is platform independent and may contain bits of game-side code where // appropriate. It shouldn't ever reference any platform specifics of the // network implementation (eg QNET), rather it should interface with an // implementation of PlatformNetworkManager to provide this functionality. -class CGameNetworkManager { - friend class IPlatformNetworkStub; - +class CGameNetworkManager : public ::minecraft::network::INetworkService { public: CGameNetworkManager(); // Misc high level flow @@ -96,9 +89,8 @@ public: bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession); void SetSessionsUpdatedCallback(std::function callback); - void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + std::function callback); void ForceFriendsSessionRefresh(); // Session joining and leaving @@ -163,11 +155,13 @@ public: static int messageQueuePos; // Methods called from PlatformNetworkManager -private: + // 4jcraft: made these public, we can't friend class StubPlatformNetwork + // here like before because that would be naming an opaque platform backend + // class, plus this API is shit so i dont care +public: void StateChange_AnyToHosting(); void StateChange_AnyToJoining(); - void StateChange_JoiningToIdle( - IPlatformNetwork::eJoinFailedReason reason); + void StateChange_JoiningToIdle(IPlatformNetwork::eJoinFailedReason reason); void StateChange_AnyToStarting(); void StateChange_AnyToEnding(bool bStateWasPlaying); void StateChange_AnyToIdle(); @@ -193,7 +187,6 @@ private: bool m_bInitialised; private: - float m_lastPlayerEventTimeStart; // For telemetry static IPlatformNetwork* s_pPlatformNetworkManager; bool m_bNetworkThreadRunning; int GetJoiningReadyPercentage(); diff --git a/targets/app/common/Network/NetworkPlayerQNet.cpp b/targets/app/common/Network/NetworkPlayerQNet.cpp deleted file mode 100644 index be89cbda0..000000000 --- a/targets/app/common/Network/NetworkPlayerQNet.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "NetworkPlayerQNet.h" - -#include - -#include "platform/NetTypes.h" -#include "java/System.h" - -NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) { - m_qnetPlayer = qnetPlayer; - m_pSocket = nullptr; -} - -unsigned char NetworkPlayerQNet::GetSmallId() { - return m_qnetPlayer->GetSmallId(); -} - -void NetworkPlayerQNet::SendData(INetworkPlayer* player, const void* pvData, - int dataSize, bool lowPriority, bool ack) { - uint32_t flags; - flags = QNET_SENDDATA_RELIABLE | QNET_SENDDATA_SEQUENTIAL; - if (lowPriority) - flags |= QNET_SENDDATA_LOW_PRIORITY | QNET_SENDDATA_SECONDARY; - m_qnetPlayer->SendData( - static_cast(player)->m_qnetPlayer, pvData, dataSize, - flags); -} - -int NetworkPlayerQNet::GetOutstandingAckCount() { return 0; } - -bool NetworkPlayerQNet::IsSameSystem(INetworkPlayer* player) { - return (m_qnetPlayer->IsSameSystem( - static_cast(player)->m_qnetPlayer) == true); -} - -int NetworkPlayerQNet::GetSendQueueSizeBytes(INetworkPlayer* player, - bool lowPriority) { - uint32_t flags = QNET_GETSENDQUEUESIZE_BYTES; - if (lowPriority) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize( - player ? static_cast(player)->m_qnetPlayer - : nullptr, - flags); -} - -int NetworkPlayerQNet::GetSendQueueSizeMessages(INetworkPlayer* player, - bool lowPriority) { - uint32_t flags = QNET_GETSENDQUEUESIZE_MESSAGES; - if (lowPriority) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize( - player ? static_cast(player)->m_qnetPlayer - : nullptr, - flags); -} - -int NetworkPlayerQNet::GetCurrentRtt() { return m_qnetPlayer->GetCurrentRtt(); } - -bool NetworkPlayerQNet::IsHost() { return (m_qnetPlayer->IsHost() == true); } - -bool NetworkPlayerQNet::IsGuest() { return (m_qnetPlayer->IsGuest() == true); } - -bool NetworkPlayerQNet::IsLocal() { return (m_qnetPlayer->IsLocal() == true); } - -int NetworkPlayerQNet::GetSessionIndex() { - return m_qnetPlayer->GetSessionIndex(); -} - -bool NetworkPlayerQNet::IsTalking() { - return (m_qnetPlayer->IsTalking() == true); -} - -bool NetworkPlayerQNet::IsMutedByLocalUser(int userIndex) { - return (m_qnetPlayer->IsMutedByLocalUser(userIndex) == true); -} - -bool NetworkPlayerQNet::HasVoice() { - return (m_qnetPlayer->HasVoice() == true); -} - -bool NetworkPlayerQNet::HasCamera() { - return (m_qnetPlayer->HasCamera() == true); -} - -int NetworkPlayerQNet::GetUserIndex() { return m_qnetPlayer->GetUserIndex(); } - -void NetworkPlayerQNet::SetSocket(Socket* pSocket) { m_pSocket = pSocket; } - -Socket* NetworkPlayerQNet::GetSocket() { return m_pSocket; } - -PlayerUID NetworkPlayerQNet::GetUID() { return m_qnetPlayer->GetXuid(); } - -const char* NetworkPlayerQNet::GetOnlineName() { - return m_qnetPlayer->GetGamertag(); -} - -std::string NetworkPlayerQNet::GetDisplayName() { - return m_qnetPlayer->GetGamertag(); -} - -IQNetPlayer* NetworkPlayerQNet::GetQNetPlayer() { return m_qnetPlayer; } - -void NetworkPlayerQNet::SentChunkPacket() { - m_lastChunkPacketTime = System::currentTimeMillis(); -} - -int NetworkPlayerQNet::GetTimeSinceLastChunkPacket_ms() { - // If we haven't ever sent a packet, return maximum - if (m_lastChunkPacketTime == 0) { - return INT_MAX; - } - - const int64_t currentTime = System::currentTimeMillis(); - return static_cast(currentTime - m_lastChunkPacketTime); -} \ No newline at end of file diff --git a/targets/app/common/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h deleted file mode 100644 index 65d961848..000000000 --- a/targets/app/common/Network/NetworkPlayerQNet.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include - -#include - -#include "platform/PlatformTypes.h" -#include "NetworkPlayerInterface.h" - -class IQNetPlayer; -class Socket; - -// This is an implementation of the INetworkPlayer interface for the supported -// QNet-backed path. It -// effectively wraps the IQNetPlayer class in a non-platform-specific way. It is -// managed by PlatformNetworkManagerStub. - -class NetworkPlayerQNet : public INetworkPlayer { -public: - // Common player interface - NetworkPlayerQNet(IQNetPlayer* qnetPlayer); - virtual unsigned char GetSmallId(); - virtual void SendData(INetworkPlayer* player, const void* pvData, - int dataSize, bool lowPriority, bool ack); - virtual bool IsSameSystem(INetworkPlayer* player); - virtual int GetOutstandingAckCount(); - virtual int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); - virtual int GetSendQueueSizeMessages(INetworkPlayer* player, - bool lowPriority); - virtual int GetCurrentRtt(); - virtual bool IsHost(); - virtual bool IsGuest(); - virtual bool IsLocal(); - virtual int GetSessionIndex(); - virtual bool IsTalking(); - virtual bool IsMutedByLocalUser(int userIndex); - virtual bool HasVoice(); - virtual bool HasCamera(); - virtual int GetUserIndex(); - virtual void SetSocket(Socket* pSocket); - virtual Socket* GetSocket(); - virtual const char* GetOnlineName(); - virtual std::string GetDisplayName(); - virtual PlayerUID GetUID(); - virtual void SentChunkPacket(); - virtual int GetTimeSinceLastChunkPacket_ms(); - - IQNetPlayer* GetQNetPlayer(); - -private: - IQNetPlayer* m_qnetPlayer; - Socket* m_pSocket; - int64_t m_lastChunkPacketTime; -}; \ No newline at end of file diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h deleted file mode 100644 index 069747bd1..000000000 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ /dev/null @@ -1,141 +0,0 @@ -#pragma once -// using namespace std; -#include -#include -#if !defined(__linux__) -#include -#endif -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "NetworkPlayerInterface.h" -#include "SessionInfo.h" -#include "platform/C4JThread.h" - -class ClientConnection; -class Minecraft; -class CGameNetworkManager; - -// This is the interface to be implemented by the platform-specific versions of -// the PlatformNetworkManagers. This API is used directly by GameNetworkManager -// so that it can remain as platform independent as possible. - -// This value should be incremented if the server version changes, or the game -// session data changes -#define MINECRAFT_NET_VERSION VER_NETWORK - -typedef struct _SearchForGamesData { - unsigned int sessionIDCount; - XSESSION_SEARCHRESULT_HEADER* searchBuffer; - XNQOS** ppQos; - SessionID* sessionIDList; - XOVERLAPPED* pOverlapped; -} SearchForGamesData; - -class IPlatformNetwork { - friend class CGameNetworkManager; - -public: - typedef enum { - JOIN_FAILED_SERVER_FULL, - JOIN_FAILED_INSUFFICIENT_PRIVILEGES, - JOIN_FAILED_NONSPECIFIC, - } eJoinFailedReason; - - virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, - int flagIndexSize) = 0; - virtual void Terminate() = 0; - virtual int GetJoiningReadyPercentage() = 0; - virtual int CorrectErrorIDS(int IDS) = 0; - - virtual void DoWork() = 0; - virtual int GetPlayerCount() = 0; - virtual int GetOnlinePlayerCount() = 0; - virtual int GetLocalPlayerMask(int playerIndex) = 0; - virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0; - virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; - virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex) = 0; - virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; - virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; - virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId) = 0; - virtual bool ShouldMessageForFullSession() = 0; - - virtual INetworkPlayer* GetHostPlayer() = 0; - virtual bool IsHost() = 0; - virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, - const INVITE_INFO* pInviteInfo) = 0; - virtual bool LeaveGame(bool bMigrateHost) = 0; - - virtual bool IsInSession() = 0; - virtual bool IsInGameplay() = 0; - virtual bool IsReadyToPlayOrIdle() = 0; - virtual bool IsInStatsEnabledSession() = 0; - virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0; - virtual void SendInviteGUI(int quadrant) = 0; - virtual bool IsAddingPlayer() = 0; - - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, - unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0) = 0; - virtual int JoinGame(FriendSessionInfo* searchResult, int dwLocalUsersMask, - int dwPrimaryUserIndex) = 0; - virtual void CancelJoinGame() {}; - virtual bool SetLocalGame(bool isLocal) = 0; - virtual bool IsLocalGame() = 0; - virtual void SetPrivateGame(bool isPrivate) = 0; - virtual bool IsPrivateGame() = 0; - virtual bool IsLeavingGame() = 0; - virtual void ResetLeavingGame() = 0; - - virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; - virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; - - virtual void HandleSignInChange() = 0; - - virtual bool _RunNetworkGame() = 0; - -private: - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0; - virtual void _HostGame( - int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0) = 0; - virtual bool _StartGame() = 0; - -public: - virtual void UpdateAndSetGameSessionData( - INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0; - -private: - virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0; - -public: - virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; - virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index) = 0; - - virtual std::string GatherStats() = 0; - virtual std::string GatherRTTStats() = 0; - -private: - virtual void SetSessionTexturePackParentId(int id) = 0; - virtual void SetSessionSubTexturePackId(int id) = 0; - virtual void Notify(int ID, uintptr_t Param) = 0; - -public: - virtual std::vector* GetSessionList(int iPad, - int localPlayers, - bool partyOnly) = 0; - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, - FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; - virtual void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback) = 0; - virtual void ForceFriendsSessionRefresh() = 0; - - virtual void FakeLocalPlayerJoined() { - }; // Temporary method whilst we don't have real networking to make this - // happen -}; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h deleted file mode 100644 index 9f1f15ca5..000000000 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ /dev/null @@ -1,200 +0,0 @@ -#pragma once -#include -// using namespace std; -#include -#include - -#include "platform/PlatformTypes.h" -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" -#include "NetworkPlayerInterface.h" -#include "platform/IPlatformNetwork.h" -#include "SessionInfo.h" -#include "platform/C4JThread.h" - -class C4JThread; -class CGameNetworkManager; -class INetworkPlayer; - -class IPlatformNetworkStub : public IPlatformNetwork { - friend class CGameNetworkManager; - -public: - virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, - int flagIndexSize); - virtual void Terminate(); - virtual int GetJoiningReadyPercentage(); - virtual int CorrectErrorIDS(int IDS); - - virtual void DoWork(); - virtual int GetPlayerCount(); - virtual int GetOnlinePlayerCount(); - virtual int GetLocalPlayerMask(int playerIndex); - virtual bool AddLocalPlayerByUserIndex(int userIndex); - virtual bool RemoveLocalPlayerByUserIndex(int userIndex); - virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); - virtual INetworkPlayer* GetPlayerByIndex(int playerIndex); - virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); - virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); - virtual bool ShouldMessageForFullSession(); - - virtual INetworkPlayer* GetHostPlayer(); - virtual bool IsHost(); - virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, - const INVITE_INFO* pInviteInfo); - virtual bool LeaveGame(bool bMigrateHost); - - virtual bool IsInSession(); - virtual bool IsInGameplay(); - virtual bool IsReadyToPlayOrIdle(); - virtual bool IsInStatsEnabledSession(); - virtual bool SessionHasSpace(unsigned int spaceRequired = 1); - virtual void SendInviteGUI(int quadrant); - virtual bool IsAddingPlayer(); - - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, - unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0); - virtual int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, - int primaryUserIndex); - virtual bool SetLocalGame(bool isLocal); - virtual bool IsLocalGame() { return m_bIsOfflineGame; } - virtual void SetPrivateGame(bool isPrivate); - virtual bool IsPrivateGame() { return m_bIsPrivateGame; } - virtual bool IsLeavingGame() { return m_bLeavingGame; } - virtual void ResetLeavingGame() { m_bLeavingGame = false; } - - virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback); - virtual void UnRegisterPlayerChangedCallback(int iPad); - - virtual void HandleSignInChange(); - - virtual bool _RunNetworkGame(); - -private: - bool isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer); - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); - virtual void _HostGame( - int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0); - virtual bool _StartGame(); - - IQNet* m_pIQNet; // pointer to QNet interface - - void* m_notificationListener; - - std::vector - m_machineQNetPrimaryPlayers; // collection of players that we deem to - // be the main one for that system - - bool m_bLeavingGame; - bool m_bLeaveGameOnTick; - bool m_migrateHostOnLeave; - bool m_bHostChanged; - - bool m_bIsOfflineGame; - bool m_bIsPrivateGame; - int m_flagIndexSize; - - // This is only maintained by the host, and is not valid on client machines - GameSessionData m_hostGameSessionData; - CGameNetworkManager* m_pGameNetworkManager; - -public: - virtual void UpdateAndSetGameSessionData( - INetworkPlayer* pNetworkPlayerLeaving = nullptr); - -private: - std::function - playerChangedCallback[XUSER_MAX_COUNT]; - - static int RemovePlayerOnSocketClosedThreadProc(void* lpParam); - virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); - - // Things for handling per-system flags - class PlayerFlags { - public: - INetworkPlayer* m_pNetworkPlayer; - unsigned char* flags; - unsigned int count; - PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); - ~PlayerFlags(); - }; - std::vector m_playerFlags; - void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); - void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); - void SystemFlagReset(); - -public: - virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); - virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); - - // For telemetry -private: - float m_lastPlayerEventTimeStart; - -public: - std::string GatherStats(); - std::string GatherRTTStats(); - -private: - std::vector friendsSessions[XUSER_MAX_COUNT]; - int m_searchResultsCount[XUSER_MAX_COUNT]; - int m_lastSearchStartTime[XUSER_MAX_COUNT]; - - // The results that will be filled in with the current search - XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pQoSResult[XUSER_MAX_COUNT]; - - // The results from the previous search, which are currently displayed in - // the game - XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT]; - int m_currentSearchResultsCount[XUSER_MAX_COUNT]; - - int m_lastSearchPad; - bool m_bSearchResultsReady; - bool m_bSearchPending; - std::function m_SessionsUpdatedCallback; - - C4JThread* m_SearchingThread; - - void TickSearch(); - void SearchForGames(); - static int SearchForGamesThreadProc(void* lpParameter); - - void SetSearchResultsReady(int resultCount = 0); - - std::vector currentNetworkPlayers; - INetworkPlayer* addNetworkPlayer(IQNetPlayer* pQNetPlayer); - void removeNetworkPlayer(IQNetPlayer* pQNetPlayer); - static INetworkPlayer* getNetworkPlayer(IQNetPlayer* pQNetPlayer); - - virtual void SetSessionTexturePackParentId(int id); - virtual void SetSessionSubTexturePackId(int id); - virtual void Notify(int ID, uintptr_t Param); - -public: - virtual std::vector* GetSessionList(int iPad, - int localPlayers, - bool partyOnly); - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, - FriendSessionInfo* foundSession); - virtual void SetSessionsUpdatedCallback( - std::function callback); - virtual void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback); - virtual void ForceFriendsSessionRefresh(); - -private: - void NotifyPlayerJoined(IQNetPlayer* pQNetPlayer); - - void FakeLocalPlayerJoined() { - NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); - } -}; diff --git a/targets/app/common/Network/QNetStubs.cpp b/targets/app/common/Network/QNetStubs.cpp deleted file mode 100644 index 6243e7eb1..000000000 --- a/targets/app/common/Network/QNetStubs.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "platform/NetTypes.h" -#include "platform/PlatformTypes.h" - -IQNetPlayer IQNet::m_player[4]; - -static bool s_gameRunning = false; - -uint8_t IQNetPlayer::GetSmallId() { return 0; } -void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData, - uint32_t dwDataSize, uint32_t dwFlags) {} -bool IQNetPlayer::IsSameSystem(IQNetPlayer* player) { return true; } -uint32_t IQNetPlayer::GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags) { - return 0; -} -uint32_t IQNetPlayer::GetCurrentRtt() { return 0; } -bool IQNetPlayer::IsHost() { return this == &IQNet::m_player[0]; } -bool IQNetPlayer::IsGuest() { return false; } -bool IQNetPlayer::IsLocal() { return true; } -PlayerUID IQNetPlayer::GetXuid() { return INVALID_XUID; } -const char* IQNetPlayer::GetGamertag() { - static const char* name = "stub"; - return name; -} -int IQNetPlayer::GetSessionIndex() { return 0; } -bool IQNetPlayer::IsTalking() { return false; } -bool IQNetPlayer::IsMutedByLocalUser(uint32_t dwUserIndex) { return false; } -bool IQNetPlayer::HasVoice() { return false; } -bool IQNetPlayer::HasCamera() { return false; } -int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; } -void IQNetPlayer::SetCustomDataValue(uintptr_t ulpCustomDataValue) { - m_customData = ulpCustomDataValue; -} -uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; } - -int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return 0; } -IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; } -IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(uint32_t dwUserIndex) { - return &m_player[dwUserIndex]; -} -IQNetPlayer* IQNet::GetPlayerByIndex(uint32_t dwPlayerIndex) { - return &m_player[0]; -} -IQNetPlayer* IQNet::GetPlayerBySmallId(uint8_t SmallId) { return &m_player[0]; } -IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { return &m_player[0]; } -uint32_t IQNet::GetPlayerCount() { return 1; } -QNET_STATE IQNet::GetState() { - return s_gameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; -} -bool IQNet::IsHost() { return true; } -int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, - const INVITE_INFO* pInviteInfo) { - return 0; -} -void IQNet::HostGame() { s_gameRunning = true; } -void IQNet::EndGame() { s_gameRunning = false; } diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index e7ed1acbf..c8936af11 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -4,10 +4,10 @@ #include #include +#include "app/common/DLC/DLCPack.h" #include "app/common/Game.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/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" @@ -21,6 +21,7 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "strings.h" unsigned int NetworkController::m_uiLastSignInData = 0; diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 4d226d8dd..82a1e0032 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -3,10 +3,10 @@ #include #include "app/common/App_structs.h" -#include "platform/NetTypes.h" -#include "platform/storage/storage.h" -#include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" +#include "platform/storage/storage.h" struct INVITE_INFO; @@ -32,10 +32,10 @@ public: unsigned int uiSignInData); static void clearSignInChangeUsersMask(); static int signoutExitWorldThreadProc(void* lpParameter); - static int primaryPlayerSignedOutReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); - static int ethernetDisconnectReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); + static int primaryPlayerSignedOutReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); + static int ethernetDisconnectReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); static void profileReadErrorCallback(void* pParam); // Notifications diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index 2af9ec1ff..9919d6021 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -1,4 +1,3 @@ -#include "app/linux/LinuxGame.h" #include "app/common/SaveManager.h" #include @@ -6,12 +5,12 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "platform/profile/profile.h" void SaveManager::setAutosaveTimerTime(int settingValue) { m_uiAutosaveTimer = - time_util::clock::now() + - std::chrono::minutes(settingValue * 15); + time_util::clock::now() + std::chrono::minutes(settingValue * 15); } bool SaveManager::autosaveDue() const { @@ -35,9 +34,8 @@ void SaveManager::lock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)true); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); } } } @@ -54,9 +52,8 @@ void SaveManager::unlock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } } } diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index c5c2e0282..ca6be829f 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -1,21 +1,22 @@ #include "app/common/SkinManager.h" +#include + #include #include #include -#include #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/common/Minecraft_Macros.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/world/entity/player/Player.h" #include "platform/profile/profile.h" @@ -44,7 +45,7 @@ void SkinManager::setPlayerSkin(int iPad, std::uint32_t dwSkinId, } std::string SkinManager::getPlayerSkinName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return getSkinPathFromId(gameSettingsA[iPad]->dwSelectedSkin); } @@ -104,7 +105,7 @@ void SkinManager::setPlayerCape(int iPad, std::uint32_t dwCapeId, } std::string SkinManager::getPlayerCapeName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return Player::getCapePathFromId(gameSettingsA[iPad]->dwSelectedCape); } @@ -122,8 +123,8 @@ void SkinManager::setPlayerFavoriteSkin(int iPad, int iIndex, gameSettingsA[iPad]->bSettingsChanged = true; } -unsigned int SkinManager::getPlayerFavoriteSkin( - int iPad, int iIndex, GAME_SETTINGS** gameSettingsA) { +unsigned int SkinManager::getPlayerFavoriteSkin(int iPad, int iIndex, + GAME_SETTINGS** gameSettingsA) { return gameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; } @@ -151,8 +152,7 @@ unsigned int SkinManager::getPlayerFavoriteSkinsCount( return uiCount; } -void SkinManager::validateFavoriteSkins(int iPad, - GAME_SETTINGS** gameSettingsA, +void SkinManager::validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager) { unsigned int uiCount = getPlayerFavoriteSkinsCount(iPad, gameSettingsA); @@ -203,7 +203,7 @@ void SkinManager::addMemoryTextureFile(const std::string& wName, if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Incrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif pData = (*it).second; @@ -233,14 +233,14 @@ void SkinManager::removeMemoryTextureFile(const std::string& wName) { if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Decrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif PMEMDATA pData = (*it).second; --pData->ucRefCount; if (pData->ucRefCount <= 0) { #if !defined(_CONTENT_PACKAGE) printf("Erasing the memory texture file data for %s\n", - wName.c_str()); + wName.c_str()); #endif delete pData; m_MEM_Files.erase(wName); diff --git a/targets/app/common/SkinManager.h b/targets/app/common/SkinManager.h index 6336f0d87..a20a52e58 100644 --- a/targets/app/common/SkinManager.h +++ b/targets/app/common/SkinManager.h @@ -38,13 +38,13 @@ public: void setPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkin(int iPad, int iIndex, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); unsigned char getPlayerFavoriteSkinsPos(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void setPlayerFavoriteSkinsPos(int iPad, int iPos, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkinsCount(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager); diff --git a/targets/app/common/TerrainFeatureManager.h b/targets/app/common/TerrainFeatureManager.h index 16cb46a1a..015bca8f7 100644 --- a/targets/app/common/TerrainFeatureManager.h +++ b/targets/app/common/TerrainFeatureManager.h @@ -2,8 +2,8 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" class TerrainFeatureManager { public: diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 5135f2c8e..e77054799 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -2,10 +2,8 @@ #include -#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -15,6 +13,8 @@ #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/network/network.h" ChangeStateConstraint::ChangeStateConstraint( Tutorial* tutorial, eTutorial_State targetState, diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index b87601123..22a99e4f1 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -2,9 +2,9 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialConstraint.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class AABB; class Tutorial; diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index b7ef2a036..81ee5e570 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -3,6 +3,7 @@ #include #include +#include "app/common/Game.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/Tutorial/Constraints/AreaConstraint.h" #include "app/common/Tutorial/Constraints/ChangeStateConstraint.h" @@ -23,7 +24,6 @@ #include "app/common/Tutorial/Tasks/UseTileTask.h" #include "app/common/Tutorial/Tasks/XuiCraftingTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/linux/LinuxGame.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/alchemy/PotionMacros.h" @@ -290,8 +290,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) IDS_TUTORIAL_TASK_CREATE_TORCH)); if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); if (area != nullptr) { std::vector* areaConstraints = new std::vector(); @@ -506,8 +505,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("minecartArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("minecartArea"); if (area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, @@ -680,8 +678,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("creativeArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("creativeArea"); if (area != nullptr) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( @@ -1195,8 +1192,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("breedingArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("breedingArea"); if (area != nullptr) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( diff --git a/targets/app/common/Tutorial/FullTutorial.h b/targets/app/common/Tutorial/FullTutorial.h index ddf86922d..17631176e 100644 --- a/targets/app/common/Tutorial/FullTutorial.h +++ b/targets/app/common/Tutorial/FullTutorial.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "Tutorial.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1 #define FULL_TUTORIAL_PROGRESS_3_X_3_Crafting 2 diff --git a/targets/app/common/Tutorial/Hints/AreaHint.cpp b/targets/app/common/Tutorial/Hints/AreaHint.cpp index 8f4501cdc..34fe58eb4 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.cpp +++ b/targets/app/common/Tutorial/Hints/AreaHint.cpp @@ -4,11 +4,11 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/TutorialEnum.h" AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial, eTutorial_State displayState, eTutorial_State completeState, diff --git a/targets/app/common/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h index 375abfc99..26887218c 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,8 +1,8 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class AABB; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.h b/targets/app/common/Tutorial/Hints/DiggerItemHint.h index 95ba875e2..58a239da4 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.h +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class DiggerItem; class Level; diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp index 486259a5a..3e60b2806 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp @@ -2,7 +2,7 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h index d74b98767..533edffeb 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -1,9 +1,9 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" #include "java/Class.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp index 2c07bbab6..07e028a8a 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp @@ -4,8 +4,8 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/item/Item.h" +#include "minecraft/world/tutorial/TutorialEnum.h" LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, int tiles[], unsigned int tilesLength, diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h index 514c4fc43..c0eff2458 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp index 51d3356e1..934442fb2 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp @@ -4,8 +4,8 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/tutorial/TutorialEnum.h" TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], unsigned int itemsLength) diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h index 0cb9c6928..4826b2bfc 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.cpp b/targets/app/common/Tutorial/Hints/TutorialHint.cpp index 1122ceb00..c5482e446 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.cpp +++ b/targets/app/common/Tutorial/Hints/TutorialHint.cpp @@ -1,10 +1,10 @@ #include "TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Entity; class ItemInstance; diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.h b/targets/app/common/Tutorial/Hints/TutorialHint.h index 0ef31b135..c1d247a64 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.h +++ b/targets/app/common/Tutorial/Hints/TutorialHint.h @@ -3,8 +3,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Entity; class ItemInstance; diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.cpp b/targets/app/common/Tutorial/Tasks/AreaTask.cpp index d3b5c7ebb..8cee93830 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.cpp +++ b/targets/app/common/Tutorial/Tasks/AreaTask.cpp @@ -5,7 +5,7 @@ #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" AreaTask::AreaTask(eTutorial_State state, Tutorial* tutorial, std::vector* inConstraints, diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.h b/targets/app/common/Tutorial/Tasks/AreaTask.h index fbbd20bcc..cbf1d6b0a 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.h +++ b/targets/app/common/Tutorial/Tasks/AreaTask.h @@ -4,8 +4,8 @@ #include #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; class TutorialConstraint; diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index fbc14d81e..377299499 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -3,15 +3,15 @@ #include #include -#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/input/input.h" ChoiceTask::ChoiceTask( Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, @@ -55,12 +55,12 @@ bool ChoiceTask::isCompleted() { if (!m_bConfirmMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iConfirmMapping) > 0) { + m_iConfirmMapping) > 0) { m_bConfirmMappingComplete = true; } if (!m_bCancelMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iCancelMapping) > 0) { + m_iCancelMapping) > 0) { m_bCancelMappingComplete = true; } } diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.h b/targets/app/common/Tutorial/Tasks/ChoiceTask.h index 7faf10682..7d5593768 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index 62b91e381..835d3cefc 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -6,13 +6,13 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/input/input.h" class Tutorial; @@ -82,7 +82,7 @@ bool ControllerTask::isCompleted() { it != southpawCompletedMappings.end(); ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { @@ -96,7 +96,7 @@ bool ControllerTask::isCompleted() { ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp index eba2e6900..01ef7dcab 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp @@ -2,7 +2,7 @@ #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" FullTutorialActiveTask::FullTutorialActiveTask( Tutorial* tutorial, diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h index bcee51649..a269825fa 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index bbb131b5a..1eb60cc15 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -3,10 +3,10 @@ #include #include "app/common/Tutorial/Tasks/ChoiceTask.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h index 67fd7c95a..1ae0e4607 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h @@ -1,7 +1,7 @@ #pragma once #include "ChoiceTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp index 65a41a07e..a3ef7f19e 100644 --- a/targets/app/common/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -5,14 +5,14 @@ #include #include -#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "platform/input/input.h" InfoTask::InfoTask(Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/) @@ -64,7 +64,7 @@ bool InfoTask::isCompleted() { bool current = (*it).second; if (!current) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - (*it).first) > 0) { + (*it).first) > 0) { (*it).second = true; bAllComplete = true; } else { diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp index 90a55014c..1220bf736 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp @@ -4,7 +4,7 @@ #include #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" ProcedureCompoundTask::~ProcedureCompoundTask() { for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) { diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h index c78318b0d..c56fe2c15 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h @@ -2,8 +2,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h index 03f0abb42..5d81d540b 100644 --- a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h +++ b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; +#include "TutorialTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/StatTask.cpp b/targets/app/common/Tutorial/Tasks/StatTask.cpp index 1cba2d63a..bfaac9e16 100644 --- a/targets/app/common/Tutorial/Tasks/StatTask.cpp +++ b/targets/app/common/Tutorial/Tasks/StatTask.cpp @@ -1,9 +1,9 @@ #include "StatTask.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/profile/profile.h" class Tutorial; @@ -23,7 +23,7 @@ bool StatTask::isCompleted() { Minecraft* minecraft = Minecraft::GetInstance(); bIsCompleted = - minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) >= - (unsigned int)targetValue; + minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue( + stat) >= (unsigned int)targetValue; return bIsCompleted; } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tasks/StateChangeTask.h b/targets/app/common/Tutorial/Tasks/StateChangeTask.h index af6e7cf20..e1235e388 100644 --- a/targets/app/common/Tutorial/Tasks/StateChangeTask.h +++ b/targets/app/common/Tutorial/Tasks/StateChangeTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/Tutorial.h" #include "TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" class StateChangeTask : public TutorialTask { private: diff --git a/targets/app/common/Tutorial/Tasks/TutorialTask.h b/targets/app/common/Tutorial/Tasks/TutorialTask.h index 593edf3a6..61080d3df 100644 --- a/targets/app/common/Tutorial/Tasks/TutorialTask.h +++ b/targets/app/common/Tutorial/Tasks/TutorialTask.h @@ -4,7 +4,7 @@ #include // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Level; class Tutorial; diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 549bd5f6f..0be4a2e96 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -6,9 +6,9 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "TutorialMessage.h" #include "app/common/App_structs.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h" #include "app/common/Tutorial/Hints/LookAtEntityHint.h" @@ -21,12 +21,9 @@ #include "app/common/Tutorial/Tasks/RideEntityTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "TutorialMessage.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -45,7 +42,10 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" #include "minecraft/world/level/tile/WallTile.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class MobEffect; @@ -72,6 +72,8 @@ bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) { return textTheSame && titleTheSame && promptTheSame; } +void ITutorial::staticInit() { Tutorial::staticCtor(); } + void Tutorial::staticCtor() { // /* @@ -2131,7 +2133,8 @@ void Tutorial::tick() { if (!m_allowShow) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2152,7 +2155,8 @@ void Tutorial::tick() { if (ui.IsPauseMenuDisplayed(m_iPad)) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2232,7 +2236,9 @@ void Tutorial::tick() { isCurrentTask = false; if ((!task->ShowMinimumTime() || (task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now())) && task->isCompleted()) { eTutorial_CompletionAction compAction = @@ -2323,7 +2329,9 @@ void Tutorial::tick() { } if (task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now()) { task->setShownForMinimumTime(); @@ -2392,14 +2400,17 @@ void Tutorial::tick() { } } - if (m_hintDisplayed && (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < - time_util::clock::now()) { + if (m_hintDisplayed && + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < + time_util::clock::now()) { m_hintDisplayed = false; } if (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders != 0) && - (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * m_iTutorialReminderTime)) < + (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * + m_iTutorialReminderTime)) < time_util::clock::now()) { // Reminder PopupMessageDetails* message = new PopupMessageDetails(); @@ -2428,7 +2439,8 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && (!message->m_isReminder || - ((lastMessageTime + std::chrono::milliseconds(m_iTutorialReminderTime)) > + ((lastMessageTime + + std::chrono::milliseconds(m_iTutorialReminderTime)) > time_util::clock::now() && message->m_isReminder))) { delete message; @@ -2527,9 +2539,12 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) { if (message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ((m_hintDisplayed && - (now - m_lastHintDisplayedTime) > std::chrono::milliseconds(m_iTutorialHintDelayTime)) || + (now - m_lastHintDisplayedTime) > + std::chrono::milliseconds(m_iTutorialHintDelayTime)) || (!m_hintDisplayed && - (now - lastMessageTime) > std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime))))) { + (now - lastMessageTime) > + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime))))) { messageShown = setMessage(message); if (messageShown) { @@ -2558,7 +2573,8 @@ void Tutorial::showTutorialPopup(bool show) { if (!show) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } diff --git a/targets/app/common/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h index 5de42d941..5f790bfc4 100644 --- a/targets/app/common/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -9,14 +9,13 @@ #include #include -#include "util/Timer.h" - +#include "TutorialMessage.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" -#include "TutorialEnum.h" -#include "TutorialMessage.h" +#include "minecraft/world/tutorial/ITutorial.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "util/Timer.h" class Entity; class ItemInstance; @@ -40,7 +39,7 @@ class Level; class CXuiScene; class Player; -class Tutorial { +class Tutorial : public ITutorial { public: class PopupMessageDetails { public: @@ -145,7 +144,7 @@ public: int getPad() { return m_iPad; } - virtual bool isStateCompleted(eTutorial_State state); + bool isStateCompleted(eTutorial_State state) override; virtual void setStateCompleted(eTutorial_State state); bool isHintCompleted(eTutorial_Hint hint); void setHintCompleted(eTutorial_Hint hint); @@ -155,21 +154,24 @@ public: void setCompleted(int completableId); bool getCompleted(int completableId); - void changeTutorialState(eTutorial_State newState, - UIScene* scene = nullptr); + void changeTutorialState(eTutorial_State newState, UIScene* scene); + void changeTutorialState(eTutorial_State newState) override { + changeTutorialState(newState, nullptr); + } bool isSelectedItemState(); bool setMessage(PopupMessageDetails* message); bool setMessage(TutorialHint* hint, PopupMessageDetails* message); - bool setMessage(const std::string& message, int icon, int auxValue); + bool setMessage(const std::string& message, int icon, + int auxValue) override; - void showTutorialPopup(bool show); + void showTutorialPopup(bool show) override; void useItemOn(Level* level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly = false); void useItemOn(std::shared_ptr item, bool bTestUseOnly = false); - void completeUsingItem(std::shared_ptr item); + void completeUsingItem(std::shared_ptr item) override; void startDestroyBlock(std::shared_ptr item, Tile* tile); void destroyBlock(Tile* tile); void attack(std::shared_ptr player, std::shared_ptr entity); @@ -177,18 +179,18 @@ public: void handleUIInput(int iAction); void createItemSelected(std::shared_ptr item, bool canMake); - void onCrafted(std::shared_ptr item); + void onCrafted(std::shared_ptr item) override; void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, - unsigned int invItemCountThisAux); - void onSelectedItemChanged(std::shared_ptr item); - void onLookAt(int id, int iData = 0); - void onLookAtEntity(std::shared_ptr entity); - void onRideEntity(std::shared_ptr entity); - void onEffectChanged(MobEffect* effect, bool bRemoved = false); + unsigned int invItemCountThisAux) override; + void onSelectedItemChanged(std::shared_ptr item) override; + void onLookAt(int id, int iData = 0) override; + void onLookAtEntity(std::shared_ptr entity) override; + void onRideEntity(std::shared_ptr entity) override; + void onEffectChanged(MobEffect* effect, bool bRemoved = false) override; bool canMoveToPosition(double xo, double yo, double zo, double xt, - double yt, double zt); + double yt, double zt) override; bool isInputAllowed(int mapping); void AddGlobalConstraint(TutorialConstraint* c); diff --git a/targets/app/common/Tutorial/TutorialMessage.cpp b/targets/app/common/Tutorial/TutorialMessage.cpp index 2f3e0f10a..f8eab5d63 100644 --- a/targets/app/common/Tutorial/TutorialMessage.cpp +++ b/targets/app/common/Tutorial/TutorialMessage.cpp @@ -1,6 +1,6 @@ #include "TutorialMessage.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" TutorialMessage::TutorialMessage( int messageId, bool limitRepeats /*= false*/, diff --git a/targets/app/common/Tutorial/TutorialMode.h b/targets/app/common/Tutorial/TutorialMode.h index a16c8b217..4d3639d3c 100644 --- a/targets/app/common/Tutorial/TutorialMode.h +++ b/targets/app/common/Tutorial/TutorialMode.h @@ -20,18 +20,17 @@ public: TutorialMode(int iPad, Minecraft* minecraft, ClientConnection* connection); virtual ~TutorialMode(); - virtual void startDestroyBlock(int x, int y, int z, int face); - virtual bool destroyBlock(int x, int y, int z, int face); - virtual void tick(); - virtual bool useItemOn(std::shared_ptr player, Level* level, - std::shared_ptr item, int x, int y, - int z, int face, Vec3* hit, - bool bTestUseOnly = false, - bool* pbUsedItem = nullptr); - virtual void attack(std::shared_ptr player, - std::shared_ptr entity); + void startDestroyBlock(int x, int y, int z, int face) override; + bool destroyBlock(int x, int y, int z, int face) override; + void tick() override; + bool useItemOn(std::shared_ptr player, Level* level, + std::shared_ptr item, int x, int y, int z, + int face, Vec3* hit, bool bTestUseOnly = false, + bool* pbUsedItem = nullptr) override; + void attack(std::shared_ptr player, + std::shared_ptr entity) override; - virtual bool isInputAllowed(int mapping); + bool isInputAllowed(int mapping) override; - Tutorial* getTutorial() { return tutorial; } + Tutorial* getTutorial() override { return tutorial; } }; \ No newline at end of file diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index 445dcd085..4959be986 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -5,13 +5,12 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "app/common/Game.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/fs/fs.h" void ArchiveFile::_readHeader(DataInputStream* dis) { int numberOfFiles = dis->readInt(); @@ -29,8 +28,7 @@ void ArchiveFile::_readHeader(DataInputStream* dis) { } else meta->isCompressed = false; - m_index.insert( - std::pair(meta->filename, meta)); + m_index.insert(std::pair(meta->filename, meta)); } } @@ -114,10 +112,9 @@ std::vector ArchiveFile::getFile(const std::string& filename) { const unsigned int fileSize = static_cast(data->filesize); std::uint8_t* pbData = new std::uint8_t[fileSize == 0 ? 1 : fileSize]; out = std::vector(pbData, pbData + fileSize); - auto readResult = - PlatformFilesystem.readFileSegment( - m_sourcefile.getPath(), static_cast(data->ptr), - out.data(), static_cast(data->filesize)); + auto readResult = PlatformFilesystem.readFileSegment( + m_sourcefile.getPath(), static_cast(data->ptr), + out.data(), static_cast(data->filesize)); if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { app.DebugPrintf("Failed to read archive file segment\n"); diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index 9bbd292b8..d41c2c753 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -1,9 +1,9 @@ #pragma once -#include "platform/storage/storage.h" #include "UIEnums.h" #include "UIStructs.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" +#include "platform/storage/storage.h" // 4J Stu - An interface class that defines all the public functions that we use // within the game code. This allows us to build the Xbox 360 version without diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index a1b1c7c71..285d02a63 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,19 +7,17 @@ #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" @@ -32,6 +30,8 @@ #include "minecraft/world/item/crafting/FurnaceRecipes.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" #include "strings.h" IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { @@ -234,8 +234,8 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() { void IUIScene_AbstractContainerMenu::onMouseTick() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { if (ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP)) { @@ -1098,8 +1098,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index dcf87e8ee..56850199d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -3,9 +3,9 @@ #include #include -#include "app/common/Tutorial/TutorialEnum.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "UIStructs.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class HtmlString; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp index 6a4d6d9c2..cde45a9ec 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp @@ -3,8 +3,8 @@ #include #include +#include "app/common/Game.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp index ab5330c4b..a8ff44b9d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp @@ -5,11 +5,11 @@ #include #include -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h index 2c106f76b..a7d052a0b 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h @@ -1,8 +1,6 @@ #pragma once #include - - class CommandBlockEntity; class IUIScene_CommandBlockMenu { diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 7cafffa2b..b62eb32e3 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,17 +7,16 @@ #include #include -#include "app/common/Console_Debug_enum.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" +#include "app/common/UI/ConsoleUIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" @@ -154,8 +153,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && @@ -212,8 +211,9 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if (pMinecraft->localgameModes[iPad] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[iPad]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[iPad] + ->getTutorial()); if (tutorial != nullptr) { tutorial->onCrafted(pTempItemInst); } @@ -247,8 +247,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if (pMinecraft->localgameModes[iPad] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[iPad]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[iPad]->getTutorial()); if (tutorial != nullptr) { tutorial->createItemSelected( pTempItemInst, @@ -876,7 +876,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { app.DebugPrintf("Need more H slots - "); #if !defined(_CONTENT_PACKAGE) fprintf( - stderr, + stderr, "%s", app.GetString(pTempItemInst->getDescriptionId())); #endif app.DebugPrintf("\n"); diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index f0d893e94..da6fe24a8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -2,10 +2,10 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class LocalPlayer; class ItemInstance; @@ -110,8 +110,7 @@ protected: virtual void setIngredientDescriptionItem( int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; - virtual void setIngredientDescriptionText(int index, - const char* text) = 0; + virtual void setIngredientDescriptionText(int index, const char* text) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0; virtual void showTabHighlight(int iIndex, bool show) = 0; virtual void setGroupText(const char* text) = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index 02e81b9b6..97de9e63f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -6,14 +6,14 @@ #include #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index dc64e747a..71b48b145 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -3,12 +3,10 @@ #include #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -22,6 +20,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/level/material/Material.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" IUIScene_HUD::IUIScene_HUD() { m_lastActiveSlot = -1; @@ -79,9 +79,10 @@ void IUIScene_HUD::updateFrameTick() { SetDisplayName(PlatformProfile.GetDisplayName(iPad)); - SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || - (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), - eGameSetting_Tooltips) != 0))); + SetTooltipsEnabled( + ((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), + eGameSetting_Tooltips) != 0))); SetActiveSlot(pMinecraft->localplayers[iPad]->inventory->selected); diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index b6dd3b624..7b782bf40 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -9,17 +9,14 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.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/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" @@ -27,6 +24,9 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/profile/profile.h" #include "strings.h" class TexturePack; @@ -212,13 +212,8 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned( int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { bool bAutosave = (bool)lpParameter; - if (bAutosave) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_AutoSaveGame); - } else { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SaveGame); - } + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SaveGame{bAutosave}); // Share AABB & Vec3 pools with default (main thread) - should be ok as long // as we don't tick the main thread whilst this thread is running @@ -230,12 +225,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { app.SetGameStarted(false); - while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != - eXuiServerAction_Idle && - !MinecraftServer::serverHalted()) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - } - if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType()) app.SetGameStarted(true); @@ -243,7 +232,7 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { if (app.GetChangingSessionType()) { // 4J Stu - This causes the fullscreenprogress scene to ignore the // action it was given - hr = ERROR_CANCELLED; + hr = 1223; // ERROR_CANCELLED } return hr; } diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 46522bac3..f3d86ae57 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,8 +1,8 @@ #pragma once +#include "app/common/DLC/DLCPack.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" -#include "app/common/DLC/DLCPack.h" class DLCPack; @@ -13,20 +13,20 @@ protected: public: static int ExitGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameDeclineSaveReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameDeclineSaveReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int EnableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DisableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int EnableAutosaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DisableAutosaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveWorldThreadProc(void* lpParameter); static int ExitWorldThreadProc(void* lpParameter); diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index a21ddffd7..38ae75cd9 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -4,11 +4,10 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" @@ -24,6 +23,7 @@ #include "minecraft/world/item/trading/MerchantRecipe.h" #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "strings.h" +#include "util/StringHelpers.h" IUIScene_TradingMenu::IUIScene_TradingMenu() { m_validOffersCount = 0; @@ -47,8 +47,8 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h index a326e5aa7..79df467b7 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h @@ -6,11 +6,11 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/Rarity.h" #include "minecraft/world/item/trading/Merchant.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class MerchantRecipe; class HtmlString; diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 32a1f1950..65f527bfc 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,10 +6,10 @@ #include #include -#include "platform/storage/storage.h" -#include "app/common/App_Defines.h" #include "UIEnums.h" -#include "platform/C4JThread.h" +#include "minecraft/GameHostOptions.h" +#include "platform/storage/storage.h" +#include "platform/thread/C4JThread.h" class Container; class Inventory; @@ -384,7 +384,7 @@ typedef struct _SignInInfo { // Credits struct SCreditTextItemDef { const char* m_Text; // Should contain string, optionally with %s to add - // in translated string ... e.g. "Andy West - %s" + // in translated string ... e.g. "Andy West - %s" int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to // add any translated string. ECreditTextTypes m_eType; @@ -417,11 +417,6 @@ typedef struct _InGamePlayerOptionsInitData { unsigned int playerPrivileges; } InGamePlayerOptionsInitData; -typedef struct _DebugSetCameraPosition { - int player; - double m_camX, m_camY, m_camZ, m_yRot, m_elev; -} DebugSetCameraPosition; - typedef struct _TeleportMenuInitData { int iPad; bool teleportToPlayer; diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index b72ea71e7..1a967e72e 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -2,17 +2,17 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index 9e72a38b0..3283c2a0a 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp index 21d50ba9e..11ffd7495 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp @@ -1,11 +1,11 @@ #include "UIComponent_DebugUIMarketingGuide.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; @@ -19,9 +19,6 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide( IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; value[0].number = (F64)0; // WIN64 -#if defined(_WINDOWS64) || defined(__linux__) - value[0].number = (F64)0; -#endif IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetPlatform, 1, value); diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h index cf45d8a71..3735cdaa8 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Logo.cpp b/targets/app/common/UI/Components/UIComponent_Logo.cpp index 57d5165e4..05517c41b 100644 --- a/targets/app/common/UI/Components/UIComponent_Logo.cpp +++ b/targets/app/common/UI/Components/UIComponent_Logo.cpp @@ -1,8 +1,8 @@ #include "UIComponent_Logo.h" -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" +#include "platform/renderer/renderer.h" UIComponent_Logo::UIComponent_Logo(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index 7ad96e0f3..d230bb1d6 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,14 +1,14 @@ #include "UIComponent_MenuBackground.h" -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void* initData, UILayer* parentLayer) @@ -41,8 +41,8 @@ std::string UIComponent_MenuBackground::getMoviePath() { return "MenuBackground"; } -void UIComponent_MenuBackground::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_MenuBackground::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index 5daaff3a6..2999fde7d 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -2,10 +2,10 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index 154e5c15f..e663598b0 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -4,15 +4,15 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index fafc1c914..73e85f686 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -2,14 +2,14 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp index 4eb7ec5c2..4ec77d637 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp @@ -1,9 +1,9 @@ #include "UIComponent_PressStartToPlay.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index d59340d6c..bcff89963 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -2,14 +2,14 @@ #include -#include "platform/PlatformTypes.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 44c7c6f51..7b734b56c 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,19 +1,19 @@ #include "UIComponent_Tooltips.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "util/StringHelpers.h" UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData, diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index b0bc2ea15..4c1b4930b 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -2,17 +2,17 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/input/InputConstants.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index a20cc72a3..2c6956927 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -4,22 +4,22 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData, UILayer* parentLayer) @@ -248,8 +248,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene* interactScene, } std::string UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, - bool isFoil, - const char* desc) { + bool isFoil, const char* desc) { std::string temp(desc); bool isFixedIcon = false; @@ -362,7 +361,7 @@ std::string UIComponent_TutorialPopup::_SetImage(std::string& desc) { } std::string UIComponent_TutorialPopup::ParseDescription(int iPad, - std::string& text) { + std::string& text) { text = replaceAll(text, "{*CraftingTableIcon*}", ""); text = replaceAll(text, "{*SticksIcon*}", ""); text = replaceAll(text, "{*PlanksIcon*}", ""); @@ -442,8 +441,8 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { } } -void UIComponent_TutorialPopup::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_TutorialPopup::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (viewport != IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index eecb81729..b168f1fbf 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -3,17 +3,17 @@ #include #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class ItemInstance; class Tutorial; @@ -115,8 +115,7 @@ private: void _SetDescription(UIScene* interactScene, const std::string& desc, const std::string& title, bool allowFade, bool isReminder); - std::string _SetIcon(int icon, int iAuxVal, bool isFoil, - const char* desc); + std::string _SetIcon(int icon, int iAuxVal, bool isFoil, const char* desc); std::string _SetImage(std::string& desc); std::string ParseDescription(int iPad, std::string& text); void UpdateInteractScenePosition(bool visible); diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 9a3bd4044..6340bf06c 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -4,15 +4,13 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/UI/Components/UIComponent_Chat.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -22,7 +20,9 @@ #include "minecraft/world/inventory/InventoryMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_HUD::UIScene_HUD(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) { @@ -261,9 +261,10 @@ void UIScene_HUD::handleReload() { repositionHud(); - SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || - (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), - eGameSetting_Tooltips) != 0))); + SetTooltipsEnabled( + ((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), + eGameSetting_Tooltips) != 0))); } int UIScene_HUD::getPad() { return m_iPad; } diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index 33e30f98a..ea016b888 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -2,17 +2,17 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_HUD.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/common/UI/ConsoleUIController.cpp similarity index 92% rename from targets/app/linux/Linux_UIController.cpp rename to targets/app/common/UI/ConsoleUIController.cpp index 642b672be..dd7ab903f 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/common/UI/ConsoleUIController.cpp @@ -1,17 +1,19 @@ // GDraw GL backend for Linux -#include "platform/renderer/renderer.h" -#include "Linux_UIController.h" +#include "ConsoleUIController.h" + +#include "app/common/Iggy/gdraw/gdraw.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/Iggy/gdraw/gdraw.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/windows/Iggy/include/gdraw.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/gdraw.h" +#include "app/common/Iggy/include/rrCore.h" ConsoleUIController ui; diff --git a/targets/app/linux/Linux_UIController.h b/targets/app/common/UI/ConsoleUIController.h similarity index 92% rename from targets/app/linux/Linux_UIController.h rename to targets/app/common/UI/ConsoleUIController.h index ca59ed540..24a951c0a 100644 --- a/targets/app/linux/Linux_UIController.h +++ b/targets/app/common/UI/ConsoleUIController.h @@ -1,9 +1,9 @@ #pragma once +#include "app/common/Iggy/include/iggy.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/UIController.h" -#include "app/linux/Iggy/include/iggy.h" -#include "app/linux/Iggy/include/rrCore.h" #include "platform/profile/profile.h" class ConsoleUIController : public UIController { diff --git a/targets/app/common/UI/Controls/UIControl.cpp b/targets/app/common/UI/Controls/UIControl.cpp index 691216a3e..5087b3ebe 100644 --- a/targets/app/common/UI/Controls/UIControl.cpp +++ b/targets/app/common/UI/Controls/UIControl.cpp @@ -1,12 +1,12 @@ #include "UIControl.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/JavaMath.h" UIControl::UIControl() { diff --git a/targets/app/common/UI/Controls/UIControl.h b/targets/app/common/UI/Controls/UIControl.h index 0c1c73133..0b019c198 100644 --- a/targets/app/common/UI/Controls/UIControl.h +++ b/targets/app/common/UI/Controls/UIControl.h @@ -2,11 +2,11 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIScene; diff --git a/targets/app/common/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp index 0476a6ea5..157ec0487 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -3,14 +3,14 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_Base::UIControl_Base() { @@ -91,8 +91,7 @@ const char* UIControl_Base::getLabel() { return m_label.c_str(); } -void UIControl_Base::setAllPossibleLabels(int labelCount, - char labels[][256]) { +void UIControl_Base::setAllPossibleLabels(int labelCount, char labels[][256]) { IggyDataValue result; IggyDataValue* value = new IggyDataValue[labelCount]; IggyStringUTF8* stringVal = new IggyStringUTF8[labelCount]; diff --git a/targets/app/common/UI/Controls/UIControl_Base.h b/targets/app/common/UI/Controls/UIControl_Base.h index 3c64dc5bb..ae473c079 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.h +++ b/targets/app/common/UI/Controls/UIControl_Base.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif // This class maps to the FJ_Base class in actionscript diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp index 0d05bee90..e4c065e86 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp @@ -1,10 +1,10 @@ #include "UIControl_BeaconEffectButton.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_BeaconEffectButton::UIControl_BeaconEffectButton() { diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h index bdc889568..9deb12b08 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp index 0142039b1..719241704 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp @@ -1,10 +1,10 @@ #include "UIControl_BitmapIcon.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h index 452ce45ee..a92f5f5c4 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_Button.cpp b/targets/app/common/UI/Controls/UIControl_Button.cpp index 1419a1bda..e28738511 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.cpp +++ b/targets/app/common/UI/Controls/UIControl_Button.cpp @@ -1,12 +1,12 @@ #include "UIControl_Button.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Button.h b/targets/app/common/UI/Controls/UIControl_Button.h index 2f5abee9c..a20be07b7 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.h +++ b/targets/app/common/UI/Controls/UIControl_Button.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp index 54e6bb157..b382fc939 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp @@ -1,14 +1,14 @@ #include "UIControl_ButtonList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_ButtonList::UIControl_ButtonList() { diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.h b/targets/app/common/UI/Controls/UIControl_ButtonList.h index e1f164916..8598a56b7 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.h +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.h @@ -3,13 +3,13 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp index 2b5956013..8c61e80c0 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp @@ -1,14 +1,14 @@ #include "UIControl_CheckBox.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_CheckBox::UIControl_CheckBox() {} diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.h b/targets/app/common/UI/Controls/UIControl_CheckBox.h index da891a56b..c5b4b8100 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.h +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.cpp b/targets/app/common/UI/Controls/UIControl_Cursor.cpp index 3a5c44f4b..c36aa0fea 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.cpp +++ b/targets/app/common/UI/Controls/UIControl_Cursor.cpp @@ -1,10 +1,10 @@ #include "UIControl_Cursor.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_Cursor::UIControl_Cursor() {} diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.h b/targets/app/common/UI/Controls/UIControl_Cursor.h index 8488628d0..7a517999b 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.h +++ b/targets/app/common/UI/Controls/UIControl_Cursor.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.cpp b/targets/app/common/UI/Controls/UIControl_DLCList.cpp index a1d7b083e..c8dd98724 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.cpp +++ b/targets/app/common/UI/Controls/UIControl_DLCList.cpp @@ -1,13 +1,13 @@ #include "UIControl_DLCList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_DLCList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.h b/targets/app/common/UI/Controls/UIControl_DLCList.h index 9b2ebf1bc..40b5e85ce 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.h +++ b/targets/app/common/UI/Controls/UIControl_DLCList.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index 9e78ba8a1..29974fb3a 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -1,13 +1,13 @@ #include "UIControl_DynamicLabel.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_DynamicLabel::UIControl_DynamicLabel() {} @@ -26,8 +26,7 @@ bool UIControl_DynamicLabel::setupControl(UIScene* scene, IggyValuePath* parent, return success; } -void UIControl_DynamicLabel::addText(const std::string& text, - bool bLastEntry) { +void UIControl_DynamicLabel::addText(const std::string& text, bool bLastEntry) { IggyDataValue result; IggyDataValue value[2]; diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h index eaa15c650..e2b897ff2 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -2,15 +2,15 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_DynamicLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index 072919ad4..bdc3aabe1 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "java/Class.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h index 31e0ff88d..ef672a20f 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" #include "java/Random.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index ccd57d319..b5fa3c325 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -5,24 +5,23 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" - +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "util/StringHelpers.h" UIControl_EnchantmentButton::UIControl_EnchantmentButton() { m_index = 0; @@ -210,11 +209,10 @@ UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string UIControl_EnchantmentButton::EnchantmentNames::getRandomName() { diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h index 26363f586..5fc294883 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h @@ -3,11 +3,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Button.h" #include "java/Random.h" diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp index 57f25b015..8cdd394f2 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp @@ -1,13 +1,13 @@ #include "UIControl_HTMLLabel.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" UIControl_HTMLLabel::UIControl_HTMLLabel() {} diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 7a988f703..520ca3df9 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -2,16 +2,16 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_HTMLLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_Label.cpp b/targets/app/common/UI/Controls/UIControl_Label.cpp index 128eb7a99..6c46af9de 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.cpp +++ b/targets/app/common/UI/Controls/UIControl_Label.cpp @@ -1,12 +1,12 @@ #include "UIControl_Label.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Label.h b/targets/app/common/UI/Controls/UIControl_Label.h index ff2e86f00..09b61dcd8 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.h +++ b/targets/app/common/UI/Controls/UIControl_Label.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index 745d6eeb3..c16fa9f8b 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -1,11 +1,11 @@ #include "UIControl_LeaderboardList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" @@ -108,9 +108,8 @@ void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) { void UIControl_LeaderboardList::addDataSet( bool bLast, int iId, int iRank, const std::string& gamertag, bool bDisplayMessage, const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6) { + const std::string& col2, const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6) { IggyDataValue result; IggyDataValue value[12]; diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h index dd6acf80f..b173d4280 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" @@ -47,10 +47,9 @@ public: void setupTitles(const std::string& rank, const std::string& gamertag); void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns); void setColumnIcon(int iColumn, int iType); - void addDataSet(bool bLast, int iId, int iRank, - const std::string& gamertag, bool bDisplayMessage, - const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6); + void addDataSet(bool bLast, int iId, int iRank, const std::string& gamertag, + bool bDisplayMessage, const std::string& col0, + const std::string& col1, const std::string& col2, + const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6); }; \ No newline at end of file diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 252e1e9f3..a1640bdf5 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -1,16 +1,14 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" - - #include #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h index 31e824f60..ef44ad127 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h @@ -1,9 +1,9 @@ #pragma once +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index ed5fee485..95e3b4fa0 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -1,16 +1,14 @@ #include "UIControl_MinecraftPlayer.h" - - #include #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h index 89d94f366..04b5558b7 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h @@ -1,9 +1,9 @@ #pragma once +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp index 4151d193e..b097b7226 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp @@ -1,13 +1,13 @@ #include "UIControl_PlayerList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_PlayerList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.h b/targets/app/common/UI/Controls/UIControl_PlayerList.h index a9941b8c8..ca4439562 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 7c0714642..a27d21c71 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -6,15 +6,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" - +#include "app/common/Game.h" #include "java/Class.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h index 76f2a683b..fb4a23171 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h @@ -5,10 +5,10 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/app/common/UI/Controls/UIControl_Progress.cpp b/targets/app/common/UI/Controls/UIControl_Progress.cpp index e8d5cb48a..d1d1b352e 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.cpp +++ b/targets/app/common/UI/Controls/UIControl_Progress.cpp @@ -1,12 +1,12 @@ #include "UIControl_Progress.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Progress.h b/targets/app/common/UI/Controls/UIControl_Progress.h index d1a1c4348..dc7518d9e 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.h +++ b/targets/app/common/UI/Controls/UIControl_Progress.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.cpp b/targets/app/common/UI/Controls/UIControl_SaveList.cpp index e583f60db..c2688b39c 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SaveList.cpp @@ -1,13 +1,13 @@ #include "UIControl_SaveList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_SaveList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.h b/targets/app/common/UI/Controls/UIControl_SaveList.h index 1ceca021a..a50ca548b 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.h +++ b/targets/app/common/UI/Controls/UIControl_SaveList.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index 1c54934c8..fa56baaeb 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -1,17 +1,17 @@ #include "UIControl_Slider.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "util/StringHelpers.h" -#include "minecraft/sounds/SoundTypes.h" UIControl_Slider::UIControl_Slider() { m_id = 0; diff --git a/targets/app/common/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h index 9481fa15c..67e7bae17 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -3,16 +3,16 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_Slider : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.cpp b/targets/app/common/UI/Controls/UIControl_SlotList.cpp index 9e46bd740..b92f9e02c 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SlotList.cpp @@ -1,11 +1,11 @@ #include "UIControl_SlotList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_SlotList::UIControl_SlotList() { m_lastHighlighted = -1; } diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.h b/targets/app/common/UI/Controls/UIControl_SlotList.h index 6a77d7608..bb0004669 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.h +++ b/targets/app/common/UI/Controls/UIControl_SlotList.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp index 3ea91d2e4..d7f581f4f 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp @@ -1,12 +1,12 @@ #include "UIControl_SpaceIndicatorBar.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h index c7323f452..3103a0dec 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h @@ -7,13 +7,13 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SpaceIndicatorBar.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.cpp b/targets/app/common/UI/Controls/UIControl_TextInput.cpp index 98156e1fd..275f574ff 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.cpp +++ b/targets/app/common/UI/Controls/UIControl_TextInput.cpp @@ -1,12 +1,12 @@ #include "UIControl_TextInput.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.h b/targets/app/common/UI/Controls/UIControl_TextInput.h index 5a272ebbc..8804e1816 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.h +++ b/targets/app/common/UI/Controls/UIControl_TextInput.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp index a91292bee..623f92f36 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp @@ -1,14 +1,14 @@ #include "UIControl_TexturePackList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_TexturePackList::UIControl_TexturePackList() {} diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h index de7dab64a..61afb1c93 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -2,15 +2,15 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_TexturePackList : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_Touch.cpp b/targets/app/common/UI/Controls/UIControl_Touch.cpp index 09da5f198..2e35b3ef1 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.cpp +++ b/targets/app/common/UI/Controls/UIControl_Touch.cpp @@ -1,10 +1,11 @@ #include "UIControl_Touch.h" +#include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_Touch::UIControl_Touch() {} @@ -20,7 +21,6 @@ bool UIControl_Touch::setupControl(UIScene* scene, IggyValuePath* parent, void UIControl_Touch::init(int iId) { m_id = iId; -#if !defined(__linux__) switch (m_parentScene->GetParentLayer()->m_iLayer) { case eUILayer_Error: case eUILayer_Fullscreen: @@ -29,7 +29,6 @@ void UIControl_Touch::init(int iId) { ui.TouchBoxAdd(this, m_parentScene); break; } -#endif } void UIControl_Touch::ReInit() { diff --git a/targets/app/common/UI/Controls/UIControl_Touch.h b/targets/app/common/UI/Controls/UIControl_Touch.h index 74329f663..2fc78791b 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.h +++ b/targets/app/common/UI/Controls/UIControl_Touch.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Touch.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index cddc30b87..b5e2938a6 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,21 +3,22 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/GameEnums.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED @@ -52,7 +53,8 @@ UIScene_DebugCreateSchematic::UIScene_DebugCreateSchematic(int iPad, m_buttonCreate.init("Create", eControl_Create); - m_data = new ConsoleSchematicFile::XboxSchematicInitParam(); + m_data = {}; + m_data.compressionType = Compression::eCompressionType_None; } std::string UIScene_DebugCreateSchematic::getMoviePath() { @@ -86,38 +88,36 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_Create: { // We want the start to be even - if (m_data->startX > 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; - else if (m_data->startX < 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; - if (m_data->startY < 0) - m_data->startY = 0; - else if (m_data->startY > 0 && m_data->startY % 2 != 0) - m_data->startY -= 1; - if (m_data->startZ > 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; - else if (m_data->startZ < 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; + if (m_data.startX > 0 && m_data.startX % 2 != 0) + m_data.startX -= 1; + else if (m_data.startX < 0 && m_data.startX % 2 != 0) + m_data.startX -= 1; + if (m_data.startY < 0) + m_data.startY = 0; + else if (m_data.startY > 0 && m_data.startY % 2 != 0) + m_data.startY -= 1; + if (m_data.startZ > 0 && m_data.startZ % 2 != 0) + m_data.startZ -= 1; + else if (m_data.startZ < 0 && m_data.startZ % 2 != 0) + m_data.startZ -= 1; // We want the end to be odd to have a total size that is even - if (m_data->endX > 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - else if (m_data->endX < 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - if (m_data->endY > Level::maxBuildHeight) - m_data->endY = Level::maxBuildHeight; - else if (m_data->endY > 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - else if (m_data->endY < 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - if (m_data->endZ > 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; - else if (m_data->endZ < 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; + if (m_data.endX > 0 && m_data.endX % 2 == 0) + m_data.endX += 1; + else if (m_data.endX < 0 && m_data.endX % 2 == 0) + m_data.endX += 1; + if (m_data.endY > Level::maxBuildHeight) + m_data.endY = Level::maxBuildHeight; + else if (m_data.endY > 0 && m_data.endY % 2 == 0) + m_data.endY += 1; + else if (m_data.endY < 0 && m_data.endY % 2 == 0) + m_data.endY += 1; + if (m_data.endZ > 0 && m_data.endZ % 2 == 0) + m_data.endZ += 1; + else if (m_data.endZ < 0 && m_data.endZ % 2 == 0) + m_data.endZ += 1; - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_ExportSchematic, - (void*)m_data); + MinecraftServer::getInstance()->queueServerAction(m_data); navigateBack(); } break; @@ -143,13 +143,13 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool selected) { switch ((int)controlId) { case eControl_SaveMobs: - m_data->bSaveMobs = selected; + m_data.saveMobs = selected; break; case eControl_UseCompression: if (selected) - m_data->compressionType = APPROPRIATE_COMPRESSION_TYPE; + m_data.compressionType = APPROPRIATE_COMPRESSION_TYPE; else - m_data->compressionType = Compression::eCompressionType_RLE; + m_data.compressionType = Compression::eCompressionType_RLE; break; } } @@ -164,9 +164,9 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { case eControl_Name: m_textInputName.setLabel(value); if (!value.empty()) { - snprintf(m_data->name, 64, "%s", value.c_str()); + snprintf(m_data.name, 64, "%s", value.c_str()); } else { - snprintf(m_data->name, 64, "schematic"); + snprintf(m_data.name, 64, "schematic"); } break; case eControl_StartX: @@ -174,7 +174,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startX = iVal; + m_data.startX = iVal; } break; case eControl_StartY: @@ -182,7 +182,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startY = iVal; + m_data.startY = iVal; } break; case eControl_StartZ: @@ -190,7 +190,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startZ = iVal; + m_data.startZ = iVal; } break; case eControl_EndX: @@ -198,7 +198,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endX = iVal; + m_data.endX = iVal; } break; case eControl_EndY: @@ -206,7 +206,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endY = iVal; + m_data.endY = iVal; } break; case eControl_EndZ: @@ -214,7 +214,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endZ = iVal; + m_data.endZ = iVal; } break; default: diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h index 8cfeb20da..b864f1c0e 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h @@ -2,14 +2,14 @@ #ifdef _DEBUG_MENUS_ENABLED #include -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "minecraft/server/ServerAction.h" class UILayer; @@ -30,7 +30,9 @@ private: eControls m_keyboardCallbackControl; - ConsoleSchematicFile::XboxSchematicInitParam* m_data; + // Local UI state collected from the form. Sent to the server as an + // ExportSchematic action when the user hits Create. + minecraft::server::ExportSchematic m_data; public: UIScene_DebugCreateSchematic(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 673ff8e1a..455f36fda 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,12 +1,12 @@ #include "UIScene_DebugOptions.h" -#include "app/common/Console_Debug_enum.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/Console_Debug_enum.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/input/InputConstants.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h index 6aedef022..1f4a1f192 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h @@ -2,10 +2,10 @@ #include -#include "app/common/Console_Debug_enum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" +#include "minecraft/Console_Debug_enum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 40a9c1de6..03e96e2d3 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,21 +5,21 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/commands/common/EnchantItemCommand.h" #include "minecraft/commands/common/GiveItemCommand.h" #include "minecraft/commands/common/TimeCommand.h" @@ -33,13 +33,14 @@ class Player; class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "util/StringHelpers.h" UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData, UILayer* parentLayer) @@ -208,9 +209,9 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { case eControl_Mobs: { int id = childId; if (id < m_mobFactories.size()) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SpawnMob, - (void*)m_mobFactories[id]); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SpawnDebugMob{ + 0, static_cast(m_mobFactories[id])}); } } break; case eControl_Enchantments: { @@ -245,8 +246,8 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { conn->send(ToggleDownfallCommand::preparePacket()); } break; case eControl_Thunder: - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_ToggleThunder); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::ToggleThunder{}); break; case eControl_ResetTutorial: Tutorial::debugResetPlayerSavedProgress( diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h index c331ce0b9..a7a6921e5 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h @@ -5,16 +5,16 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Class.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 730e86c4e..2e5a8222c 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,25 +5,26 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "util/StringHelpers.h" UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, UILayer* parentLayer) @@ -32,38 +33,38 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, initialiseMovie(); int playerNo = 0; - currentPosition = new DebugSetCameraPosition(); - currentPosition->player = playerNo; + currentPosition = {}; + currentPosition.player = playerNo; Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft != nullptr) { Vec3 vec = pMinecraft->localplayers[playerNo]->getPos(1.0); - currentPosition->m_camX = vec.x; - currentPosition->m_camY = + currentPosition.m_camX = vec.x; + currentPosition.m_camY = vec.y - 1.62; // pMinecraft->localplayers[playerNo]->getHeadHeight(); - currentPosition->m_camZ = vec.z; + currentPosition.m_camZ = vec.z; - currentPosition->m_yRot = pMinecraft->localplayers[playerNo]->yRot; - currentPosition->m_elev = pMinecraft->localplayers[playerNo]->xRot; + currentPosition.m_yRot = pMinecraft->localplayers[playerNo]->yRot; + currentPosition.m_elev = pMinecraft->localplayers[playerNo]->xRot; } char TempString[256]; - snprintf(TempString, 256, "%f", currentPosition->m_camX); + snprintf(TempString, 256, "%f", currentPosition.m_camX); m_textInputX.init(TempString, eControl_CamX); - snprintf(TempString, 256, "%f", currentPosition->m_camY); + snprintf(TempString, 256, "%f", currentPosition.m_camY); m_textInputY.init(TempString, eControl_CamY); - snprintf(TempString, 256, "%f", currentPosition->m_camZ); + snprintf(TempString, 256, "%f", currentPosition.m_camZ); m_textInputZ.init(TempString, eControl_CamZ); - snprintf(TempString, 256, "%f", currentPosition->m_yRot); + snprintf(TempString, 256, "%f", currentPosition.m_yRot); m_textInputYRot.init(TempString, eControl_YRot); - snprintf(TempString, 256, "%f", currentPosition->m_elev); + snprintf(TempString, 256, "%f", currentPosition.m_elev); m_textInputElevation.init(TempString, eControl_Elevation); m_checkboxLockPlayer.init("Lock Player", eControl_LockPlayer, @@ -78,9 +79,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, m_labelYRotElev.init("Y-Rot & Elevation (Degs)"); } -std::string UIScene_DebugSetCamera::getMoviePath() { - return "DebugSetCamera"; -} +std::string UIScene_DebugSetCamera::getMoviePath() { return "DebugSetCamera"; } void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, @@ -107,11 +106,13 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { - case eControl_Teleport: - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SetCameraLocation, - (void*)currentPosition); - break; + case eControl_Teleport: { + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SetCameraLocation{ + currentPosition.player, currentPosition.m_camX, + currentPosition.m_camY, currentPosition.m_camZ, + currentPosition.m_yRot, currentPosition.m_elev}); + } break; case eControl_CamX: case eControl_CamY: case eControl_CamZ: @@ -146,23 +147,23 @@ int UIScene_DebugSetCamera::handleKeyboardComplete(bool bRes) { switch (m_keyboardCallbackControl) { case eControl_CamX: m_textInputX.setLabel(value); - currentPosition->m_camX = val; + currentPosition.m_camX = val; break; case eControl_CamY: m_textInputY.setLabel(value); - currentPosition->m_camY = val; + currentPosition.m_camY = val; break; case eControl_CamZ: m_textInputZ.setLabel(value); - currentPosition->m_camZ = val; + currentPosition.m_camZ = val; break; case eControl_YRot: m_textInputYRot.setLabel(value); - currentPosition->m_yRot = val; + currentPosition.m_yRot = val; break; case eControl_Elevation: m_textInputElevation.setLabel(value); - currentPosition->m_elev = val; + currentPosition.m_elev = val; break; default: break; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h index 061f00481..59e4b1d4f 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h @@ -2,14 +2,13 @@ #ifdef _DEBUG_MENUS_ENABLED #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; @@ -30,7 +29,18 @@ private: bool freeze; } FreezePlayerParam; - DebugSetCameraPosition* currentPosition; + // Local UI state collected from the form. Sent to the server as a + // SetCameraLocation action when the user hits Teleport. + struct CameraFormState { + int player = 0; + double m_camX = 0.0; + double m_camY = 0.0; + double m_camZ = 0.0; + double m_yRot = 0.0; + double m_elev = 0.0; + }; + + CameraFormState currentPosition; FreezePlayerParam* fpp; eControls m_keyboardCallbackControl; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp index 9fc4d9e3e..e03066933 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp @@ -4,18 +4,18 @@ #include -#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/profile/profile.h" class UILayer; @@ -145,8 +145,9 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { app.GetFileFromTPD(eTPDFileType_Loc, pbData, dwBytes, &pbFileData, &dwFileBytes); if (dwFileBytes > 0 && pbFileData) { - StringTable* pStringTable = - new StringTable(pbFileData, dwFileBytes); + StringTable* pStringTable = new StringTable( + std::span(pbFileData, dwFileBytes), + app.getLocale()); m_texturePackTitle.SetText( pStringTable->getString("IDS_DISPLAY_NAME")); m_texturePackDescription.SetText( diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index b38d136ee..d4a8730ac 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h @@ -2,14 +2,14 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -54,8 +54,8 @@ protected: static int TrialTexturePackWarningReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int UnlockTexturePackReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int UnlockTexturePackReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index 4e90a5ab0..9c2fd82f9 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -6,15 +6,13 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -22,27 +20,23 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.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/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/network/NetTypes.h" +#include "platform/profile/profile.h" #include "strings.h" - -#if defined(_WINDOWS64) - -#include - -#include "../../../../../Windows64/Resource.h" -#endif +#include "util/StringHelpers.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 #define GAME_CREATE_ONLINE_TIMER_TIME 100 @@ -197,8 +191,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, snprintf(imageName, 64, "tpack%08x", tp->getId()); registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i, imageName); - app.DebugPrintf("Adding texture pack %s at %d\n", imageName, - i); + app.DebugPrintf("Adding texture pack %s at %d\n", imageName, i); } } @@ -570,7 +563,6 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) { } } - void UIScene_CreateWorldMenu::checkStateAndStartGame() { int primaryPad = PlatformProfile.GetPrimaryPad(); bool isSignedInLive = true; @@ -586,7 +578,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { iPadNotSignedInLive = i; } - isSignedInLive = isSignedInLive && PlatformProfile.IsSignedInLive(i); + isSignedInLive = + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -621,7 +614,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -893,9 +887,9 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, if (bContinue == true) { // It's possible that the player has not signed in - they can back out if (PlatformProfile.IsSignedIn(pClass->m_iPad)) { - bool isOnlineGame = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isOnlineGame = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; // bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int primaryPad = PlatformProfile.GetPrimaryPad(); bool noPrivileges = false; @@ -988,7 +982,8 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -1006,9 +1001,9 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( } else { // Check if user-created content is allowed, as we cannot play // multiplayer if it's not - bool isClientSide = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isClientSide = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; bool pccAllowed = true; bool pccFriendsAllowed = true; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h index ee1237adb..e7ddeb5b9 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h @@ -4,9 +4,9 @@ #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -17,7 +17,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index f028964d1..597731396 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -1,13 +1,13 @@ #include "UIScene_DLCMainMenu.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "strings.h" class UILayer; @@ -93,8 +93,8 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { void UIScene_DLCMainMenu::handleTimerComplete(int id) {} -int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_DLCMainMenu::ExitDLCMainMenu( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h index c216c32ff..f572e61dc 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h @@ -2,13 +2,13 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index c02b8a636..e67158bfc 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -3,15 +3,15 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/renderer/renderer.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h index 584bb262f..5968ea869 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp index f54343940..3987c9415 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp @@ -3,18 +3,18 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) @@ -32,8 +32,7 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) std::vector paragraphs; int lastIndex = 0; for (int index = EULA.find("\r\n", lastIndex, 2); - index != std::string::npos; - index = EULA.find("\r\n", lastIndex, 2)) { + index != std::string::npos; index = EULA.find("\r\n", lastIndex, 2)) { paragraphs.push_back(EULA.substr(lastIndex, index - lastIndex) + " "); lastIndex = index + 2; } @@ -45,7 +44,8 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h index 84172be8b..b0d2b7221 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp index 66c74e7e3..dab36146a 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp @@ -1,9 +1,9 @@ #include "UIScene_Intro.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" -#include "app/linux/Linux_UIController.h" class UILayer; @@ -25,9 +25,7 @@ UIScene_Intro::UIScene_Intro(int iPad, void* initData, UILayer* parentLayer) bool bChina = false; // 4J Stu - These map to values in the Actionscript -#if defined(_WINDOWS64) || defined(__linux__) int platformIdx = 0; -#endif IggyDataValue result; IggyDataValue value[3]; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h index 473342785..49a6414d5 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp index b846bb591..50ff87332 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp @@ -4,22 +4,22 @@ #include #include -#include "app/common/App_Defines.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/SessionInfo.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h index 67f2121ed..eab94aad9 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h @@ -2,13 +2,13 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class FriendSessionInfo; class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp index 444d53517..9156eda3d 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp @@ -4,11 +4,9 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -16,11 +14,14 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 #define GAME_CREATE_ONLINE_TIMER_TIME 100 diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h index 228865ead..4de255444 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -11,11 +12,10 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index ed50aee4d..1b23301ad 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -8,21 +8,19 @@ #include -#include "platform/profile/profile.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/Leaderboards/LeaderboardInterface.h" -#include "app/common/Leaderboards/LeaderboardManager.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/leaderboard/leaderboard.h" +#include "platform/profile/profile.h" #include "strings.h" #define PLAYER_ONLINE_TIMER_ID 0 @@ -97,7 +95,7 @@ const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu:: UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, UILayer* parentLayer) - : UIScene(iPad, parentLayer), m_interface(LeaderboardManager::Instance()) { + : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene initialiseMovie(); @@ -127,8 +125,8 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, m_labelFilter.init(filterBuffer); char entriesBuffer[40]; - snprintf(entriesBuffer, 40, "%s%i", - app.GetString(IDS_LEADERBOARD_ENTRIES), 0); + snprintf(entriesBuffer, 40, "%s%i", app.GetString(IDS_LEADERBOARD_ENTRIES), + 0); m_labelEntries.init(entriesBuffer); ReadStats(-1); @@ -160,7 +158,7 @@ std::string UIScene_LeaderboardsMenu::getMoviePath() { void UIScene_LeaderboardsMenu::tick() { UIScene::tick(); - m_interface.tick(); + PlatformLeaderboard.Tick(); } void UIScene_LeaderboardsMenu::handleReload() { @@ -208,8 +206,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_RIGHT_SCROLL: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -241,8 +238,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_RIGHT: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -272,8 +268,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_PAGEDOWN: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -286,8 +281,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_X: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -367,23 +361,25 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { switch (filtermode) { case IPlatformLeaderboard::eFM_TopRank: { - m_interface.ReadStats_TopRank( + PlatformLeaderboard.ReadStats_TopRank( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, m_newEntryIndex, m_newReadSize); } break; case IPlatformLeaderboard::eFM_MyScore: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); - m_interface.ReadStats_MyScore( + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); + PlatformLeaderboard.ReadStats_MyScore( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, uid /*ignored on PS3*/, m_newReadSize); } break; case IPlatformLeaderboard::eFM_Friends: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); - m_interface.ReadStats_Friends( + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); + PlatformLeaderboard.ReadStats_Friends( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, uid /*ignored on PS3*/, m_newEntryIndex, m_newReadSize); @@ -405,7 +401,7 @@ bool UIScene_LeaderboardsMenu::OnStatsReadComplete( m_isProcessingStatsRead = true; - // bool noResults = LeaderboardManager::Instance()->GetStatsState() != + // bool noResults = PlatformLeaderboard.GetStatsState() != // XboxIPlatformLeaderboard::eStatsState_Ready; bool ret; @@ -415,7 +411,7 @@ bool UIScene_LeaderboardsMenu::OnStatsReadComplete( m_stats = results; ret = RetrieveStats(); - // else LeaderboardManager::Instance()->SetStatsRetrieved(false); + // else PlatformLeaderboard.SetStatsRetrieved(false); PopulateLeaderboard(retIn); @@ -483,7 +479,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { m_leaderboard.m_entries[entryIndex].m_bRequestedFriend = false; } - // LeaderboardManager::Instance()->SetStatsRetrieved(true); + // PlatformLeaderboard.SetStatsRetrieved(true); m_newEntryIndex = 0; m_newEntriesCount = NUM_ENTRIES; @@ -491,11 +487,11 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { return true; } - // assert( LeaderboardManager::Instance()->GetStats() != nullptr ); + // assert( PlatformLeaderboard.GetStats() != nullptr ); // PXUSER_STATS_READ_RESULTS stats = - // LeaderboardManager::Instance()->GetStats(); if( m_currentFilter == + // PlatformLeaderboard.GetStats(); if( m_currentFilter == // IPlatformLeaderboard::eFM_Friends ) - // LeaderboardManager::Instance()->SortFriendStats(); + // PlatformLeaderboard.SortFriendStats(); bool isDistanceLeaderboard = LEADERBOARD_DESCRIPTORS[m_currentLeaderboard][m_currentDifficulty] @@ -513,7 +509,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { : m_numStats; if (m_leaderboard.m_totalEntryCount == 0 || m_newEntriesCount == 0) { - // LeaderboardManager::Instance()->SetStatsRetrieved(false); + // PlatformLeaderboard.SetStatsRetrieved(false); return false; } @@ -734,8 +730,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard( true, // 4J-JEV: Has error message to display. - app.GetString(idsErrorMessage), "", "", "", "", "", - ""); + app.GetString(idsErrorMessage), "", "", "", "", "", ""); } else { m_listEntries.addDataSet( isLast, m_leaderboard.m_entries[i].m_row, @@ -826,7 +821,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { if (m_leaderboard.m_totalEntryCount > 0 && (item + 1) < GetEntryStartIndex()) { - if (LeaderboardManager::Instance()->isIdle()) { + if (PlatformLeaderboard.isIdle()) { int readIndex = (GetEntryStartIndex() + 1) - READ_SIZE; if (readIndex <= 0) readIndex = 1; assert(readIndex >= 1 && @@ -836,7 +831,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { } else if (m_leaderboard.m_totalEntryCount > 0 && (item + 1) >= (GetEntryStartIndex() + m_leaderboard.m_entries.size())) { - if (LeaderboardManager::Instance()->isIdle()) { + if (PlatformLeaderboard.isIdle()) { int readIndex = (GetEntryStartIndex() + 1) + m_leaderboard.m_entries.size(); assert(readIndex >= 1 && diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h index 396304e39..41df37f72 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h @@ -3,19 +3,19 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" -#include "app/common/Leaderboards/LeaderboardInterface.h" -#include "app/common/Leaderboards/LeaderboardManager.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" +#include "platform/leaderboard/leaderboard.h" +#include "platform/storage/storage.h" + #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; @@ -98,8 +98,6 @@ private: bool m_bPopulatedOnce; bool m_bReady; - LeaderboardInterface m_interface; - UIControl_LeaderboardList m_listEntries; UIControl_Label m_labelFilter, m_labelLeaderboard, m_labelEntries, m_labelInfo; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index 71015957d..a9182a013 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -4,16 +4,13 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -21,17 +18,21 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.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/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 @@ -301,7 +302,7 @@ void UIScene_LoadMenu::tick() { if (szSeed[0] != 0) { char TempString[256]; - snprintf(TempString, 256, "%s: %hs", app.GetString(IDS_SEED), + snprintf(TempString, 256, "%s: %s", app.GetString(IDS_SEED), szSeed); m_labelSeed.setLabel(TempString); } else { @@ -776,7 +777,8 @@ void UIScene_LoadMenu::LaunchGame(void) { &pSaveDetails ->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { - return loadSaveDataReturned(bCorrupt, bOwner); + return loadSaveDataReturned(bCorrupt, + bOwner); }); #if TO_BE_IMPLEMENTED @@ -784,7 +786,8 @@ void UIScene_LoadMenu::LaunchGame(void) { IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving PlatformStorage.SetSaveDisabled(true); - PlatformStorage.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDeviceSelected(m_iPad, + false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -867,8 +870,8 @@ int UIScene_LoadMenu::CheckResetNetherReturned( return 0; } -int UIScene_LoadMenu::ConfirmLoadReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::ConfirmLoadReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -1025,8 +1028,8 @@ int UIScene_LoadMenu::loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner) { return 0; } -int UIScene_LoadMenu::TrophyDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::TrophyDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h index 96a3ebff3..005126ca0 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h @@ -3,9 +3,9 @@ #include #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -15,7 +15,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class LevelGenerationOptions; @@ -126,16 +126,16 @@ private: static int TrophyDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int LoadDataComplete(void* pParam); - static int CheckResetNetherReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CheckResetNetherReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bSuccess); static int MustSignInReturnedPSN(void* pParam, int iPad, IPlatformStorage::EMessageResult result); public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int StartGame_SignInReturned(void* pParam, bool, int); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index a45cf9f2f..274f4d487 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -6,29 +6,29 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/SessionInfo.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/input/input.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" #include "strings.h" #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) @@ -295,8 +295,9 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { if (navBack) { app.SetLiveLinkRequired(true); - m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && - PlatformProfile.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput = false; @@ -350,9 +351,7 @@ void UIScene_LoadOrJoinMenu::handleLoseFocus() { killTimer(JOIN_LOAD_ONLINE_TIMER_ID); } -std::string UIScene_LoadOrJoinMenu::getMoviePath() { - return "LoadOrJoinMenu"; -} +std::string UIScene_LoadOrJoinMenu::getMoviePath() { return "LoadOrJoinMenu"; } void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); @@ -427,7 +426,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -449,7 +449,7 @@ void UIScene_LoadOrJoinMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -494,7 +494,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -599,8 +600,8 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - IPlatformStorage::ESaveGameState eSGIStatus = PlatformStorage.GetSavesInfo( - m_iPad, nullptr, (char*)"save"); + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo(m_iPad, nullptr, (char*)"save"); } #if TO_BE_IMPLEMENTED @@ -1118,7 +1119,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { delete m_currentSessions; m_currentSessions = - g_NetworkManager.GetSessionList(m_iPad, 1, m_bShowingPartyGamesOnly); + PlatformNetwork.GetSessionList(m_iPad, 1, m_bShowingPartyGamesOnly); // Update the xui list displayed unsigned int xuiListSize = m_buttonListGames.getItemCount(); @@ -1207,8 +1208,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { std::uint8_t* imageData = tp->getPackIcon(imageBytes); if (imageBytes > 0 && imageData) { - snprintf(textureName, 64, "%s", - sessionInfo->displayLabel); + snprintf(textureName, 64, "%s", sessionInfo->displayLabel); registerSubstitutionTexture(textureName, imageData, imageBytes); } @@ -1429,8 +1429,9 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( pClass->m_iDefaultButtonsC], [cbId](const bool bRes) { ui.lockCallbackScenes(); - auto* p = (UIScene_LoadOrJoinMenu*) - ui.GetSceneFromCallbackId(cbId); + auto* p = + (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId( + cbId); if (p) { p->deleteSaveDataReturned(bRes); } @@ -1703,7 +1704,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); strncpy(wSaveName, pNameUTF8, - strlen(pNameUTF8) + 1); // plus null + strlen(pNameUTF8) + 1); // plus null PlatformStorage.SetSaveTitle(wSaveName); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -1737,10 +1738,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage()->waitForPlatformStorageIdle(); IPlatformStorage::ESaveGameState saveState = - PlatformStorage.SaveSaveData( - [pClass](const bool bRes) { - return pClass->createDummySaveDataCallback(bRes); - }); + PlatformStorage.SaveSaveData([pClass](const bool bRes) { + return pClass->createDummySaveDataCallback(bRes); + }); if (saveState == IPlatformStorage::ESaveGame_Save) { pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; @@ -1955,9 +1955,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // we need to wait for the - // save system to be idle - // here, as Flush doesn't - // check for it. + // save system to be idle + // here, as Flush doesn't + // check for it. pSave->Flush(false, false); } break; case eSaveTransfer_Saving: { @@ -1982,12 +1982,13 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { uiIDA[0] = IDS_CONFIRM_OK; app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, - uiIDA, 1, PlatformProfile.GetPrimaryPad(), + uiIDA, 1, + PlatformProfile.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2041,7 +2042,8 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { return pClass ->crossSaveDeleteOnErrorReturned(bRes); }); - if (eDeleteStatus == IPlatformStorage::ESaveGame_Delete) { + if (eDeleteStatus == + IPlatformStorage::ESaveGame_Delete) { pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; } else { @@ -2061,9 +2063,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { case eSaveTransfer_ErrorMesssage: { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player if (pClass->m_saveTransferDownloadCancelled) { pClass->m_eSaveTransferState = eSaveTransfer_Idle; } else { diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h index d03c6b834..104394ca3 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h @@ -5,17 +5,17 @@ #include #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/storage/storage.h" class LevelGenerationOptions; class File; @@ -137,14 +137,14 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int LoadSaveCallback(void* lpParam, bool bRes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int SaveOptionsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int SaveOptionsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); int renameSaveDataReturned(bool bRes); int handleKeyboardCompleteWorldName(bool bRes); @@ -201,11 +201,11 @@ private: int createDummySaveDataCallback(bool bRes); int crossSaveGetSavesInfoCallback(SAVE_DETAILS* pSaveDetails, bool bRes); int loadCrossSaveDataCallback(bool bIsCorrupt, bool bIsOwner); - static int CrossSaveFinishedCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CrossSaveFinishedCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int crossSaveDeleteOnErrorReturned(bool bRes); - static int RemoteSaveNotFoundCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int RemoteSaveNotFoundCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int DownloadSonyCrossSaveThreadProc(void* lpParameter); static void SaveTransferReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); @@ -237,8 +237,8 @@ private: static void SaveUploadReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); static void CancelSaveUploadCallback(void* lpParam); - static int SaveTransferDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int SaveTransferDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback( void* pParam, int iPad, IPlatformStorage::EMessageResult result); #endif diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index 46f40fe3b..ef4788ffb 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -1,40 +1,41 @@ #include "UIScene_MainMenu.h" +#include #include +#include #include #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.h" - #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/game/game.h" +#include "platform/network/NetTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class LevelGenerationOptions; @@ -175,18 +176,22 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { random->nextInt((int)m_splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - SYSTEMTIME LocalSysTime; - GetLocalTime(&LocalSysTime); - if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) { + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + const auto month = ymd.month(); + const uint32_t day = static_cast(ymd.day()); + + if (month == std::chrono::November && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) { + } else if (month == std::chrono::June && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (LocalSysTime.wMonth == 12 && - LocalSysTime.wDay == 24) // the Java game shows this on - // Christmas Eve, so we will too + } else if (month == std::chrono::December && + day == 24) // the Java game shows this on + // Christmas Eve, so we will too { splashIndex = eSplashMerryXmas; - } else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) { + } else if (month == std::chrono::January && day == 1) { splashIndex = eSplashHappyNewYear; } // splashIndex = 47; // Very short string @@ -296,8 +301,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { if (PlatformProfile.IsSignedIn(primaryPad)) { if (confirmUser) { PlatformProfile.RequestSignInUI(false, false, true, false, true, - signInReturnedFunc, - primaryPad); + signInReturnedFunc, primaryPad); } else { RunAction(primaryPad); } @@ -393,8 +397,8 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { ui.endCustomDraw(region); } -int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::MustSignInReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -451,8 +455,8 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -468,7 +472,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, // 4J-JEV: Don't we only need to update rich-presence if the sign-in // status changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); #if TO_BE_IMPLEMENTED if (app.GetTMSDLCInfoRead()) @@ -503,8 +507,8 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -520,7 +524,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -532,7 +536,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); // change the minecraft player name - Minecraft::GetInstance()->user->name = + Minecraft::GetInstance()->user->name = PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); { @@ -593,9 +597,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, } #else Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); @@ -609,8 +612,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // offline PlatformProfile.DisplayOfflineProfile( [pClass](bool b, int p) { - return CScene_Main::CreateLoad_OfflineProfileReturned( - pClass, b, p); + return CScene_Main:: + CreateLoad_OfflineProfileReturned(pClass, b, p); }, PlatformProfile.GetPrimaryPad()); #else @@ -630,8 +633,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -646,7 +649,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -674,7 +677,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, PlatformProfile.GetPrimaryPad()); #endif } else { - PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); + PlatformProfile.SetLockedProfile( + PlatformProfile.GetPrimaryPad()); proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LeaderboardsMenu); } @@ -686,8 +690,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -703,7 +707,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); // XShowAchievementsUI(PlatformProfile.GetPrimaryPad()); } else { @@ -713,8 +717,8 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -729,7 +733,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); pClass->RunUnlockOrDLC(iPad); } else { @@ -739,8 +743,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -748,8 +752,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, return 0; } -int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::ExitGameReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this @@ -767,7 +771,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { // clear the remembered signed in users so their profiles get read again app.ClearSignInChangeUsersMask(); - app.ReleaseSaveThumbnail(); + PlatformGame.ReleaseSaveThumbnail(); if (PlatformProfile.IsGuest(iPad)) { unsigned int uiIDA[1]; @@ -782,7 +786,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - Need to check for installed DLC if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); @@ -807,9 +811,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { if (PlatformStorage.SetSaveDevice( &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // save device already selected // ensure we've applied this player's settings @@ -839,8 +842,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { m_Timer.SetShow(true); } #else - pMinecraft->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); @@ -891,7 +894,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); proceedToScene(iPad, eUIScene_LeaderboardsMenu); } @@ -911,7 +914,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); { bool bContentRestricted = false; @@ -1010,7 +1013,7 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) { // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); #if TO_BE_IMPLEMENTED // 4J-PB - You can be offline and still can go into help and options diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h index da092417b..98712efca 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h @@ -5,16 +5,16 @@ #include #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Random.h" class Random; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp index 1edae7b8c..e32a94edc 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp @@ -3,15 +3,15 @@ #include -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "strings.h" UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h index 741e00729..4fff97e1b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp index 5b36680b5..b50713a4a 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp @@ -1,17 +1,18 @@ #include "UIScene_SaveMessage.h" -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" #include "strings.h" #define PROFILE_LOADED_TIMER_ID 0 @@ -38,7 +39,8 @@ UIScene_SaveMessage::UIScene_SaveMessage(int iPad, void* initData, // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h index 1e9752efc..2a512b612 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h @@ -2,15 +2,15 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp index 408edb982..980f65d3e 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp @@ -1,12 +1,12 @@ #include "UIScene_TrialExitUpsell.h" -#include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp index 9797f1aa3..8c29b49ba 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,19 +4,19 @@ #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h index 01a5ccd68..cfec284b6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h @@ -2,17 +2,17 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp index a8cc86b8b..aa51481b6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -4,12 +4,12 @@ #include #include +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "strings.h" +#include "util/StringHelpers.h" #define CREDIT_ICON -2 @@ -27,8 +27,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line {"%s", IDS_CREDITS_RESTOFMOJANG, NO_TRANSLATED_STRING, eMediumText}, {"%s", IDS_CREDITS_LEADPC, NO_TRANSLATED_STRING, eLargeText}, - {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_JON_KAGSTROM, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_CEO, NO_TRANSLATED_STRING, eLargeText}, {"Carl Manneh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -73,8 +72,8 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line // Added credit for horses - {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, - NO_TRANSLATED_STRING, eExtraLargeText}, + {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, + eExtraLargeText}, {"John Olarte (DrZhark)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kent Christian Jensen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, @@ -83,8 +82,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line - {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eExtraLargeText}, + {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eExtraLargeText}, {"%s", IDS_CREDITS_PROGRAMMING, NO_TRANSLATED_STRING, eLargeText}, {"Paddy Burns", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Richard Reavy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -92,12 +90,10 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"James Vaughan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Mark Hughes", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Harry Gordon", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_ART, NO_TRANSLATED_STRING, eLargeText}, - {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Alan Redmond", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Chris Reeves", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kate Wright", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -125,14 +121,14 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { // Miles & Iggy credits {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Iggy, eSmallText}, // extra blank line {"Uses Iggy.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"Copyright (C) 2009-2014 by RAD Game Tools, Inc.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Miles, eSmallText}, // extra blank line {"Uses Miles Sound System.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h index 4920654df..f2f77632c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h @@ -2,14 +2,14 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; @@ -21,10 +21,8 @@ class UILayer; #define DYNAMODE_FONT_CREDITS_COUNT 2 #define PS3_DOLBY_CREDIT 4 -#if defined(_WINDOWS64) || defined(__linux__) #define MAX_CREDIT_STRINGS \ (XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT) -#endif class UIScene_Credits : public UIScene { private: diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp index 38f341d24..28143d744 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -1,14 +1,14 @@ #include "UIScene_HelpAndOptionsMenu.h" -#include "platform/profile/profile.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h index ea34f974b..147566885 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp index 6846170a4..d8be9f2ab 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,14 +6,14 @@ #include -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameEnums.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h index f068baf2e..a29f00e9e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp index c84ab18d5..51c1468e1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -3,13 +3,13 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" #include "strings.h" // strings for buttons in the list diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h index a49e14d5e..582bcb40d 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp index 20a7c58f2..678631c89 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -1,12 +1,12 @@ #include "UIScene_LanguageSelector.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" #include "strings.h" // strings for buttons in the list diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index e183a6e9f..9d1240b9f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -2,15 +2,15 @@ #include -#include "app/common/App_Defines.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" +#include "platform/profile/ProfileConstants.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp index 9cd949d15..c91307abc 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -1,10 +1,10 @@ #include "UIScene_ReinstallMenu.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h index 764686419..d64ff33e9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp index aeef22f6f..e79cd3599 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,12 +3,12 @@ #include -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h index 35b3cc41f..c74f4cf33 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp index a3e65f9e0..7b5a30786 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h index 325fbdd9a..b2d563757 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp index 23ac8299b..ef9e7a073 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,16 +2,16 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h index 967ce1aea..0e3943fcb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp index e5719b4c2..d9e13f32b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -1,14 +1,14 @@ #include "UIScene_SettingsMenu.h" -#include "platform/profile/profile.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h index b8e886f58..ff2c03e9c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,11 +2,11 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -51,6 +51,6 @@ public: protected: void handlePress(F64 controlId, F64 childId); - static int ResetDefaultsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ResetDefaultsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp index 2c7f0a946..dc3a0fb01 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,20 +3,20 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4] = { @@ -380,7 +380,8 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, std::string wsText = app.GetString(m_iDifficultySettingA[value]); EHTMLFontSize size = eHTMLSize_Normal; - if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } char startTags[64]; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h index 5046ba223..692ed4d2b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp index 125bf5abc..2eb5912df 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,15 +3,15 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h index ac245c6cf..fc135ff38 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index 810830562..16707e95f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,26 +5,25 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" -#include "app/common/Minecraft_Macros.h" +#include "app/common/Audio/SoundTypes.h" #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/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/client/model/SkinBox.h" -#include "util/StringHelpers.h" - +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class ModelPart; @@ -528,8 +527,8 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion* region) { // region->stencil_func_ref, region->stencil_write_mask); if (region->stencil_func_ref != 0) PlatformRenderer.StateSetStencil(GL_EQUAL, region->stencil_func_ref, - region->stencil_func_mask, - region->stencil_write_mask); + region->stencil_func_mask, + region->stencil_write_mask); m_characters[characterId].render(region); // Finish GDraw and anything else that needs to be finalised @@ -589,7 +588,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { case SKIN_SELECT_PACK_DEFAULT: backupTexture = getTextureId(m_skinIndex); - if (m_skinIndex == std::to_underlying(EDefaultSkins::ServerSelected)) { + if (m_skinIndex == + static_cast(EDefaultSkins::ServerSelected)) { skinName = app.GetString(IDS_DEFAULT_SKINS); } else { skinName = wchDefaultNamesA[m_skinIndex]; @@ -885,6 +885,8 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) { case EDefaultSkins::Skin7: texture = TN_MOB_CHAR7; break; + case EDefaultSkins::Count: + break; }; return texture; @@ -906,8 +908,8 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) { ++nextSkin; if (m_packIndex == SKIN_SELECT_PACK_DEFAULT && - nextSkin >= std::to_underlying(EDefaultSkins::Count)) { - nextSkin = std::to_underlying(EDefaultSkins::ServerSelected); + nextSkin >= static_cast(EDefaultSkins::Count)) { + nextSkin = static_cast(EDefaultSkins::ServerSelected); } else if (m_currentPack != nullptr && nextSkin >= m_currentPack->getSkinCount()) { nextSkin = 0; @@ -931,7 +933,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) { default: if (previousSkin == 0) { if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) { - previousSkin = std::to_underlying(EDefaultSkins::Count) - 1; + previousSkin = static_cast(EDefaultSkins::Count) - 1; } else if (m_currentPack != nullptr) { previousSkin = m_currentPack->getSkinCount() - 1; } diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index be4090428..5e9027f0f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -3,28 +3,29 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/entity/player/SkinTypes.h" class DLCPack; class UILayer; class UIScene_SkinSelectMenu : public UIScene { private: - static const char* wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; + static const char* + wchDefaultNamesA[static_cast(EDefaultSkins::Count)]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 6147b1661..725618e7a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -4,16 +4,16 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" @@ -193,8 +193,8 @@ void UIScene_AbstractContainerMenu::tick() { IggyPlayerDispatchEventRS(getMovie(), &mouseEvent, &result); } -void UIScene_AbstractContainerMenu::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewpBort) { +void UIScene_AbstractContainerMenu::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewpBort) { m_cacheSlotRenders = true; m_needsCacheRendered = m_needsCacheRendered || m_menu->needsRendered(); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h index 84b037e5d..62a0ecd1f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h @@ -2,18 +2,18 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class AbstractContainerMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp index 6bf9d5a95..13d78f813 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp @@ -7,17 +7,13 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" @@ -25,7 +21,12 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; @@ -92,7 +93,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData, setIgnoreInput(false); - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL); } std::string UIScene_AnvilMenu::getMoviePath() { @@ -317,7 +318,8 @@ UIControl* UIScene_AnvilMenu::getSection(ESceneSection eSection) { void UIScene_AnvilMenu::handleEditNamePressed() { setIgnoreInput(true); PlatformInput.RequestKeyboard( - app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, 30, + app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, + 30, [this](bool bRes) -> int { // 4J HEG - No reason to set value if keyboard was cancelled setIgnoreInput(false); @@ -338,8 +340,7 @@ void UIScene_AnvilMenu::setEditNameValue(const std::string& name) { void UIScene_AnvilMenu::setEditNameEditable(bool enabled) {} -void UIScene_AnvilMenu::setCostLabel(const std::string& label, - bool canAfford) { +void UIScene_AnvilMenu::setCostLabel(const std::string& label, bool canAfford) { IggyDataValue result; IggyDataValue value[2]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h index 6a4262c7c..28b906b24 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/input/input.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_AnvilMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -12,9 +12,9 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/input/input.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/MerchantMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index a3ea7c513..5097afe16 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -4,20 +4,21 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/BeaconMenu.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "strings.h" class UILayer; @@ -61,7 +62,7 @@ UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void* _initData, m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4); - // app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON); + // PlatformGame.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON); delete initData; } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h index 173a4f0cb..5282a8965 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_BeaconMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -10,9 +11,8 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp index fb29b70e0..ba2670a51 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp @@ -2,21 +2,22 @@ #include -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/profile/profile.h" class UILayer; @@ -61,7 +62,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void* _initData, if (initData) delete initData; - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING); } std::string UIScene_BrewingStandMenu::getMoviePath() { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h index ffa31b5c2..83cc46c8f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_BrewingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class BrewingStandTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp index 84e5a798e..405b31139 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp @@ -4,18 +4,18 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/ContainerMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h index becd3b9a4..54081c8f4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_ContainerMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index cf611ba13..60fd450ec 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -4,26 +4,26 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" +#include "platform/XboxStubs.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h index d96c3ba37..92e86282d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,9 +10,8 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp index a1beb76d7..99166d7fc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp @@ -4,17 +4,17 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h index 47402ff55..e22da5241 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_DispenserMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp index 9be761c88..06ec9498e 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp @@ -5,19 +5,20 @@ #include -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; @@ -55,7 +56,7 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void* _initData, m_slotListIngredient.addSlots(EnchantmentMenu::INGREDIENT_SLOT, 1); - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING); delete initData; } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index 4cce00e0b..f4de320cb 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -2,6 +2,8 @@ #include +#include "UIScene_AbstractContainerMenu.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_EnchantingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,8 +13,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp index 235401cf6..2df9c6a4a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp @@ -4,16 +4,16 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/world/inventory/FireworksMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h index b457fb614..b11207dfb 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_FireworksMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,9 +10,8 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp index bf465d457..fb463ad2b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp @@ -3,18 +3,19 @@ #include -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; @@ -53,7 +54,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void* _initData, m_slotListIngredient.addSlots(FurnaceMenu::INGREDIENT_SLOT, 1); m_slotListResult.addSlots(FurnaceMenu::RESULT_SLOT, 1); - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING); delete initData; } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h index 4f43bc00b..df8f0fcf9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_FurnaceMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class FurnaceTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp index cd37450b0..71aa4f94b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp @@ -4,18 +4,18 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HopperMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h index 63b54e8df..7d2a7bdac 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_HopperMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index baf7dcd44..775d1af5c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -4,20 +4,21 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/animal/EntityHorse.h" @@ -77,7 +78,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, setIgnoreInput(false); - // app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE); + // PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE); } std::string UIScene_HorseInventoryMenu::getMoviePath() { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h index 04a880fdc..3e624caf4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -10,9 +11,8 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index f0aafc9f5..9cbc3fdfc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -7,15 +7,13 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -23,7 +21,9 @@ #include "minecraft/stats/GenericStats.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/inventory/InventoryMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h index b5c7548c1..601d0e95d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_InventoryMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,9 +10,8 @@ #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp index 3829bf771..8f58c8451 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp @@ -5,17 +5,14 @@ #include #include -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" @@ -23,7 +20,11 @@ #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; @@ -83,7 +84,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void* _initData, ui.OverrideSFX(m_iPad, ACTION_MENU_UP, true); ui.OverrideSFX(m_iPad, ACTION_MENU_DOWN, true); - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING); } std::string UIScene_TradingMenu::getMoviePath() { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h index 736c01d1f..a4161d29c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_TradingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -9,9 +10,8 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class InventoryMenu; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp index dbb9361dc..89c9306c0 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp @@ -1,17 +1,15 @@ #include "UIScene_CraftingMenu.h" -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" @@ -22,6 +20,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; @@ -118,7 +119,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void* _initData, #endif - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING); setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); // Update the tutorial state diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h index 134f67da8..8a6c9124c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h @@ -3,6 +3,7 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_CraftingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -10,9 +11,8 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class AbstractContainerMenu; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp index 04ef15858..957a7f8f1 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp @@ -3,20 +3,20 @@ #include -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h index e1d9bce0c..05b284cd5 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp index 9185eb526..45fca4abc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp @@ -6,21 +6,21 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h index 9d5f13c9d..bbb4ea473 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h @@ -3,13 +3,13 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp index 37a433684..ea3ad81ec 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp @@ -3,20 +3,20 @@ #include -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/network/network.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h index 193153e68..236cc1306 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp index 766c715f3..98b654614 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp @@ -2,26 +2,25 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "app/common/Console_Debug_enum.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h index 995c07e3f..60f75b8fb 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h @@ -4,14 +4,14 @@ #include #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class INetworkPlayer; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index 1a0cf76fd..527d23d7c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -3,23 +3,23 @@ #include -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/packet/PlayerInfoPacket.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/network/network.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h index 0b7f4a3a3..62d6d4866 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h @@ -3,18 +3,18 @@ #include #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class INetworkPlayer; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp index 469b58061..8c40bd7e5 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp @@ -202,7 +202,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -224,7 +225,7 @@ void UIScene_InGameSaveManagementMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -268,7 +269,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h index 737d8d5ef..639fe48d8 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h @@ -91,9 +91,9 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + unsigned int thumbnailBytes); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); protected: diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp index 371facf6b..27f93a7c4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp @@ -5,24 +5,26 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "platform/profile/profile.h" #include "strings.h" class TexturePack; @@ -64,8 +66,8 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, // IsLocalGame() issues on Iggy if (/*g_NetworkManager.IsLocalGame() &&*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); } Minecraft* pMinecraft = Minecraft::GetInstance(); @@ -194,9 +196,8 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, if (iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } ui.PlayUISFX(eSFX_Back); @@ -263,9 +264,8 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { if (m_iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } navigateBack(); break; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h index 23c305cf8..ce1ea3377 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h @@ -2,12 +2,12 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp index 7a637adfb..c28be48be 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp @@ -1,24 +1,24 @@ #include "UIScene_SignEntryMenu.h" -#include "platform/input/input.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/SignUpdatePacket.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/input/input.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, UILayer* parentLayer) @@ -52,7 +52,8 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, IPlatformInput::EKeyboardMode_Alphabet); break; default: - m_signRows[i].SetKeyboardType(IPlatformInput::EKeyboardMode_Full); + m_signRows[i].SetKeyboardType( + IPlatformInput::EKeyboardMode_Full); break; } @@ -164,8 +165,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { // 4J HEG - No reason to set value if keyboard was cancelled m_bIgnoreInput = false; if (bRes && m_iEditingLine >= 0 && m_iEditingLine < 4) { - std::string str = - PlatformInput.GetText(); + std::string str = PlatformInput.GetText(); if (str.size() > 15) str.resize(15); m_textInputLines[m_iEditingLine].setLabel(str); } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h index 6a7c356a4..ac41b5f67 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h @@ -3,12 +3,12 @@ #include #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class SignTileEntity; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp index d5c4379a1..0166c1c05 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp @@ -3,21 +3,21 @@ #include -#include "app/common/Console_Debug_enum.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/network/packet/GameCommandPacket.h" #include "minecraft/server/commands/TeleportCommand.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/network/network.h" #include "strings.h" UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h index a0b2dbb57..615dba118 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h @@ -3,13 +3,13 @@ #include #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" class INetworkPlayer; class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index fcc99ac9e..4eaaa2ae3 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,20 +1,20 @@ #include "UIScene_ConnectingProgress.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "java/System.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_ConnectingProgress::UIScene_ConnectingProgress(int iPad, diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h index 7ede9166d..084582a83 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 9c64047a4..c56edb1ff 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -4,23 +4,22 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/C4JThread.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/thread/C4JThread.h" #include "strings.h" UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void* initData, @@ -166,7 +165,7 @@ void UIScene_FullscreenProgress::tick() { // If we failed (currently used by network connection thread), navigate // back if (exitcode != 0) { - if (exitcode == ERROR_CANCELLED) { + if (exitcode == 1223 /* ERROR_CANCELLED */) { // Current thread cancelled for whatever reason // Currently used only for the // Game::RemoteSaveThreadProc thread Assume to @@ -232,7 +231,8 @@ void UIScene_FullscreenProgress::tick() { // This just allows it to be shown Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes - [PlatformProfile.GetPrimaryPad()] != nullptr) + [PlatformProfile.GetPrimaryPad()] != + nullptr) pMinecraft ->localgameModes[PlatformProfile .GetPrimaryPad()] diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h index ad2e219c7..0dcf321ea 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" class C4JThread; class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 96eee7240..f1b74a608 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -1,15 +1,15 @@ #include "UIScene_Keyboard.h" -#include "app/common/App_Defines.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameTypes.h" #include "strings.h" +#include "util/StringHelpers.h" #define KEYBOARD_DONE_TIMER_ID 0 #define KEYBOARD_DONE_TIMER_TIME 100 @@ -30,7 +30,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void* initData, m_ButtonCursorRight.init("Cursor Right", -1); m_ButtonCaps.init("Caps", -1); m_ButtonDone.init("Done", 0); // only the done button needs an id, the - // others will never call back! + // others will never call back! m_ButtonSymbols.init("Symbols", -1); m_ButtonBackspace.init("Backspace", -1); diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.h b/targets/app/common/UI/Scenes/UIScene_Keyboard.h index 83eb9b4d6..5b7d98d18 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.h +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.h @@ -2,16 +2,16 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 1c5e369aa..e3b9516b5 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -1,15 +1,15 @@ #include "UIScene_MessageBox.h" -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_MessageBox::UIScene_MessageBox(int iPad, void* initData, @@ -114,7 +114,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, if (pressed) { navigateBack(); if (m_Func) - m_Func(m_lpParam, iPad, IPlatformStorage::EMessage_Cancelled); + m_Func(m_lpParam, iPad, + IPlatformStorage::EMessage_Cancelled); } break; case ACTION_MENU_OK: @@ -129,7 +130,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, } void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { - IPlatformStorage::EMessageResult result = IPlatformStorage::EMessage_Cancelled; + IPlatformStorage::EMessageResult result = + IPlatformStorage::EMessage_Cancelled; switch ((int)controlId) { case 0: result = IPlatformStorage::EMessage_ResultAccept; diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index d417692e5..8c2c121f5 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,16 +2,16 @@ #include -#include "platform/storage/storage.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 3dea50cd3..a8019e001 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -3,15 +3,15 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void* _initData, @@ -35,9 +35,7 @@ UIScene_QuadrantSignin::~UIScene_QuadrantSignin() { m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -std::string UIScene_QuadrantSignin::getMoviePath() { - return "QuadrantSignin"; -} +std::string UIScene_QuadrantSignin::getMoviePath() { return "QuadrantSignin"; } void UIScene_QuadrantSignin::updateTooltips() { ui.SetTooltips(m_iPad, IDS_TOOLTIPS_CONTINUE, IDS_TOOLTIPS_CANCEL); @@ -150,8 +148,7 @@ void UIScene_QuadrantSignin::updateState() { if (!m_iconRequested[i]) { app.DebugPrintf(app.USER_SR, "Requesting avatar for %d\n", i); if (PlatformProfile.GetProfileAvatar( - i, - [this](std::uint8_t* data, unsigned int bytes) { + i, [this](std::uint8_t* data, unsigned int bytes) { return AvatarReturned(this, data, bytes); })) { m_iconRequested[i] = true; diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h index 88f52f472..af04d0d32 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h @@ -3,15 +3,15 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index 1ed7820e5..50062c000 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -1,12 +1,12 @@ #include "UIBitmapFont.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "minecraft/client/BufferedImage.h" #include "UIFontData.h" +#include "app/common/Iggy/include/rrCore.h" +#include "minecraft/client/BufferedImage.h" ///////////////////////////// // UI Abstract Bitmap Font // diff --git a/targets/app/common/UI/UIBitmapFont.h b/targets/app/common/UI/UIBitmapFont.h index 48d8ed9ce..2d0baf83b 100644 --- a/targets/app/common/UI/UIBitmapFont.h +++ b/targets/app/common/UI/UIBitmapFont.h @@ -2,11 +2,11 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" struct SFontData; class CFontData; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 12c385a29..12d91628d 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -10,11 +10,9 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -29,21 +27,17 @@ #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/common/UI/UITTFFont.h" -#include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" #include "UIFontData.h" -#include "platform/XboxStubs.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" - -#include "util/StringHelpers.h" - +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Textures.h" @@ -51,7 +45,11 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "platform/XboxStubs.h" +#include "platform/thread/C4JThread.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Tutorial; @@ -60,19 +58,12 @@ class Tutorial; // #define EXCLUDE_IGGY_ALLOCATIONS_FROM_HEAP_INSPECTOR // #define ENABLE_IGGY_EXPLORER -#if defined(ENABLE_IGGY_EXPLORER) -#include "app/windows/Iggy/include/iggyexpruntime.h" -#endif // #define ENABLE_IGGY_PERFMON #if defined(ENABLE_IGGY_PERFMON) #define PM_ORIGIN_X 24 -#define PM_ORIGIN_Y 34 - -#if defined(__WINDOWS64) -#include "app/windows/Iggy/include/iggyperfmon.h" -#endif +#define PM_ORIGIN_ #endif @@ -215,7 +206,7 @@ UIController::UIController() { // 4J Stu - This is a bit of a hack until we change the Minecraft // initialisation to store the proper screen size for other platforms -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 m_fScreenWidth = 1920.0f; m_fScreenHeight = 1080.0f; m_bScreenWidthSetup = true; @@ -355,15 +346,13 @@ UITTFFont* UIController::createFont(EFont fontLanguage) { "app/common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN case eFont_TradChinese: - return new UITTFFont( - "Mojangles_TTF_cnTD", - "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", - 0x2022); // CHT + return new UITTFFont("Mojangles_TTF_cnTD", + "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", + 0x2022); // CHT case eFont_Korean: - return new UITTFFont( - "Mojangles_TTF_koKR", - "app/common/Media/font/KOR/BOKMSD.ttf", - 0x2022); // KOR + return new UITTFFont("Mojangles_TTF_koKR", + "app/common/Media/font/KOR/BOKMSD.ttf", + 0x2022); // KOR // 4J-JEV, Cyrillic characters have been added to this font now, // (4/July/14) XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK: default: @@ -502,7 +491,7 @@ void UIController::tick() { void UIController::loadSkins() { std::string platformSkinPath = ""; -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 if (m_fScreenHeight == 1080.0f) { platformSkinPath = "skinHDWin.swf"; } else { @@ -518,7 +507,7 @@ void UIController::loadSkins() { loadSkin(platformSkinPath, "platformskin.swf"); } -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 #if defined(_WINDOWS64) // 4J Stu - Load the 720/480 skins so that we have something to fallback on @@ -561,8 +550,7 @@ void UIController::loadSkins() { loadSkin("skinHDLabels.swf", "skinHDLabels.swf"); m_iggyLibraries[eLibrary_InGame] = loadSkin("skinHDInGame.swf", "skinHDInGame.swf"); - m_iggyLibraries[eLibrary_HUD] = - loadSkin("skinHDHud.swf", "skinHDHud.swf"); + m_iggyLibraries[eLibrary_HUD] = loadSkin("skinHDHud.swf", "skinHDHud.swf"); m_iggyLibraries[eLibrary_Tooltips] = loadSkin("skinHDTooltips.swf", "skinHDTooltips.swf"); m_iggyLibraries[eLibrary_Default] = loadSkin("skinHD.swf", "skinHD.swf"); @@ -621,7 +609,7 @@ void UIController::ReloadSkin() { m_iggyLibraries[i] = IGGY_INVALID_LIBRARY; } -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 // 4J Stu - Don't load on a thread on windows. I haven't investigated this // in detail, so a quick fix reloadSkinThreadProc(this); @@ -673,7 +661,7 @@ int UIController::reloadSkinThreadProc(void* lpParam) { // 4J Stu - Don't do this on windows, as we never navigated forwards to // start with -#if !(defined(_WINDOWS64) || defined(__linux__)) +#if 0 controller->NavigateBack(0, false, eUIScene_COUNT, eUILayer_Tooltips); #endif } @@ -740,7 +728,7 @@ void UIController::tickInput() { #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { if (PlatformInput.ButtonPressed(PlatformProfile.GetPrimaryPad(), - ACTION_MENU_STICK_PRESS)) + ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; } else #endif @@ -777,7 +765,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { if (pressed) { // Start repeat timer m_actionRepeatTimer[iPad][key] = - time_util::clock::now() + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); + time_util::clock::now() + + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); } else if (released) { // Stop repeat timer m_actionRepeatTimer[iPad][key] = {}; @@ -887,8 +876,8 @@ void UIController::renderScenes() { #endif } -void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport, - S32& width, S32& height) { +void UIController::getRenderDimensions( + IPlatformRenderer::eViewportType viewport, S32& width, S32& height) { switch (viewport) { case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: width = (S32)(getScreenWidth()); @@ -916,7 +905,8 @@ void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport } } -void UIController::setupRenderPosition(IPlatformRenderer::eViewportType viewport) { +void UIController::setupRenderPosition( + IPlatformRenderer::eViewportType viewport) { if (m_bCustomRenderPosition || m_currentRenderViewport != viewport) { m_currentRenderViewport = viewport; m_bCustomRenderPosition = false; @@ -972,13 +962,7 @@ void UIController::setupCustomDrawGameState() { m_customRenderingClearRect.top = LONG_MAX; m_customRenderingClearRect.bottom = LONG_MIN; -#if defined(_WINDOWS64) PlatformRenderer.StartFrame(); - - gdraw_D3D11_setViewport_4J(); -#elif defined(__linux__) - PlatformRenderer.StartFrame(); -#endif PlatformRenderer.Set_matrixDirty(); // 4J Stu - We don't need to clear this here as iggy hasn't written anything @@ -1062,11 +1046,7 @@ void UIController::setupCustomDrawGameStateAndMatrices( } void UIController::endCustomDrawGameState() { -#if defined(__linux__) PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT); -#else - PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); -#endif // glClear(GL_DEPTH_BUFFER_BIT); glDepthMask(false); glDisable(GL_ALPHA_TEST); @@ -1128,8 +1108,8 @@ GDrawTexture* RADLINK UIController::TextureSubstitutionCreateCallback( if (image.getData() != nullptr) { image.preMultiplyAlpha(); Textures* t = Minecraft::GetInstance()->textures; - int id = t->getTexture(&image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + int id = t->getTexture( + &image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); // 4J Stu - All our flash controls that allow replacing textures use // a special 64x64 symbol Force this size here so that our images @@ -1179,8 +1159,8 @@ void UIController::registerSubstitutionTexture(const std::string& textureName, std::vector(pbData, pbData + dwLength); } -void UIController::unregisterSubstitutionTexture( - const std::string& textureName, bool deleteData) { +void UIController::unregisterSubstitutionTexture(const std::string& textureName, + bool deleteData) { auto it = m_substitutionTextures.find(textureName); if (it != m_substitutionTextures.end()) { @@ -1288,7 +1268,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void* initData, setFullscreenMenuDisplayed(true); } - std::println(stderr, "TIMER: Navigate to scene: Elapsed time {:.6f}", + fprintf(stderr, "TIMER: Navigate to scene: Elapsed time %.6f", timer.elapsed_seconds()); return success; @@ -1357,9 +1337,11 @@ void UIController::NavigateToHomeMenu() { // 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(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); // if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) @@ -1370,7 +1352,8 @@ void UIController::NavigateToHomeMenu() { // { // pDLCTexPack->m_pSoundBank->Destroy(); // } - const unsigned int result = PlatformStorage.UnmountInstalledDLC("TPACK"); + const unsigned int result = + PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -1796,8 +1779,7 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) { } } -void UIController::SetSelectedItem(unsigned int iPad, - const std::string& name) { +void UIController::SetSelectedItem(unsigned int iPad, const std::string& name) { EUIGroup group; if (app.GetGameStarted()) { @@ -2159,8 +2141,8 @@ void UIController::ClearPressStart() { m_iPressStartQuadrantsMask = 0; } IPlatformStorage::EMessageResult UIController::RequestAlertMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false); } @@ -2168,8 +2150,8 @@ IPlatformStorage::EMessageResult UIController::RequestAlertMessage( IPlatformStorage::EMessageResult UIController::RequestErrorMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true); } @@ -2177,8 +2159,9 @@ IPlatformStorage::EMessageResult UIController::RequestErrorMessage( IPlatformStorage::EMessageResult UIController::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString, unsigned int dwFocusButton, bool bIsError) + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString, unsigned int dwFocusButton, + bool bIsError) { MessageBoxInfo param; @@ -2224,7 +2207,8 @@ IPlatformStorage::EMessageResult UIController::RequestMessageBox( IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2244,9 +2228,11 @@ IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( lpParam); } -IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( +IPlatformStorage::EMessageResult +UIController::RequestContentRestrictedMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2254,7 +2240,7 @@ IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBo } if (message == -1) { -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 // IDS_CONTENT_RESTRICTION doesn't exist on XB1 message = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE; #else @@ -2280,7 +2266,7 @@ void UIController::setFontCachingCalculationBuffer(int length) { draw call is not large enough, Iggy will crash or otherwise behave incorrectly. */ -#if defined(_WIN64) || defined(__linux__) +#if INTPTR_MAX == INT64_MAX static const int CHAR_SIZE = 24; #else static const int CHAR_SIZE = 16; diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 561513dbe..3082fe34a 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -8,30 +8,22 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "util/Timer.h" - -#ifdef __linux__ - -#include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif - -#elif defined(_WINDOWS64) -#include "app/windows/Iggy/include/iggy.h" -#endif - -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" +#include "UIGroup.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "UIGroup.h" -#include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" class UIAbstractBitmapFont; class UIBitmapFont; @@ -43,8 +35,8 @@ class Tutorial; class UIScene; // 4jcraft, used to be D3D11_RECT. -// This was the only class that used it, so it's here now. -struct RECT { +// This was the only class that used it, so it's here now. +struct RECT_4J { long left; long top; long right; @@ -72,7 +64,8 @@ private: 300; // How long from press until the first repeat static constexpr int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats - time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU + 1]; + time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT] + [ACTION_MAX_MENU + 1]; float m_fScreenWidth; float m_fScreenHeight; @@ -197,7 +190,7 @@ private: int m_accumulatedTicks; uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect - RECT m_customRenderingClearRect; + RECT_4J m_customRenderingClearRect; std::unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's @@ -277,8 +270,8 @@ public: } virtual void render() = 0; - void getRenderDimensions(IPlatformRenderer::eViewportType viewport, S32& width, - S32& height); + void getRenderDimensions(IPlatformRenderer::eViewportType viewport, + S32& width, S32& height); void setupRenderPosition(IPlatformRenderer::eViewportType viewport); void setupRenderPosition(S32 xOrigin, S32 yOrigin); @@ -431,12 +424,14 @@ public: virtual IPlatformStorage::EMessageResult RequestAlertMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); virtual IPlatformStorage::EMessageResult RequestErrorMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); private: @@ -450,11 +445,13 @@ private: public: IPlatformStorage::EMessageResult RequestUGCMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); IPlatformStorage::EMessageResult RequestContentRestrictedMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); diff --git a/targets/app/common/UI/UIFontData.cpp b/targets/app/common/UI/UIFontData.cpp index 5f4e53c9d..1d36d18dc 100644 --- a/targets/app/common/UI/UIFontData.cpp +++ b/targets/app/common/UI/UIFontData.cpp @@ -4,7 +4,7 @@ #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" ///////////////////////////////////////////////////// // --- -- --- THIS FILE IS IN UNICODE --- -- --- // diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index b949956d4..f008de7b7 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,16 +1,16 @@ #include "UIGroup.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/UILayer.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" class UIScene; @@ -251,7 +251,9 @@ void UIGroup::SetViewportType(IPlatformRenderer::eViewportType type) { } } -IPlatformRenderer::eViewportType UIGroup::GetViewportType() { return m_viewportType; } +IPlatformRenderer::eViewportType UIGroup::GetViewportType() { + return m_viewportType; +} void UIGroup::HandleDLCMountingComplete() { // Ignore this group if the player isn't signed in diff --git a/targets/app/common/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h index 806c269c4..5d69416b9 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -1,10 +1,10 @@ #pragma once #include -#include "platform/renderer/renderer.h" -#include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/Iggy/include/rrCore.h" #include "UILayer.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "platform/renderer/renderer.h" class UIComponent_Tooltips; class UIComponent_TutorialPopup; diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index ba67117b4..efa8abaf0 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -2,7 +2,8 @@ #include -#include "platform/renderer/renderer.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Components/UIComponent_DebugUIConsole.h" @@ -14,6 +15,7 @@ #include "app/common/UI/Components/UIComponent_Tooltips.h" #include "app/common/UI/Components/UIComponent_TutorialPopup.h" #include "app/common/UI/Components/UIScene_HUD.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugOptions.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h" @@ -76,9 +78,7 @@ #include "app/common/UI/Scenes/UIScene_Timer.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "platform/renderer/renderer.h" UILayer::UILayer(UIGroup* parent) { m_parentGroup = parent; @@ -138,7 +138,8 @@ void UILayer::tick() { } } -void UILayer::render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { +void UILayer::render(S32 width, S32 height, + IPlatformRenderer::eViewportType viewport) { if (!ui.IsExpectingOrReloadingSkin()) { for (auto it = m_components.begin(); it != m_components.end(); ++it) { auto itRef = m_componentRefCount.find((*it)->getSceneType()); diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index 540c3bd24..1d66d8dd4 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -6,9 +6,9 @@ #include #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" // using namespace std; class UIScene; @@ -44,7 +44,8 @@ public: UILayer(UIGroup* parent); void tick(); - void render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport); + void render(S32 width, S32 height, + IPlatformRenderer::eViewportType viewport); void getRenderDimensions(S32& width, S32& height); void DestroyAll(); diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 148d8f930..140f73542 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -4,6 +4,7 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -11,21 +12,19 @@ #include "app/common/UI/UIController.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UILayer.h" -#include "app/linux/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/item/ItemInstance.h" #include "util/StringHelpers.h" @@ -587,7 +586,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, } m_cachedSlotDraw.clear(); - if (useCommandBuffers) PlatformRenderer.CBuffCall(list); + if (useCommandBuffers) (void)PlatformRenderer.CBuffCall(list); // Finish GDraw and anything else that needs to be finalised ui.endCustomDraw(region); diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index ebb660d42..81664313e 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -13,15 +13,15 @@ #include #include -#include "platform/renderer/renderer.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class ItemRenderer; class UILayer; diff --git a/targets/app/common/UI/UIString.cpp b/targets/app/common/UI/UIString.cpp index 235e67a60..e08539d33 100644 --- a/targets/app/common/UI/UIString.cpp +++ b/targets/app/common/UI/UIString.cpp @@ -1,6 +1,6 @@ #include "UIString.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/XboxStubs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index fe5065a90..39436fea5 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -2,14 +2,14 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/fs/fs.h" +#include "util/StringHelpers.h" UITTFFont::UITTFFont(const std::string& name, const std::string& path, S32 fallbackCharacter) diff --git a/targets/app/common/UI/UITTFFont.h b/targets/app/common/UI/UITTFFont.h index 736ed9ba6..b5df051b6 100644 --- a/targets/app/common/UI/UITTFFont.h +++ b/targets/app/common/UI/UITTFFont.h @@ -3,7 +3,7 @@ #include #include -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UITTFFont { private: diff --git a/targets/app/common/XboxStubs.cpp b/targets/app/common/XboxStubs.cpp index d0b57de3d..913f61e07 100644 --- a/targets/app/common/XboxStubs.cpp +++ b/targets/app/common/XboxStubs.cpp @@ -1,6 +1,7 @@ -#include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" +#include "platform/PlatformTypes.h" + bool IsEqualXUID(PlayerUID a, PlayerUID b) { return a == b; } uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt new file mode 100644 index 000000000..3af0cf590 --- /dev/null +++ b/targets/app/common_sources.txt @@ -0,0 +1,216 @@ +common/AppGameServices.cpp +common/ArchiveManager.cpp +common/Audio/SoundEngine.cpp +common/Audio/SoundNames.cpp +common/Audio/ConsoleSoundEngine.cpp +common/BannedListManager.cpp +common/ConsoleGameMode.cpp +common/DLC/DLCAudioFile.cpp +common/DLC/DLCCapeFile.cpp +common/DLC/DLCColourTableFile.cpp +common/DLC/DLCFile.cpp +common/DLC/DLCGameRulesFile.cpp +common/DLC/DLCGameRulesHeader.cpp +common/DLC/DLCLocalisationFile.cpp +common/DLC/DLCManager.cpp +common/DLC/DLCPack.cpp +common/DLC/DLCSkinFile.cpp +common/DLC/DLCTextureFile.cpp +common/DLC/DLCUIDataFile.cpp +common/DLCController.cpp +common/DebugOptions.cpp +common/Game.cpp +common/GameMenuService.cpp +common/GameRules/GameRuleManager.cpp +common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +common/GameRules/LevelGeneration/BiomeOverride.cpp +common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +common/GameRules/LevelGeneration/LevelGenerators.cpp +common/GameRules/LevelGeneration/StartFeature.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +common/GameRules/LevelRules/LevelRules.cpp +common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +common/GameRules/LevelRules/Rules/GameRule.cpp +common/GameSettingsManager.cpp +common/Game_XuiActions.cpp +common/LocalizationManager.cpp +common/MenuController.cpp +common/Network/GameNetworkManager.cpp +common/NetworkController.cpp +common/SaveManager.cpp +common/SkinManager.cpp +common/TerrainFeatureManager.cpp +common/Trial/TrialMode.cpp +common/Tutorial/Constraints/AreaConstraint.cpp +common/Tutorial/Constraints/ChangeStateConstraint.cpp +common/Tutorial/Constraints/InputConstraint.cpp +common/Tutorial/FullTutorial.cpp +common/Tutorial/FullTutorialMode.cpp +common/Tutorial/Hints/AreaHint.cpp +common/Tutorial/Hints/DiggerItemHint.cpp +common/Tutorial/Hints/LookAtEntityHint.cpp +common/Tutorial/Hints/LookAtTileHint.cpp +common/Tutorial/Hints/TakeItemHint.cpp +common/Tutorial/Hints/TutorialHint.cpp +common/Tutorial/Tasks/AreaTask.cpp +common/Tutorial/Tasks/ChoiceTask.cpp +common/Tutorial/Tasks/CompleteUsingItemTask.cpp +common/Tutorial/Tasks/ControllerTask.cpp +common/Tutorial/Tasks/CraftTask.cpp +common/Tutorial/Tasks/EffectChangedTask.cpp +common/Tutorial/Tasks/FullTutorialActiveTask.cpp +common/Tutorial/Tasks/HorseChoiceTask.cpp +common/Tutorial/Tasks/InfoTask.cpp +common/Tutorial/Tasks/PickupTask.cpp +common/Tutorial/Tasks/ProcedureCompoundTask.cpp +common/Tutorial/Tasks/ProgressFlagTask.cpp +common/Tutorial/Tasks/RideEntityTask.cpp +common/Tutorial/Tasks/StatTask.cpp +common/Tutorial/Tasks/TutorialTask.cpp +common/Tutorial/Tasks/UseItemTask.cpp +common/Tutorial/Tasks/UseTileTask.cpp +common/Tutorial/Tasks/XuiCraftingTask.cpp +common/Tutorial/Tutorial.cpp +common/Tutorial/TutorialMessage.cpp +common/Tutorial/TutorialMode.cpp +common/Iggy/gdraw/gdraw.c +common/UI/ConsoleUIController.cpp +common/UI/All Platforms/ArchiveFile.cpp +common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +common/UI/All Platforms/IUIScene_AnvilMenu.cpp +common/UI/All Platforms/IUIScene_BeaconMenu.cpp +common/UI/All Platforms/IUIScene_BrewingMenu.cpp +common/UI/All Platforms/IUIScene_CommandBlockMenu.cpp +common/UI/All Platforms/IUIScene_ContainerMenu.cpp +common/UI/All Platforms/IUIScene_CraftingMenu.cpp +common/UI/All Platforms/IUIScene_CreativeMenu.cpp +common/UI/All Platforms/IUIScene_DispenserMenu.cpp +common/UI/All Platforms/IUIScene_EnchantingMenu.cpp +common/UI/All Platforms/IUIScene_FireworksMenu.cpp +common/UI/All Platforms/IUIScene_FurnaceMenu.cpp +common/UI/All Platforms/IUIScene_HUD.cpp +common/UI/All Platforms/IUIScene_HopperMenu.cpp +common/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp +common/UI/All Platforms/IUIScene_InventoryMenu.cpp +common/UI/All Platforms/IUIScene_PauseMenu.cpp +common/UI/All Platforms/IUIScene_TradingMenu.cpp +common/UI/Components/UIComponent_Chat.cpp +common/UI/Components/UIComponent_DebugUIConsole.cpp +common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +common/UI/Components/UIComponent_Logo.cpp +common/UI/Components/UIComponent_MenuBackground.cpp +common/UI/Components/UIComponent_Panorama.cpp +common/UI/Components/UIComponent_PressStartToPlay.cpp +common/UI/Components/UIComponent_Tooltips.cpp +common/UI/Components/UIComponent_TutorialPopup.cpp +common/UI/Components/UIScene_HUD.cpp +common/UI/Controls/UIControl.cpp +common/UI/Controls/UIControl_Base.cpp +common/UI/Controls/UIControl_BeaconEffectButton.cpp +common/UI/Controls/UIControl_BitmapIcon.cpp +common/UI/Controls/UIControl_Button.cpp +common/UI/Controls/UIControl_ButtonList.cpp +common/UI/Controls/UIControl_CheckBox.cpp +common/UI/Controls/UIControl_Cursor.cpp +common/UI/Controls/UIControl_DLCList.cpp +common/UI/Controls/UIControl_DynamicLabel.cpp +common/UI/Controls/UIControl_EnchantmentBook.cpp +common/UI/Controls/UIControl_EnchantmentButton.cpp +common/UI/Controls/UIControl_HTMLLabel.cpp +common/UI/Controls/UIControl_Label.cpp +common/UI/Controls/UIControl_LeaderboardList.cpp +common/UI/Controls/UIControl_MinecraftHorse.cpp +common/UI/Controls/UIControl_MinecraftPlayer.cpp +common/UI/Controls/UIControl_PlayerList.cpp +common/UI/Controls/UIControl_PlayerSkinPreview.cpp +common/UI/Controls/UIControl_Progress.cpp +common/UI/Controls/UIControl_SaveList.cpp +common/UI/Controls/UIControl_Slider.cpp +common/UI/Controls/UIControl_SlotList.cpp +common/UI/Controls/UIControl_SpaceIndicatorBar.cpp +common/UI/Controls/UIControl_TextInput.cpp +common/UI/Controls/UIControl_TexturePackList.cpp +common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_Credits.cpp +common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +common/UI/Scenes/UIScene_ConnectingProgress.cpp +common/UI/Scenes/UIScene_FullscreenProgress.cpp +common/UI/Scenes/UIScene_Keyboard.cpp +common/UI/Scenes/UIScene_MessageBox.cpp +common/UI/Scenes/UIScene_QuadrantSignin.cpp +common/UI/Scenes/UIScene_Timer.cpp +common/UI/UIBitmapFont.cpp +common/UI/UIController.cpp +common/UI/UIFontData.cpp +common/UI/UIGroup.cpp +common/UI/UILayer.cpp +common/UI/UIScene.cpp +common/UI/UIString.cpp +common/UI/UITTFFont.cpp +common/XboxStubs.cpp diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/desktop/main.cpp similarity index 73% rename from targets/app/linux/Linux_Minecraft.cpp rename to targets/app/desktop/main.cpp index c9d5d3c5e..5799856be 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/desktop/main.cpp @@ -40,7 +40,6 @@ static void sigsegv_handler(int sig) { _exit(139); } #endif -#include #include #include #include @@ -50,32 +49,27 @@ static void sigsegv_handler(int sig) { #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/level/Level.h" -// #include "app/common/Leaderboards/LeaderboardManager.h" +#include "platform/leaderboard/leaderboard.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "app/common/App_Defines.h" #include "app/common/Audio/SoundEngine.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" -// #include "../Orbis/Leaderboards/OrbisLeaderboardManager.h" - -// #include "../Orbis/Network/Orbis_NPToolkit.h" -// #include "../Orbis/Network/SonyVoiceChat_Orbis.h" - #define THEME_NAME "584111F70AAAAAAA" #define THEME_FILESIZE 2797568 @@ -108,17 +102,17 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -132,92 +126,92 @@ void DefineActions(void) { MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -231,92 +225,92 @@ void DefineActions(void) { MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -333,77 +327,77 @@ void DefineActions(void) { MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); } int main(int argc, const char* argv[]) { @@ -513,7 +507,12 @@ int main(int argc, const char* argv[]) { Level::enableLightingCache(); Tile::CreateNewThreadStorage(); - Minecraft::main(); + // Composition root: read the leaderboard backend from the existing + // LinuxLeaderboardManager singleton (still used by the legacy UI + // scenes) and pass it down via constructor injection. Once the UI + // side is also injected, the singleton can be deleted entirely and + // the backend constructed via std::make_unique here. + Minecraft::main(PlatformLeaderboard); Minecraft* pMinecraft = Minecraft::GetInstance(); app.InitGameSettings(); diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp deleted file mode 100644 index dda0e9728..000000000 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "LinuxLeaderboardManager.h" - -#include "app/common/Leaderboards/LeaderboardManager.h" - -LeaderboardManager* LeaderboardManager::m_instance = - new LinuxLeaderboardManager(); // Singleton instance of the - // LeaderboardManager \ No newline at end of file diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h deleted file mode 100644 index 72fe03e0e..000000000 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "platform/PlatformTypes.h" -#include "app/common/Leaderboards/LeaderboardManager.h" - -class LinuxLeaderboardManager : public LeaderboardManager { -public: - virtual void Tick() {} - - // Open a session - virtual bool OpenSession() { return true; } - - // Close a session - virtual void CloseSession() {} - - // Delete a session - virtual void DeleteSession() {} - - // Write the given stats - // This is called synchronously and will not free any memory allocated for - // views when it is done - - virtual bool WriteStats(unsigned int viewCount, ViewIn views) { - return false; - } - - virtual bool ReadStats_Friends(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID) { - return false; - } - virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID, unsigned int readCount) { - return false; - } - virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - return false; - } - - // Perform a flush of the stats - virtual void FlushStats() {} - - // Cancel the current operation - virtual void CancelOperation() {} - - // Is the leaderboard manager idle. - virtual bool isIdle() { return true; } -}; diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp deleted file mode 100644 index 0e6d59c73..000000000 --- a/targets/app/linux/LinuxGame.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "LinuxGame.h" - -#include - -#include - -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" -#include "app/common/Game.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/UI/All Platforms/UIStructs.h" -#include "platform/C4JThread.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/User.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/world/level/LevelSettings.h" - -LinuxGame app; - -#define CONTEXT_GAME_STATE 0 - -LinuxGame::LinuxGame() : Game() {} - -void LinuxGame::SetRichPresenceContext(int iPad, int contextId) {} - -void LinuxGame::StoreLaunchData() {} -void LinuxGame::ExitGame() { - app.DebugPrintf("Linux_App LinuxGame::ExitGame AFTER START\n"); - PlatformRenderer.Close(); -} -void LinuxGame::FatalLoadError() { - app.DebugPrintf( - "LinuxGame::FatalLoadError - asserting 0 and dying...\n"); - assert(0); -} - -void LinuxGame::CaptureSaveThumbnail() {} -void LinuxGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} -void LinuxGame::ReleaseSaveThumbnail() {} - -void LinuxGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} - -void LinuxGame::TemporaryCreateGameStart() { - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_Main::OnInit - - app.setLevelGenerationOptions(nullptr); - - // From CScene_Main::RunPlayGame - Minecraft* pMinecraft = Minecraft::GetInstance(); - app.ReleaseSaveThumbnail(); - PlatformProfile.SetLockedProfile(0); - pMinecraft->user->name = "Windows"; - app.ApplyGameSettingsChanged(0); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameJoinLoad::OnInit - MinecraftServer::resetFlags(); - - // From CScene_MultiGameJoinLoad::OnNotifyPressEx - app.SetTutorialMode(false); - app.SetCorruptSaveDeleted(false); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameCreate::CreateGame - - app.ClearTerrainFeaturePosition(); - std::string wWorldName = "TestWorld"; - - PlatformStorage.ResetSaveData(); - PlatformStorage.SetSaveTitle(wWorldName.c_str()); - - bool isFlat = false; - int64_t seedValue = - 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); - // // 4J - was (new Random())->nextLong() - now trying to actually - // find a seed to suit our requirements - - NetworkGameInitData* param = new NetworkGameInitData(); - param->seed = seedValue; - param->saveData = nullptr; - - app.SetGameHostOption(eGameHostOption_Difficulty, 0); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends, 0); - app.SetGameHostOption(eGameHostOption_Gamertags, 1); - app.SetGameHostOption(eGameHostOption_BedrockFog, 1); - - app.SetGameHostOption( - eGameHostOption_GameType, - GameType::CREATIVE->getId()); // LevelSettings::GAMETYPE_SURVIVAL - app.SetGameHostOption(eGameHostOption_LevelType, 0); - app.SetGameHostOption(eGameHostOption_Structures, 1); - app.SetGameHostOption(eGameHostOption_BonusChest, 0); - - app.SetGameHostOption(eGameHostOption_PvP, 1); - app.SetGameHostOption(eGameHostOption_TrustPlayers, 1); - app.SetGameHostOption(eGameHostOption_FireSpreads, 1); - app.SetGameHostOption(eGameHostOption_TNT, 1); - app.SetGameHostOption(eGameHostOption_HostCanFly, 1); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1); - - param->settings = app.GetGameHostOption(eGameHostOption_All); - - g_NetworkManager.FakeLocalPlayerJoined(); - - LoadingInputParams* loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = param; - - // Reset the autosave time - app.SetAutosaveTimerTime(); - - C4JThread* thread = new C4JThread(loadingParams->func, - loadingParams->lpParam, "RunNetworkGame"); - thread->run(); -} - -int LinuxGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { - return -1; -} - -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } - -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { - return -1; -} - -void LinuxGame::FreeLocalTMSFiles(eTMSFileType eType) {} diff --git a/targets/app/linux/LinuxGame.h b/targets/app/linux/LinuxGame.h deleted file mode 100644 index 528dfde4e..000000000 --- a/targets/app/linux/LinuxGame.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include - -#include "minecraft/GameEnums.h" -#include "app/common/Game.h" - -class C4JStringTable; - -class LinuxGame : public Game { -public: - LinuxGame(); - - void SetRichPresenceContext(int iPad, int contextId) override; - - void StoreLaunchData() override; - void ExitGame() override; - void FatalLoadError() override; - - void CaptureSaveThumbnail() override; - void GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) override; - void ReleaseSaveThumbnail() override; - void GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize) override; - - int LoadLocalTMSFile(char* wchTMSFile) override; - int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) override; - - void FreeLocalTMSFiles(eTMSFileType eType) override; - int GetLocalTMSFileIndex( - char* wchTMSFile, bool bFilenameIncludesExtension, - eFileExtensionType eEXT = eFileExtensionType_PNG) override; - - void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false) override {} - - C4JStringTable* GetStringTable() { return nullptr; } - - // original code - virtual void TemporaryCreateGameStart(); -}; - -extern LinuxGame app; - diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h deleted file mode 100644 index 52ef81a12..000000000 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef WINAPISTUBS_H -#define WINAPISTUBS_H - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -typedef struct { - int32_t LowPart; - int32_t HighPart; - int64_t QuadPart; -} LARGE_INTEGER; - -typedef struct { - uint32_t LowPart; - uint32_t HighPart; - uint64_t QuadPart; -} ULARGE_INTEGER; - -#define ERROR_SUCCESS 0L -#define ERROR_IO_PENDING 997L // dderror -#define ERROR_CANCELLED 1223L - -#define MEM_COMMIT 0x1000 -#define MEM_RESERVE 0x2000 -#define MEM_DECOMMIT 0x4000 -#define PAGE_READWRITE 0x04 - -// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime -typedef struct _FILETIME { - int32_t dwLowDateTime; - int32_t dwHighDateTime; -} FILETIME, *PFILETIME, *LPFILETIME; - -// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime -typedef struct _SYSTEMTIME { - int16_t wYear; - int16_t wMonth; - int16_t wDayOfWeek; - int16_t wDay; - int16_t wHour; - int16_t wMinute; - int16_t wSecond; - int16_t wMilliseconds; -} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; - -#ifdef __LP64__ -static inline int64_t InterlockedCompareExchangeRelease64( - int64_t volatile* Destination, int64_t Exchange, int64_t Comperand) { - int64_t expected = Comperand; - __atomic_compare_exchange_n(Destination, &expected, Exchange, false, - __ATOMIC_RELEASE, __ATOMIC_RELAXED); - return expected; -} -#else -static inline int64_t InterlockedCompareExchangeRelease( - LONG volatile* Destination, LONG Exchange, LONG Comperand) { - LONG expected = Comperand; - __atomic_compare_exchange_n(Destination, &expected, Exchange, false, - __ATOMIC_RELEASE, __ATOMIC_RELAXED); - return expected; -} -#endif - -// internal helper: convert time_t to FILETIME (100ns intervals since -// 1601-01-01) -static inline FILETIME _TimeToFileTime(time_t t) { - const uint64_t EPOCH_DIFF = 11644473600ULL; - uint64_t val = ((uint64_t)t + EPOCH_DIFF) * 10000000ULL; - FILETIME ft; - ft.dwLowDateTime = (int32_t)(val & 0xFFFFFFFF); - ft.dwHighDateTime = (int32_t)(val >> 32); - return ft; -} - -// internal helper: convert FILETIME (100ns since 1601) to time_t (seconds since -// 1970) -static inline time_t _FileTimeToTimeT(const FILETIME& ft) { - uint64_t val = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime; - const uint64_t EPOCH_DIFF = - 116444736000000000ULL; // 100ns intervals between 1601-01-01 and - // 1970-01-01 - return (time_t)((val - EPOCH_DIFF) / 10000000ULL); -} - -// internal helper: read the current wall clock into a timespec -static inline void _CurrentTimeSpec(struct timespec* ts) { -#ifdef CLOCK_REALTIME - clock_gettime(CLOCK_REALTIME, ts); -#else - struct timeval tv; - gettimeofday(&tv, nullptr); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * 1000; -#endif -} - -// internal helper: fill SYSTEMTIME from a broken-down tm + nanosecond remainder -static inline void _FillSystemTime(const struct tm* tm, long tv_nsec, - LPSYSTEMTIME lpSystemTime) { - lpSystemTime->wYear = tm->tm_year + 1900; - lpSystemTime->wMonth = tm->tm_mon + 1; - lpSystemTime->wDayOfWeek = tm->tm_wday; // 0 = Sunday - lpSystemTime->wDay = tm->tm_mday; - lpSystemTime->wHour = tm->tm_hour; - lpSystemTime->wMinute = tm->tm_min; - lpSystemTime->wSecond = tm->tm_sec; - lpSystemTime->wMilliseconds = (int16_t)(tv_nsec / 1000000); // ns to ms -} - -// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlocaltime -static inline void GetLocalTime(LPSYSTEMTIME lpSystemTime) { - struct timespec ts; - _CurrentTimeSpec(&ts); - struct tm tm; - localtime_r(&ts.tv_sec, &tm); // local time - _FillSystemTime(&tm, ts.tv_nsec, lpSystemTime); -} - -// https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-filetimetosystemtime -static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, - LPSYSTEMTIME lpSystemTime) { - uint64_t ft = ((uint64_t)lpFileTime->dwHighDateTime << 32) | - lpFileTime->dwLowDateTime; - time_t t = _FileTimeToTimeT(*lpFileTime); - long remainder_ns = (long)((ft % 10000000ULL) * 100); - - struct tm tm; - gmtime_r(&t, &tm); // UTC - _FillSystemTime(&tm, remainder_ns, lpSystemTime); - return true; -} - -static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, - int32_t flAllocationType, int32_t flProtect) { - // MEM_COMMIT | MEM_RESERVE → mmap anonymous - int prot = 0; - if (flProtect == 0x04 /*PAGE_READWRITE*/) - prot = PROT_READ | PROT_WRITE; - else if (flProtect == 0x40 /*PAGE_EXECUTE_READWRITE*/) - prot = PROT_READ | PROT_WRITE | PROT_EXEC; - else if (flProtect == 0x02 /*PAGE_READONLY*/) - prot = PROT_READ; - else - prot = PROT_READ | PROT_WRITE; // default - - int flags = MAP_PRIVATE | MAP_ANONYMOUS; - if (lpAddress != nullptr) flags |= MAP_FIXED; - - void* p = mmap(lpAddress, dwSize, prot, flags, -1, 0); - if (p == MAP_FAILED) return nullptr; - return p; -} - -static inline bool VirtualFree(void* lpAddress, size_t dwSize, - int32_t dwFreeType) { - if (lpAddress == nullptr) return false; - // MEM_RELEASE (0x8000) frees the whole region - if (dwFreeType == 0x8000 /*MEM_RELEASE*/) { - // dwSize should be 0 for MEM_RELEASE per Win32 API, but we don't track - // allocation sizes Use dwSize if provided, otherwise this is a - // best-effort - if (dwSize == 0) dwSize = 4096; // minimum page - munmap(lpAddress, dwSize); - } else { - // MEM_DECOMMIT (0x4000) - just decommit (make inaccessible) - madvise(lpAddress, dwSize, MADV_DONTNEED); - } - return true; -} - -#endif // WINAPISTUBS_H diff --git a/targets/app/meson.build b/targets/app/meson.build index 7047eaef0..ec3a3b41f 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -1,86 +1,74 @@ -exclude_platform_common_sources = [ - ' ! -name "UIScene_InGameSaveManagementMenu.cpp"', -] +# Source lists live in common_sources.txt and are +# regenerated by scripts/list_sources.py whenever files are added or +# removed. +fs = import('fs') -# all sources in common/ -platform_sources = run_command( - 'sh', - '-c', 'find "' - + meson.current_source_dir() / 'common' - + '" \\( -name "*.cpp" -o -name "*.c" \\)' - + ' '.join(exclude_platform_common_sources), - check: true, -).stdout().strip().split('\n') +app_common_sources = files(fs.read('common_sources.txt').strip().split('\n')) +app_dependencies = [] +app_link_args = [] -# linux-specific files -if host_machine.system() == 'linux' - platform_sources += run_command( - 'sh', - '-c', 'find "' - + meson.current_source_dir() / 'linux' - + '" \\( -name "*.cpp" -o -name "*.c" \\) ', - check: true, - ).stdout().strip().split('\n') +# mimalloc must come first so the linker resolves malloc/free symbols to it +# before glibc. --no-as-needed prevents the linker from dropping it as +# "unreferenced" (the override happens via weak symbols, not direct calls). +mimalloc_dep = dependency('mimalloc', required: get_option('enable_mimalloc')) +if mimalloc_dep.found() + app_dependencies += mimalloc_dep endif -client_dependencies = [ - java_dep, - nbt_dep, - render_dep, - input_dep, - profile_dep, - storage_dep, - assets_localisation_dep, - platform_dep, - minecraft_dep, - gl_dep, - glu_dep, - thread_dep, - dl_dep, - dependency('zlib'), - miniaudio_dep, - stb_dep, - simdutf_dep, - util_dep, -] - if get_option('ui_backend') == 'shiggy' - shiggy_dep = dependency( - 'shiggy', - fallback: ['shiggy', 'shiggy_dep'], - ) - client_dependencies += shiggy_dep + app_dependencies += dependency( + 'shiggy', + fallback: ['shiggy', 'shiggy_dep'], + ) endif +app_dependencies += [ + dependency('sdl2'), # blame iggy gdraw, nuke this later + dependency('miniaudio'), # todo: remove once PlatformSound is used + dependency('stb'), + dependency('simdutf'), + dependency('glew'), # TODO remove + java_dep, + nbt_dep, + util_dep, + minecraft_dep, + assets_localisation_dep, + platform_fs_dep, + platform_game_dep, + platform_input_dep, + platform_leaderboard_dep, + platform_network_dep, + platform_profile_dep, + platform_renderer_dep, + platform_sound_dep, + platform_storage_dep, + platform_thread_dep, + # technically also GL/EGL, but the GL renderer needs to not leak GL shit to fix that +] -client = executable( - 'Minecraft.Client', - platform_sources + localisation[1], - include_directories: include_directories('..'), - dependencies: client_dependencies, - cpp_args: global_cpp_args - + global_cpp_defs - + [ - '-DUNICODE', - '-D_UNICODE', - ], - c_args: global_cpp_defs + ['-DUNICODE', '-D_UNICODE'], - install: true, - install_dir: '', +app = executable( + 'Minecraft.Client', + app_common_sources + app_platform_sources + localisation[1], + include_directories: include_directories('..'), + dependencies: app_dependencies, + cpp_args: global_cpp_args + global_cpp_defs, + link_args: app_link_args, + install: true, + install_dir: '', ) custom_target( - 'copy_assets_to_client', - input: [client, media_archive], - output: 'assets.stamp', - command: [ - python, - meson.project_source_root() / 'scripts/copy_assets_to_client.py', - meson.project_source_root(), - meson.project_build_root(), - meson.current_build_dir(), - '@INPUT1@', - '@OUTPUT@', - ], - build_by_default: true, + 'copy_assets_to_app', + input: [app, media_archive], + output: 'assets.stamp', + command: [ + python, + meson.project_source_root() / 'scripts/copy_assets_to_app.py', + meson.project_source_root(), + meson.project_build_root(), + meson.current_build_dir(), + '@INPUT1@', + '@OUTPUT@', + ], + build_by_default: true, ) diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl b/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl deleted file mode 100644 index 722b96972..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ /dev/null @@ -1,4689 +0,0 @@ -// This file was automatically generated by shadergen. Do not edit by hand! - -static DWORD pshader_basic_0[239] = { - 0x43425844, 0x424a7ef2, 0x6c708f66, 0xff55849a, 0xbcc512aa, 0x00000001, - 0x000003bc, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000340, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000104, 0x00000040, - 0x00000041, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x09000038, - 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, 0x00208246, - 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, 0x0020803a, - 0x00000000, 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000007, 0x00000002, 0x00000000, 0x00000002, 0x00000003, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_1[261] = { - 0x43425844, 0x90372132, 0x718f790d, 0x41ee8636, 0x62f4522d, 0x00000001, - 0x00000414, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000398, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000015c, 0x00000040, - 0x00000057, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x09000038, - 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, 0x00208246, - 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, 0x0020803a, - 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, - 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_2[249] = { - 0x43425844, 0xf18db76f, 0x60007209, 0xb95de8b5, 0x04b32ff3, 0x00000001, - 0x000003e4, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000368, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000012c, 0x00000040, - 0x0000004b, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000001, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0b000032, - 0x00100012, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010003a, - 0x00000000, 0x0020803a, 0x00000000, 0x00000001, 0x09000000, 0x001000e2, - 0x00000000, 0x00208906, 0x00000000, 0x00000000, 0x00208906, 0x00000000, - 0x00000001, 0x07000038, 0x00102072, 0x00000000, 0x00100006, 0x00000000, - 0x00100796, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010000a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000008, 0x00000001, - 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_3[298] = { - 0x43425844, 0x8666f1ab, 0x6789c83a, 0x84ddee9b, 0x99672a63, 0x00000001, - 0x000004a8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000042c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, - 0x00000040, 0x00000069, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, - 0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_4[320] = { - 0x43425844, 0xc29dc729, 0xa89895e0, 0x45d2e5a7, 0x85a6e3df, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000484, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001fc, - 0x00000040, 0x0000007f, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_5[337] = { - 0x43425844, 0xf38a8aa1, 0x76e83e07, 0xe035a58b, 0x8d62e8be, 0x00000001, - 0x00000544, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004c8, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000240, - 0x00000040, 0x00000090, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, 0x3f800000, - 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00100072, - 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, 0x07000039, - 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, 0x00000000, - 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, 0x0010003a, - 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000010, 0x00000002, 0x00000000, 0x00000002, - 0x0000000a, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_basic_6[298] = { - 0x43425844, 0xf4bd11d7, 0x2d1585d4, 0xa2bece1a, 0x528591b0, 0x00000001, - 0x000004a8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000042c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, - 0x00000040, 0x00000069, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, - 0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_7[320] = { - 0x43425844, 0xf035ea5f, 0x7228ce0c, 0x7acda6b1, 0x84f793b7, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000484, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001fc, - 0x00000040, 0x0000007f, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_8[308] = { - 0x43425844, 0x8de8fdf8, 0x79362b3c, 0xd3e53d96, 0x9a753d05, 0x00000001, - 0x000004d0, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000454, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001cc, - 0x00000040, 0x00000073, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020803a, - 0x00000000, 0x00000000, 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000001, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0a000032, - 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0010003a, 0x00000001, - 0x0020803a, 0x00000000, 0x00000001, 0x09000000, 0x001000e2, 0x00000000, - 0x00208906, 0x00000000, 0x00000000, 0x00208906, 0x00000000, 0x00000001, - 0x07000038, 0x00102072, 0x00000000, 0x00100006, 0x00000000, 0x00100796, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, - 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_9[310] = { - 0x43425844, 0xf476d124, 0xc7f0f06d, 0x96327107, 0x57955bd0, 0x00000001, - 0x000004d8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000045c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001d4, - 0x00000040, 0x00000075, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000d, - 0x00000002, 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_10[332] = { - 0x43425844, 0x08449793, 0x6e27fb50, 0xe33f149a, 0x0f517c0c, 0x00000001, - 0x00000530, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004b4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000022c, - 0x00000040, 0x0000008b, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_11[349] = { - 0x43425844, 0x10a3f918, 0xf7959328, 0x525b10eb, 0x0f678477, 0x00000001, - 0x00000574, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004f8, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000270, - 0x00000040, 0x0000009c, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, 0x3f800000, - 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00100072, - 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, 0x07000039, - 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, 0x00000000, - 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, 0x0010003a, - 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000012, 0x00000002, 0x00000000, 0x00000002, - 0x0000000c, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_basic_12[365] = { - 0x43425844, 0x50cde65f, 0xba0450c9, 0xc66a01ba, 0xf364c937, 0x00000001, - 0x000005b4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000538, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002b0, - 0x00000040, 0x000000ac, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, - 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, - 0x00000001, 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_13[387] = { - 0x43425844, 0x80d41dbd, 0x58a18bbb, 0x9707037c, 0x21268324, 0x00000001, - 0x0000060c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000590, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000308, - 0x00000040, 0x000000c2, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, - 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, - 0x00000001, 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000016, 0x00000002, - 0x00000000, 0x00000002, 0x0000000b, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_14[404] = { - 0x43425844, 0xb2a25f21, 0x5a5542ec, 0xc550e23f, 0x5a891887, 0x00000001, - 0x00000650, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000005d4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000034c, - 0x00000040, 0x000000d3, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, - 0x3f800000, 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, - 0x00100072, 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, - 0x07000039, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, - 0x00000000, 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, - 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, - 0x00000001, 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000007, 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, - 0x07000038, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000018, 0x00000002, 0x00000000, - 0x00000002, 0x0000000e, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_15[322] = { - 0x43425844, 0xe9ac3a59, 0xb10c74ae, 0x7d8ea66b, 0x7f38f805, 0x00000001, - 0x00000508, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000048c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000204, - 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x09000032, 0x00100012, 0x00000002, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x00004001, 0xbf000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x05000036, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x07000031, 0x00100012, - 0x00000000, 0x0010000a, 0x00000002, 0x00004001, 0x00000000, 0x0304000d, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000f, - 0x00000003, 0x00000000, 0x00000002, 0x00000007, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_16[339] = { - 0x43425844, 0x254d5609, 0xfb3546e9, 0x05f36a1e, 0x58e4fd27, 0x00000001, - 0x0000054c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004d0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000248, - 0x00000040, 0x00000092, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x09000032, 0x00100012, 0x00000002, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x00004001, 0xbf000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x07000031, - 0x00100012, 0x00000001, 0x0010000a, 0x00000002, 0x00004001, 0x00000000, - 0x0304000d, 0x0010000a, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_17[325] = { - 0x43425844, 0x9b76f721, 0x305d6ada, 0x87db10d5, 0x6ff15183, 0x00000001, - 0x00000514, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000498, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000210, - 0x00000040, 0x00000084, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020803a, - 0x00000000, 0x00000000, 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000001, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0a000032, - 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0010003a, 0x00000001, - 0x0020803a, 0x00000000, 0x00000001, 0x07000000, 0x00100022, 0x00000000, - 0x0010000a, 0x00000000, 0x00004001, 0xbf000000, 0x07000031, 0x00100022, - 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x00000000, 0x0304000d, - 0x0010001a, 0x00000000, 0x09000000, 0x001000e2, 0x00000000, 0x00208906, - 0x00000000, 0x00000000, 0x00208906, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100006, 0x00000000, 0x00100796, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000002, 0x00000000, 0x00000002, - 0x00000008, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { - { - pshader_basic_0, - 956, - }, - { - pshader_basic_1, - 1044, - }, - { - pshader_basic_2, - 996, - }, - { - pshader_basic_3, - 1192, - }, - { - pshader_basic_4, - 1280, - }, - { - pshader_basic_5, - 1348, - }, - { - pshader_basic_6, - 1192, - }, - { - pshader_basic_7, - 1280, - }, - { - pshader_basic_8, - 1232, - }, - { - pshader_basic_9, - 1240, - }, - { - pshader_basic_10, - 1328, - }, - { - pshader_basic_11, - 1396, - }, - { - pshader_basic_12, - 1460, - }, - { - pshader_basic_13, - 1548, - }, - { - pshader_basic_14, - 1616, - }, - { - pshader_basic_15, - 1288, - }, - { - pshader_basic_16, - 1356, - }, - { - pshader_basic_17, - 1300, - }, -}; - -static DWORD pshader_exceptional_blend_1[335] = { - 0x43425844, 0x0b4014f2, 0x2a24373f, 0xb6c4e09c, 0xd8c938b5, 0x00000001, - 0x0000053c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004c0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000238, - 0x00000040, 0x0000008e, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000e2, 0x00000001, 0x00100906, 0x00000000, - 0x00100906, 0x00000002, 0x09000032, 0x00100072, 0x00000001, 0x00100006, - 0x00000001, 0x00100246, 0x00000002, 0x00100796, 0x00000001, 0x08000000, - 0x00100082, 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, - 0x3f800000, 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, - 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, - 0x00102082, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, - 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000e, 0x00000003, 0x00000000, 0x00000002, 0x00000006, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_2[361] = { - 0x43425844, 0xf906958b, 0x06acfe4b, 0x355048f1, 0x63cfff9c, 0x00000001, - 0x000005a4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000528, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002a0, - 0x00000040, 0x000000a8, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x08000000, 0x00100072, 0x00000003, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x0a000032, 0x00100072, - 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, 0x00000001, - 0x00100ff6, 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x09000032, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000001, 0x00100246, 0x00000002, 0x00100246, - 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, 0x00000041, - 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, 0x00000001, - 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, 0x00000002, - 0x00000008, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_exceptional_blend_3[356] = { - 0x43425844, 0xfa19bb88, 0xda5ce80c, 0x160c8b13, 0xebac0845, 0x00000001, - 0x00000590, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000514, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000028c, - 0x00000040, 0x000000a3, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000f2, 0x00000003, 0x00100736, 0x00000000, - 0x00100dc6, 0x00000002, 0x07000034, 0x00100032, 0x00000003, 0x001005d6, - 0x00000003, 0x00100086, 0x00000003, 0x07000038, 0x00100062, 0x00000001, - 0x00100ef6, 0x00000000, 0x00100ba6, 0x00000002, 0x07000034, 0x00100042, - 0x00000003, 0x0010002a, 0x00000001, 0x0010001a, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_4[356] = { - 0x43425844, 0x51f459c3, 0x15565fe2, 0x4f2b3854, 0x901f8bb9, 0x00000001, - 0x00000590, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000514, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000028c, - 0x00000040, 0x000000a3, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000f2, 0x00000003, 0x00100736, 0x00000000, - 0x00100dc6, 0x00000002, 0x07000033, 0x00100032, 0x00000003, 0x001005d6, - 0x00000003, 0x00100086, 0x00000003, 0x07000038, 0x00100062, 0x00000001, - 0x00100ef6, 0x00000000, 0x00100ba6, 0x00000002, 0x07000033, 0x00100042, - 0x00000003, 0x0010002a, 0x00000001, 0x0010001a, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_5[294] = { - 0x43425844, 0x78df9480, 0x22fce9ea, 0x892ac708, 0xebd122be, 0x00000001, - 0x00000498, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000041c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000194, - 0x00000040, 0x00000065, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x0b000032, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000000, 0x00000003, 0x00208ae6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000000, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, - 0x0a000033, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00004002, - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x0100003e, 0x54415453, - 0x00000074, 0x00000009, 0x00000002, 0x00000000, 0x00000002, 0x00000004, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_6[309] = { - 0x43425844, 0x72cc2469, 0xfeb8ff3a, 0xc3c15aed, 0x5d2bdd8a, 0x00000001, - 0x000004d4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000458, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001d0, - 0x00000040, 0x00000074, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x0b000032, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000000, 0x00000003, 0x00208ae6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, - 0x00100072, 0x00000000, 0x80100246, 0x00000041, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x07000033, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x00004001, 0x3f800000, 0x0a000034, 0x00102072, 0x00000000, - 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, - 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_7[374] = { - 0x43425844, 0xeeebdd02, 0x607b5e55, 0x9b2d4bb0, 0x0c029c3e, 0x00000001, - 0x000005d8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000055c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002d4, - 0x00000040, 0x000000b5, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100062, 0x00000001, 0x00100106, 0x00000000, - 0x00100ff6, 0x00000002, 0x0a000032, 0x00100062, 0x00000001, 0x00100ff6, - 0x00000000, 0x00100106, 0x00000002, 0x80100656, 0x00000041, 0x00000001, - 0x06000036, 0x00100032, 0x00000003, 0x80100596, 0x00000081, 0x00000001, - 0x07000038, 0x00100022, 0x00000001, 0x0010002a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00100022, 0x00000001, 0x0010003a, 0x00000000, - 0x0010002a, 0x00000002, 0x8010001a, 0x00000041, 0x00000001, 0x06000036, - 0x00100042, 0x00000003, 0x8010001a, 0x00000081, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000013, 0x00000004, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_8[343] = { - 0x43425844, 0x4c133b76, 0xe54d7a26, 0xec03c69d, 0xd69182c1, 0x00000001, - 0x0000055c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004e0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000258, - 0x00000040, 0x00000096, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x08000000, 0x00100072, 0x00000002, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x09000032, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000002, 0x00100246, - 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, 0x00000041, - 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, 0x00000001, - 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000003, 0x00000000, 0x00000002, - 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_exceptional_blend_9[430] = { - 0x43425844, 0x0e53b9bf, 0xa40806de, 0xc8710d16, 0xff1f73e9, 0x00000001, - 0x000006b8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000063c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003b4, - 0x00000040, 0x000000ed, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000005, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x08000000, 0x00100072, 0x00000003, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x07000000, 0x00100072, - 0x00000003, 0x00100246, 0x00000003, 0x00100246, 0x00000003, 0x0a000032, - 0x00100072, 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, - 0x00000001, 0x00100ff6, 0x00000001, 0x0700000f, 0x00100082, 0x00000001, - 0x00100006, 0x00000002, 0x00100006, 0x00000000, 0x07000038, 0x00100012, - 0x00000003, 0x0010003a, 0x00000002, 0x00004001, 0x3f000000, 0x07000031, - 0x00100072, 0x00000003, 0x00100246, 0x00000002, 0x00100006, 0x00000003, - 0x09000037, 0x00100012, 0x00000004, 0x0010000a, 0x00000003, 0x0010003a, - 0x00000001, 0x0010000a, 0x00000001, 0x0700000f, 0x00100012, 0x00000001, - 0x00100556, 0x00000002, 0x00100556, 0x00000000, 0x09000037, 0x00100022, - 0x00000004, 0x0010001a, 0x00000003, 0x0010000a, 0x00000001, 0x0010001a, - 0x00000001, 0x0700000f, 0x00100012, 0x00000001, 0x00100aa6, 0x00000002, - 0x00100aa6, 0x00000000, 0x09000037, 0x00100042, 0x00000004, 0x0010002a, - 0x00000003, 0x0010000a, 0x00000001, 0x0010002a, 0x00000001, 0x08000000, - 0x00100012, 0x00000001, 0x8010003a, 0x00000041, 0x00000000, 0x00004001, - 0x3f800000, 0x09000032, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x00100246, 0x00000004, 0x08000000, 0x00100082, - 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, 0x3f800000, - 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000002, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001a, - 0x00000005, 0x00000000, 0x00000002, 0x0000000e, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_10[430] = { - 0x43425844, 0x5b763bc7, 0xa04a2226, 0x01dce3d1, 0xed9b4a05, 0x00000001, - 0x000006b8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000063c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003b4, - 0x00000040, 0x000000ed, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000005, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x08000000, 0x00100072, 0x00000003, 0x80100246, 0x00000041, - 0x00000002, 0x00100ff6, 0x00000002, 0x07000000, 0x00100072, 0x00000003, - 0x00100246, 0x00000003, 0x00100246, 0x00000003, 0x07000038, 0x00100082, - 0x00000001, 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, - 0x00100072, 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, - 0x00000001, 0x00100ff6, 0x00000001, 0x07000038, 0x00100082, 0x00000001, - 0x0010003a, 0x00000000, 0x00004001, 0x3f000000, 0x07000031, 0x00100072, - 0x00000003, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, 0x0700000f, - 0x00100082, 0x00000001, 0x00100006, 0x00000002, 0x00100006, 0x00000000, - 0x09000037, 0x00100012, 0x00000004, 0x0010000a, 0x00000003, 0x0010003a, - 0x00000001, 0x0010000a, 0x00000001, 0x0700000f, 0x00100012, 0x00000001, - 0x00100556, 0x00000002, 0x00100556, 0x00000000, 0x09000037, 0x00100022, - 0x00000004, 0x0010001a, 0x00000003, 0x0010000a, 0x00000001, 0x0010001a, - 0x00000001, 0x0700000f, 0x00100012, 0x00000001, 0x00100aa6, 0x00000002, - 0x00100aa6, 0x00000000, 0x09000037, 0x00100042, 0x00000004, 0x0010002a, - 0x00000003, 0x0010000a, 0x00000001, 0x0010002a, 0x00000001, 0x08000000, - 0x00100012, 0x00000001, 0x8010003a, 0x00000041, 0x00000000, 0x00004001, - 0x3f800000, 0x09000032, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x00100246, 0x00000004, 0x08000000, 0x00100082, - 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, 0x3f800000, - 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000002, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001a, - 0x00000005, 0x00000000, 0x00000002, 0x0000000e, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_11[284] = { - 0x43425844, 0xb5fd5f87, 0x5eef857b, 0xa3d0d13a, 0xf65c919c, 0x00000001, - 0x00000470, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000003f4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000016c, - 0x00000040, 0x0000005b, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0020803a, 0x00000000, 0x00000001, 0x0a002032, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010000a, - 0x00000000, 0x08000000, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, 0x00100062, 0x00000000, - 0x00101106, 0x00000001, 0x00208106, 0x00000000, 0x00000003, 0x00208ba6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100596, - 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, - 0x001020f2, 0x00000000, 0x00100006, 0x00000000, 0x00100e46, 0x00000001, - 0x0100003e, 0x54415453, 0x00000074, 0x00000008, 0x00000002, 0x00000000, - 0x00000002, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_12[276] = { - 0x43425844, 0x8aa79ff3, 0xa0220437, 0x6186c7a6, 0x358ad839, 0x00000001, - 0x00000450, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000003d4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000014c, - 0x00000040, 0x00000053, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0020803a, 0x00000000, 0x00000001, 0x0a002032, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010000a, - 0x00000000, 0x0b000032, 0x00100062, 0x00000000, 0x00101106, 0x00000001, - 0x00208106, 0x00000000, 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, - 0x09000045, 0x001000f2, 0x00000001, 0x00100596, 0x00000000, 0x00107e46, - 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, - 0x00000074, 0x00000007, 0x00000002, 0x00000000, 0x00000002, 0x00000002, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { - NULL, - 0, - }, - { - pshader_exceptional_blend_1, - 1340, - }, - { - pshader_exceptional_blend_2, - 1444, - }, - { - pshader_exceptional_blend_3, - 1424, - }, - { - pshader_exceptional_blend_4, - 1424, - }, - { - pshader_exceptional_blend_5, - 1176, - }, - { - pshader_exceptional_blend_6, - 1236, - }, - { - pshader_exceptional_blend_7, - 1496, - }, - { - pshader_exceptional_blend_8, - 1372, - }, - { - pshader_exceptional_blend_9, - 1720, - }, - { - pshader_exceptional_blend_10, - 1720, - }, - { - pshader_exceptional_blend_11, - 1136, - }, - { - pshader_exceptional_blend_12, - 1104, - }, -}; - -static DWORD pshader_filter_0[379] = { - 0x43425844, 0x24aad9c6, 0x43cc8801, 0x5ba2dc0b, 0xffe933e2, 0x00000001, - 0x000005ec, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000570, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000020c, 0x00000040, 0x00000083, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x08000034, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x08000000, 0x00100012, 0x00000002, 0x8010003a, 0x00000041, 0x00000001, - 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100006, 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000d, 0x00000003, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_1[377] = { - 0x43425844, 0x1e4f7d74, 0xaaf944d6, 0xb5f0a484, 0xc246b059, 0x00000001, - 0x000005e4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000568, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000204, 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000000, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000000, 0x00100656, 0x00000000, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100596, 0x00000000, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100022, - 0x00000000, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000001, 0x00000002, 0x07000038, 0x001020f2, 0x00000000, 0x00100006, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_2[411] = { - 0x43425844, 0x434da1c1, 0xc6277d6b, 0xf3644d3f, 0x33d647fa, 0x00000001, - 0x0000066c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005f0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000240, 0x00000040, 0x00000090, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000002, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x00100e46, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_3[409] = { - 0x43425844, 0x965f1059, 0xcdafe63f, 0x73c062f4, 0xcd63b2ea, 0x00000001, - 0x00000664, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005e8, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000238, 0x00000040, 0x0000008e, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_4[402] = { - 0x43425844, 0x4c377bd9, 0xfb4c5258, 0xe793fa9d, 0xf685a588, 0x00000001, - 0x00000648, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x000005cc, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000268, 0x00000040, 0x0000009a, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x00004001, 0x3f800000, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x08000038, - 0x001000e2, 0x00000000, 0x00100006, 0x00000000, 0x00208906, 0x00000001, - 0x00000002, 0x0b000032, 0x00100012, 0x00000000, 0x8020803a, 0x00000041, - 0x00000001, 0x00000002, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, - 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100072, 0x00000001, 0x00100006, 0x00000000, - 0x00100246, 0x00000001, 0x09000032, 0x00102072, 0x00000000, 0x00100796, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000001, 0x05000036, - 0x00102082, 0x00000000, 0x0010003a, 0x00000001, 0x0100003e, 0x54415453, - 0x00000074, 0x00000010, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_5[377] = { - 0x43425844, 0x9ff592ef, 0xe7109a8c, 0xc01f276d, 0x73f691c7, 0x00000001, - 0x000005e4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000568, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000204, 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x00004001, 0x3f800000, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100062, 0x00000000, 0x00101106, 0x00000001, 0x00208106, 0x00000001, - 0x00000001, 0x08000033, 0x00100062, 0x00000000, 0x00100656, 0x00000000, - 0x00208ba6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100596, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x08000038, 0x001000f2, 0x00000001, 0x00100ff6, 0x00000001, 0x00208e46, - 0x00000001, 0x00000002, 0x07000038, 0x001020f2, 0x00000000, 0x00100006, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_6[423] = { - 0x43425844, 0x5360f80d, 0x54f4e830, 0xa8cabb2e, 0x51c8fc74, 0x00000001, - 0x0000069c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000620, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000270, 0x00000040, 0x0000009c, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000000, 0x00100082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000001, 0x09000032, - 0x00102072, 0x00000000, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, - 0x00000000, 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_7[401] = { - 0x43425844, 0x0439e6c7, 0xa22f2670, 0x44e3f549, 0xd957dde0, 0x00000001, - 0x00000644, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005c8, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000218, 0x00000040, 0x00000086, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x00000008, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_8[246] = { - 0x43425844, 0xd318033e, 0x780e8795, 0xb2e4d27b, 0x11bd4a8f, 0x00000001, - 0x000003d8, 0x00000005, 0x00000034, 0x000001c0, 0x00000218, 0x0000024c, - 0x0000035c, 0x46454452, 0x00000184, 0x00000001, 0x00000090, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000153, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x61726170, 0xababab00, 0x00000088, 0x00000005, 0x000000a8, - 0x00000050, 0x00000000, 0x00000000, 0x00000120, 0x00000000, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000010, - 0x00000002, 0x00000128, 0x00000000, 0x0000013f, 0x00000020, 0x00000010, - 0x00000002, 0x00000128, 0x00000000, 0x00000145, 0x00000030, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x0000014c, 0x00000040, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x6d616c63, 0xab003070, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6d616c63, 0x63003170, 0x726f6c6f, - 0x6c6f6300, 0x0032726f, 0x6f5f6374, 0x4d006666, 0x6f726369, 0x74666f73, - 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, - 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000108, 0x00000040, - 0x00000042, 0x04000059, 0x00208e46, 0x00000001, 0x00000003, 0x0300005a, - 0x00106000, 0x00000001, 0x04001858, 0x00107000, 0x00000001, 0x00005555, - 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000001, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000001, 0x00106000, 0x00000001, 0x09000000, 0x00100012, 0x00000001, - 0x8020803a, 0x00000041, 0x00000001, 0x00000002, 0x00004001, 0x3f800000, - 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000001, 0x00208e46, 0x00000001, 0x00000002, 0x0100003e, 0x54415453, - 0x00000074, 0x00000006, 0x00000002, 0x00000000, 0x00000002, 0x00000003, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_9[177] = { - 0x43425844, 0x6be5959a, 0xfbf9f786, 0x3ad2a2c2, 0xed03ea11, 0x00000001, - 0x000002c4, 0x00000005, 0x00000034, 0x00000174, 0x000001cc, 0x00000200, - 0x00000248, 0x46454452, 0x00000138, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000107, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000005, 0x0000005c, 0x00000050, - 0x00000000, 0x00000000, 0x000000d4, 0x00000000, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x000000ec, 0x00000010, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x000000f3, 0x00000020, 0x00000010, 0x00000002, - 0x000000dc, 0x00000000, 0x000000f9, 0x00000030, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x00000100, 0x00000040, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x6d616c63, 0xab003070, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6d616c63, 0x63003170, 0x726f6c6f, 0x6c6f6300, - 0x0032726f, 0x6f5f6374, 0x4d006666, 0x6f726369, 0x74666f73, 0x29522820, - 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, - 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, 0x00000010, - 0x04000059, 0x00208e46, 0x00000001, 0x00000003, 0x03000065, 0x001020f2, - 0x00000000, 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000001, - 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_10[411] = { - 0x43425844, 0x06c32e7c, 0xd1fa07e2, 0x2d208e5f, 0x5002e2cc, 0x00000001, - 0x0000066c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005f0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000240, 0x00000040, 0x00000090, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000001, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000001, 0x00100656, 0x00000001, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000002, 0x00100596, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000002, 0x00100006, 0x00000001, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_11[343] = { - 0x43425844, 0xba36eafb, 0x7eb5939c, 0xf32591ec, 0x30eeb32a, 0x00000001, - 0x0000055c, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x000004e0, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740032, 0x74003078, 0x00327865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000017c, 0x00000040, 0x0000005f, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000002, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000002, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000001, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x05000036, 0x00100022, 0x00000000, - 0x00004001, 0x3f000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000002, 0x00106000, 0x00000002, 0x0100003e, - 0x54415453, 0x00000074, 0x00000009, 0x00000001, 0x00000000, 0x00000002, - 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_16[435] = { - 0x43425844, 0x6063564a, 0xa8def096, 0xcca0d8e9, 0xfad099ba, 0x00000001, - 0x000006cc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000650, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002ec, 0x00000040, 0x000000bb, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000002, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x00100e46, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000014, 0x00000003, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_17[433] = { - 0x43425844, 0x9d251e4d, 0x6df18823, 0x51817ea5, 0xa8eeefd8, 0x00000001, - 0x000006c4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000648, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002e4, 0x00000040, 0x000000b9, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x00000014, 0x00000002, 0x00000000, 0x00000002, - 0x0000000d, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_18[455] = { - 0x43425844, 0x01fc38b9, 0x9e8809ca, 0x9767109e, 0x3100f672, 0x00000001, - 0x0000071c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006a0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002f0, 0x00000040, 0x000000bc, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100012, - 0x00000002, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000003, 0x00000000, 0x00000002, 0x0000000b, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_19[453] = { - 0x43425844, 0x93b178e0, 0xac5fae3d, 0x5854ccdb, 0x646aa2b1, 0x00000001, - 0x00000714, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000698, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002e8, 0x00000040, 0x000000ba, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100012, - 0x00000001, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000013, 0x00000002, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_20[447] = { - 0x43425844, 0x9a125209, 0xf5c56096, 0xd7eccf22, 0x9fa5961c, 0x00000001, - 0x000006fc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000680, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000031c, 0x00000040, 0x000000c7, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000000, 0x00100082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000001, 0x09000032, - 0x00102072, 0x00000000, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000016, 0x00000002, - 0x00000000, 0x00000002, 0x0000000d, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_21[425] = { - 0x43425844, 0x893ebdf3, 0x678513c8, 0xea77bccb, 0x915f5370, 0x00000001, - 0x000006a4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000628, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002c4, 0x00000040, 0x000000b1, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000002, 0x00000000, 0x00000002, 0x0000000c, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_22[467] = { - 0x43425844, 0x2b2ebefd, 0x99c6691a, 0xf5589278, 0x00bf4796, 0x00000001, - 0x0000074c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006d0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000320, 0x00000040, 0x000000c8, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000000, 0x00100082, 0x00000000, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x07000038, 0x00100072, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000001, 0x09000032, 0x00102072, 0x00000000, 0x00100246, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000001, 0x05000036, 0x00102082, - 0x00000000, 0x0010003a, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000015, 0x00000002, 0x00000000, 0x00000002, 0x0000000c, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_23[445] = { - 0x43425844, 0xc733b29b, 0xcc301191, 0xb70dd0eb, 0xb530bacb, 0x00000001, - 0x000006f4, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000678, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002c8, 0x00000040, 0x000000b2, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x00000012, 0x00000002, 0x00000000, 0x00000002, - 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_24[435] = { - 0x43425844, 0x19fff495, 0xbd100eb6, 0x9012a014, 0xcb173d4f, 0x00000001, - 0x000006cc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000650, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002ec, 0x00000040, 0x000000bb, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000001, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000001, 0x00100656, 0x00000001, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000002, 0x00100596, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000002, 0x00100006, 0x00000001, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000014, 0x00000003, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_25[367] = { - 0x43425844, 0x23e9ff30, 0xa49b9308, 0xc4b02a07, 0xfe240ca9, 0x00000001, - 0x000005bc, 0x00000005, 0x00000034, 0x00000284, 0x000002dc, 0x00000310, - 0x00000540, 0x46454452, 0x00000248, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000216, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000005, 0x0000017c, 0x00000050, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001f4, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001fb, 0x00000010, 0x00000010, 0x00000000, - 0x00000150, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x0000020f, 0x00000040, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, 0x6f630031, - 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000228, - 0x00000040, 0x0000008a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, - 0x00000002, 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000000, 0x00100032, - 0x00000000, 0x00101046, 0x00000001, 0x80208046, 0x00000041, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000000, 0x00100012, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000001, 0x08000038, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, 0x00000001, 0x00000004, - 0x05002036, 0x00100022, 0x00000000, 0x0010000a, 0x00000000, 0x06002036, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x08000038, - 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, 0x00000001, - 0x00000003, 0x0a000032, 0x001020f2, 0x00000000, 0x00100006, 0x00000000, - 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000002, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_26[455] = { - 0x43425844, 0x77befa0f, 0xa8c6f51f, 0x871b10c5, 0x56e7a09b, 0x00000001, - 0x0000071c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006a0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002f0, 0x00000040, 0x000000bc, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000001, - 0x00000001, 0x08000033, 0x00100062, 0x00000001, 0x00100656, 0x00000001, - 0x00208ba6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000002, - 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000002, 0x00100006, - 0x00000001, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000003, 0x00000000, 0x00000002, 0x0000000b, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_27[387] = { - 0x43425844, 0xf3f7a1fb, 0xbd22ef0c, 0x3d9cc820, 0xe4ffde46, 0x00000001, - 0x0000060c, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000590, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740032, 0x74003078, 0x00327865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000022c, 0x00000040, 0x0000008b, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000002, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000002, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x09002032, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f000000, 0x00004001, 0x3f000000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001020f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { - pshader_filter_0, - 1516, - }, - { - pshader_filter_1, - 1508, - }, - { - pshader_filter_2, - 1644, - }, - { - pshader_filter_3, - 1636, - }, - { - pshader_filter_4, - 1608, - }, - { - pshader_filter_5, - 1508, - }, - { - pshader_filter_6, - 1692, - }, - { - pshader_filter_7, - 1604, - }, - { - pshader_filter_8, - 984, - }, - { - pshader_filter_9, - 708, - }, - { - pshader_filter_10, - 1644, - }, - { - pshader_filter_11, - 1372, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - pshader_filter_16, - 1740, - }, - { - pshader_filter_17, - 1732, - }, - { - pshader_filter_18, - 1820, - }, - { - pshader_filter_19, - 1812, - }, - { - pshader_filter_20, - 1788, - }, - { - pshader_filter_21, - 1700, - }, - { - pshader_filter_22, - 1868, - }, - { - pshader_filter_23, - 1780, - }, - { - pshader_filter_24, - 1740, - }, - { - pshader_filter_25, - 1468, - }, - { - pshader_filter_26, - 1820, - }, - { - pshader_filter_27, - 1548, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, -}; - -static DWORD pshader_blur_2[320] = { - 0x43425844, 0x67a35e3a, 0x560d90ec, 0x256f19fd, 0x4a310ce8, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000484, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001b8, 0x00000040, - 0x0000006e, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000003, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_3[363] = { - 0x43425844, 0xceb6aa80, 0x47281357, 0x6546706b, 0x9a86cc96, 0x00000001, - 0x000005ac, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000530, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000264, 0x00000040, - 0x00000099, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000004, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, - 0x00000000, 0x00000002, 0x0000000a, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_4[406] = { - 0x43425844, 0x28bb4db6, 0x76164852, 0x9c2d5fab, 0x2f864c24, 0x00000001, - 0x00000658, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x000005dc, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000310, 0x00000040, - 0x000000c4, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000015, - 0x00000002, 0x00000000, 0x00000002, 0x0000000d, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_5[449] = { - 0x43425844, 0x750da756, 0x7d011ff8, 0xac8d5660, 0x8246b36e, 0x00000001, - 0x00000704, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000688, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003bc, 0x00000040, - 0x000000ef, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000006, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000001a, 0x00000002, 0x00000000, 0x00000002, 0x00000010, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000005, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_6[492] = { - 0x43425844, 0xaa04fad9, 0xf1b31202, 0xbebf01fc, 0xc2f4f30e, 0x00000001, - 0x000007b0, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000734, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000468, 0x00000040, - 0x0000011a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000007, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, - 0x00000074, 0x0000001f, 0x00000002, 0x00000000, 0x00000002, 0x00000013, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_7[535] = { - 0x43425844, 0xd887ebb4, 0xc4924177, 0xe04802c2, 0xf91cc99d, 0x00000001, - 0x0000085c, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x000007e0, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000514, 0x00000040, - 0x00000145, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000008, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000024, 0x00000002, 0x00000000, 0x00000002, - 0x00000016, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_blur_8[578] = { - 0x43425844, 0x27ab5347, 0x36a0e6bc, 0xb93d307d, 0xb1f00bc0, 0x00000001, - 0x00000908, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x0000088c, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000005c0, 0x00000040, - 0x00000170, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000009, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000008, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000008, 0x00100e46, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000029, 0x00000002, 0x00000000, - 0x00000002, 0x00000019, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_9[621] = { - 0x43425844, 0xab49c198, 0x28ead186, 0xcdcc1184, 0x605159a1, 0x00000001, - 0x000009b4, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000938, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000066c, 0x00000040, - 0x0000019b, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x0000000a, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000008, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000008, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000009, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000009, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000002e, 0x00000002, - 0x00000000, 0x00000002, 0x0000001c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - pshader_blur_2, - 1280, - }, - { - pshader_blur_3, - 1452, - }, - { - pshader_blur_4, - 1624, - }, - { - pshader_blur_5, - 1796, - }, - { - pshader_blur_6, - 1968, - }, - { - pshader_blur_7, - 2140, - }, - { - pshader_blur_8, - 2312, - }, - { - pshader_blur_9, - 2484, - }, -}; - -static DWORD pshader_color_matrix_0[308] = { - 0x43425844, 0x5b914181, 0xde722329, 0xe875a0ba, 0xa156b551, 0x00000001, - 0x000004d0, 0x00000005, 0x00000034, 0x0000021c, 0x00000274, 0x000002a8, - 0x00000454, 0x46454452, 0x000001e0, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001ac, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000001, 0x0000017c, 0x00000050, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x00000194, 0x00000000, 0x00000050, 0x00000002, - 0x0000019c, 0x00000000, 0x61746164, 0xababab00, 0x00030001, 0x00040001, - 0x00000005, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, - 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e, - 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, 0x00000040, 0x00000069, - 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, 0x00208e46, - 0x00000001, 0x00000005, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, - 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000011, 0x00100012, 0x00000001, 0x00208e46, - 0x00000001, 0x00000000, 0x00100e46, 0x00000000, 0x0a000032, 0x00100012, - 0x00000001, 0x0020800a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010000a, 0x00000001, 0x08000011, 0x00100082, 0x00000001, 0x00208e46, - 0x00000001, 0x00000001, 0x00100e46, 0x00000000, 0x0a000032, 0x00100022, - 0x00000001, 0x0020801a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00208e46, - 0x00000001, 0x00000002, 0x00100e46, 0x00000000, 0x0a000032, 0x00100042, - 0x00000001, 0x0020802a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010000a, 0x00000000, 0x08000038, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0020803a, 0x00000001, 0x00000003, 0x08000038, 0x00102072, - 0x00000000, 0x00100246, 0x00000001, 0x00208ff6, 0x00000001, 0x00000003, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, - 0x00000002, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_color_matrix_arr[1] = { - { - pshader_color_matrix_0, - 1232, - }, -}; - -static DWORD pshader_manual_clear_0[171] = { - 0x43425844, 0xeb343b5a, 0xfec80b96, 0xf65a4d5b, 0xb96aacbe, 0x00000001, - 0x000002ac, 0x00000005, 0x00000034, 0x0000015c, 0x000001b4, 0x000001e8, - 0x00000230, 0x46454452, 0x00000120, 0x00000001, 0x00000040, 0x00000001, - 0x0000001c, 0xffff0400, 0x00008100, 0x000000ed, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00635350, 0x0000003c, 0x00000004, 0x00000058, 0x00000040, 0x00000000, - 0x00000000, 0x000000b8, 0x00000000, 0x00000010, 0x00000002, 0x000000c4, - 0x00000000, 0x000000d4, 0x00000010, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x000000de, 0x00000020, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x000000e4, 0x00000030, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, - 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, - 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, 0x00000010, - 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_manual_clear_arr[1] = { - { - pshader_manual_clear_0, - 684, - }, -}; - -static DWORD vshader_vsd3d10_0[305] = { - 0x43425844, 0xbcb06f4b, 0x808953d6, 0x687571c0, 0x1b5b041c, 0x00000001, - 0x000004c4, 0x00000005, 0x00000034, 0x000001cc, 0x00000200, 0x00000258, - 0x00000448, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0xababab00, 0x4e47534f, 0x00000050, 0x00000002, 0x00000008, - 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, - 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, - 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, - 0x52444853, 0x000001e8, 0x00010040, 0x0000007a, 0x04000059, 0x00208e46, - 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, - 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, - 0x02000068, 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00101e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x08000038, 0x00100072, - 0x00000000, 0x00100006, 0x00000000, 0x00208246, 0x00000000, 0x00000006, - 0x08000011, 0x00100082, 0x00000000, 0x00101e46, 0x00000000, 0x00208e46, - 0x00000000, 0x00000000, 0x0a000032, 0x00100072, 0x00000000, 0x00100ff6, - 0x00000000, 0x00208246, 0x00000000, 0x00000005, 0x00100246, 0x00000000, - 0x08000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00208246, - 0x00000000, 0x00000007, 0x0a00000e, 0x00100042, 0x00000000, 0x00004002, - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x0010002a, 0x00000000, - 0x07000038, 0x00102032, 0x00000000, 0x00100aa6, 0x00000000, 0x00100046, - 0x00000000, 0x06000036, 0x00102042, 0x00000000, 0x0020802a, 0x00000000, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x00004001, 0x3f800000, - 0x08000011, 0x00100012, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x00101e46, 0x00000000, 0x08000011, 0x00100022, 0x00000000, 0x00208e46, - 0x00000000, 0x00000004, 0x00101e46, 0x00000000, 0x07000038, 0x00102032, - 0x00000001, 0x00100aa6, 0x00000000, 0x00100046, 0x00000000, 0x05000036, - 0x00102082, 0x00000001, 0x0010002a, 0x00000000, 0x05000036, 0x00102042, - 0x00000001, 0x00004001, 0x3f800000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000f, 0x00000001, 0x00000000, 0x00000003, 0x00000009, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD vshader_vsd3d10_1[417] = { - 0x43425844, 0x79f68211, 0x83ecd840, 0x5fea9f88, 0xed27bac2, 0x00000001, - 0x00000684, 0x00000005, 0x00000034, 0x000001cc, 0x00000220, 0x00000278, - 0x00000608, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, - 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x0000070f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0xabab0044, 0x4e47534f, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x52444853, 0x00000388, 0x00010040, 0x000000e2, - 0x04000059, 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, - 0x00000000, 0x0300005f, 0x00101072, 0x00000001, 0x04000067, 0x001020f2, - 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x02000068, - 0x00000003, 0x0500002b, 0x00100072, 0x00000000, 0x00101496, 0x00000001, - 0x0a000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, - 0x3c800000, 0x3c800000, 0x3d000000, 0x00000000, 0x0800000f, 0x00100012, - 0x00000001, 0x00100046, 0x00000000, 0x00208046, 0x00000000, 0x00000002, - 0x0800000f, 0x00100022, 0x00000001, 0x00100046, 0x00000000, 0x00208ae6, - 0x00000000, 0x00000002, 0x0800000f, 0x00100012, 0x00000002, 0x00100046, - 0x00000001, 0x00208046, 0x00000000, 0x00000000, 0x0800000f, 0x00100022, - 0x00000002, 0x00100046, 0x00000001, 0x00208046, 0x00000000, 0x00000001, - 0x0700000f, 0x00100082, 0x00000000, 0x00100046, 0x00000002, 0x00100046, - 0x00000002, 0x0500004b, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, - 0x0a000039, 0x00100012, 0x00000001, 0x00004002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x0010003a, 0x00000000, 0x09000037, 0x00100082, - 0x00000000, 0x0010000a, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, - 0x3f800000, 0x0700000f, 0x00100012, 0x00000000, 0x00100046, 0x00000000, - 0x00100046, 0x00000000, 0x0500004b, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0700000e, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, - 0x0010003a, 0x00000000, 0x08000011, 0x00100012, 0x00000001, 0x00101e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x08000011, 0x00100022, - 0x00000001, 0x00101e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, - 0x09000032, 0x00100032, 0x00000000, 0x00100046, 0x00000002, 0x00100006, - 0x00000000, 0x00100046, 0x00000001, 0x08000038, 0x00100072, 0x00000001, - 0x00100556, 0x00000000, 0x00208246, 0x00000000, 0x00000006, 0x0a000032, - 0x001000b2, 0x00000000, 0x00100006, 0x00000000, 0x00208846, 0x00000000, - 0x00000005, 0x00100846, 0x00000001, 0x08000000, 0x001000b2, 0x00000000, - 0x00100c46, 0x00000000, 0x00208846, 0x00000000, 0x00000007, 0x0a00000e, - 0x00100082, 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, - 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00102032, 0x00000000, - 0x00100ff6, 0x00000000, 0x00100046, 0x00000000, 0x06000036, 0x00102042, - 0x00000000, 0x0020802a, 0x00000000, 0x00000000, 0x05000036, 0x00102082, - 0x00000000, 0x00004001, 0x3f800000, 0x08000011, 0x00100012, 0x00000000, - 0x00208e46, 0x00000000, 0x00000003, 0x00101e46, 0x00000000, 0x08000011, - 0x00100022, 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00101e46, - 0x00000000, 0x07000038, 0x00102072, 0x00000001, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000001, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001c, 0x00000003, - 0x00000000, 0x00000004, 0x00000013, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD vshader_vsd3d10_2[300] = { - 0x43425844, 0x50edc469, 0x3be0d512, 0xffa16ac1, 0x10a3602c, 0x00000001, - 0x000004b0, 0x00000005, 0x00000034, 0x000001cc, 0x00000220, 0x00000278, - 0x00000434, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0xabab0044, 0x4e47534f, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x52444853, 0x000001b4, 0x00010040, 0x0000006d, - 0x04000059, 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, - 0x00000000, 0x0300005f, 0x00101032, 0x00000001, 0x04000067, 0x001020f2, - 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x02000068, - 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00101e46, 0x00000000, - 0x00208e46, 0x00000000, 0x00000001, 0x08000038, 0x00100072, 0x00000000, - 0x00100006, 0x00000000, 0x00208246, 0x00000000, 0x00000006, 0x08000011, - 0x00100082, 0x00000000, 0x00101e46, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x0a000032, 0x00100072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00208246, 0x00000000, 0x00000005, 0x00100246, 0x00000000, 0x08000000, - 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00208246, 0x00000000, - 0x00000007, 0x0a00000e, 0x00100042, 0x00000000, 0x00004002, 0x3f800000, - 0x3f800000, 0x3f800000, 0x3f800000, 0x0010002a, 0x00000000, 0x07000038, - 0x00102032, 0x00000000, 0x00100aa6, 0x00000000, 0x00100046, 0x00000000, - 0x06000036, 0x00102042, 0x00000000, 0x0020802a, 0x00000000, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x00004001, 0x3f800000, 0x07000038, - 0x00102032, 0x00000001, 0x00100aa6, 0x00000000, 0x00101046, 0x00000001, - 0x05000036, 0x00102082, 0x00000001, 0x0010002a, 0x00000000, 0x05000036, - 0x00102042, 0x00000001, 0x00004001, 0x3f800000, 0x0100003e, 0x54415453, - 0x00000074, 0x0000000d, 0x00000001, 0x00000000, 0x00000004, 0x00000007, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations vshader_vsd3d10_arr[3] = { - { - vshader_vsd3d10_0, - 1220, - }, - { - vshader_vsd3d10_1, - 1668, - }, - { - vshader_vsd3d10_2, - 1200, - }, -}; diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp deleted file mode 100644 index eae540d50..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include "minecraft/stdafx.h" // 4J - -// gdraw_d3d11.cpp - author: Fabian Giesen - copyright 2011 RAD Game Tools -// -// This implements the Iggy graphics driver layer for D3D 11. - -// GDraw consists of several components that interact fairly loosely with each -// other; e.g. the resource management, drawing and filtering parts are all -// fairly independent of each other. If you want to modify some aspect of GDraw -// - say the texture allocation logic - your best bet is usually to just look -// for one of the related entry points, e.g. MakeTextureBegin, and take it from -// there. There's a bunch of code in this file, but none of it is really -// complicated. -// -// The one bit you might want to change that's not that localized is to -// integrate GDraw with an existing state caching system. The following bits all -// modify D3D state in some way: -// - The rendering helpers (set_viewport_raw, set_projection_raw, -// set_*_renderstate) -// - RenderTile*/TextureDrawBuffer* may change the active rendertarget and -// depth/stencil surface, -// as do D3D1X_(NoMoreGDrawThisFrame) and set_render_target -// - set_texture -// - set_renderstate and set_renderstate_full. These are the main places where -// render state changes occur; -// you should probably start here. -// - DrawIndexedTriangles sets the active vertex/index buffers and vertex -// declaration -// - Most of the functions in the "filter effects" section modify D3D state, -// mostly -// pixel shader constants and textures - -#define GDRAW_ASSERTS - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -// We temporarily disable this warning for the shared interface portions -#pragma warning(push) -#pragma warning(disable \ - : 4201) // nonstandard extension used : nameless struct/union - -#include -#include -#include -#include - -#include "../include/gdraw.h" -#include "../include/iggy.h" -#include "gdraw_d3d11.h" - -#pragma warning(pop) - -// Some macros to allow as much sharing between D3D10 and D3D11 code as -// possible. -#define D3D1X_(id) D3D11_##id -#define ID3D1X(id) ID3D11##id -#define gdraw_D3D1X_(id) gdraw_D3D11_##id -#define GDRAW_D3D1X_(id) GDRAW_D3D11_##id - -typedef ID3D11Device ID3D1XDevice; -typedef ID3D11DeviceContext ID3D1XContext; -typedef F32 ViewCoord; -typedef gdraw_d3d11_resourcetype gdraw_resourcetype; - -static void report_d3d_error(HRESULT hr, char* call, char* context); - -static void* map_buffer(ID3D1XContext* ctx, ID3D11Buffer* buf, bool discard) { - D3D11_MAPPED_SUBRESOURCE msr; - HRESULT hr = ctx->Map( - buf, 0, - discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, - &msr); - if (FAILED(hr)) { - report_d3d_error(hr, "Map", "of buffer"); - return NULL; - } else - return msr.pData; -} - -static void unmap_buffer(ID3D1XContext* ctx, ID3D11Buffer* buf) { - ctx->Unmap(buf, 0); -} - -static RADINLINE void set_pixel_shader(ID3D11DeviceContext* ctx, - ID3D11PixelShader* shader) { - ctx->PSSetShader(shader, NULL, 0); -} - -static RADINLINE void set_vertex_shader(ID3D11DeviceContext* ctx, - ID3D11VertexShader* shader) { - ctx->VSSetShader(shader, NULL, 0); -} - -static ID3D11BlendState* create_blend_state(ID3D11Device* dev, BOOL blend, - D3D11_BLEND src, D3D11_BLEND dst) { - D3D11_BLEND_DESC desc = {}; - desc.RenderTarget[0].BlendEnable = blend; - desc.RenderTarget[0].SrcBlend = src; - desc.RenderTarget[0].DestBlend = dst; - desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - desc.RenderTarget[0].SrcBlendAlpha = - (src == D3D11_BLEND_DEST_COLOR) ? D3D11_BLEND_DEST_ALPHA : src; - desc.RenderTarget[0].DestBlendAlpha = dst; - desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - - ID3D11BlendState* res; - HRESULT hr = dev->CreateBlendState(&desc, &res); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBlendState", ""); - res = NULL; - } - - return res; -} - -#define GDRAW_SHADER_FILE "gdraw_d3d10_shaders.inl" -#include "gdraw_d3d1x_shared.inl" - -static void create_pixel_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src) { - *p = *src; - if (p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, - NULL, &p->pshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = NULL; - return; - } - } -} - -static void create_vertex_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src) { - *p = *src; - if (p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, - NULL, &p->vshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = NULL; - return; - } - } -} - -GDrawFunctions* gdraw_D3D11_CreateContext(ID3D11Device* dev, - ID3D11DeviceContext* ctx, S32 w, - S32 h) { - return create_context(dev, ctx, w, h); -} - -// 4J added - interface so we can set the viewport back to the one that Iggy -// last set up -void gdraw_D3D11_setViewport_4J() { set_viewport(); } diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h deleted file mode 100644 index 0c5b12493..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h +++ /dev/null @@ -1,162 +0,0 @@ -#pragma once // 4J - -// gdraw_d3d11.h - author: Fabian Giesen - copyright 2011 RAD Game Tools -// -// Interface for creating a D3D11 GDraw driver. - -#define IDOC -// idoc(parent,GDraw_d3d11) - -typedef enum gdraw_d3d11_resourcetype { - GDRAW_D3D11_RESOURCE_rendertarget, - GDRAW_D3D11_RESOURCE_texture, - GDRAW_D3D11_RESOURCE_vertexbuffer, - GDRAW_D3D11_RESOURCE_dynbuffer, // Streaming buffer for dynamic - // vertex/index data (handle count ignored) - - GDRAW_D3D11_RESOURCE__count, -} gdraw_d3d11_resourcetype; - -IDOC extern int gdraw_D3D11_SetResourceLimits(gdraw_d3d11_resourcetype type, - S32 num_handles, S32 num_bytes); -/* This sets how large the memory pool for a given resource types is, and how - many handles GDraw should allocate for it. GDraw keeps track of allocations - in each pool, and will free old resources in a LRU manner to make space if - one of the limits is about to be exceeded. - - Returns 1 if value successfully changed, 0 on error. - You need to call IggyPlayerFlushAll on all active Iggys before you do this to - make them flush their resources since changing the resource limits - invalidates all handles. You also need to call IggyFlushInstalledFonts if you - have any installed fonts. -*/ - -IDOC extern GDrawFunctions* gdraw_D3D11_CreateContext(ID3D11Device* dev, - ID3D11DeviceContext* ctx, - S32 w, S32 h); -/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D - device, the device context to use for rendering, and the width/height of - render target textures. - - The width/height is used solely for sizing internal rendertargets. They will - be allocated to the larger of this size and the size of any rendered tiles - (with padding). In other words, you can pass in (0,0) and the rendertargets - will be allocated to the right size. However, if you draw multiple Iggy files - or tiles of different sizes, they might first be allocated too small; it's - best to pass in the correct size initially to avoid unnecessary - allocation/deallocation of too-small rendertargets. - - There can only be one D3D GDraw context active at any one time. - - If initialization fails for some reason (the main reason would be an out of - memory condition), NULL is returned. Otherwise, you can pass the return value - to IggySetGDraw. */ - -IDOC extern void gdraw_D3D11_DestroyContext(void); -/* Destroys the current GDraw context, if any. */ - -IDOC extern void gdraw_D3D11_SetErrorHandler( - void(__cdecl* error_handler)(HRESULT hr)); -/* Sets the GDraw D3D error handler. - - This will get called with the respective D3D error code if GDraw encounters - an error that it can't handle by itself (e.g. running out of state objects). - */ - -IDOC extern void gdraw_D3D11_SetRendertargetSize(S32 w, S32 h); -/* Changes the current render target size (and recreates all rendertargets if - necessary). This allows you to shrink the rendertargets if the new needed - size is smaller than it was previously. As with $gdraw_D3D11_CreateContext, - the width and height specified here are only minimums; GDraw will reallocate - larger rendertargets as needed. */ - -IDOC extern void gdraw_D3D11_SetTileOrigin( - ID3D11RenderTargetView* main_rt, ID3D11DepthStencilView* main_ds, - ID3D11ShaderResourceView* non_msaa_rt, S32 x, S32 y); -/* This sets the main rendertarget and matching depth/stencil buffer that GDraw - should render to and the x/y position of the output location of the top-left - of the current tile (allowing you to finely-position content, or to do tiled - rendering). - - If your rendertarget uses multisampling, you also need to specify a shader - resource view for a non-MSAA rendertarget texture (identically sized to - main_rt) in non_msaa_rt. This is only used if the Flash content includes - non-standard blend modes which have to use a special blend shader, so you can - leave it NULL if you forbid such content. - - You need to call this before Iggy calls any rendering functions. */ - -IDOC extern void gdraw_D3D11_NoMoreGDrawThisFrame(void); -/* Tells GDraw that no more rendering operations will occur this frame. This - triggers some end-of-frame processing; most importantly, GDraw uses this call - as a marker to detect thrashing (and react accordingly), so please do not - forget to call this every frame! (As long as Iggy does any rendering, that - is) */ - -IDOC extern void gdraw_D3D11_PreReset(void); -/* Call this before D3D device Reset(); it will free all default pool resources - allocated by GDraw. */ - -IDOC extern void gdraw_D3D11_PostReset(void); -/* Call after D3D device Reset(). */ - -IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw_4J( - IggyCustomDrawCallbackRegion* Region, F32 mat[16]); -IDOC extern void RADLINK gdraw_D3D11_CalculateCustomDraw_4J( - IggyCustomDrawCallbackRegion* Region, F32 mat[16]); -IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw( - IggyCustomDrawCallbackRegion* Region, F32 mat[4][4]); -/* Call at the beginning of Iggy custom draw callback to clear any odd render - states GDraw has set on the D3D device, and to get the current 2D - object-to-world transformation. */ - -IDOC extern void RADLINK -gdraw_D3D11_EndCustomDraw(IggyCustomDrawCallbackRegion* Region); -/* Call at the end of Iggy custom draw callback so GDraw can restore its render - * states. */ - -IDOC extern void RADLINK gdraw_D3D11_GetResourceUsageStats( - gdraw_d3d11_resourcetype type, S32* handles_used, S32* bytes_used); -/* D3D only: Get resource usage stats for last frame. - This can be used to get an estimate of how much graphics memory got used by - GDraw during the last frame. - - For the dynbuffer, this always returns 0 in handles_used and the *size of the - largest single allocation* in bytes_used. It needs to be sized so that this - allocation fits; make it smaller and it won't work, but if you make it much - larger (say more than 2x as big), it's just a waste of memory. That said, we - still recommend to make it no smaller than 64k, and the default is 256k. - - Caveat: This counts the number of bytes that GDraw knows about. 3D hardware - usually has its own management overhead, alignment requirements, allocation - granularity and so on. In short, this is not an accurate estimate of how much - memory is actually used by the GPU - it is a lower bound, though, and makes - for a useful ballpark estimate. */ - -IDOC extern GDrawTexture* gdraw_D3D11_WrappedTextureCreate( - ID3D11ShaderResourceView* tex_view); -/* Create a wrapped texture from a shader resource view. - A wrapped texture can be used to let Iggy draw using the contents of a - texture you create and manage on your own. For example, you might render to - this texture, or stream video into it. Wrapped textures take up a handle. - They will never be freed or otherwise modified by GDraw; nor will GDraw - change any reference counts. All this is up to the application. */ - -IDOC extern void gdraw_D3D11_WrappedTextureChange( - GDrawTexture* tex, ID3D11ShaderResourceView* tex_view); -/* Switch an existing GDrawTexture * that represents a wrapped texture to use - a new underlying D3D view. For example, you might internally double-buffer - a dynamically updated texture. As above, GDraw will leave this texture alone - and not touch any reference counts. */ - -IDOC extern void gdraw_D3D11_WrappedTextureDestroy(GDrawTexture* tex); -/* Destroys the GDraw wrapper for a wrapped texture object. This will free up - a GDraw texture handle but not release the associated D3D texture; that is - up to you. */ - -GDrawTexture* RADLINK gdraw_D3D11_MakeTextureFromResource( - U8* resource_file, S32 length, IggyFileTextureRaw* texture); -void RADLINK gdraw_D3D11_DestroyTextureFromResource(GDrawTexture* tex); - -// 4J added -extern void RADLINK gdraw_D3D11_setViewport_4J(); \ No newline at end of file diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl b/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl deleted file mode 100644 index 9f3cba01f..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ /dev/null @@ -1,2722 +0,0 @@ -// gdraw_d3d1x_shared.inl - author: Fabian Giesen - copyright 2012 RAD Game -// Tools -// -// This file implements the part of the Iggy graphics driver layer shared -// between D3D10 and 11 (which is most of it). It heavily depends on a bunch of -// typedefs, #defines and utility functions that need to be set up correctly for -// the D3D version being targeted. This is a bit ugly, but much easier to -// maintain than the original solution, where we just kept two almost identical -// versions of this code. - -// That native handle type holds resource handles and a coarse description. -typedef union { - // handle that is a texture - struct { - ID3D1X(Texture2D) * d3d; - ID3D1X(ShaderResourceView) * d3d_view; - ID3D1X(RenderTargetView) * d3d_rtview; - U32 w, h; - } tex; - - // handle that is a vertex buffer - struct { - ID3D1X(Buffer) * verts; - ID3D1X(Buffer) * inds; - } vbuf; -} GDrawNativeHandle; - -#define GDRAW_NO_STREAMING_MIPGEN // This renderer doesn't use GDraw-internal - // mipmap generation -#include "gdraw_shared.inl" - -// max rendertarget stack depth. this depends on the extent to which you -// use filters and non-standard blend modes, and how nested they are. -#define MAX_RENDER_STACK_DEPTH \ - 8 // Iggy is hardcoded to a limit of 16... probably 1-3 is realistic -#define AATEX_SAMPLER 7 // sampler that aa_tex gets set in -#define STENCIL_STATE_CACHE_SIZE \ - 32 // number of distinct stencil states we cache DepthStencilStates for -#define QUAD_IB_COUNT 2048 // quad index buffer has indices for this many quads - -#define ASSERT_COUNT(a, b) ((a) == (b) ? (b) : -1) - -static GDrawFunctions gdraw_funcs; - -// render target state -typedef struct { - GDrawHandle* color_buffer; - S32 base_x, base_y, width, height; - U32 flags; - rrbool cached; -} GDrawFramebufferState; - -struct ProgramWithCachedVariableLocations { - DWORD* bytecode; - union { - DWORD size; - ID3D1X(PixelShader) * pshader; - ID3D1X(VertexShader) * vshader; - }; -}; - -struct DynBuffer { - ID3D1X(Buffer) * buffer; - U32 size; // size of buffer - U32 write_pos; // start of most recently allocated chunk - U32 alloc_pos; // end of most recently allocated chunk (=start of next - // allocation) -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// GDraw data structure -// -// -// This is the primary rendering abstraction, which hides all -// the platform-specific rendering behavior from Iggy. It is -// full of platform-specific graphics state, and also general -// graphics state so that it doesn't have to callback into Iggy -// to get at that graphics state. - -typedef struct { - ID3D1XDevice* d3d_device; - ID3D1XContext* d3d_context; - - // fragment shaders - ProgramWithCachedVariableLocations fprog[GDRAW_TEXTURE__count][3]; - ProgramWithCachedVariableLocations - exceptional_blend[GDRAW_BLENDSPECIAL__count]; - ProgramWithCachedVariableLocations filter_prog[2][16]; - ProgramWithCachedVariableLocations blur_prog[MAX_TAPS + 1]; - ProgramWithCachedVariableLocations colormatrix; - ProgramWithCachedVariableLocations clear_ps; - - // vertex input layouts - ID3D1X(InputLayout) * inlayout[GDRAW_vformat__count]; - - // vertex shaders - ProgramWithCachedVariableLocations vert[GDRAW_vformat__count]; // [format] - - // render targets - GDrawHandleCache rendertargets; - GDrawHandle - rendertarget_handles[MAX_RENDER_STACK_DEPTH]; // not -1, because we use - // +1 to initialize - - gswf_recti rt_valid[MAX_RENDER_STACK_DEPTH + - 1]; // valid rect for texture clamping - - // size of framebuffer-sized texture used for implementing blend modes - S32 frametex_width, frametex_height; - - // viewport setting (in pixels) for current frame - S32 vx, vy; - S32 fw, fh; // full width/height of virtual display - S32 tw, th; // actual width/height of current tile - S32 tpw, tph; // width/height of padded version of tile - - S32 tx0, ty0; - S32 tx0p, ty0p; - rrbool in_blur; - struct { - S32 x, y, w, h; - } cview; // current viewport - - F32 projection[4]; // scalex,scaley,transx,transy - F32 projmat[3][4]; - F32 xform_3d[3][4]; - rrbool use_3d; - - ID3D1X(RenderTargetView) * main_framebuffer; - ID3D1X(DepthStencilView) * depth_buffer[2]; // 0=main, 1=rendertarget - ID3D1X(ShaderResourceView) * main_resolve_target; - rrbool main_msaa; // does main framebuffer have MSAA enabled? - - ID3D1X(Texture2D) * rt_depth_buffer; - ID3D1X(Texture2D) * aa_tex; - ID3D1X(ShaderResourceView) * aa_tex_view; - ID3D1X(Buffer) * quad_ib; // canned quad indices - - // scale factor converting worldspace to viewspace <0,0>.. - F32 world_to_pixel[2]; - - // state objects - ID3D1X(RasterizerState) * raster_state[2]; // [msaa] - ID3D1X(SamplerState) * - sampler_state[2][GDRAW_WRAP__count]; // [nearest][wrap] - ID3D1X(BlendState) * blend_state[GDRAW_BLEND__count]; - ID3D1X(BlendState) * blend_no_color_write; - ID3D1X(DepthStencilState) * depth_state[2][2]; // [set_id][test_id] - - // stencil state cache - // SOA so the keys are tightly packed in a few cache lines! - U32 stencil_cache_key[STENCIL_STATE_CACHE_SIZE]; - ID3D1X(DepthStencilState) * stencil_cache[STENCIL_STATE_CACHE_SIZE]; - U32 stencil_cache_lru[STENCIL_STATE_CACHE_SIZE]; - U32 stencil_cache_now; - - // constant buffers - ID3D1X(Buffer) * cb_vertex; - ID3D1X(Buffer) * cb_ps_common; - ID3D1X(Buffer) * cb_filter; - ID3D1X(Buffer) * cb_colormatrix; - ID3D1X(Buffer) * cb_blur; - - // streaming buffers for dynamic vertex/index data - DynBuffer dyn_vb; - DynBuffer dyn_ib; - - U32 dyn_maxalloc, last_dyn_maxalloc; - S32 max_quad_vert_count; - - // cached state - U32 scissor_state; // ~0 if unknown, otherwise 0 or 1 - S32 blend_mode; // -1 if unknown, otherwise GDRAW_BLEND_* - - // render-state stack described above for 'temporary' rendering - GDrawFramebufferState frame[MAX_RENDER_STACK_DEPTH]; - GDrawFramebufferState* cur; - - // texture and vertex buffer pools - GDrawHandleCache* texturecache; - GDrawHandleCache* vbufcache; - - // stat tracking - rrbool frame_done; - U64 frame_counter; - - // error handler - void(__cdecl* error_handler)(HRESULT hr); -} GDraw; - -static GDraw* gdraw; - -static const F32 four_zeros[4] = {0}; // used in several places - -//////////////////////////////////////////////////////////////////////// -// -// General resource management for both textures and vertex buffers -// - -template -static void safe_release(T*& p) { - if (p) { - p->Release(); - p = NULL; - } -} - -static void report_d3d_error(HRESULT hr, char* call, char* context) { - if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, - context); - else - IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, - context, hr); -} - -static void unbind_resources(void) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // unset active textures and vertex/index buffers, - // to make sure there are no dangling refs - static ID3D1X(ShaderResourceView) * no_views[3] = {0}; - ID3D1X(Buffer)* no_vb = NULL; - UINT no_offs = 0; - - d3d->PSSetShaderResources(0, 3, no_views); - d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); -} - -static void api_free_resource(GDrawHandle* r) { - unbind_resources(); - if (r->state != GDRAW_HANDLE_STATE_user_owned) { - if (!r->cache->is_vertex) { - safe_release(r->handle.tex.d3d_view); - safe_release(r->handle.tex.d3d_rtview); - safe_release(r->handle.tex.d3d); - } else { - safe_release(r->handle.vbuf.verts); - safe_release(r->handle.vbuf.inds); - } - } -} - -static void RADLINK gdraw_UnlockHandles(GDrawStats* /*stats*/) { - gdraw_HandleCacheUnlockAll(gdraw->texturecache); - gdraw_HandleCacheUnlockAll(gdraw->vbufcache); -} - -//////////////////////////////////////////////////////////////////////// -// -// Dynamic buffer -// - -static void* start_write_dyn(DynBuffer* buf, U32 size) { - U8* ptr = NULL; - - if (size > buf->size) { - IggyGDrawSendWarning(NULL, - "GDraw dynamic vertex buffer usage of %d bytes in " - "one call larger than buffer size %d", - size, buf->size); - return NULL; - } - - // update statistics - gdraw->dyn_maxalloc = RR_MAX(gdraw->dyn_maxalloc, size); - - // invariant: current alloc_pos is in [0,size] - assert(buf->alloc_pos <= buf->size); - - // wrap around when less than "size" bytes left in buffer - buf->write_pos = ((buf->size - buf->alloc_pos) < size) ? 0 : buf->alloc_pos; - - // discard buffer whenever the current write position is 0; - // done this way so that if a DISCARD Map() were to fail, we would - // just keep retrying the next time around. - ptr = (U8*)map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0); - if (ptr) { - ptr += buf->write_pos; // we return pointer to write position in buffer - buf->alloc_pos = buf->write_pos + size; // bump alloc position - assert(buf->alloc_pos <= buf->size); // invariant again - } - // if map_buffer fails, it will have sent a warning - - return ptr; -} - -static U32 end_write_dyn(DynBuffer* buf) { - unmap_buffer(gdraw->d3d_context, buf->buffer); - return buf->write_pos; -} - -//////////////////////////////////////////////////////////////////////// -// -// Stencil state cache -// - -static void stencil_state_cache_clear() { - S32 i; - - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - gdraw->stencil_cache_key[i] = 0; - safe_release(gdraw->stencil_cache[i]); - gdraw->stencil_cache_lru[i] = 0; - } - - gdraw->stencil_cache_now = 0; -} - -static ID3D1X(DepthStencilState) * - stencil_state_cache_lookup(rrbool set_id, rrbool test_id, U8 read_mask, - U8 write_mask) { - D3D1X_(DEPTH_STENCIL_DESC) desc; - S32 i, best = 0; - U32 key = (set_id << 1) | test_id | (read_mask << 8) | (write_mask << 16); - U32 now, age, highest_age; - HRESULT hr; - - // for LRU - now = ++gdraw->stencil_cache_now; - - // do we have this in the cache? - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - if (gdraw->stencil_cache_key[i] == key) { - gdraw->stencil_cache_lru[i] = now; - return gdraw->stencil_cache[i]; - } - } - - // not in the cache, find the best slot to replace it with (LRU) - highest_age = 0; - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - if (!gdraw->stencil_cache[i]) { // unused slot! - best = i; - break; - } - - age = now - gdraw->stencil_cache_lru[i]; - if (age > highest_age) { - highest_age = age; - best = i; - } - } - - // release old depth/stencil state at that position and create new one - safe_release(gdraw->stencil_cache[best]); - - gdraw->depth_state[set_id][test_id]->GetDesc(&desc); // reference state - desc.StencilEnable = TRUE; - desc.StencilReadMask = read_mask; - desc.StencilWriteMask = write_mask; - desc.FrontFace.StencilFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.FrontFace.StencilDepthFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.FrontFace.StencilPassOp = D3D1X_(STENCIL_OP_REPLACE); - desc.FrontFace.StencilFunc = D3D1X_(COMPARISON_EQUAL); - desc.BackFace.StencilFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.BackFace.StencilDepthFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.BackFace.StencilPassOp = D3D1X_(STENCIL_OP_REPLACE); - desc.BackFace.StencilFunc = D3D1X_(COMPARISON_EQUAL); - - hr = gdraw->d3d_device->CreateDepthStencilState( - &desc, &gdraw->stencil_cache[best]); - if (FAILED(hr)) report_d3d_error(hr, "CreateDepthStencilState", ""); - - gdraw->stencil_cache_key[best] = key; - gdraw->stencil_cache_lru[best] = now; - return gdraw->stencil_cache[best]; -} - -//////////////////////////////////////////////////////////////////////// -// -// Texture creation/updating/deletion -// - -extern GDrawTexture* gdraw_D3D1X_(WrappedTextureCreate)( - ID3D1X(ShaderResourceView) * tex_view) { - GDrawStats stats = {0}; - GDrawHandle* p = gdraw_res_alloc_begin( - gdraw->texturecache, 0, - &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = NULL; - p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = NULL; - p->handle.tex.w = 1; - p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); - return (GDrawTexture*)p; -} - -extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture* tex, - ID3D1X(ShaderResourceView) * - tex_view) { - GDrawHandle* p = (GDrawHandle*)tex; - p->handle.tex.d3d = NULL; - p->handle.tex.d3d_view = tex_view; -} - -extern void gdraw_D3D1X_(WrappedTextureDestroy)(GDrawTexture* tex) { - GDrawStats stats = {0}; - gdraw_res_free((GDrawHandle*)tex, &stats); -} - -static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture* tex, void* old_id, - void* new_id) { - GDrawHandle* p = (GDrawHandle*)tex; - // if this is still the handle it's thought to be, change the owner; - // if the owner *doesn't* match, then they're changing a stale handle, so - // ignore - if (p->owner == old_id) p->owner = new_id; -} - -static rrbool RADLINK gdraw_MakeTextureBegin( - void* owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, - GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { - GDrawHandle* t = NULL; - DXGI_FORMAT dxgi_fmt; - S32 bpp, size = 0, nmips = 0; - - if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning( - NULL, - "GDraw texture size too large (%d x %d), dimension limit is 16384", - width, height); - return false; - } - - if (format == GDRAW_TEXTURE_FORMAT_rgba32) { - dxgi_fmt = DXGI_FORMAT_R8G8B8A8_UNORM; - bpp = 4; - } else { - dxgi_fmt = DXGI_FORMAT_R8_UNORM; - bpp = 1; - } - - // compute estimated size of texture in video memory - do { - size += RR_MAX(width >> nmips, 1) * RR_MAX(height >> nmips, 1) * bpp; - ++nmips; - } while ((flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) && - ((width >> nmips) || (height >> nmips))); - - // try to allocate memory for the client to write to - p->texture_data = (U8*)IggyGDrawMalloc(size); - if (!p->texture_data) { - IggyGDrawSendWarning(NULL, - "GDraw out of memory to store texture data to " - "pass to D3D for %d x %d texture", - width, height); - return false; - } - - // allocate a handle and make room in the cache for this much data - t = gdraw_res_alloc_begin(gdraw->texturecache, size, stats); - if (!t) { - IggyGDrawFree(p->texture_data); - return false; - } - - t->handle.tex.w = width; - t->handle.tex.h = height; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; - - p->texture_type = GDRAW_TEXTURE_TYPE_rgba; - p->p0 = t; - p->p1 = owner; - p->i0 = width; - p->i1 = height; - p->i2 = flags; - p->i3 = dxgi_fmt; - p->i4 = size; - p->i5 = nmips; - p->i6 = bpp; - - p->stride_in_bytes = width * bpp; - p->num_rows = height; - - return true; -} - -static rrbool RADLINK -gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo* /*p*/) { - return false; -} - -static GDrawTexture* RADLINK -gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { - GDrawHandle* t = (GDrawHandle*)p->p0; - D3D1X_(SUBRESOURCE_DATA) mipdata[24]; - S32 i, w, h, nmips, bpp; - HRESULT hr = 0; - char* failed_call; - U8* ptr; - - // generate mip maps and set up descriptors for them - assert(p->i5 <= 24); - ptr = p->texture_data; - w = p->i0; - h = p->i1; - nmips = p->i5; - bpp = p->i6; - - for (i = 0; i < nmips; ++i) { - mipdata[i].pSysMem = ptr; - mipdata[i].SysMemPitch = RR_MAX(w >> i, 1) * bpp; - mipdata[i].SysMemSlicePitch = 0; - ptr += mipdata[i].SysMemPitch * RR_MAX(h >> i, 1); - - // create mip data by downsampling - if (i) - gdraw_Downsample((U8*)mipdata[i].pSysMem, mipdata[i].SysMemPitch, - w >> i, h >> i, (U8*)mipdata[i - 1].pSysMem, - mipdata[i - 1].SysMemPitch, bpp); - } - - // actually create texture - D3D1X_(TEXTURE2D_DESC) - desc = {w, - h, - nmips, - 1, - (DXGI_FORMAT)p->i3, - {1, 0}, - (p->i2 & GDRAW_MAKETEXTURE_FLAGS_updatable) - ? D3D1X_(USAGE_DEFAULT) - : D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - - failed_call = "CreateTexture2D"; - hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &t->handle.tex.d3d); - if (FAILED(hr)) goto done; - - // and create a corresponding shader resource view - failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, - &t->handle.tex.d3d_view); - -done: - if (!FAILED(hr)) { - gdraw_HandleCacheAllocateEnd( - t, p->i4, p->p1, - (p->i2 & GDRAW_MAKETEXTURE_FLAGS_never_flush) - ? GDRAW_HANDLE_STATE_pinned - : GDRAW_HANDLE_STATE_locked); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += p->i4; - } else { - safe_release(t->handle.tex.d3d); - safe_release(t->handle.tex.d3d_view); - - gdraw_HandleCacheAllocateFail(t); - t = NULL; - report_d3d_error(hr, failed_call, " while creating texture"); - } - - IggyGDrawFree(p->texture_data); - return (GDrawTexture*)t; -} - -static rrbool RADLINK gdraw_UpdateTextureBegin(GDrawTexture* t, void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); -} - -static void RADLINK gdraw_UpdateTextureRect(GDrawTexture* t, - void* /*unique_id*/, S32 x, S32 y, - S32 stride, S32 w, S32 h, - U8* samples, - gdraw_texture_format /*format*/) { - GDrawHandle* s = (GDrawHandle*)t; - D3D1X_(BOX) box = {x, y, 0, x + w, y + h, 1}; - - gdraw->d3d_context->UpdateSubresource(s->handle.tex.d3d, 0, &box, samples, - stride, 0); -} - -static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture* t, void* /*unique_id*/, - GDrawStats* /*stats*/) { - gdraw_HandleCacheUnlock((GDrawHandle*)t); -} - -static void RADLINK gdraw_FreeTexture(GDrawTexture* tt, void* unique_id, - GDrawStats* stats) { - GDrawHandle* t = (GDrawHandle*)tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { - if (t->cache == &gdraw->rendertargets) { - gdraw_HandleCacheUnlock(t); - // cache it by simply not freeing it - return; - } - - gdraw_res_free(t, stats); - } -} - -static rrbool RADLINK gdraw_TryToLockTexture(GDrawTexture* t, void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); -} - -static void RADLINK gdraw_DescribeTexture(GDrawTexture* tex, - GDraw_Texture_Description* desc) { - GDrawHandle* p = (GDrawHandle*)tex; - desc->width = p->handle.tex.w; - desc->height = p->handle.tex.h; - desc->size_in_bytes = p->bytes; -} - -static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8* rgba) { - HRESULT hr; - - safe_release(gdraw->aa_tex_view); - safe_release(gdraw->aa_tex); - - D3D1X_(TEXTURE2D_DESC) - desc = {width, - 1, - 1, - 1, - DXGI_FORMAT_R8G8B8A8_UNORM, - {1, 0}, - D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - D3D1X_(SUBRESOURCE_DATA) data = {rgba, width * 4, 0}; - - hr = gdraw->d3d_device->CreateTexture2D(&desc, &data, &gdraw->aa_tex); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateTexture2D", ""); - return; - } - - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, - &gdraw->aa_tex_view); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateShaderResourceView", - " while creating texture"); - safe_release(gdraw->aa_tex); - return; - } -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex buffer creation/deletion -// - -static rrbool RADLINK gdraw_MakeVertexBufferBegin( - void* unique_id, gdraw_vformat /*vformat*/, S32 vbuf_size, S32 ibuf_size, - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* stats) { - // prepare staging buffers for the app to put data into - p->vertex_data = (U8*)IggyGDrawMalloc(vbuf_size); - p->index_data = (U8*)IggyGDrawMalloc(ibuf_size); - if (p->vertex_data && p->index_data) { - GDrawHandle* vb = gdraw_res_alloc_begin(gdraw->vbufcache, - vbuf_size + ibuf_size, stats); - if (vb) { - vb->handle.vbuf.verts = NULL; - vb->handle.vbuf.inds = NULL; - - p->vertex_data_length = vbuf_size; - p->index_data_length = ibuf_size; - p->p0 = vb; - p->p1 = unique_id; - return true; - } - } - - if (p->vertex_data) IggyGDrawFree(p->vertex_data); - if (p->index_data) IggyGDrawFree(p->index_data); - - return false; -} - -static rrbool RADLINK -gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_ProcessingInfo* /*p*/) { - assert(0); - return false; -} - -static GDrawVertexBuffer* RADLINK gdraw_MakeVertexBufferEnd( - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* /*stats*/) { - GDrawHandle* vb = (GDrawHandle*)p->p0; - - HRESULT hr; - D3D1X_(BUFFER_DESC) - vbdesc = {p->vertex_data_length, D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_VERTEX_BUFFER), 0, 0}; - D3D1X_(SUBRESOURCE_DATA) vbdata = {p->vertex_data, 0, 0}; - - D3D1X_(BUFFER_DESC) - ibdesc = {p->index_data_length, D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_INDEX_BUFFER), 0, 0}; - D3D1X_(SUBRESOURCE_DATA) ibdata = {p->index_data, 0, 0}; - - hr = gdraw->d3d_device->CreateBuffer(&vbdesc, &vbdata, - &vb->handle.vbuf.verts); - if (!FAILED(hr)) - hr = gdraw->d3d_device->CreateBuffer(&ibdesc, &ibdata, - &vb->handle.vbuf.inds); - - if (FAILED(hr)) { - safe_release(vb->handle.vbuf.verts); - safe_release(vb->handle.vbuf.inds); - - gdraw_HandleCacheAllocateFail(vb); - vb = NULL; - - report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); - } else { - gdraw_HandleCacheAllocateEnd( - vb, p->vertex_data_length + p->index_data_length, p->p1, - GDRAW_HANDLE_STATE_locked); - } - - IggyGDrawFree(p->vertex_data); - IggyGDrawFree(p->index_data); - - return (GDrawVertexBuffer*)vb; -} - -static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)vb, unique_id); -} - -static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, GDrawStats* stats) { - GDrawHandle* h = (GDrawHandle*)vb; - assert(h != NULL); // @GDRAW_ASSERT - if (h->owner == unique_id) gdraw_res_free(h, stats); -} - -static void RADLINK gdraw_DescribeVertexBuffer( - GDrawVertexBuffer* vbuf, GDraw_VertexBuffer_Description* desc) { - GDrawHandle* p = (GDrawHandle*)vbuf; - desc->size_in_bytes = p->bytes; -} - -//////////////////////////////////////////////////////////////////////// -// -// Create/free (or cache) render targets -// - -static GDrawHandle* get_color_rendertarget(GDrawStats* stats) { - char* failed_call; - - // try to recycle LRU rendertarget - GDrawHandle* t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); - if (t) { - gdraw_HandleCacheLock(t, (void*)1); - return t; - } - - // ran out of RTs, allocate a new one - S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; - if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning( - NULL, - "GDraw rendertarget allocation failed: hit size limit of %d bytes", - gdraw->rendertargets.total_bytes); - return NULL; - } - - t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); - if (!t) { - IggyGDrawSendWarning( - NULL, "GDraw rendertarget allocation failed: hit handle limit"); - return t; - } - - D3D1X_(TEXTURE2D_DESC) - desc = {gdraw->frametex_width, - gdraw->frametex_height, - 1, - 1, - DXGI_FORMAT_R8G8B8A8_UNORM, - {1, 0}, - D3D1X_(USAGE_DEFAULT), - D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), - 0, - 0}; - - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; - - HRESULT hr = - gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); - failed_call = "CreateTexture2D"; - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView( - t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); - failed_call = "CreateTexture2D"; - } - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView( - t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); - failed_call = "CreateRenderTargetView"; - } - - if (FAILED(hr)) { - safe_release(t->handle.tex.d3d); - safe_release(t->handle.tex.d3d_view); - safe_release(t->handle.tex.d3d_rtview); - gdraw_HandleCacheAllocateFail(t); - - report_d3d_error(hr, failed_call, " creating rendertarget"); - - return NULL; - } - - gdraw_HandleCacheAllocateEnd(t, size, (void*)1, GDRAW_HANDLE_STATE_locked); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += size; - - return t; -} - -static ID3D1X(DepthStencilView) * - get_rendertarget_depthbuffer(GDrawStats* stats) { - if (!gdraw->depth_buffer[1]) { - char* failed_call; - assert(!gdraw->rt_depth_buffer); - - D3D1X_(TEXTURE2D_DESC) - desc = {gdraw->frametex_width, - gdraw->frametex_height, - 1, - 1, - DXGI_FORMAT_D24_UNORM_S8_UINT, - {1, 0}, - D3D1X_(USAGE_DEFAULT), - D3D1X_(BIND_DEPTH_STENCIL), - 0, - 0}; - - HRESULT hr = gdraw->d3d_device->CreateTexture2D( - &desc, NULL, &gdraw->rt_depth_buffer); - failed_call = "CreateTexture2D"; - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView( - gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); - failed_call = "CreateDepthStencilView while creating rendertarget"; - } - - if (FAILED(hr)) { - report_d3d_error(hr, failed_call, ""); - safe_release(gdraw->rt_depth_buffer); - safe_release(gdraw->depth_buffer[1]); - } else { - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += - gdraw->frametex_width * gdraw->frametex_height * 4; - - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], - D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), 1.0f, 0); - } - } - - return gdraw->depth_buffer[1]; -} - -static void flush_rendertargets(GDrawStats* stats) { - gdraw_res_flush(&gdraw->rendertargets, stats); - - safe_release(gdraw->depth_buffer[1]); - safe_release(gdraw->rt_depth_buffer); -} - -//////////////////////////////////////////////////////////////////////// -// -// Constant buffer layouts -// - -struct VertexVars { - F32 world[2][4]; - F32 x_off[4]; - F32 texgen_s[4]; - F32 texgen_t[4]; - F32 x3d[4]; - F32 y3d[4]; - F32 w3d[4]; -}; - -struct PixelCommonVars { - F32 color_mul[4]; - F32 color_add[4]; - F32 focal[4]; - F32 rescale1[4]; -}; - -struct PixelParaFilter { - F32 clamp0[4], clamp1[4]; - F32 color[4], color2[4]; - F32 tc_off[4]; -}; - -struct PixelParaBlur { - F32 clamp[4]; - F32 tap[9][4]; -}; - -struct PixelParaColorMatrix { - F32 data[5][4]; -}; - -//////////////////////////////////////////////////////////////////////// -// -// Rendering helpers -// - -static void disable_scissor(int force) { - if (force || gdraw->scissor_state) { - // disable scissor by setting whole viewport as scissor rect - S32 x = gdraw->cview.x; - S32 y = gdraw->cview.y; - D3D1X_(RECT) r = {x, y, x + gdraw->cview.w, y + gdraw->cview.h}; - - gdraw->d3d_context->RSSetScissorRects(1, &r); - gdraw->scissor_state = 0; - } -} - -static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h) { - D3D1X_(VIEWPORT) - vp = {(ViewCoord)x, (ViewCoord)y, (ViewCoord)w, (ViewCoord)h, 0.0f, 1.0f}; - gdraw->d3d_context->RSSetViewports(1, &vp); - gdraw->cview.x = x; - gdraw->cview.y = y; - gdraw->cview.w = w; - gdraw->cview.h = h; - - disable_scissor(1); -} - -static void set_projection_base(void) { - // x3d = < viewproj.x, 0, 0, 0 > - // y3d = < 0, viewproj.y, 0, 0 > - // w3d = < viewproj.z, viewproj.w, 1.0, 1.0 > - - memset(gdraw->projmat[0], 0, sizeof(gdraw->projmat)); - gdraw->projmat[0][0] = gdraw->projection[0]; - gdraw->projmat[1][1] = gdraw->projection[1]; - gdraw->projmat[2][0] = gdraw->projection[2]; - gdraw->projmat[2][1] = gdraw->projection[3]; - - gdraw->projmat[2][2] = 1.0; - gdraw->projmat[2][3] = 1.0; -} - -static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1) { - gdraw->projection[0] = 2.0f / (x1 - x0); - gdraw->projection[1] = 2.0f / (y1 - y0); - gdraw->projection[2] = (x1 + x0) / (F32)(x0 - x1); - gdraw->projection[3] = (y1 + y0) / (F32)(y0 - y1); - - set_projection_base(); -} - -static void set_viewport(void) { - if (gdraw->in_blur) { - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - return; - } - - if (gdraw->cur == gdraw->frame) // if the rendering stack is empty - // render a tile-sized region to the user-request tile location - set_viewport_raw(gdraw->vx, gdraw->vy, gdraw->tw, gdraw->th); - else if (gdraw->cur->cached) - set_viewport_raw(0, 0, gdraw->cur->width, gdraw->cur->height); - else - // if on the render stack, draw a padded-tile-sized region at the origin - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); -} - -static void set_projection(void) { - if (gdraw->in_blur) return; - if (gdraw->cur == gdraw->frame) // if the render stack is empty - set_projection_raw(gdraw->tx0, gdraw->tx0 + gdraw->tw, - gdraw->ty0 + gdraw->th, gdraw->ty0); - else if (gdraw->cur->cached) - set_projection_raw( - gdraw->cur->base_x, gdraw->cur->base_x + gdraw->cur->width, - gdraw->cur->base_y, gdraw->cur->base_y + gdraw->cur->height); - else - set_projection_raw(gdraw->tx0p, gdraw->tx0p + gdraw->tpw, - gdraw->ty0p + gdraw->tph, gdraw->ty0p); -} - -static void clear_renderstate(void) { gdraw->d3d_context->ClearState(); } - -static void set_common_renderstate() { - ID3D1XContext* d3d = gdraw->d3d_context; - S32 i; - - clear_renderstate(); - - // all the render states we never change while drawing - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLELIST)); - - d3d->PSSetShaderResources(7, 1, &gdraw->aa_tex_view); - d3d->PSSetSamplers(7, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // set a well-defined default sampler for all PS textures we use - for (i = 0; i < 3; ++i) - d3d->PSSetSamplers(i, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // reset our state caching - gdraw->scissor_state = ~0u; - gdraw->blend_mode = -1; -} - -static void manual_clear(gswf_recti* r, GDrawStats* stats); -static void set_render_target(GDrawStats* stats); - -//////////////////////////////////////////////////////////////////////// -// -// Begin/end rendering of a tile and per-frame processing -// - -void gdraw_D3D1X_(SetRendertargetSize)(S32 w, S32 h) { - if (gdraw && (w != gdraw->frametex_width || h != gdraw->frametex_height)) { - GDrawStats stats = {0}; - gdraw->frametex_width = w; - gdraw->frametex_height = h; - flush_rendertargets(&stats); - } -} - -void gdraw_D3D1X_(SetTileOrigin)(ID3D1X(RenderTargetView) * main_rt, - ID3D1X(DepthStencilView) * main_ds, - ID3D1X(ShaderResourceView) * non_msaa_rt, - S32 x, S32 y) { - D3D1X_(RENDER_TARGET_VIEW_DESC) desc; - - if (gdraw->frame_done) { - ++gdraw->frame_counter; - gdraw->frame_done = false; - } - - main_rt->GetDesc(&desc); - - gdraw->main_framebuffer = main_rt; - gdraw->main_resolve_target = non_msaa_rt; - gdraw->main_msaa = - (desc.ViewDimension == D3D1X_(RTV_DIMENSION_TEXTURE2DMS)); - gdraw->depth_buffer[0] = main_ds; - - gdraw->vx = x; - gdraw->vy = y; -} - -static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, - F32 scaley) { - memset(gdraw->frame, 0, sizeof(gdraw->frame)); - gdraw->cur = gdraw->frame; - gdraw->fw = w; - gdraw->fh = h; - gdraw->tw = w; - gdraw->th = h; - gdraw->world_to_pixel[0] = scalex; - gdraw->world_to_pixel[1] = scaley; - set_viewport(); -} - -// must include anything necessary for texture creation/update -static void RADLINK gdraw_RenderingBegin(void) {} -static void RADLINK gdraw_RenderingEnd(void) {} - -static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, - S32 pad, GDrawStats* stats) { - if (x0 == 0 && y0 == 0 && x1 == gdraw->fw && y1 == gdraw->fh) pad = 0; - - gdraw->tx0 = x0; - gdraw->ty0 = y0; - gdraw->tw = x1 - x0; - gdraw->th = y1 - y0; - - // padded region - gdraw->tx0p = RR_MAX(x0 - pad, 0); - gdraw->ty0p = RR_MAX(y0 - pad, 0); - gdraw->tpw = RR_MIN(x1 + pad, gdraw->fw) - gdraw->tx0p; - gdraw->tph = RR_MIN(y1 + pad, gdraw->fh) - gdraw->ty0p; - - // make sure our rendertargets are large enough to contain the tile - if (gdraw->tpw > gdraw->frametex_width || - gdraw->tph > gdraw->frametex_height) { - gdraw->frametex_width = RR_MAX(gdraw->tpw, gdraw->frametex_width); - gdraw->frametex_height = RR_MAX(gdraw->tph, gdraw->frametex_height); - - flush_rendertargets(stats); - } - assert(gdraw->tpw <= gdraw->frametex_width && - gdraw->tph <= gdraw->frametex_height); - - // set up rendertargets we'll use - set_common_renderstate(); - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[0], D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), - 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), - 1.0f, 0); - - set_projection(); - set_viewport(); - set_render_target(stats); -} - -static void RADLINK gdraw_RenderTileEnd(GDrawStats* /*stats*/) {} - -void gdraw_D3D1X_(NoMoreGDrawThisFrame)(void) { - clear_renderstate(); - gdraw->frame_done = true; - - gdraw->last_dyn_maxalloc = gdraw->dyn_maxalloc; - gdraw->dyn_maxalloc = 0; - - // reset dynamic buffer alloc position so they get DISCARDed - // next time around. - gdraw->dyn_vb.alloc_pos = 0; - gdraw->dyn_ib.alloc_pos = 0; - - GDrawFence now = {gdraw->frame_counter}; - gdraw_HandleCacheTick(gdraw->texturecache, now); - gdraw_HandleCacheTick(gdraw->vbufcache, now); -} - -#define MAX_DEPTH_VALUE (1 << 13) - -static void RADLINK gdraw_GetInfo(GDrawInfo* d) { - d->num_stencil_bits = 8; - d->max_id = MAX_DEPTH_VALUE - 2; - // for floating point depth, just use mantissa, e.g. 16-20 bits - d->buffer_format = GDRAW_BFORMAT_vbib; - d->shared_depth_stencil = 1; - d->always_mipmap = 1; -#ifndef GDRAW_D3D11_LEVEL9 - d->max_texture_size = 8192; - d->conditional_nonpow2 = 0; -#else - d->max_texture_size = 2048; - d->conditional_nonpow2 = 1; -#endif -} - -//////////////////////////////////////////////////////////////////////// -// -// Enable/disable rendertargets in stack fashion -// - -static ID3D1X(RenderTargetView) * get_active_render_target() { - if (gdraw->cur->color_buffer) { - unbind_resources(); // to make sure this RT isn't accidentally set as a - // texture (avoid D3D warnings) - return gdraw->cur->color_buffer->handle.tex.d3d_rtview; - } else - return gdraw->main_framebuffer; -} - -static void set_render_target(GDrawStats* stats) { - ID3D1X(RenderTargetView)* target = get_active_render_target(); - if (target == gdraw->main_framebuffer) { - gdraw->d3d_context->OMSetRenderTargets(1, &target, - gdraw->depth_buffer[0]); - gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); - } else { - ID3D1X(DepthStencilView)* depth = NULL; - if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) - depth = get_rendertarget_depthbuffer(stats); - - gdraw->d3d_context->OMSetRenderTargets(1, &target, depth); - gdraw->d3d_context->RSSetState(gdraw->raster_state[0]); - } - - stats->nonzero_flags |= GDRAW_STATS_rendtarg; - stats->rendertarget_changes += 1; -} - -static rrbool RADLINK gdraw_TextureDrawBufferBegin( - gswf_recti* region, gdraw_texture_format /*format*/, U32 flags, void* owner, - GDrawStats* stats) { - GDrawFramebufferState* n = gdraw->cur + 1; - GDrawHandle* t = NULL; - if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); - return false; - } - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - assert(0); - IggyGDrawSendWarning( - NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); - return false; - } - - if (owner) { - // nyi - } else { - t = get_color_rendertarget(stats); - if (!t) return false; - } - - n->flags = flags; - n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT - - ++gdraw->cur; - gdraw->cur->cached = owner != NULL; - if (owner) { - gdraw->cur->base_x = region->x0; - gdraw->cur->base_y = region->y0; - gdraw->cur->width = region->x1 - region->x0; - gdraw->cur->height = region->y1 - region->y0; - } - - set_render_target(stats); - assert(gdraw->frametex_width >= gdraw->tw && - gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT - - S32 k = (S32)(t - gdraw->rendertargets.handle); - - if (region) { - gswf_recti r; - S32 ox, oy, pad = 2; // 2 pixels of border on all sides - // 1 pixel turns out to be not quite enough with the interpolator - // precision we get. - - if (gdraw->in_blur) - ox = oy = 0; - else - ox = gdraw->tx0p, oy = gdraw->ty0p; - - // clamp region to tile - S32 xt0 = RR_MAX(region->x0 - ox, 0); - S32 yt0 = RR_MAX(region->y0 - oy, 0); - S32 xt1 = RR_MIN(region->x1 - ox, gdraw->tpw); - S32 yt1 = RR_MIN(region->y1 - oy, gdraw->tph); - - // but the padding needs to clamp to render target bounds - r.x0 = RR_MAX(xt0 - pad, 0); - r.y0 = RR_MAX(yt0 - pad, 0); - r.x1 = RR_MIN(xt1 + pad, gdraw->frametex_width); - r.y1 = RR_MIN(yt1 + pad, gdraw->frametex_height); - - if (r.x1 <= r.x0 || - r.y1 <= r.y0) { // region doesn't intersect with current tile - --gdraw->cur; - gdraw_FreeTexture((GDrawTexture*)t, 0, stats); - // note: don't send a warning since this will happen during regular - // tiled rendering - return false; - } - - manual_clear(&r, stats); - - gdraw->rt_valid[k].x0 = xt0; - gdraw->rt_valid[k].y0 = yt0; - gdraw->rt_valid[k].x1 = xt1; - gdraw->rt_valid[k].y1 = yt1; - } else { - gdraw->d3d_context->ClearRenderTargetView( - gdraw->cur->color_buffer->handle.tex.d3d_rtview, four_zeros); - gdraw->rt_valid[k].x0 = 0; - gdraw->rt_valid[k].y0 = 0; - gdraw->rt_valid[k].x1 = gdraw->frametex_width; - gdraw->rt_valid[k].y1 = gdraw->frametex_height; - } - - if (!gdraw->in_blur) { - set_viewport(); - set_projection(); - } else { - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); - } - - return true; -} - -static GDrawTexture* RADLINK gdraw_TextureDrawBufferEnd(GDrawStats* stats) { - GDrawFramebufferState* n = gdraw->cur; - GDrawFramebufferState* m = --gdraw->cur; - if (gdraw->tw == 0 || gdraw->th == 0) return 0; - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) - return 0; // already returned a warning in Begin - - assert(m >= gdraw->frame); // bug in Iggy -- unbalanced - - if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT - } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT - - // switch back to old render target - set_render_target(stats); - - // if we're at the root, set the viewport back - set_viewport(); - set_projection(); - - return (GDrawTexture*)n->color_buffer; -} - -//////////////////////////////////////////////////////////////////////// -// -// Clear stencil/depth buffers -// -// Open question whether we'd be better off finding bounding boxes -// and only clearing those; it depends exactly how fast clearing works. -// - -static void RADLINK gdraw_ClearStencilBits(U32 /*bits*/) { - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[0], - D3D1X_(CLEAR_STENCIL), 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], D3D1X_(CLEAR_STENCIL), 1.0f, 0); -} - -// this only happens rarely (hopefully never) if we use the depth buffer, -// so we can just clear the whole thing -static void RADLINK gdraw_ClearID(void) { - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[0], - D3D1X_(CLEAR_DEPTH), 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[1], - D3D1X_(CLEAR_DEPTH), 1.0f, 0); -} - -//////////////////////////////////////////////////////////////////////// -// -// Set all the render state from GDrawRenderState -// -// This also is responsible for getting the framebuffer into a texture -// if the read-modify-write blend operation can't be expressed with -// the native blend operators. (E.g. "screen") -// - -// convert an ID request to a value suitable for the depth buffer, -// assuming the depth buffer has been mappped to 0..1 -static F32 depth_from_id(S32 id) { - return 1.0f - ((F32)id + 1.0f) / MAX_DEPTH_VALUE; -} - -static void set_texture(S32 texunit, GDrawTexture* tex, rrbool nearest, - S32 wrap) { - ID3D1XContext* d3d = gdraw->d3d_context; - - if (tex == NULL) { - ID3D1X(ShaderResourceView)* notex = NULL; - d3d->PSSetShaderResources(texunit, 1, ¬ex); - } else { - GDrawHandle* h = (GDrawHandle*)tex; - d3d->PSSetShaderResources(texunit, 1, &h->handle.tex.d3d_view); - d3d->PSSetSamplers(texunit, 1, &gdraw->sampler_state[nearest][wrap]); - } -} - -static void RADLINK gdraw_Set3DTransform(F32* mat) { - if (mat == NULL) - gdraw->use_3d = 0; - else { - gdraw->use_3d = 1; - memcpy(gdraw->xform_3d, mat, sizeof(gdraw->xform_3d)); - } -} - -static int set_renderstate_full(S32 vertex_format, GDrawRenderState* r, - GDrawStats* /* stats */, const F32* rescale1) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // set vertex shader - set_vertex_shader(d3d, gdraw->vert[vertex_format].vshader); - - // set vertex shader constants - if (VertexVars* vvars = (VertexVars*)map_buffer(gdraw->d3d_context, - gdraw->cb_vertex, true)) { - F32 depth = depth_from_id(r->id); - if (!r->use_world_space) - gdraw_ObjectSpace(vvars->world[0], r->o2w, depth, 0.0f); - else - gdraw_WorldSpace(vvars->world[0], gdraw->world_to_pixel, depth, - 0.0f); - - memcpy(&vvars->x_off, r->edge_matrix, 4 * sizeof(F32)); - - if (r->texgen0_enabled) { - memcpy(&vvars->texgen_s, r->s0_texgen, 4 * sizeof(F32)); - memcpy(&vvars->texgen_t, r->t0_texgen, 4 * sizeof(F32)); - } - - if (gdraw->use_3d) - memcpy(vvars->x3d, gdraw->xform_3d, 12 * sizeof(F32)); - else - memcpy(vvars->x3d, gdraw->projmat, 12 * sizeof(F32)); - - unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex); - - d3d->VSSetConstantBuffers(0, 1, &gdraw->cb_vertex); - } - - // set the blend mode - int blend_mode = r->blend_mode; - if (blend_mode != gdraw->blend_mode) { - gdraw->blend_mode = blend_mode; - d3d->OMSetBlendState(gdraw->blend_state[blend_mode], four_zeros, ~0u); - } - - // set the fragment program - if (blend_mode != GDRAW_BLEND_special) { - int which = r->tex0_mode; - assert(which >= 0 && - which < sizeof(gdraw->fprog) / sizeof(*gdraw->fprog)); - - int additive = 0; - if (r->cxf_add) { - additive = 1; - if (r->cxf_add[3]) additive = 2; - } - - ID3D1X(PixelShader)* program = gdraw->fprog[which][additive].pshader; - if (r->stencil_set) { - // in stencil set mode, prefer not doing any shading at all - // but if alpha test is on, we need to make an exception - -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems - if (which != GDRAW_TEXTURE_alpha_test) - program = NULL; - else -#endif - { - gdraw->blend_mode = -1; - d3d->OMSetBlendState(gdraw->blend_no_color_write, four_zeros, - ~0u); - } - } - - set_pixel_shader(d3d, program); - } else - set_pixel_shader(d3d, - gdraw->exceptional_blend[r->special_blend].pshader); - - set_texture(0, r->tex[0], r->nearest0, r->wrap0); - - // pixel shader constants - if (PixelCommonVars* pvars = (PixelCommonVars*)map_buffer( - gdraw->d3d_context, gdraw->cb_ps_common, true)) { - memcpy(pvars->color_mul, r->color, 4 * sizeof(float)); - - if (r->cxf_add) { - pvars->color_add[0] = r->cxf_add[0] / 255.0f; - pvars->color_add[1] = r->cxf_add[1] / 255.0f; - pvars->color_add[2] = r->cxf_add[2] / 255.0f; - pvars->color_add[3] = r->cxf_add[3] / 255.0f; - } else - pvars->color_add[0] = pvars->color_add[1] = pvars->color_add[2] = - pvars->color_add[3] = 0.0f; - - if (r->tex0_mode == GDRAW_TEXTURE_focal_gradient) - memcpy(pvars->focal, r->focal_point, 4 * sizeof(float)); - if (r->blend_mode == GDRAW_BLEND_special) - memcpy(pvars->rescale1, rescale1, 4 * sizeof(float)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common); - d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common); - } - - // Set pixel operation states - if (r->scissor) { - D3D1X_(RECT) s; - gdraw->scissor_state = 1; - if (gdraw->cur == gdraw->frame) { - s.left = r->scissor_rect.x0 + gdraw->vx - gdraw->tx0; - s.top = r->scissor_rect.y0 + gdraw->vy - gdraw->ty0; - s.right = r->scissor_rect.x1 + gdraw->vx - gdraw->tx0; - s.bottom = r->scissor_rect.y1 + gdraw->vy - gdraw->ty0; - } else { - s.left = r->scissor_rect.x0 - gdraw->tx0p; - s.top = r->scissor_rect.y0 - gdraw->ty0p; - s.right = r->scissor_rect.x1 - gdraw->tx0p; - s.bottom = r->scissor_rect.y1 - gdraw->ty0p; - } - d3d->RSSetScissorRects(1, &s); - } else if (r->scissor != gdraw->scissor_state) - disable_scissor(0); - - if (r->stencil_set | r->stencil_test) - d3d->OMSetDepthStencilState( - stencil_state_cache_lookup(r->set_id, r->test_id, r->stencil_test, - r->stencil_set), - 255); - else - d3d->OMSetDepthStencilState(gdraw->depth_state[r->set_id][r->test_id], - 0); - - return 1; -} - -static RADINLINE int set_renderstate(S32 vertex_format, GDrawRenderState* r, - GDrawStats* stats) { - static const F32 unit_rescale[4] = {1.0f, 1.0f, 0.0f, 0.0f}; - if (r->identical_state) { - // fast path: only need to change vertex shader, other state is the same - set_vertex_shader(gdraw->d3d_context, - gdraw->vert[vertex_format].vshader); - return 1; - } else - return set_renderstate_full(vertex_format, r, stats, unit_rescale); -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex formats -// - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2aa[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R16G16B16A16_SINT, 0, 8, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2tc2[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static struct gdraw_vertex_format_desc { - D3D1X_(INPUT_ELEMENT_DESC) * desc; - U32 nelem; -} vformats[ASSERT_COUNT(GDRAW_vformat__basic_count, 3)] = { - vformat_v2, 1, // GDRAW_vformat_v2 - vformat_v2aa, 2, // GDRAW_vformat_v2aa - vformat_v2tc2, 2, // GDRAW_vforamt_v2tc2 -}; - -static int vertsize[GDRAW_vformat__basic_count] = { - 8, // GDRAW_vformat_v2 - 16, // GDRAW_vformat_v2aa - 16, // GDRAW_vformat_v2tc2 -}; - -//////////////////////////////////////////////////////////////////////// -// -// Draw triangles with a given renderstate -// - -static void tag_resources(void* r1, void* r2 = NULL, void* r3 = NULL, - void* r4 = NULL) { - U64 now = gdraw->frame_counter; - if (r1) ((GDrawHandle*)r1)->fence.value = now; - if (r2) ((GDrawHandle*)r2)->fence.value = now; - if (r3) ((GDrawHandle*)r3)->fence.value = now; - if (r4) ((GDrawHandle*)r4)->fence.value = now; -} - -static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState* r, - GDrawPrimitive* p, - GDrawVertexBuffer* buf, - GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - GDrawHandle* vb = (GDrawHandle*)buf; - int vfmt = p->vertex_format; - assert(vfmt >= 0 && vfmt < GDRAW_vformat__count); - - if (!set_renderstate(vfmt, r, stats)) return; - - UINT stride = vertsize[vfmt]; - d3d->IASetInputLayout(gdraw->inlayout[vfmt]); - - if (vb) { - UINT offs = (UINT)(UINTa)p->vertices; - - d3d->IASetVertexBuffers(0, 1, &vb->handle.vbuf.verts, &stride, &offs); - d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, - (UINT)(UINTa)p->indices); - d3d->DrawIndexed(p->num_indices, 0, 0); - } else if (p->indices) { - U32 vbytes = p->num_vertices * stride; - U32 ibytes = p->num_indices * 2; - - if (void* vbptr = start_write_dyn(&gdraw->dyn_vb, vbytes)) { - memcpy(vbptr, p->vertices, vbytes); - UINT vboffs = end_write_dyn(&gdraw->dyn_vb); - - if (void* ibptr = start_write_dyn(&gdraw->dyn_ib, ibytes)) { - memcpy(ibptr, p->indices, ibytes); - UINT iboffs = end_write_dyn(&gdraw->dyn_ib); - - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, &stride, - &vboffs); - d3d->IASetIndexBuffer(gdraw->dyn_ib.buffer, - DXGI_FORMAT_R16_UINT, iboffs); - d3d->DrawIndexed(p->num_indices, 0, 0); - } - } - } else { // dynamic quads - assert(p->num_vertices % 4 == 0); - d3d->IASetIndexBuffer(gdraw->quad_ib, DXGI_FORMAT_R16_UINT, 0); - - if (gdraw->max_quad_vert_count) { - S32 pos = 0; - while (pos < p->num_vertices) { - S32 vert_count = - RR_MIN(p->num_vertices - pos, gdraw->max_quad_vert_count); - UINT chunk_bytes = vert_count * stride; - - if (void* vbptr = - start_write_dyn(&gdraw->dyn_vb, chunk_bytes)) { - memcpy(vbptr, (U8*)p->vertices + pos * stride, chunk_bytes); - UINT offs = end_write_dyn(&gdraw->dyn_vb); - - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, - &stride, &offs); - d3d->DrawIndexed((vert_count >> 2) * 6, 0, 0); - } - pos += vert_count; - } - } - } - - tag_resources(vb, r->tex[0], r->tex[1]); - - stats->nonzero_flags |= GDRAW_STATS_batches; - stats->num_batches += 1; - stats->drawn_indices += p->num_indices; - stats->drawn_vertices += p->num_vertices; -} - -/////////////////////////////////////////////////////////////////////// -// -// Flash 8 filter effects -// - -static void* start_ps_constants(ID3D1X(Buffer) * buffer) { - return map_buffer(gdraw->d3d_context, buffer, true); -} - -static void end_ps_constants(ID3D1X(Buffer) * buffer) { - unmap_buffer(gdraw->d3d_context, buffer); - gdraw->d3d_context->PSSetConstantBuffers(1, 1, &buffer); -} - -static void set_pixel_constant(F32* constant, F32 x, F32 y, F32 z, F32 w) { - constant[0] = x; - constant[1] = y; - constant[2] = z; - constant[3] = w; -} - -// caller sets up texture coordinates -static void do_screen_quad(gswf_recti* s, const F32* tc, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - F32 px0 = (F32)s->x0, py0 = (F32)s->y0, px1 = (F32)s->x1, py1 = (F32)s->y1; - - // generate vertex data - gswf_vertex_xyst* vert = (gswf_vertex_xyst*)start_write_dyn( - &gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst)); - if (!vert) return; - - vert[0].x = px0; - vert[0].y = py0; - vert[0].s = tc[0]; - vert[0].t = tc[1]; - vert[1].x = px1; - vert[1].y = py0; - vert[1].s = tc[2]; - vert[1].t = tc[1]; - vert[2].x = px0; - vert[2].y = py1; - vert[2].s = tc[0]; - vert[2].t = tc[3]; - vert[3].x = px1; - vert[3].y = py1; - vert[3].s = tc[2]; - vert[3].t = tc[3]; - UINT offs = end_write_dyn(&gdraw->dyn_vb); - UINT stride = sizeof(gswf_vertex_xyst); - - if (VertexVars* vvars = (VertexVars*)map_buffer(gdraw->d3d_context, - gdraw->cb_vertex, true)) { - gdraw_PixelSpace(vvars->world[0]); - memcpy(vvars->x3d, gdraw->projmat, 12 * sizeof(F32)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex); - d3d->VSSetConstantBuffers(0, 1, &gdraw->cb_vertex); - - set_vertex_shader(d3d, gdraw->vert[GDRAW_vformat_v2tc2].vshader); - - d3d->IASetInputLayout(gdraw->inlayout[GDRAW_vformat_v2tc2]); - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, &stride, &offs); - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLESTRIP)); - d3d->Draw(4, 0); - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLELIST)); - - stats->nonzero_flags |= GDRAW_STATS_batches; - stats->num_batches += 1; - stats->drawn_indices += 6; - stats->drawn_vertices += 4; - } -} - -static void manual_clear(gswf_recti* r, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // go to known render state - d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); - d3d->OMSetDepthStencilState(gdraw->depth_state[0][0], 0); - gdraw->blend_mode = GDRAW_BLEND_none; - - set_viewport_raw(0, 0, gdraw->frametex_width, gdraw->frametex_height); - set_projection_raw(0, gdraw->frametex_width, gdraw->frametex_height, 0); - set_pixel_shader(d3d, gdraw->clear_ps.pshader); - - if (PixelCommonVars* pvars = (PixelCommonVars*)map_buffer( - gdraw->d3d_context, gdraw->cb_ps_common, true)) { - memset(pvars, 0, sizeof(*pvars)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common); - d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common); - - do_screen_quad(r, four_zeros, stats); - } -} - -static void gdraw_DriverBlurPass(GDrawRenderState* r, int taps, float* data, - gswf_recti* s, float* tc, float /*height_max*/, - float* clamp, GDrawStats* gstats) { - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - - set_pixel_shader(gdraw->d3d_context, gdraw->blur_prog[taps].pshader); - PixelParaBlur* para = (PixelParaBlur*)start_ps_constants(gdraw->cb_blur); - memcpy(para->clamp, clamp, 4 * sizeof(float)); - memcpy(para->tap, data, taps * 4 * sizeof(float)); - end_ps_constants(gdraw->cb_blur); - - do_screen_quad(s, tc, gstats); - tag_resources(r->tex[0]); -} - -static void gdraw_Colormatrix(GDrawRenderState* r, gswf_recti* s, float* tc, - GDrawStats* stats) { - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - 0, stats)) - return; - - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - set_pixel_shader(gdraw->d3d_context, gdraw->colormatrix.pshader); - - PixelParaColorMatrix* para = - (PixelParaColorMatrix*)start_ps_constants(gdraw->cb_colormatrix); - memcpy(para->data, r->shader_data, 5 * 4 * sizeof(float)); - end_ps_constants(gdraw->cb_colormatrix); - - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); -} - -static gswf_recti* get_valid_rect(GDrawTexture* tex) { - GDrawHandle* h = (GDrawHandle*)tex; - S32 n = (S32)(h - gdraw->rendertargets.handle); - assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH + 1); - return &gdraw->rt_valid[n]; -} - -static void set_clamp_constant(F32* constant, GDrawTexture* tex) { - gswf_recti* s = get_valid_rect(tex); - // when we make the valid data, we make sure there is an extra empty pixel - // at the border - set_pixel_constant(constant, (s->x0 - 0.5f) / gdraw->frametex_width, - (s->y0 - 0.5f) / gdraw->frametex_height, - (s->x1 + 0.5f) / gdraw->frametex_width, - (s->y1 + 0.5f) / gdraw->frametex_height); -} - -static void gdraw_Filter(GDrawRenderState* r, gswf_recti* s, float* tc, - int isbevel, GDrawStats* stats) { - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - NULL, stats)) - return; - - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - set_texture(1, r->tex[1], false, GDRAW_WRAP_clamp); - set_texture(2, r->tex[2], false, GDRAW_WRAP_clamp); - set_pixel_shader(gdraw->d3d_context, - gdraw->filter_prog[isbevel][r->filter_mode].pshader); - - PixelParaFilter* para = - (PixelParaFilter*)start_ps_constants(gdraw->cb_filter); - set_clamp_constant(para->clamp0, r->tex[0]); - set_clamp_constant(para->clamp1, r->tex[1]); - set_pixel_constant(para->color, r->shader_data[0], r->shader_data[1], - r->shader_data[2], r->shader_data[3]); - set_pixel_constant(para->color2, r->shader_data[8], r->shader_data[9], - r->shader_data[10], r->shader_data[11]); - set_pixel_constant( - para->tc_off, -r->shader_data[4] / (F32)gdraw->frametex_width, - -r->shader_data[5] / (F32)gdraw->frametex_height, r->shader_data[6], 0); - end_ps_constants(gdraw->cb_filter); - - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0], r->tex[1], r->tex[2]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); -} - -static void RADLINK gdraw_FilterQuad(GDrawRenderState* r, S32 x0, S32 y0, - S32 x1, S32 y1, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - F32 tc[4]; - gswf_recti s; - - // clip to tile boundaries - s.x0 = RR_MAX(x0, gdraw->tx0p); - s.y0 = RR_MAX(y0, gdraw->ty0p); - s.x1 = RR_MIN(x1, gdraw->tx0p + gdraw->tpw); - s.y1 = RR_MIN(y1, gdraw->ty0p + gdraw->tph); - if (s.x1 < s.x0 || s.y1 < s.y0) return; - - tc[0] = (s.x0 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[1] = (s.y0 - gdraw->ty0p) / (F32)gdraw->frametex_height; - tc[2] = (s.x1 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[3] = (s.y1 - gdraw->ty0p) / (F32)gdraw->frametex_height; - - // clear to known render state - d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); - d3d->OMSetDepthStencilState(gdraw->depth_state[0][0], 0); - disable_scissor(0); - gdraw->blend_mode = GDRAW_BLEND_none; - - if (r->blend_mode == GDRAW_BLEND_filter) { - switch (r->filter) { - case GDRAW_FILTER_blur: { - GDrawBlurInfo b; - gswf_recti bounds = *get_valid_rect(r->tex[0]); - gdraw_ShiftRect(&s, &s, -gdraw->tx0p, - -gdraw->ty0p); // blur uses physical - // rendertarget coordinates - - b.BlurPass = gdraw_DriverBlurPass; - b.w = gdraw->tpw; - b.h = gdraw->tph; - b.frametex_width = gdraw->frametex_width; - b.frametex_height = gdraw->frametex_height; - - // blur needs to draw with multiple passes, so set up special - // state - gdraw->in_blur = true; - - // do the blur - gdraw_Blur(&gdraw_funcs, &b, r, &s, &bounds, stats); - - // restore the normal state - gdraw->in_blur = false; - set_viewport(); - set_projection(); - break; - } - - case GDRAW_FILTER_colormatrix: - gdraw_Colormatrix(r, &s, tc, stats); - break; - - case GDRAW_FILTER_dropshadow: - gdraw_Filter(r, &s, tc, 0, stats); - break; - - case GDRAW_FILTER_bevel: - gdraw_Filter(r, &s, tc, 1, stats); - break; - - default: - assert(0); - } - } else { - GDrawHandle* blend_tex = NULL; - - // for crazy blend modes, we need to read back from the framebuffer - // and do the blending in the pixel shader. we do this with copies - // rather than trying to render-to-texture-all-along, because we want - // to be able to render over the user's existing framebuffer, which - // might not be a texture. note that this isn't optimal when MSAA is on! - F32 rescale1[4] = {1.0f, 1.0f, 0.0f, 0.0f}; - if (r->blend_mode == GDRAW_BLEND_special) { - ID3D1XContext* d3d = gdraw->d3d_context; - ID3D1X(Resource) * cur_rt_rsrc; - get_active_render_target()->GetResource(&cur_rt_rsrc); - - if (gdraw->cur == gdraw->frame && gdraw->main_msaa) { - // source surface is main framebuffer and it uses MSAA. just - // resolve it first. - D3D1X_(SHADER_RESOURCE_VIEW_DESC) desc; - D3D1X_(TEXTURE2D_DESC) texdesc; - ID3D1X(Texture2D) * resolve_tex; - - gdraw->main_resolve_target->GetDesc(&desc); - gdraw->main_resolve_target->GetResource( - (ID3D1X(Resource)**)&resolve_tex); - resolve_tex->GetDesc(&texdesc); - d3d->ResolveSubresource(resolve_tex, 0, cur_rt_rsrc, 0, - desc.Format); - resolve_tex->Release(); - - stats->nonzero_flags |= GDRAW_STATS_blits; - stats->num_blits += 1; - stats->num_blit_pixels += texdesc.Width * texdesc.Height; - - d3d->PSSetShaderResources(1, 1, &gdraw->main_resolve_target); - d3d->PSSetSamplers(1, 1, - &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // calculate texture coordinate remapping - rescale1[0] = gdraw->frametex_width / (F32)texdesc.Width; - rescale1[1] = gdraw->frametex_height / (F32)texdesc.Height; - rescale1[2] = - (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / (F32)texdesc.Width; - rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / - (F32)texdesc.Height; - } else { - D3D1X_(BOX) box = {0, 0, 0, 0, 0, 1}; - S32 dx = 0, dy = 0; - blend_tex = get_color_rendertarget(stats); - - if (gdraw->cur != gdraw->frame) - box.right = gdraw->tpw, box.bottom = gdraw->tph; - else { - box.left = gdraw->vx, box.top = gdraw->vy, - box.right = gdraw->vx + gdraw->tw, - box.bottom = gdraw->vy + gdraw->th; - dx = gdraw->tx0 - gdraw->tx0p; - dy = gdraw->ty0 - gdraw->ty0p; - } - - d3d->CopySubresourceRegion(blend_tex->handle.tex.d3d, 0, dx, dy, - 0, cur_rt_rsrc, 0, &box); - - stats->nonzero_flags |= GDRAW_STATS_blits; - stats->num_blits += 1; - stats->num_blit_pixels += - (box.right - box.left) * (box.bottom - box.top); - - set_texture(1, (GDrawTexture*)blend_tex, false, - GDRAW_WRAP_clamp); - } - - cur_rt_rsrc->Release(); - } - - if (!set_renderstate_full(GDRAW_vformat_v2tc2, r, stats, rescale1)) - return; - - do_screen_quad(&s, tc, stats); - tag_resources(r->tex[0], r->tex[1]); - if (blend_tex) gdraw_FreeTexture((GDrawTexture*)blend_tex, 0, stats); - } -} - -/////////////////////////////////////////////////////////////////////// -// -// Shaders and state -// - -#include GDRAW_SHADER_FILE - -static void destroy_shader(ProgramWithCachedVariableLocations* p) { - if (p->pshader) { - p->pshader->Release(); - p->pshader = NULL; - } -} - -static ID3D1X(Buffer) * create_dynamic_buffer(U32 size, U32 bind) { - D3D1X_(BUFFER_DESC) - desc = {size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0}; - ID3D1X(Buffer)* buf = NULL; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = NULL; - } - return buf; -} - -static void init_dyn_buffer(DynBuffer* buf, U32 size, U32 bind) { - buf->buffer = create_dynamic_buffer(size, bind); - buf->size = size; - buf->write_pos = 0; - buf->alloc_pos = 0; -} - -// These two functions are implemented by the D3D10- respectively D3D11-specific -// part. -static void create_pixel_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src); -static void create_vertex_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src); - -static void create_all_shaders_and_state(void) { - ID3D1X(Device)* d3d = gdraw->d3d_device; - HRESULT hr; - S32 i, j; - - for (i = 0; i < GDRAW_TEXTURE__count * 3; ++i) - create_pixel_shader(&gdraw->fprog[0][i], pshader_basic_arr + i); - for (i = 0; i < GDRAW_BLENDSPECIAL__count; ++i) - create_pixel_shader(&gdraw->exceptional_blend[i], - pshader_exceptional_blend_arr + i); - for (i = 0; i < 32; ++i) - create_pixel_shader(&gdraw->filter_prog[0][i], pshader_filter_arr + i); - for (i = 0; i < MAX_TAPS + 1; ++i) - create_pixel_shader(&gdraw->blur_prog[i], pshader_blur_arr + i); - create_pixel_shader(&gdraw->colormatrix, pshader_color_matrix_arr); - create_pixel_shader(&gdraw->clear_ps, pshader_manual_clear_arr); - - for (i = 0; i < GDRAW_vformat__basic_count; i++) { - ProgramWithCachedVariableLocations* vsh = vshader_vsd3d10_arr + i; - - create_vertex_shader(&gdraw->vert[i], vsh); - HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, - vsh->bytecode, vsh->size, - &gdraw->inlayout[i]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = NULL; - } - } - - // create rasterizer state setups - for (i = 0; i < 2; ++i) { - D3D1X_(RASTERIZER_DESC) - raster_desc = {D3D1X_(FILL_SOLID), - D3D1X_(CULL_NONE), - FALSE, - 0, - 0.0f, - 0.0f, - TRUE, - TRUE, - FALSE, - FALSE}; - raster_desc.MultisampleEnable = i; - hr = d3d->CreateRasterizerState(&raster_desc, &gdraw->raster_state[i]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateRasterizerState", ""); - return; - } - } - - // create sampler state setups - static const D3D1X_(TEXTURE_ADDRESS_MODE) - addrmode[ASSERT_COUNT(GDRAW_WRAP__count, 4)] = { - D3D1X_(TEXTURE_ADDRESS_CLAMP), // GDRAW_WRAP_clamp - D3D1X_(TEXTURE_ADDRESS_WRAP), // GDRAW_WRAP_repeat - D3D1X_(TEXTURE_ADDRESS_MIRROR), // GDRAW_WRAP_mirror - D3D1X_(TEXTURE_ADDRESS_CLAMP), // GDRAW_WRAP_clamp_to_border - // (unused for this renderer) - }; - - for (i = 0; i < 2; ++i) { - for (j = 0; j < GDRAW_WRAP__count; ++j) { - D3D1X_(SAMPLER_DESC) sampler_desc; - memset(&sampler_desc, 0, sizeof(sampler_desc)); - sampler_desc.Filter = i ? D3D1X_(FILTER_MIN_LINEAR_MAG_MIP_POINT) - : D3D1X_(FILTER_MIN_MAG_MIP_LINEAR); - sampler_desc.AddressU = addrmode[j]; - sampler_desc.AddressV = addrmode[j]; - sampler_desc.AddressW = D3D1X_(TEXTURE_ADDRESS_CLAMP); - sampler_desc.MaxAnisotropy = 1; - sampler_desc.MaxLOD = D3D1X_(FLOAT32_MAX); - hr = d3d->CreateSamplerState(&sampler_desc, - &gdraw->sampler_state[i][j]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateSamplerState", ""); - return; - } - } - } - - // create blend stage setups - static struct blendspec { - BOOL blend; - D3D1X_(BLEND) src; - D3D1X_(BLEND) dst; - } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_none - TRUE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_INV_SRC_ALPHA), // GDRAW_BLEND_alpha - TRUE, - D3D1X_(BLEND_DEST_COLOR), - D3D1X_(BLEND_INV_SRC_ALPHA), // GDRAW_BLEND_multiply - TRUE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ONE), // GDRAW_BLEND_add - - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_filter - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_special - }; - - for (i = 0; i < GDRAW_BLEND__count; ++i) { - gdraw->blend_state[i] = create_blend_state( - d3d, blends[i].blend, blends[i].src, blends[i].dst); - if (!gdraw->blend_state[i]) return; - } - - D3D1X_(BLEND_DESC) blend_desc; - memset(&blend_desc, 0, sizeof(blend_desc)); - hr = d3d->CreateBlendState(&blend_desc, &gdraw->blend_no_color_write); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBlendState", ""); - return; - } - - // create depth/stencil setups - for (i = 0; i < 2; ++i) { - for (j = 0; j < 2; ++j) { - D3D1X_(DEPTH_STENCIL_DESC) depth_desc; - memset(&depth_desc, 0, sizeof(depth_desc)); - - depth_desc.DepthEnable = (i || j); - depth_desc.DepthWriteMask = i ? D3D1X_(DEPTH_WRITE_MASK_ALL) - : D3D1X_(DEPTH_WRITE_MASK_ZERO); - depth_desc.DepthFunc = - j ? D3D1X_(COMPARISON_LESS) : D3D1X_(COMPARISON_ALWAYS); - depth_desc.StencilEnable = FALSE; - - hr = d3d->CreateDepthStencilState(&depth_desc, - &gdraw->depth_state[i][j]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateDepthStencilState", ""); - return; - } - } - } - - // constant buffers - gdraw->cb_vertex = - create_dynamic_buffer(sizeof(VertexVars), D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_ps_common = create_dynamic_buffer(sizeof(PixelCommonVars), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_filter = create_dynamic_buffer(sizeof(PixelParaFilter), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_colormatrix = create_dynamic_buffer(sizeof(PixelParaColorMatrix), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_blur = create_dynamic_buffer(sizeof(PixelParaBlur), - D3D1X_(BIND_CONSTANT_BUFFER)); - - // quad index buffer - assert(QUAD_IB_COUNT * 4 < - 65535); // can't use more; we have 16-bit index buffers and 0xffff = - // primitive cut index - U16* inds = (U16*)IggyGDrawMalloc(QUAD_IB_COUNT * 6 * sizeof(U16)); - if (inds) { - D3D1X_(BUFFER_DESC) bufdesc = {}; - D3D1X_(SUBRESOURCE_DATA) data = {inds, 0, 0}; - - bufdesc.ByteWidth = QUAD_IB_COUNT * 6 * sizeof(U16); - bufdesc.Usage = D3D1X_(USAGE_IMMUTABLE); - bufdesc.BindFlags = D3D1X_(BIND_INDEX_BUFFER); - - for (U16 i = 0; i < QUAD_IB_COUNT; i++) { - inds[i * 6 + 0] = i * 4 + 0; - inds[i * 6 + 1] = i * 4 + 1; - inds[i * 6 + 2] = i * 4 + 2; - inds[i * 6 + 3] = i * 4 + 0; - inds[i * 6 + 4] = i * 4 + 2; - inds[i * 6 + 5] = i * 4 + 3; - } - - hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = NULL; - } - IggyGDrawFree(inds); - } else - gdraw->quad_ib = NULL; -} - -static void destroy_all_shaders_and_state() { - S32 i; - - for (i = 0; i < GDRAW_TEXTURE__count * 3; ++i) - destroy_shader(&gdraw->fprog[0][i]); - for (i = 0; i < GDRAW_BLENDSPECIAL__count; ++i) - destroy_shader(&gdraw->exceptional_blend[i]); - for (i = 0; i < 32; ++i) destroy_shader(&gdraw->filter_prog[0][i]); - for (i = 0; i < MAX_TAPS + 1; ++i) destroy_shader(&gdraw->blur_prog[i]); - destroy_shader(&gdraw->colormatrix); - destroy_shader(&gdraw->clear_ps); - - for (i = 0; i < GDRAW_vformat__basic_count; i++) { - safe_release(gdraw->inlayout[i]); - destroy_shader(&gdraw->vert[i]); - } - - for (i = 0; i < 2; ++i) safe_release(gdraw->raster_state[i]); - for (i = 0; i < GDRAW_WRAP__count * 2; ++i) - safe_release(gdraw->sampler_state[0][i]); - for (i = 0; i < GDRAW_BLEND__count; ++i) - safe_release(gdraw->blend_state[i]); - for (i = 0; i < 2 * 2; ++i) safe_release(gdraw->depth_state[0][i]); - - safe_release(gdraw->blend_no_color_write); - - safe_release(gdraw->cb_vertex); - safe_release(gdraw->cb_ps_common); - safe_release(gdraw->cb_filter); - safe_release(gdraw->cb_colormatrix); - safe_release(gdraw->cb_blur); - - safe_release(gdraw->quad_ib); -} - -//////////////////////////////////////////////////////////////////////// -// -// Create and tear-down the state -// - -typedef struct { - S32 num_handles; - S32 num_bytes; -} GDrawResourceLimit; - -// These are the defaults limits used by GDraw unless the user specifies -// something else. -static GDrawResourceLimit gdraw_limits[GDRAW_D3D1X_(RESOURCE__count)] = { - MAX_RENDER_STACK_DEPTH + 1, - 16 * 1024 * 1024, // RESOURCE_rendertarget - 500, - 16 * 1024 * 1024, // RESOURCE_texture - 1000, - 2 * 1024 * 1024, // RESOURCE_vertexbuffer - 0, - 256 * 1024, // RESOURCE_dynbuffer -}; - -static GDrawHandleCache* make_handle_cache(gdraw_resourcetype type) { - S32 num_handles = gdraw_limits[type].num_handles; - S32 num_bytes = gdraw_limits[type].num_bytes; - GDrawHandleCache* cache = (GDrawHandleCache*)IggyGDrawMalloc( - sizeof(GDrawHandleCache) + (num_handles - 1) * sizeof(GDrawHandle)); - if (cache) { - gdraw_HandleCacheInit(cache, num_handles, num_bytes); - cache->is_vertex = (type == GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - } - - return cache; -} - -static void free_gdraw() { - if (!gdraw) return; - if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); - if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); - IggyGDrawFree(gdraw); - gdraw = NULL; -} - -static bool alloc_dynbuffer(U32 size) { - // specified input size is vertex buffer size. determine sensible size for - // the corresponding index buffer. iggy always uses 16-bit indices and has - // three primary types of geometry it sends: - // - // 1. filled polygons. these are triangulated simple polygons and thus have - // roughly as many triangles as they have vertices. they use either 8- or - // 16-byte vertex formats; this makes a worst case of 6 bytes of indices - // for every 8 bytes of vertex data. - // 2. strokes and edge antialiasing. they use a 16-byte vertex format and - // worst-case write a "double quadstrip" which has 4 triangles for every - // 3 vertices, which means 24 bytes of index data for every 48 bytes - // of vertex data. - // 3. textured quads. they use a 16-byte vertex format, have exactly 2 - // triangles for every 4 vertices, and use either a static index buffer - // (quad_ib) or a single triangle strip, so for our purposes they need no - // space to store indices at all. - // - // 1) argues for allocating index buffers at 3/4 the size of the - // corresponding vertex buffer, while 2) and 3) need 1/2 the size of the - // vertex buffer or less. 2) and 3) are the most common types of vertex - // data, while 1) is used only for morphed shapes and in certain cases when - // the RESOURCE_vertexbuffer pool is full. we just play it safe anyway and - // make sure we size the IB large enough to cover the worst case for 1). - // this is conservative, but it probably doesn't matter much. - U32 ibsize = (size * 3) / 4; - - init_dyn_buffer(&gdraw->dyn_vb, size, D3D1X_(BIND_VERTEX_BUFFER)); - init_dyn_buffer(&gdraw->dyn_ib, ibsize, D3D1X_(BIND_INDEX_BUFFER)); - - gdraw->max_quad_vert_count = - RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); - gdraw->max_quad_vert_count &= ~3; // must be multiple of four - - return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; -} - -int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, - S32 num_bytes) { - GDrawStats stats = {0}; - - if (type == GDRAW_D3D1X_(RESOURCE_rendertarget)) // RT count is small and - // space is preallocated - num_handles = MAX_RENDER_STACK_DEPTH + 1; - - assert(type >= GDRAW_D3D1X_(RESOURCE_rendertarget) && - type < GDRAW_D3D1X_(RESOURCE__count)); - assert(num_handles >= 0); - assert(num_bytes >= 0); - - // nothing to do if the values are unchanged - if (gdraw_limits[type].num_handles == num_handles && - gdraw_limits[type].num_bytes == num_bytes) - return 1; - - gdraw_limits[type].num_handles = num_handles; - gdraw_limits[type].num_bytes = num_bytes; - - // if no gdraw context created, there's nothing to worry about - if (!gdraw) return 1; - - // resize the appropriate pool - switch (type) { - case GDRAW_D3D1X_(RESOURCE_rendertarget): - flush_rendertargets(&stats); - gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, - num_bytes); - return 1; - - case GDRAW_D3D1X_(RESOURCE_texture): - if (gdraw->texturecache) { - gdraw_res_flush(gdraw->texturecache, &stats); - IggyGDrawFree(gdraw->texturecache); - } - gdraw->texturecache = - make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != NULL; - - case GDRAW_D3D1X_(RESOURCE_vertexbuffer): - if (gdraw->vbufcache) { - gdraw_res_flush(gdraw->vbufcache, &stats); - IggyGDrawFree(gdraw->vbufcache); - } - gdraw->vbufcache = - make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; - - case GDRAW_D3D1X_(RESOURCE_dynbuffer): - unbind_resources(); - safe_release(gdraw->dyn_vb.buffer); - safe_release(gdraw->dyn_ib.buffer); - return alloc_dynbuffer(num_bytes); - - default: - return 0; - } -} - -static GDrawFunctions* create_context(ID3D1XDevice* dev, ID3D1XContext* ctx, - S32 w, S32 h) { - gdraw = (GDraw*)IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; - - memset(gdraw, 0, sizeof(*gdraw)); - - gdraw->frametex_width = w; - gdraw->frametex_height = h; - gdraw->d3d_device = dev; - gdraw->d3d_context = ctx; - - gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - gdraw_HandleCacheInit( - &gdraw->rendertargets, - gdraw_limits[GDRAW_D3D1X_(RESOURCE_rendertarget)].num_handles, - gdraw_limits[GDRAW_D3D1X_(RESOURCE_rendertarget)].num_bytes); - - if (!gdraw->texturecache || !gdraw->vbufcache || - !alloc_dynbuffer( - gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { - free_gdraw(); - return NULL; - } - - create_all_shaders_and_state(); - - gdraw_funcs.SetViewSizeAndWorldScale = gdraw_SetViewSizeAndWorldScale; - gdraw_funcs.GetInfo = gdraw_GetInfo; - - gdraw_funcs.DescribeTexture = gdraw_DescribeTexture; - gdraw_funcs.DescribeVertexBuffer = gdraw_DescribeVertexBuffer; - - gdraw_funcs.RenderingBegin = gdraw_RenderingBegin; - gdraw_funcs.RenderingEnd = gdraw_RenderingEnd; - gdraw_funcs.RenderTileBegin = gdraw_RenderTileBegin; - gdraw_funcs.RenderTileEnd = gdraw_RenderTileEnd; - - gdraw_funcs.TextureDrawBufferBegin = gdraw_TextureDrawBufferBegin; - gdraw_funcs.TextureDrawBufferEnd = gdraw_TextureDrawBufferEnd; - - gdraw_funcs.DrawIndexedTriangles = gdraw_DrawIndexedTriangles; - gdraw_funcs.FilterQuad = gdraw_FilterQuad; - - gdraw_funcs.SetAntialiasTexture = gdraw_SetAntialiasTexture; - - gdraw_funcs.ClearStencilBits = gdraw_ClearStencilBits; - gdraw_funcs.ClearID = gdraw_ClearID; - - gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; - gdraw_funcs.MakeTextureMore = gdraw_MakeTextureMore; - gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; - - gdraw_funcs.UpdateTextureBegin = gdraw_UpdateTextureBegin; - gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; - gdraw_funcs.UpdateTextureEnd = gdraw_UpdateTextureEnd; - - gdraw_funcs.FreeTexture = gdraw_FreeTexture; - gdraw_funcs.TryToLockTexture = gdraw_TryToLockTexture; - - gdraw_funcs.MakeTextureFromResource = - (gdraw_make_texture_from_resource*)gdraw_D3D1X_( - MakeTextureFromResource); - gdraw_funcs.FreeTextureFromResource = - gdraw_D3D1X_(DestroyTextureFromResource); - - gdraw_funcs.MakeVertexBufferBegin = gdraw_MakeVertexBufferBegin; - gdraw_funcs.MakeVertexBufferMore = gdraw_MakeVertexBufferMore; - gdraw_funcs.MakeVertexBufferEnd = gdraw_MakeVertexBufferEnd; - gdraw_funcs.TryToLockVertexBuffer = gdraw_TryLockVertexBuffer; - gdraw_funcs.FreeVertexBuffer = gdraw_FreeVertexBuffer; - - gdraw_funcs.UnlockHandles = gdraw_UnlockHandles; - gdraw_funcs.SetTextureUniqueID = gdraw_SetTextureUniqueID; - - gdraw_funcs.Set3DTransform = gdraw_Set3DTransform; - - return &gdraw_funcs; -} - -void gdraw_D3D1X_(DestroyContext)(void) { - if (gdraw && gdraw->d3d_device) { - GDrawStats stats = {0}; - clear_renderstate(); - stencil_state_cache_clear(); - destroy_all_shaders_and_state(); - safe_release(gdraw->aa_tex); - safe_release(gdraw->aa_tex_view); - safe_release(gdraw->dyn_vb.buffer); - safe_release(gdraw->dyn_ib.buffer); - - flush_rendertargets(&stats); - if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); - if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - - gdraw->d3d_device = NULL; - } - - free_gdraw(); -} - -void gdraw_D3D1X_(SetErrorHandler)(void(__cdecl* error_handler)(HRESULT hr)) { - if (gdraw) gdraw->error_handler = error_handler; -} - -void gdraw_D3D1X_(PreReset)(void) { - if (!gdraw) return; - - GDrawStats stats = {0}; - flush_rendertargets(&stats); - - // we may end up resizing the frame buffer - gdraw->frametex_width = 0; - gdraw->frametex_height = 0; -} - -void gdraw_D3D1X_(PostReset)(void) { - // maybe re-create rendertargets right now? -} - -void RADLINK gdraw_D3D1X_(BeginCustomDraw)(IggyCustomDrawCallbackRegion* region, - F32 mat[4][4]) { - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(mat[0], region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK gdraw_D3D1X_(BeginCustomDraw_4J)( - IggyCustomDrawCallbackRegion* region, F32 mat[16]) { - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(mat, region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK gdraw_D3D1X_(CalculateCustomDraw_4J)( - IggyCustomDrawCallbackRegion* region, F32 mat[16]) { - gdraw_GetObjectSpaceMatrix(mat, region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK -gdraw_D3D1X_(EndCustomDraw)(IggyCustomDrawCallbackRegion* /*region*/) { - GDrawStats stats = {}; - set_common_renderstate(); - set_viewport(); - set_render_target(&stats); -} - -void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, - S32* handles_used, - S32* bytes_used) { - GDrawHandleCache* cache; - - switch (type) { - case GDRAW_D3D1X_(RESOURCE_rendertarget): - cache = &gdraw->rendertargets; - break; - case GDRAW_D3D1X_(RESOURCE_texture): - cache = gdraw->texturecache; - break; - case GDRAW_D3D1X_(RESOURCE_vertexbuffer): - cache = gdraw->vbufcache; - break; - case GDRAW_D3D1X_(RESOURCE_dynbuffer): - *handles_used = 0; - *bytes_used = gdraw->last_dyn_maxalloc; - return; - default: - cache = NULL; - break; - } - - *handles_used = *bytes_used = 0; - - if (cache) { - S32 i; - U64 frame = gdraw->frame_counter; - - for (i = 0; i < cache->max_handles; ++i) - if (cache->handle[i].bytes && cache->handle[i].owner && - cache->handle[i].fence.value == frame) { - *handles_used += 1; - *bytes_used += cache->handle[i].bytes; - } - } -} - -static S32 num_pixels(S32 w, S32 h, S32 mipmaps) { - S32 k, pixels = 0; - for (k = 0; k < mipmaps; ++k) { - pixels += w * h * 2; - w = (w >> 1); - w += !w; - h = (h >> 1); - h += !h; - } - return pixels; -} - -GDrawTexture* RADLINK gdraw_D3D1X_(MakeTextureFromResource)( - U8* resource_file, S32 /*len*/, IggyFileTextureRaw* texture) { - char* failed_call = ""; - U8* free_data = 0; - GDrawTexture* t = 0; - S32 width, height, mipmaps, size, blk; - ID3D1X(Texture2D)* tex = 0; - ID3D1X(ShaderResourceView)* view = 0; - - DXGI_FORMAT d3dfmt; - D3D1X_(SUBRESOURCE_DATA) mipdata[24] = {0}; - S32 k; - - HRESULT hr = 0; - - width = texture->w; - height = texture->h; - mipmaps = texture->mipmaps; - blk = 1; - - D3D1X_(TEXTURE2D_DESC) - desc = {width, - height, - mipmaps, - 1, - DXGI_FORMAT_UNKNOWN, - {1, 0}, - D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - - switch (texture->format) { - case IFT_FORMAT_rgba_8888: - size = 4; - d3dfmt = DXGI_FORMAT_R8G8B8A8_UNORM; - break; - case IFT_FORMAT_DXT1: - size = 8; - d3dfmt = DXGI_FORMAT_BC1_UNORM; - blk = 4; - break; - case IFT_FORMAT_DXT3: - size = 16; - d3dfmt = DXGI_FORMAT_BC2_UNORM; - blk = 4; - break; - case IFT_FORMAT_DXT5: - size = 16; - d3dfmt = DXGI_FORMAT_BC3_UNORM; - blk = 4; - break; - default: { - IggyGDrawSendWarning(NULL, - "GDraw .iggytex raw texture format %d not " - "supported by hardware", - texture->format); - goto done; - } - } - - desc.Format = d3dfmt; - - U8* data = resource_file + texture->file_offset; - - if (texture->format == IFT_FORMAT_i_8 || - texture->format == IFT_FORMAT_i_4) { - // convert from intensity to luma+alpha - S32 i; - S32 total_size = 2 * num_pixels(width, height, mipmaps); - - free_data = (U8*)IggyGDrawMalloc(total_size); - if (!free_data) { - IggyGDrawSendWarning(NULL, - "GDraw out of memory to store texture data to " - "pass to D3D for %d x %d texture", - width, height); - goto done; - } - - U8* cur = free_data; - - for (k = 0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - for (i = 0; i < w * h; ++i) { - cur[0] = cur[1] = *data++; - cur += 2; - } - } - data = free_data; - } - - for (k = 0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - S32 blkw = (w + blk - 1) / blk; - S32 blkh = (h + blk - 1) / blk; - - mipdata[k].pSysMem = data; - mipdata[k].SysMemPitch = blkw * size; - data += blkw * blkh * size; - } - - failed_call = "CreateTexture2D"; - hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex); - if (FAILED(hr)) goto done; - - failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); - if (FAILED(hr)) goto done; - - t = gdraw_D3D1X_(WrappedTextureCreate)(view); - -done: - if (FAILED(hr)) { - report_d3d_error(hr, failed_call, ""); - } - - if (free_data) IggyGDrawFree(free_data); - - if (!t) { - if (view) view->Release(); - if (tex) tex->Release(); - } else { - ((GDrawHandle*)t)->handle.tex.d3d = tex; - } - return t; -} - -void RADLINK gdraw_D3D1X_(DestroyTextureFromResource)(GDrawTexture* tex) { - GDrawHandle* h = (GDrawHandle*)tex; - safe_release(h->handle.tex.d3d_view); - safe_release(h->handle.tex.d3d); - gdraw_D3D1X_(WrappedTextureDestroy)(tex); -} diff --git a/targets/app/windows/Iggy/include/gdraw.h b/targets/app/windows/Iggy/include/gdraw.h deleted file mode 100644 index d1c58dfe8..000000000 --- a/targets/app/windows/Iggy/include/gdraw.h +++ /dev/null @@ -1,841 +0,0 @@ -// gdraw.h - author: Sean Barrett - copyright 2009 RAD Game Tools -// -// This is the graphics rendering abstraction that Iggy is implemented -// on top of. - -#ifndef __RAD_INCLUDE_GDRAW_H__ -#define __RAD_INCLUDE_GDRAW_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -// idoc(parent,GDrawAPI_Buffers) - -#ifndef IGGY_GDRAW_SHARED_TYPEDEF - -#define IGGY_GDRAW_SHARED_TYPEDEF -typedef struct GDrawFunctions GDrawFunctions; - -typedef struct GDrawTexture GDrawTexture; - -#endif // IGGY_GDRAW_SHARED_TYPEDEF - -IDOC typedef struct GDrawVertexBuffer GDrawVertexBuffer; -/* An opaque handle to an internal GDraw vertex buffer. */ - -// idoc(parent,GDrawAPI_Base) - -IDOC typedef struct gswf_recti { - S32 x0, y0; // Minimum corner of the rectangle - S32 x1, y1; // Maximum corner of the rectangle -} gswf_recti; -/* A 2D rectangle with integer coordinates specifying its minimum and maximum - * corners. */ - -IDOC typedef struct gswf_rectf { - F32 x0, y0; // Minimum corner of the rectangle - F32 x1, y1; // Maximum corner of the rectangle -} gswf_rectf; -/* A 2D rectangle with floating-point coordinates specifying its minimum and - * maximum corners. */ - -IDOC typedef struct gswf_matrix { - union { - F32 m[2][2]; // 2x2 transform matrix - struct { - F32 m00; // Alternate name for m[0][0], for coding convenience - F32 m01; // Alternate name for m[0][1], for coding convenience - F32 m10; // Alternate name for m[1][0], for coding convenience - F32 m11; // Alternate name for m[1][1], for coding convenience - }; - }; - F32 trans[2]; // 2D translation vector (the affine component of the matrix) -} gswf_matrix; -/* A 2D transform matrix plus a translation offset. */ - -#define GDRAW_STATS_batches 1 -#define GDRAW_STATS_blits 2 -#define GDRAW_STATS_alloc_tex 4 -#define GDRAW_STATS_frees 8 -#define GDRAW_STATS_defrag 16 -#define GDRAW_STATS_rendtarg 32 -#define GDRAW_STATS_clears 64 -IDOC typedef struct GDrawStats { - S16 nonzero_flags; // which of the fields below are non-zero - - U16 num_batches; // number of batches, e.g. DrawPrim, DrawPrimUP - U16 num_blits; // number of blit operations (resolve, msaa resolve, blend - // readback) - U16 freed_objects; // number of cached objects freed - U16 defrag_objects; // number of cached objects defragmented - U16 alloc_tex; // number of textures/buffers allocated - U16 rendertarget_changes; // number of rendertarget changes - U16 num_clears; - // 0 mod 8 - - U32 drawn_indices; // number of indices drawn (3 times number of triangles) - U32 drawn_vertices; // number of unique vertices referenced - U32 num_blit_pixels; // number of pixels in blit operations - U32 alloc_tex_bytes; // number of bytes in textures/buffers allocated - U32 freed_bytes; // number of bytes in freed cached objects - U32 defrag_bytes; // number of bytes in defragmented cached objects - U32 cleared_pixels; // number of pixels cleared by clear operation - U32 reserved; - // 0 mod 8 -} GDrawStats; -/* A structure with statistics information to show in resource browser/Telemetry - */ - -//////////////////////////////////////////////////////////// -// -// Queries -// -// idoc(parent,GDrawAPI_Queries) - -IDOC typedef enum gdraw_bformat { - GDRAW_BFORMAT_vbib, // Platform uses vertex and index buffers - GDRAW_BFORMAT_wii_dlist, // Platform uses Wii-style display lists - GDRAW_BFORMAT_vbib_single_format, // Platform uses vertex and index - // buffers, but doesn't support multiple - // vertex formats in a single VB - - GDRAW_BFORMAT__count, -} gdraw_bformat; -/* Specifies what data format GDraw expects in MakeVertexBuffer_* and - DrawIndexedTriangles. - - Most supported platforms prefer Vertex and Index buffers so that's what we - use, but this format turns out to be somewhat awkward for Wii, so we use the - native graphics processor display list format on that platform. */ - -IDOC typedef struct GDrawInfo { - S32 num_stencil_bits; // number of (possibly emulated) stencil buffer bits - U32 max_id; // number of unique values that can be easily encoded in - // zbuffer - U32 max_texture_size; // edge length of largest square texture supported by - // hardware - U32 buffer_format; // one of $gdraw_bformat - rrbool shared_depth_stencil; // does 0'th framebuffer share depth & stencil - // with others? (on GL it can't?) - rrbool always_mipmap; // if GDraw can generate mipmaps nearly for free, - // then set this flag - rrbool conditional_nonpow2; // non-pow2 textures supported, but only using - // clamp and without mipmaps - rrbool has_rendertargets; // if true, then there is no rendertarget stack - // support - rrbool no_nonpow2; // non-pow2 textures aren't supported at all -} GDrawInfo; // must be a multiple of 8 -/* $GDrawInfo contains the information that Iggy needs to know about - what a GDraw implementation supports and what limits it places on - certain important values. */ - -IDOC typedef void RADLINK gdraw_get_info(GDrawInfo* d); -/* Iggy queries this at the beginning of rendering to get information - about the viewport and the device capabilities. */ - -//////////////////////////////////////////////////////////// -// -// Drawing State -// -// idoc(parent,GDrawAPI_DrawingState) - -IDOC typedef enum gdraw_blend { - GDRAW_BLEND_none, // Directly copy - GDRAW_BLEND_alpha, // Use the source alpha channel to modulate its - // contribution - GDRAW_BLEND_multiply, // Multiply colors componentwise - GDRAW_BLEND_add, // Add the source and destination together - - GDRAW_BLEND_filter, // Uses a secondary $gdraw_filter specification to - // determine how to blend - GDRAW_BLEND_special, // Uses a secondary $gdraw_blendspecial specification - // to determine how to blend - - GDRAW_BLEND__count, -} gdraw_blend; -/* Identifier indicating the type of blending operation to use when rendering.*/ - -IDOC typedef enum gdraw_blendspecial { - GDRAW_BLENDSPECIAL_layer, // s - GDRAW_BLENDSPECIAL_multiply, // s*d - GDRAW_BLENDSPECIAL_screen, // sa*da - (da-d)*(sa-s) - GDRAW_BLENDSPECIAL_lighten, // max(sa*d,s*da) - GDRAW_BLENDSPECIAL_darken, // min(sa*d,s*da) - GDRAW_BLENDSPECIAL_add, // min(d+s,1.0) - GDRAW_BLENDSPECIAL_subtract, // max(d-s,0.0) - GDRAW_BLENDSPECIAL_difference, // abs(sa*d-s*da) - GDRAW_BLENDSPECIAL_invert, // sa*(da-d) - GDRAW_BLENDSPECIAL_overlay, // d < da/2.0 ? (2.0*s*d) : (sa*da - // - 2.0*(da-d)*(sa-s)) - GDRAW_BLENDSPECIAL_hardlight, // s < sa/2.0 ? (2.0*s*d) : (sa*da - // - 2.0*(da-d)*(sa-s)) - - // these do extra-special math on the output alpha - GDRAW_BLENDSPECIAL_erase, // d*(1.0-sa) - GDRAW_BLENDSPECIAL_alpha_special, // d*sa - - GDRAW_BLENDSPECIAL__count, -} gdraw_blendspecial; -/* Specifies a type of "special" blend mode, which is defined as one - that has to read from the framebuffer to compute its effect. - - These modes are only used with a 1-to-1 textured quad containing - the exact output data in premultiplied alpha. They all need to - read from the framebuffer to compute their effect, so a GDraw - implementation will usually need a custom path to handle that. - Users will not warn in advance whether you're going to need this - operation, so implementations either need to always render to a - texture in case it happens, or copy the framebuffer to a texture - when it does. - - Note that $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_erase) and - $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_alpha_special) are unique - among $gdraw_blendspecial modes in that they may not actually need - to be implemented with the destination input as a texture if - the destination buffer doesn't have an alpha channel. */ - -// (@OPTIMIZE: the last filter in each chain could be combined with -// the final blend, although only worth doing if the final blend is -// ALPHA/ADD/MULTIPLY--it's usually ALPHA though so worth doing!) -IDOC typedef enum gdraw_filter { - GDRAW_FILTER_blur, // Blurs the source image - GDRAW_FILTER_colormatrix, // Transform RGB pixel values by a matrix - GDRAW_FILTER_bevel, // Bevels the source image - GDRAW_FILTER_dropshadow, // Adds a dropshadow underneath the source image - - GDRAW_FILTER__count, -} gdraw_filter; -/* Specifies a type of post-processing graphics filter. - - These modes are only used to implement filter effects, and will - always be blending from a temporary buffer to another temporary - buffer with no blending, so in general they should not require - any additional input. -*/ - -IDOC typedef enum gdraw_texture { - GDRAW_TEXTURE_none, // No texture applied - GDRAW_TEXTURE_normal, // Texture is bitmap or linear gradient - GDRAW_TEXTURE_alpha, // Texture is an alpha-only font bitmap - GDRAW_TEXTURE_radial, // Texture is a radial gradient - GDRAW_TEXTURE_focal_gradient, // Texture is a "focal" radial gradient - GDRAW_TEXTURE_alpha_test, // Texture is an alpha-only font bitmap, alpha - // test for alpha >= 0.5 - - GDRAW_TEXTURE__count, -} gdraw_texture; -/* Specifies how to apply a texture while rendering. */ - -IDOC typedef enum gdraw_wrap { - GDRAW_WRAP_clamp, // Texture coordinates clamped to edges - GDRAW_WRAP_repeat, // Texture repeats periodically - GDRAW_WRAP_mirror, // Repeat periodically, mirror on odd repetititions - GDRAW_WRAP_clamp_to_border, // only used internally by some GDraws - - GDRAW_WRAP__count, -} gdraw_wrap; -/* Specifies what to do with texture coordinates outside [0,1]. */ - -typedef struct GDrawRenderState { - S32 id; // Object "identifier" used for high-quality AA mode - U32 test_id : 1; // Whether to test zbuffer == id - U32 set_id : 1; // Whether to set zbuffer == id - U32 use_world_space - : 1; // Whether primitive is defined in object space or world space - U32 scissor : 1; // Whether rendering will be clipped to - // $(GDrawRenderState::scissor_rect) - U32 identical_state : 1; // Whether state is identical to the one used for - // the previous draw call - U32 unused : 27; - // aligned 0 mod 8 - - U8 texgen0_enabled; // Whether to use texgen for tex0 - U8 tex0_mode; // One of $gdraw_texture - U8 wrap0; // One of $gdraw_wrap - U8 nearest0; // Whether to sample texture 0 nearest neighbor - - U8 blend_mode; // One of $gdraw_blend - U8 special_blend; // One of $gdraw_blendspecial (used only if - // $(GDrawRenderState::blend_mode) == - // $(gdraw_blend::GDRAW_BLEND_special) - U8 filter; // One of $gdraw_filter (used only if - // $(GDrawRenderState::blend_mode) == - // $(gdraw_blend::GDRAW_BLEND_filter) - U8 filter_mode; // Used to select the right compositing operation for the - // $(gdraw_filter::GDRAW_FILTER_bevel) and - // $(gdraw_filter::GDRAW_FILTER_dropshadow) modes - // aligned 0 mod 8 - U8 stencil_test; // Only draw if these stencil bits are "set" - U8 stencil_set; // "Set" these stencil bits (note that actual - // implementation initializes stencil to 1, and "set" makes - // them 0) - - U8 reserved[2]; // Currently unused (used to make padding to 4/8-byte - // boundary for following pointer explicit) - S32 blur_passes; // For filters that include blurring, this is the number - // of box filter passes to run - // align 0 mod 8 - - S16* cxf_add; // Color transform addition (discourage additive alpha!) - - GDrawTexture* tex[3]; // One or more textures to apply -- need 3 for - // gradient dropshadow. - // 0 mod 8 - F32* edge_matrix; // Screen to object space matrix (for edge antialiasing) - gswf_matrix* o2w; // Object-to-world matrix - - // --- Everything below this point must be manually initialized - - // 0 mod 8 - F32 color[4]; // Color of the object - - // 0 mod 8 - gswf_recti scissor_rect; // The rectangle to which rendering will be - // clipped if $(GDrawRenderState::scissor) is set - // 0 mod 8 - // --- Everything below this point might be uninitialized if it's not used - // for this particular render state - - F32 s0_texgen[4]; // "s" (x) row of texgen matrix - F32 t0_texgen[4]; // "t" (y) row of texgen matrix - // 0 mod 8 - F32 focal_point[4]; // Data used for - // $(gdraw_texgen_mode::GDRAW_TEXTURE_focal_gradient) - // 0 mod 8 - F32 blur_x, blur_y; // The size of the box filter, where '1' is the - // identity and 2 adds half a pixel on each side - // 0 mod 8 - F32 shader_data[20]; // Various data that depends on filter (e.g. drop - // shadow direction, color) -} GDrawRenderState; -/* Encapsulation of the entire drawing state that affects a rendering command. - */ - -IDOC typedef void RADLINK gdraw_set_view_size_and_world_scale( - S32 w, S32 h, F32 x_world_to_pixel, F32 y_world_to_pixel); -/* Sets the size of the rendering viewport and the world to pixel scaling. - - Iggy calls this function with the full size that the viewport would - be if it were rendered untiled, even if it will eventually be - rendered as a collection of smaller tiles. - - The world scale is used to compensate non-square pixel aspect ratios - when rendering wide lines. Both scale factors are 1 unless Iggy is - running on a display with non-square pixels. */ - -typedef void RADLINK gdraw_set_3d_transform(F32* mat); /* mat[3][4] */ - -IDOC typedef void RADLINK gdraw_render_tile_begin(S32 tx0, S32 ty0, S32 tx1, - S32 ty1, S32 pad, - GDrawStats* stats); -/* Begins rendering of a sub-region of the rendered image. */ - -IDOC typedef void RADLINK gdraw_render_tile_end(GDrawStats* stats); -/* Ends rendering of a sub-region of the rendered image. */ - -IDOC typedef void RADLINK gdraw_rendering_begin(void); -/* Begins rendering; takes control of the graphics API. */ - -IDOC typedef void RADLINK gdraw_rendering_end(void); -/* Ends rendering; gives up control of the graphics API. */ - -//////////////////////////////////////////////////////////// -// -// Drawing -// -// idoc(parent,GDrawAPI_Drawing) - -IDOC typedef void RADLINK gdraw_clear_stencil_bits(U32 bits); -/* Clears the 'bits' parts of the stencil value in the entire framebuffer to the - * default value. */ - -IDOC typedef void RADLINK gdraw_clear_id(void); -/* Clears the 'id' buffer, which is typically the z-buffer but can also be the - * stencil buffer. */ - -IDOC typedef void RADLINK gdraw_filter_quad(GDrawRenderState* r, S32 x0, S32 y0, - S32 x1, S32 y1, GDrawStats* stats); -/* Draws a special quad in viewport-relative pixel space. - - May be normal, may be displaced by filters, etc. and require multiple passes, - may apply special blending (and require extra resolves/rendertargets) - for filter/blend., - - The x0,y0,x1,y1 always describes the "input" box. */ - -IDOC typedef struct GDrawPrimitive { - F32* vertices; // Pointer to an array of $gswf_vertex_xy, - // $gswf_vertex_xyst, or $gswf_vertex_xyoffs - U16* indices; // Pointer to an array of 16-bit indices into - // $(GDrawPrimitive::vertices) - - S32 num_vertices; // Count of elements in $(GDrawPrimitive::vertices) - S32 num_indices; // Count of elements in $(GDrawPrimitive::indices) - - S32 vertex_format; // One of $gdraw_vformat, specifying the type of element - // in $(GDrawPrimitive::vertices) - - U32 uniform_count; - F32* uniforms; - - U8 drawprim_mode; -} GDrawPrimitive; -/* Specifies the vertex and index data necessary to draw a batch of graphics - * primitives. */ - -IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState* r, - GDrawPrimitive* prim, - GDrawVertexBuffer* buf, - GDrawStats* stats); -/* Draws a collection of indexed triangles, ignoring special filters or blend - modes. - - If buf is NULL, then the pointers in 'prim' are machine pointers, and - you need to make a copy of the data (note currently all triangles - implementing strokes (wide lines) go this path). - - If buf is non-NULL, then use the appropriate vertex buffer, and the - pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; - (note there are separate spaces for vertices and indices; e.g. the - first mesh in a given vertex buffer will normally have a 0 offset - for the vertices and a 0 offset for the indices) -*/ - -IDOC typedef void RADLINK gdraw_set_antialias_texture(S32 width, U8* rgba); -/* Specifies the 1D texture data to be used for the antialiasing gradients. - - 'rgba' specifies the pixel values in rgba byte order. This will only be - called once during initialization. */ - -//////////////////////////////////////////////////////////// -// -// Texture and Vertex Buffers -// -// idoc(parent,GDrawAPI_Buffers) - -IDOC typedef enum gdraw_texture_format { - // Platform-independent formats - GDRAW_TEXTURE_FORMAT_rgba32, // 32bpp RGBA data in platform-preferred byte - // order (returned by - // $gdraw_make_texture_begin as - // $gdraw_texture_type) - GDRAW_TEXTURE_FORMAT_font, // Alpha-only data with at least 4 bits/pixel. - // Data is submitted as 8 bits/pixel, conversion - // (if necessary) done by GDraw. - - // First platform-specific format index (for reference) - GDRAW_TEXTURE_FORMAT__platform = 16, - - // In the future, we will support platform-specific formats and add them to - // this list. -} gdraw_texture_format; -/* Describes the format of a texture submitted to GDraw. */ - -IDOC typedef enum gdraw_texture_type { - GDRAW_TEXTURE_TYPE_rgba, // Raw 4-channel packed texels, in OpenGL-standard - // order - GDRAW_TEXTURE_TYPE_bgra, // Raw 4-channel packed texels, in - // Direct3D-standard order - GDRAW_TEXTURE_TYPE_argb, // Raw 4-channel packed texels, in Flash native - // order - - GDRAW_TEXTURE_TYPE__count, -} gdraw_texture_type; -/* Describes the channel layout of a RGBA texture submitted to GDraw. */ - -IDOC typedef struct GDraw_MakeTexture_ProcessingInfo { - U8* texture_data; // Pointer to the texture image bits - S32 num_rows; // Number of rows to upload in the current chunk - S32 stride_in_bytes; // Distance between a given pixel and the first pixel - // in the next row - S32 texture_type; // One of $gdraw_texture_type - - U32 temp_buffer_bytes; // Size of temp buffer in bytes - U8* temp_buffer; // Temp buffer for GDraw to work in (used during mipmap - // creation) - - void *p0, *p1, *p2, *p3, *p4, *p5, *p6, - *p7; // Pointers for GDraw to store data across "passes" (never touched - // by Iggy) - U32 i0, i1, i2, i3, i4, i5, i6, - i7; // Integers for GDraw to store data across "passes" (never touched - // by Iggy) -} GDraw_MakeTexture_ProcessingInfo; -/* $GDraw_MakeTexture_ProcessingInfo is used when building a texture. */ - -IDOC typedef struct GDraw_Texture_Description { - S32 width; // Width of the texture in pixels - S32 height; // Height of the texture in pixels - U32 size_in_bytes; // Size of the texture in bytes -} GDraw_Texture_Description; -/* $GDraw_Texture_Description contains information about a texture. */ - -IDOC typedef U32 gdraw_maketexture_flags; -#define GDRAW_MAKETEXTURE_FLAGS_mipmap \ - 1 IDOC // Generates mip-maps for the texture -#define GDRAW_MAKETEXTURE_FLAGS_updatable \ - 2 IDOC // Set if the texture might be updated subsequent to its initial - // submission -#define GDRAW_MAKETEXTURE_FLAGS_never_flush \ - 4 IDOC // Set to request that the texture never be flushed from the GDraw - // cache - -/* Flags that control the submission and management of GDraw textures. */ - -IDOC typedef void RADLINK gdraw_set_texture_unique_id(GDrawTexture* tex, - void* old_unique_id, - void* new_unique_id); -/* Changes unique id of a texture, only used for TextureSubstitution */ - -IDOC typedef rrbool RADLINK gdraw_make_texture_begin( - void* unique_id, S32 width, S32 height, gdraw_texture_format format, - gdraw_maketexture_flags flags, - GDraw_MakeTexture_ProcessingInfo* output_info, GDrawStats* stats); -/* Begins specifying a new texture. - - $:unique_id Unique value specified by Iggy that you can use to identify a - reference to the same texture even if its handle has been discarded - $:return Error code if there was a problem, IGGY_RESULT_OK otherwise -*/ - -IDOC typedef rrbool RADLINK -gdraw_make_texture_more(GDraw_MakeTexture_ProcessingInfo* info); -/* Continues specifying a new texture. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return True if specification can continue, false if specification must be - aborted -*/ - -IDOC typedef GDrawTexture* RADLINK gdraw_make_texture_end( - GDraw_MakeTexture_ProcessingInfo* info, GDrawStats* stats); -/* Ends specification of a new texture. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured -*/ - -IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Begins updating a previously submitted texture. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin - $:return True on success, false otherwise and the texture must be recreated -*/ - -IDOC typedef void RADLINK gdraw_update_texture_rect( - GDrawTexture* tex, void* unique_id, S32 x, S32 y, S32 stride, S32 w, S32 h, - U8* data, gdraw_texture_format format); -/* Updates a rectangle in a previously submitted texture. - - $:format Must be the $gdraw_texture_format that was originally passed to - $gdraw_make_texture_begin for this texture. -*/ - -IDOC typedef void RADLINK gdraw_update_texture_end(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Ends an update to a previously submitted texture. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin (and hence $gdraw_update_texture_begin) -*/ - -IDOC typedef void RADLINK -gdraw_describe_texture(GDrawTexture* tex, GDraw_Texture_Description* desc); -/* Returns a texture description for a given GDraw texture. */ - -IDOC typedef GDrawTexture* RADLINK gdraw_make_texture_from_resource( - U8* resource_file, S32 file_len, void* texture); -/* Loads a texture from a resource file and returns a wrapped pointer. */ - -IDOC typedef void RADLINK gdraw_free_texture_from_resource(GDrawTexture* tex); -/* Frees a texture created with gdraw_make_texture_from_resource. */ - -IDOC typedef struct gswf_vertex_xy { - F32 x, y; // Position of the vertex -} gswf_vertex_xy; -/* A 2D point with floating-point position. */ - -IDOC typedef struct gswf_vertex_xyoffs { - F32 x, y; // Position of the vertex - - S16 aa; // Stroke/aa texcoord - S16 dx, dy; // Vector offset from the position, used for anti-aliasing - // (signed 11.5 fixed point) - S16 unused; -} gswf_vertex_xyoffs; -/* A 2D point with floating-point position, additional integer parameter, and - * integer anti-aliasing offset vector. */ - -IDOC typedef struct gswf_vertex_xyst { - F32 x, y; // Position of the vertex - F32 s, t; // Explicit texture coordinates for rectangles -} gswf_vertex_xyst; -/* A 2D point with floating-point position and texture coordinates. */ - -typedef int gdraw_verify_size_xy[sizeof(gswf_vertex_xy) == 8 ? 1 : -1]; -typedef int gdraw_verify_size_xyoffs[sizeof(gswf_vertex_xyoffs) == 16 ? 1 : -1]; -typedef int gdraw_verify_size_xyst[sizeof(gswf_vertex_xyst) == 16 ? 1 : -1]; - -IDOC typedef enum gdraw_vformat { - GDRAW_vformat_v2, // Indicates vertices of type $gswf_vertex_xy (8 bytes - // per vertex) - GDRAW_vformat_v2aa, // Indicates vertices of type $gswf_vertex_xyoffs (16 - // bytes per vertex) - GDRAW_vformat_v2tc2, // Indicates vertices of type $gswf_vertex_xyst (16 - // bytes per vertex) - - GDRAW_vformat__basic_count, - GDRAW_vformat_ihud1 = - GDRAW_vformat__basic_count, // primary format for ihud, currently - // v2tc2mat4 (20 bytes per vertex) - - GDRAW_vformat__count, - GDRAW_vformat_mixed, // Special value that denotes a VB containing data in - // multiple vertex formats. Never used when drawing! -} gdraw_vformat; -/* Identifies one of the vertex data types. */ - -IDOC typedef struct GDraw_MakeVertexBuffer_ProcessingInfo { - U8* vertex_data; // location to write vertex data - U8* index_data; // location to write index data - - S32 vertex_data_length; // size of buffer to write vertex data - S32 index_data_length; // size of buffer to write index data - - void *p0, *p1, *p2, *p3, *p4, *p5, *p6, - *p7; // Pointers for GDraw to store data across "passes" (never touched - // by Iggy) - U32 i0, i1, i2, i3, i4, i5, i6, - i7; // Integers for GDraw to store data across "passes" (never touched - // by Iggy) -} GDraw_MakeVertexBuffer_ProcessingInfo; -/* $GDraw_MakeVertexBuffer_ProcessingInfo is used when building a vertex buffer. - */ - -IDOC typedef struct GDraw_VertexBuffer_Description { - S32 size_in_bytes; // Size of the vertex buffer in bytes -} GDraw_VertexBuffer_Description; -/* $GDraw_VertexBuffer_Description contains information about a vertex buffer. - */ - -IDOC typedef rrbool RADLINK gdraw_make_vertex_buffer_begin( - void* unique_id, gdraw_vformat vformat, S32 vdata_len_in_bytes, - S32 idata_len_in_bytes, GDraw_MakeVertexBuffer_ProcessingInfo* info, - GDrawStats* stats); -/* Begins specifying a new vertex buffer. - - $:unique_id Unique value that identifies this texture, across potentially - multiple flushes and re-creations of its $GDrawTexture handle in GDraw - $:vformat One of $gdraw_vformat, denoting the format of the vertex data - submitted - $:return false if there was a problem, true if ok -*/ - -IDOC typedef rrbool RADLINK -gdraw_make_vertex_buffer_more(GDraw_MakeVertexBuffer_ProcessingInfo* info); -/* Continues specifying a new vertex buffer. - - $:info The same handle initially passed to $gdraw_make_vertex_buffer_begin - $:return True if specification can continue, false if specification must be - aborted -*/ - -IDOC typedef GDrawVertexBuffer* RADLINK gdraw_make_vertex_buffer_end( - GDraw_MakeVertexBuffer_ProcessingInfo* info, GDrawStats* stats); -/* Ends specification of a new vertex buffer. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created vertex buffer -*/ - -IDOC typedef void RADLINK gdraw_describe_vertex_buffer( - GDrawVertexBuffer* buffer, GDraw_VertexBuffer_Description* desc); -/* Returns a description for a given GDrawVertexBuffer */ - -IDOC typedef rrbool RADLINK gdraw_try_to_lock_texture(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Tells GDraw that a $GDrawTexture is going to be referenced. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin -*/ - -IDOC typedef rrbool RADLINK gdraw_try_to_lock_vertex_buffer( - GDrawVertexBuffer* vb, void* unique_id, GDrawStats* stats); -/* Tells GDraw that a $GDrawVertexBuffer is going to be referenced. - - $:unique_id Must be the same value initially passed to - $gdraw_make_vertex_buffer_begin -*/ - -IDOC typedef void RADLINK gdraw_unlock_handles(GDrawStats* stats); -/* Indicates that the user of GDraw will not try to reference anything without - locking it again. - - Note that although a call to $gdraw_unlock_handles indicates that - all $GDrawTexture and $GDrawVertexBuffer handles that have had a - "unique_id" specified will no longer be referenced by the user of - GDraw, it does not affect those $GDrawTexture handles that were - created by $gdraw_start_texture_draw_buffer with a unique_id of 0. -*/ - -IDOC typedef void RADLINK gdraw_free_vertex_buffer(GDrawVertexBuffer* vb, - void* unique_id, - GDrawStats* stats); -/* Free a vertex buffer and invalidate the handle - - $:unique_id Must be the same value initially passed to - $gdraw_make_vertex_buffer_begin -*/ - -IDOC typedef void RADLINK gdraw_free_texture(GDrawTexture* t, void* unique_id, - GDrawStats* stats); -/* Free a texture and invalidate the handle. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin, or 0 for a texture created by - $gdraw_end_texture_draw_buffer -*/ - -//////////////////////////////////////////////////////////// -// -// Render targets -// -// idoc(parent,GDrawAPI_Targets) - -IDOC typedef U32 gdraw_texturedrawbuffer_flags; -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color \ - 1 IDOC // Tells GDraw that you will need the color channel when rendering a - // texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha \ - 2 IDOC // Tells GDraw that you will need the alpha channel when rendering a - // texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil \ - 4 IDOC // Tells GDraw that you will need the stencil channel when rendering - // a texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id \ - 8 IDOC // Tells GDraw that you will need the id channel when rendering a - // texture - -/* Flags that control rendering to a texture. */ - -IDOC typedef rrbool RADLINK gdraw_texture_draw_buffer_begin( - gswf_recti* region, gdraw_texture_format format, - gdraw_texturedrawbuffer_flags flags, void* unique_id, GDrawStats* stats); -/* Starts rendering all GDraw commands to a new texture. - - Creates a rendertarget with destination alpha, initializes to all 0s and - prepares to render into it -*/ - -IDOC typedef GDrawTexture* RADLINK -gdraw_texture_draw_buffer_end(GDrawStats* stats); -/* Ends rendering GDraw commands to a texture, and returns the texture created. - - You can get the size of the resulting texture with $gdraw_query_texture_size. -*/ - -//////////////////////////////////////////////////////////// -// -// Masking -// -// idoc(parent,GDrawAPI_Masking) - -IDOC typedef void RADLINK gdraw_draw_mask_begin(gswf_recti* region, - S32 mask_bit, - GDrawStats* stats); -/* Start a masking operation on the given region for the specified mask bit. - - For most drivers, no special preparation is necessary to start masking, so - this is a no-op. -*/ - -IDOC typedef void RADLINK gdraw_draw_mask_end(gswf_recti* region, S32 mask_bit, - GDrawStats* stats); -/* End a masking operation on the given region for the specified mask bit. - - For most drivers, no special preparation is necessary to end masking, so this - is a no-op. -*/ - -//////////////////////////////////////////////////////////// -// -// GDraw API Function table -// -// idoc(parent,GDrawAPI_Base) - -IDOC struct GDrawFunctions { - // queries - gdraw_get_info* GetInfo; - - // drawing state - gdraw_set_view_size_and_world_scale* SetViewSizeAndWorldScale; - gdraw_render_tile_begin* RenderTileBegin; - gdraw_render_tile_end* RenderTileEnd; - gdraw_set_antialias_texture* SetAntialiasTexture; - - // drawing - gdraw_clear_stencil_bits* ClearStencilBits; - gdraw_clear_id* ClearID; - gdraw_filter_quad* FilterQuad; - gdraw_draw_indexed_triangles* DrawIndexedTriangles; - gdraw_make_texture_begin* MakeTextureBegin; - gdraw_make_texture_more* MakeTextureMore; - gdraw_make_texture_end* MakeTextureEnd; - gdraw_make_vertex_buffer_begin* MakeVertexBufferBegin; - gdraw_make_vertex_buffer_more* MakeVertexBufferMore; - gdraw_make_vertex_buffer_end* MakeVertexBufferEnd; - gdraw_try_to_lock_texture* TryToLockTexture; - gdraw_try_to_lock_vertex_buffer* TryToLockVertexBuffer; - gdraw_unlock_handles* UnlockHandles; - gdraw_free_texture* FreeTexture; - gdraw_free_vertex_buffer* FreeVertexBuffer; - gdraw_update_texture_begin* UpdateTextureBegin; - gdraw_update_texture_rect* UpdateTextureRect; - gdraw_update_texture_end* UpdateTextureEnd; - - // rendertargets - gdraw_texture_draw_buffer_begin* TextureDrawBufferBegin; - gdraw_texture_draw_buffer_end* TextureDrawBufferEnd; - - gdraw_describe_texture* DescribeTexture; - gdraw_describe_vertex_buffer* DescribeVertexBuffer; - - // new functions are always added at the end, so these have no structure - gdraw_set_texture_unique_id* SetTextureUniqueID; - - gdraw_draw_mask_begin* DrawMaskBegin; - gdraw_draw_mask_end* DrawMaskEnd; - - gdraw_rendering_begin* RenderingBegin; - gdraw_rendering_end* RenderingEnd; - - gdraw_make_texture_from_resource* MakeTextureFromResource; - gdraw_free_texture_from_resource* FreeTextureFromResource; - - gdraw_set_3d_transform* Set3DTransform; -}; -/* The function interface called by Iggy to render graphics on all - platforms. - - So that Iggy can integrate with the widest possible variety of - rendering scenarios, all of its renderer-specific drawing calls - go through this table of function pointers. This allows you - to dynamically configure which of RAD's supplied drawing layers - you wish to use, or to integrate it directly into your own - renderer by implementing your own versions of the drawing - functions Iggy requires. -*/ - -RADDEFEND - -#endif diff --git a/targets/app/windows/Iggy/include/iggy.h b/targets/app/windows/Iggy/include/iggy.h deleted file mode 100644 index c1d89e639..000000000 --- a/targets/app/windows/Iggy/include/iggy.h +++ /dev/null @@ -1,1638 +0,0 @@ -// Iggy -- Copyright 2008-2013 RAD Game Tools - -#ifndef __RAD_INCLUDE_IGGY_H__ -#define __RAD_INCLUDE_IGGY_H__ - -#include // size_t - -#define IggyVersion "1.2.30" -#define IggyFlashVersion "9,1,2,30" - -#include "rrCore.h" // base data types, macros - -RADDEFSTART - -#ifndef IGGY_GDRAW_SHARED_TYPEDEF - -#define IGGY_GDRAW_SHARED_TYPEDEF - -typedef struct GDrawFunctions GDrawFunctions; -typedef struct GDrawTexture GDrawTexture; - -#endif // IGGY_GDRAW_SHARED_TYPEDEF - -#define IDOCN // Used by documentation generation system - -//////////////////////////////////////////////////////////// -// -// Basic Operations -// - -typedef enum IggyResult { - IGGY_RESULT_SUCCESS = 0, - - IGGY_RESULT_Warning_None = 0, - - IGGY_RESULT_Warning_Misc = 100, - IGGY_RESULT_Warning_GDraw = 101, - IGGY_RESULT_Warning_ProgramFlow = 102, - IGGY_RESULT_Warning_Actionscript = 103, - IGGY_RESULT_Warning_Graphics = 104, - IGGY_RESULT_Warning_Font = 105, - IGGY_RESULT_Warning_Timeline = 106, - IGGY_RESULT_Warning_Library = 107, - IGGY_RESULT_Warning_ValuePath = 108, - IGGY_RESULT_Warning_Audio = 109, - - IGGY_RESULT_Warning_CannotSustainFrameRate = - 201, // During a call to $IggyPlayerReadyToTick, Iggy detected that its - // rendering of a Flash file was not keeping up with the frame - // rate requested. - IGGY_RESULT_Warning_ThrewException = 202, - - IGGY_RESULT_Error_Threshhold = 400, - - IGGY_RESULT_Error_Misc = 400, // an uncategorized error - IGGY_RESULT_Error_GDraw = 401, // an error occured in GDraw - IGGY_RESULT_Error_ProgramFlow = - 402, // an error occured with the user's program flow through the Iggy - // API (e.g. reentrancy issues) - IGGY_RESULT_Error_Actionscript = - 403, // an error occurred in Actionscript processing - IGGY_RESULT_Error_Graphics = 404, - IGGY_RESULT_Error_Font = 405, - IGGY_RESULT_Error_Create = 406, - IGGY_RESULT_Error_Library = 407, - IGGY_RESULT_Error_ValuePath = - 408, // an error occurred while processing a ValuePath - IGGY_RESULT_Error_Audio = 409, - - IGGY_RESULT_Error_Internal = 499, - - IGGY_RESULT_Error_InvalidIggy = 501, - IGGY_RESULT_Error_InvalidArgument = 502, - IGGY_RESULT_Error_InvalidEntity = 503, - IGGY_RESULT_Error_UndefinedEntity = 504, - - IGGY_RESULT_Error_OutOfMemory = - 1001, // Iggy ran out of memory while processing the SWF. The Iggy - // player is now invalid and you cannot do anything further with - // it (except read AS3 variables). Should this happen, you'll - // want to $IggyPlayerDestroy and reopen the $Iggy. -} IggyResult; - -typedef enum IggyDatatype { - IGGY_DATATYPE__invalid_request, // Set only when there is an error - - IGGY_DATATYPE_undefined, // Undefined data type - IGGY_DATATYPE_null, // No data type - IGGY_DATATYPE_boolean, // Data of type rrbool - - IGGY_DATATYPE_number, // Data of type F64 - IGGY_DATATYPE_string_UTF8, // Data of type $IggyStringUTF8 - IGGY_DATATYPE_string_UTF16, // Data of type $IggyStringUTF16 - IGGY_DATATYPE_fastname, // Only used when calling functions (avoids a copy - // operation) - IGGY_DATATYPE_valuepath, // Only used when calling functions - IGGY_DATATYPE_valueref, // Only used when calling functions - - // the following datatypes can be queried, but cannot appear - // as function arguments - - IGGY_DATATYPE_array, // Data of type Array in AS3 (appears in datatype - // query, never as arguments) - IGGY_DATATYPE_object, // Data of type Object (or a subclass) in AS3 - // (appears in datatype query, never as arguments) - IGGY_DATATYPE_displayobj, // Data of type DisplayObject (or a subclass) in - // AS3 (only appears in callbacks) - - IGGY_DATATYPE_xml, // Data of type XML or XMLList in AS3 (appears in - // datatype query, never as arguments) - - // the following datatypes also exists, but you can't access any data - // from within them. we give you the exact type for e.g. debugging - IGGY_DATATYPE_namespace, // Data of type Namespace in AS3 (appears in - // datatype query, never as arguments) - IGGY_DATATYPE_qname, // Data of type QName in AS3 (appears in datatype - // query, never as arguments) - IGGY_DATATYPE_function, // Data of type Function in AS3 (appears in - // datatype query, never as arguments) - IGGY_DATATYPE_class, // Data of type Class in AS3 (appears in datatype - // query, never as arguments) -} IggyDatatype; -/* Describes an AS3 datatype visible through iggy interface. */ - -#ifdef __RADWIN__ -#include -IDOCN typedef char IggyUTF16; -#else -typedef unsigned short IggyUTF16; -#endif - -typedef struct IggyStringUTF16 { - IggyUTF16* string; // Null-terminated, UTF16-encoded characters - S32 length; // Count of 16-bit characters in string, not including - // the null terminator -} IggyStringUTF16; - -typedef struct IggyStringUTF8 { - char* string; // Null-terminated, UTF8-encoded characters - S32 length; // Count of 8-bit bytes in string, not including the - // null terminator -} IggyStringUTF8; - -typedef UINTa IggyName; -typedef struct IggyValuePath IggyValuePath; -typedef void* IggyValueRef; -typedef UINTa IggyTempRef; - -typedef struct IggyDataValue { - S32 type; // an $IggyDatatype which determines which of the union members - // is valid. -#ifdef __RAD64__ - S32 padding; -#endif - IggyTempRef - temp_ref; // An opaque temporary reference which you can efficiently - // turn into an $IggyValueRef; this is written by Iggy on - // callbacks but never read by Iggy - union { - IggyStringUTF16 - string16; // A UTF16 string, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_string_UTF16) - IggyStringUTF8 string8; // A UTF8 string, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_string_UTF8) - F64 number; // A 64-bit floating point number (a double); valid if type - // = $(IggyDatatype::IGGY_DATATYPE_number) - rrbool boolval; // A boolean value, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_boolean) - IggyName - fastname; // A fast name, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_fastname); this is only - // an "in" type; Iggy will never define these itself - void* userdata; // A userdata pointer from a DisplayObject, valid if - // type = $(IggyDatatype::IGGY_DATATYPE_displayobj) - IggyValuePath* - valuepath; // A path to an object in the AS3 VM, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_valuepath); this is - // only an "in" type--Iggy will never output this - IggyValueRef - valueref; // An IggyValueRef, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_valueref); this is only - // an "in" type--Iggy will never output this - }; -} IggyDataValue; - -typedef struct IggyExternalFunctionCallUTF16 { - IggyStringUTF16 function_name; // The name of the function - S32 num_arguments; // The number of arguments that must be passed to the - // function - S32 padding; - IggyDataValue arguments[1]; // The argument types, assumed to contain - // num_arguments elements -} IggyExternalFunctionCallUTF16; - -typedef struct IggyExternalFunctionCallUTF8 { - IggyStringUTF8 function_name; // The name of the function - S32 num_arguments; // The number of arguments that must be passed to the - // function - S32 padding; - IggyDataValue arguments[1]; // The argument types, assumed to contain - // num_arguments elements -} IggyExternalFunctionCallUTF8; - -typedef void* RADLINK Iggy_AllocateFunction(void* alloc_callback_user_data, - size_t size_requested, - size_t* size_returned); -typedef void RADLINK Iggy_DeallocateFunction(void* alloc_callback_user_data, - void* ptr); - -typedef struct IggyAllocator { - void* user_callback_data; - Iggy_AllocateFunction* mem_alloc; - Iggy_DeallocateFunction* mem_free; -#ifndef __RAD64__ - void* struct_padding; // pad to 8-byte boundary -#endif -} IggyAllocator; - -RADEXPFUNC void RADEXPLINK IggyInit(IggyAllocator* allocator); -RADEXPFUNC void RADEXPLINK IggyShutdown(void); - -typedef enum IggyConfigureBoolName { - IGGY_CONFIGURE_BOOL_StartupExceptionsAreWarnings, // if true, ActionScript - // exceptions thrown - // during startup will - // not prevent Iggy from - // being created (default - // false) - IGGY_CONFIGURE_BOOL_IgnoreFlashVersion, - IGGY_CONFIGURE_BOOL_NeverDelayGotoProcessing, - IGGY_CONFIGURE_BOOL_SuppressAntialiasingOnAllBitmaps, - IGGY_CONFIGURE_BOOL_SuppressAntialiasingOn9SliceBitmaps, -} IggyConfigureBoolName; - -RADEXPFUNC void RADEXPLINK IggyConfigureBool(IggyConfigureBoolName prop, - rrbool value); - -typedef enum { - IGGY_VERSION_1_0_21 = 1, // behavior from 1.0.21 and earlier - IGGY_VERSION_1_0_24 = 3, // behavior from 1.0.24 and earlier - IGGY_VERSION_1_1_1 = 5, // behavior from 1.1.1 and earlier - IGGY_VERSION_1_1_8 = 7, // behavior from 1.1.8 and earlier - IGGY_VERSION_1_2_28 = 9, // behavior from 1.2.28 and earlier - IGGY_VERSION_default = 0x7fffffff, // default (current) Iggy behavior -} IggyVersionNumber; - -typedef enum { - IGGY_VERSIONED_BEHAVIOR_movieclip_gotoand = - 128, // This changes the behavior of AS3 gotoAndPlay and gotoAndStop. - // Valid values: IGGY_VERSION_1_0_21, IGGY_VERSION_default - IGGY_VERSIONED_BEHAVIOR_textfield_position = - 129, // This changes the behavior of textfield positioning as reported - // by AS3 getBounds/getRect and width/height. Values with - // different behavior: IGGY_VERSION_1_0_24, IGGY_VERSION_default. - IGGY_VERSIONED_BEHAVIOR_bitmap_smoothing = 130, - IGGY_VERSIONED_BEHAVIOR_textfield_autoscroll = - 131, // This makes textfield autoscrolling behave specially: Valid - // values: IGGY_VERSION_1_1_8, IGGY_VERSION_default - IGGY_VERSIONED_BEHAVIOR_fast_text_effects = - 132, // This fixes the behavior of fast text effects to be in the - // correct direction; Valid values: IGGY_VERSION_1_2_28, - // IGGY_VERSION_default -} IggyVersionedBehaviorName; - -RADEXPFUNC void RADEXPLINK IggyConfigureVersionedBehavior( - IggyVersionedBehaviorName prop, IggyVersionNumber value); - -typedef enum IggyTelemetryAmount { - IGGY_TELEMETRY_normal, // Normal amount for users debugging applications - // using Iggy - IGGY_TELEMETRY_internal, // Shows more internal details, useful when - // optimizing Iggy itself -} IggyTelemetryAmount; - -RADEXPFUNC void RADEXPLINK IggyUseTmLite(void* context, - IggyTelemetryAmount amount); -RADEXPFUNC void RADEXPLINK IggyUseTelemetry(void* context, - IggyTelemetryAmount amount); - -//////////////////////////////////////////////////////////// -// -// Translation -// - -typedef struct { - IggyUTF16* object_name; /* null-terminated Textfield.name value at the time - the text is set */ - rrbool autosize; /* true if the autosize value is non-zero at the time the - text is set */ - F32 width; /* the objectspace width of the textfield at the time the text is - set */ - F32 height; /* the objectspace height of the textfield at the time the text - is set */ - rrbool is_html_text; /* whether the provided text is going through - Textfield.htmlText or Textfield.text */ -} IggyTextfieldInfo; - -typedef void RADLINK Iggy_TranslationFreeFunction(void* callback_data, - void* data, S32 length); -typedef rrbool RADLINK Iggy_TranslateFunctionUTF16(void* callback_data, - IggyStringUTF16* src, - IggyStringUTF16* dest); -typedef rrbool RADLINK Iggy_TranslateFunctionUTF8(void* callback_data, - IggyStringUTF8* src, - IggyStringUTF8* dest); -typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF16( - void* callback_data, IggyStringUTF16* src, IggyStringUTF16* dest, - IggyTextfieldInfo* textfield); -typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF8( - void* callback_data, IggyStringUTF8* src, IggyStringUTF8* dest, - IggyTextfieldInfo* textfield); - -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunction( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF16( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF8( - Iggy_TranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunction( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF16( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF8( - Iggy_TranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF16( - Iggy_TextfieldTranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF8( - Iggy_TextfieldTranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); - -typedef enum { - IGGY_LANG_default, - IGGY_LANG_ja, - IGGY_LANG_ja_flash, // more strictly matches Flash -} IggyLanguageCode; - -RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); - -//////////////////////////////////////////////////////////// -// -// Playback -// - -typedef struct Iggy Iggy; -typedef S32 IggyLibrary; - -typedef void RADLINK Iggy_TraceFunctionUTF16(void* user_callback_data, - Iggy* player, - IggyUTF16 const* utf16_string, - S32 length_in_16bit_chars); -typedef void RADLINK Iggy_TraceFunctionUTF8(void* user_callback_data, - Iggy* player, - char const* utf8_string, - S32 length_in_bytes); -typedef void RADLINK Iggy_WarningFunction(void* user_callback_data, - Iggy* player, IggyResult error_code, - char const* error_message); - -typedef struct { - S32 total_storage_in_bytes; // the total memory to use for the AS3 heap and - // garbage collector - S32 stack_size_in_bytes; // size of the stack used for AS3 expression - // evaluation and function activation records - S32 young_heap_size_in_bytes; // size of the heap from which initial - // allocations are made - S32 old_heap_size_in_bytes; // this parameter is not supported yet - S32 remembered_set_size_in_bytes; // storage used to keep track of pointers - // from old heap to young heap - S32 greylist_size_in_bytes; // storage used to keep track of - // partially-garbage collected objects on the - // old heap - S32 rootstack_size_in_bytes; // size of the stack used for exposing - // temporaries to the garbage collector - S32 padding; -} IggyPlayerGCSizes; - -typedef struct { - IggyAllocator allocator; - IggyPlayerGCSizes gc; - char* filename; - char* user_name; - rrbool load_in_place; - rrbool did_load_in_place; -} IggyPlayerConfig; - -RADEXPFUNC Iggy* RADEXPLINK IggyPlayerCreateFromFileAndPlay( - char const* filename, IggyPlayerConfig const* config); - -RADEXPFUNC Iggy* RADEXPLINK IggyPlayerCreateFromMemory( - void const* data, U32 data_size_in_bytes, IggyPlayerConfig* config); - -#define IGGY_INVALID_LIBRARY -1 - -RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemory( - char const* url_utf8_null_terminated, void const* data, - U32 data_size_in_bytes, IggyPlayerConfig* config); - -RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemoryUTF16( - IggyUTF16 const* url_utf16_null_terminated, void const* data, - U32 data_size_in_bytes, IggyPlayerConfig* config); - -RADEXPFUNC void RADEXPLINK IggyPlayerDestroy(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyLibraryDestroy(IggyLibrary lib); -RADEXPFUNC void RADEXPLINK IggySetWarningCallback(Iggy_WarningFunction* error, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF8( - Iggy_TraceFunctionUTF8* trace_utf8, void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF16( - Iggy_TraceFunctionUTF16* trace_utf16, void* user_callback_data); - -typedef struct IggyProperties { - S32 movie_width_in_pixels; // the width of the "document" specified in the - // SWF file - S32 movie_height_in_pixels; // the height of the "document" specified in - // the SWF file - - F32 movie_frame_rate_current_in_fps; // the current frame rate Iggy is - // trying to achieve for the file - F32 movie_frame_rate_from_file_in_fps; // the frame rate specified in the - // SWF file - - S32 frames_passed; // the number of times Tick() has been called - S32 swf_major_version_number; // the major SWF version number of the file, - // currently always 9 - - F64 time_passed_in_seconds; // the total time passed since starting the - // file - F64 seconds_since_last_tick; // the number of seconds that have ocurred - F64 seconds_per_drawn_frame; // 1/render fps, updated on - // $IggyPlayerDrawTilesStart -} IggyProperties; - -RADEXPFUNC IggyProperties* RADEXPLINK IggyPlayerProperties(Iggy* player); - -typedef enum { - IGGY_PAUSE_continue_audio, - IGGY_PAUSE_pause_audio, - IGGY_PAUSE_stop_audio -} IggyAudioPauseMode; - -RADEXPFUNC void* RADEXPLINK IggyPlayerGetUserdata(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerSetUserdata(Iggy* player, void* userdata); - -RADEXPFUNC void RADEXPLINK IggyPlayerInitializeAndTickRS(Iggy* player); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerReadyToTick(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerTickRS(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerPause(Iggy* player, - IggyAudioPauseMode pause_audio); -RADEXPFUNC void RADEXPLINK IggyPlayerPlay(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFrameRate(Iggy* player, - F32 frame_rate_in_fps); -RADEXPFUNC void RADEXPLINK IggyPlayerGotoFrameRS(Iggy* f, S32 frame, - rrbool stop); - -#ifndef __RAD_HIGGYEXP_ -#define __RAD_HIGGYEXP_ -typedef void* HIGGYEXP; -/* An IggyExplorer context, it represents a connection to Iggy Explorer. */ -#endif - -#ifndef __RAD_HIGGYPERFMON_ -#define __RAD_HIGGYPERFMON_ -typedef void* HIGGYPERFMON; -/* An IggyPerfMon context */ -#endif - -IDOCN typedef void RADLINK iggyexp_detach_callback(void* ptr); - -IDOCN typedef struct { - U64 tick_ticks; - U64 draw_ticks; -} IggyPerfmonStats; - -IDOCN typedef struct { - void(RADLINK* get_stats)(Iggy* swf, IggyPerfmonStats* pdest); - const char*(RADLINK* get_display_name)(Iggy* swf); -} IggyForPerfmonFunctions; - -// This is used by both Iggy Explorer and Perfmon -IDOCN typedef struct { - rrbool(RADLINK* connection_valid)( - Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy - // Explorer is still connected - S32(RADLINK* poll_command)( - Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes - void(RADLINK* send_command)( - Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, - S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands - rrbool(RADLINK* attach)( - Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, - IggyForPerfmonFunctions* - pmf); // an Iggy file is trying to attach itself to this connection - // (one at a time) - rrbool(RADLINK* detach)( - Iggy* swf, HIGGYEXP iggyexp); // the current Iggy file should be - // detached (generate callback) - void(RADLINK* draw_tile_hook)( - Iggy* swf, HIGGYEXP iggyexp, - GDrawFunctions* iggy_gdraw); // only used by perfmon -} IggyExpFunctions; - -RADEXPFUNC void RADEXPLINK IggyInstallPerfmon(void* perfmon_context); - -RADEXPFUNC void RADEXPLINK IggyUseExplorer(Iggy* swf, void* context); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSendFrameToExplorer(Iggy* f); - -//////////////////////////////////////////////////////////// -// -// Fonts -// - -typedef struct { - F32 ascent; - F32 descent; - F32 line_gap; - F32 average_glyph_width_for_tab_stops; // for embedded fonts, Iggy uses - // width of 'g' - F32 largest_glyph_bbox_y1; -} IggyFontMetrics; - -typedef struct { - F32 x0, y0, x1, y1; // bounding box - F32 advance; // distance to move origin after this character -} IggyGlyphMetrics; - -typedef enum { - IGGY_VERTEX_move = 1, - IGGY_VERTEX_line = 2, - IGGY_VERTEX_curve = 3, -} IggyShapeVertexType; - -typedef struct { - F32 x, y; // if IGGY_VERTEX_move, point to start a new loop; if - // IGGY_VERTEX_line/curve, endpoint of segment - F32 cx, cy; // if IGGY_VERTEX_curve, control point on segment; ignored - // otherwise - U8 type; // value from $IggyShapeVertexType - - S8 padding; // ignore - U16 f0; // set to 1 - U16 f1; // set to 0 - U16 line; // ignore -} IggyShapeVertex; - -typedef struct { - IggyShapeVertex* vertices; - S32 num_vertices; - void* user_context_for_free; // you can use this to store data to access on - // the corresponding free call -} IggyVectorShape; - -typedef struct { - U8* pixels_one_per_byte; // pixels from the top left, 0 is transparent and - // 255 is opaque - S32 width_in_pixels; // this is the actual width of the bitmap data - S32 height_in_pixels; // this is the actual height of the bitmap data - S32 stride_in_bytes; // the distance from one row to the next - S32 oversample; // this is the amount of oversampling (0 or 1 = not - // oversample, 2 = 2x oversampled, 4 = 4x oversampled) - rrbool point_sample; // if true, the bitmap will be drawn with point - // sampling; if false, it will be drawn with bilinear - S32 top_left_x; // the offset of the top left corner from the character - // origin - S32 top_left_y; // the offset of the top left corner from the character - // origin - F32 pixel_scale_correct; // the pixel_scale at which this character should - // be displayed at width_in_pixels - F32 pixel_scale_min; // the smallest pixel_scale to allow using this - // character (scaled down) - F32 pixel_scale_max; // the largest pixels cale to allow using this - // character (scaled up) - void* user_context_for_free; // you can use this to store data to access on - // the corresponding free call -} IggyBitmapCharacter; - -typedef IggyFontMetrics* RADLINK -IggyFontGetFontMetrics(void* user_context, IggyFontMetrics* metrics); - -#define IGGY_GLYPH_INVALID -1 -typedef S32 RADLINK IggyFontGetCodepointGlyph(void* user_context, - U32 codepoint); -typedef IggyGlyphMetrics* RADLINK IggyFontGetGlyphMetrics( - void* user_context, S32 glyph, IggyGlyphMetrics* metrics); -typedef rrbool RADLINK IggyFontIsGlyphEmpty(void* user_context, S32 glyph); -typedef F32 RADLINK IggyFontGetKerningForGlyphPair(void* user_context, - S32 first_glyph, - S32 second_glyph); - -typedef void RADLINK IggyVectorFontGetGlyphShape(void* user_context, S32 glyph, - IggyVectorShape* shape); -typedef void RADLINK IggyVectorFontFreeGlyphShape(void* user_context, S32 glyph, - IggyVectorShape* shape); - -typedef rrbool RADLINK IggyBitmapFontCanProvideBitmap(void* user_context, - S32 glyph, - F32 pixel_scale); -typedef rrbool RADLINK -IggyBitmapFontGetGlyphBitmap(void* user_context, S32 glyph, F32 pixel_scale, - IggyBitmapCharacter* bitmap); -typedef void RADLINK IggyBitmapFontFreeGlyphBitmap(void* user_context, - S32 glyph, F32 pixel_scale, - IggyBitmapCharacter* bitmap); - -typedef struct { - IggyFontGetFontMetrics* get_font_metrics; - - IggyFontGetCodepointGlyph* get_glyph_for_codepoint; - IggyFontGetGlyphMetrics* get_glyph_metrics; - IggyFontIsGlyphEmpty* is_empty; - IggyFontGetKerningForGlyphPair* get_kerning; - - IggyVectorFontGetGlyphShape* get_shape; - IggyVectorFontFreeGlyphShape* free_shape; - - S32 num_glyphs; - - void* userdata; -} IggyVectorFontProvider; - -typedef struct { - IggyFontGetFontMetrics* get_font_metrics; - - IggyFontGetCodepointGlyph* get_glyph_for_codepoint; - IggyFontGetGlyphMetrics* get_glyph_metrics; - IggyFontIsGlyphEmpty* is_empty; - IggyFontGetKerningForGlyphPair* get_kerning; - - IggyBitmapFontCanProvideBitmap* can_bitmap; - IggyBitmapFontGetGlyphBitmap* get_bitmap; - IggyBitmapFontFreeGlyphBitmap* free_bitmap; - - S32 num_glyphs; - - void* userdata; -} IggyBitmapFontProvider; - -typedef struct { - IggyBitmapFontCanProvideBitmap* can_bitmap; - IggyBitmapFontGetGlyphBitmap* get_bitmap; - IggyBitmapFontFreeGlyphBitmap* free_bitmap; - void* userdata; -} IggyBitmapFontOverride; - -RADEXPFUNC void RADEXPLINK IggySetInstalledFontMaxCount(S32 num); -RADEXPFUNC void RADEXPLINK IggySetIndirectFontMaxCount(S32 num); - -#define IGGY_FONTFLAG_none 0 -#define IGGY_FONTFLAG_bold 1 -#define IGGY_FONTFLAG_italic 2 -#define IGGY_FONTFLAG_all (~0U) // indirection only - -#define IGGY_TTC_INDEX_none 0 - -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF8( - const void* truetype_storage, S32 ttc_index, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF16( - const void* truetype_storage, S32 ttc_index, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF8( - const char* fontname, S32 len, U32 fontflags, S32 fallback_codepoint); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF16( - const U16* fontname, S32 len, U32 fontflags, S32 fallback_codepoint); -RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF8( - const IggyVectorFontProvider* vfp, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF16( - const IggyVectorFontProvider* vfp, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF8( - const IggyBitmapFontProvider* bmf, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF16( - const IggyBitmapFontProvider* bmf, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF8( - const IggyBitmapFontOverride* bmf, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF16( - const IggyBitmapFontOverride* bmf, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); - -RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF8(const char* fontname, - S32 namelen_in_bytes, - U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF16(const U16* fontname, - S32 namelen_in_16bit_quantities, - U32 fontflags); - -RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF8( - const char* request_name, S32 request_namelen, U32 request_flags, - const char* result_name, S32 result_namelen, U32 result_flags); -RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF16( - const U16* request_name, S32 request_namelen, U32 request_flags, - const U16* result_name, S32 result_namelen, U32 result_flags); - -RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF8(const char* fontname, - S32 fontname_len, - U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16* fontname, - S32 fontname_len, - U32 fontflags); - -//////////////////////////////////////////////////////////// -// -// Audio -// - -struct _RadSoundSystem; -IDOCN typedef S32 (*IGGYSND_OPEN_FUNC)(struct _RadSoundSystem* i_SoundSystem, - U32 i_MinBufferSizeInMs, U32 i_Frequency, - U32 i_ChannelCount, U32 i_MaxLockSize, - U32 i_Flags); - -IDOCN RADEXPFUNC void RADEXPLINK -IggyAudioSetDriver(IGGYSND_OPEN_FUNC driver_open, U32 flags); - -// These functions cause Iggy to use a specific audio API, most of which -// are only actually defined on one target platform. Probably, you'll just -// want to call IggyAudioUseDefault. - -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseDirectSound(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseWaveOut(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseXAudio2(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseLibAudio(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseAX(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseCoreAudio(void); - -RADEXPFUNC void RADEXPLINK IggyAudioUseDefault(void); - -#ifndef __RAD_DEFINE_IGGYMP3__ -#define __RAD_DEFINE_IGGYMP3__ -IDOCN typedef struct IggyMP3Interface IggyMP3Interface; -IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface* decoder); -#endif - -#ifdef __RADNT__ -RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); -RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char* path); -RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(char* path); -#else -// this is overkill for non-DLL implementations, which could call into Iggy -// directly, but it means everything goes through the same indirection -// internally -IDOCN RADEXPFUNC IggyGetMP3Decoder* RADEXPLINK IggyAudioGetMP3Decoder(void); -IDOCN RADEXPFUNC void RADEXPLINK -IggyAudioInstallMP3DecoderExplicit(IggyGetMP3Decoder* init); - -#define IggyAudioInstallMP3Decoder() \ - IggyAudioInstallMP3DecoderExplicit(IggyAudioGetMP3Decoder()) IDOCN -#endif - -RADEXPFUNC rrbool RADEXPLINK IggyAudioSetMaxBufferTime(S32 ms); -RADEXPFUNC void RADEXPLINK IggyAudioSetLatency(S32 ms); -RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioVolume(Iggy* iggy, - F32 attenuation); - -#define IGGY_AUDIODEVICE_default 0 -#define IGGY_AUDIODEVICE_primary 1 -#define IGGY_AUDIODEVICE_secondary 2 - -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioDevice(Iggy* iggy, - S32 device); - -//////////////////////////////////////////////////////////// -// -// Rendering -// - -typedef struct IggyCustomDrawCallbackRegion { - IggyUTF16* name; // the name of the DisplayObject being substituted - F32 x0, y0, x1, - y1; // the bounding box of the original DisplayObject, in object space - F32 rgba_mul[4]; // any multiplicative color effect specified for the - // DisplayObject or its parents - F32 rgba_add[4]; // any additive color effect specified for the - // DisplayObject or its parents - S32 scissor_x0, scissor_y0, scissor_x1, - scissor_y1; // optional scissor rect box - U8 scissor_enable; // if non-zero, clip to the scissor rect - U8 stencil_func_mask; // D3DRS_STENCILMASK or equivalent - U8 stencil_func_ref; // D3DRS_STENCILREF or equivalent - U8 stencil_write_mask; // if non-zero, D3DRS_STENCILWRITEMASK or equivalent - struct gswf_matrix* o2w; // Iggy object-to-world matrix (used internally) -} IggyCustomDrawCallbackRegion; - -typedef void RADLINK -Iggy_CustomDrawCallback(void* user_callback_data, Iggy* player, - IggyCustomDrawCallbackRegion* Region); -typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallback( - void* user_callback_data, IggyUTF16* texture_name, S32* width, S32* height, - void** destroy_callback_data); -typedef void RADLINK Iggy_TextureSubstitutionDestroyCallback( - void* user_callback_data, void* destroy_callback_data, - GDrawTexture* handle); -typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallbackUTF8( - void* user_callback_data, char* texture_name, S32* width, S32* height, - void** destroy_callback_data); - -RADEXPFUNC void RADEXPLINK IggySetCustomDrawCallback( - Iggy_CustomDrawCallback* custom_draw, void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacks( - Iggy_TextureSubstitutionCreateCallback* texture_create, - Iggy_TextureSubstitutionDestroyCallback* texture_destroy, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacksUTF8( - Iggy_TextureSubstitutionCreateCallbackUTF8* texture_create, - Iggy_TextureSubstitutionDestroyCallback* texture_destroy, - void* user_callback_data); - -typedef enum { - IGGY_FLUSH_no_callback, // do not generate the - // $Iggy_TextureSubstitutionDestroyCallback - IGGY_FLUSH_destroy_callback, // do generate the - // $Iggy_TextureSubstitutionDestroyCallback -} IggyTextureSubstitutionFlushMode; - -RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlush( - GDrawTexture* handle, IggyTextureSubstitutionFlushMode do_destroy_callback); -RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlushAll( - IggyTextureSubstitutionFlushMode do_destroy_callback); - -RADEXPFUNC void RADEXPLINK IggySetGDraw(GDrawFunctions* gdraw); -RADEXPFUNC void RADEXPLINK IggyPlayerGetBackgroundColor(Iggy* player, - F32 output_color[3]); - -typedef enum { - IGGY_ROTATION_0_degrees = 0, - IGGY_ROTATION_90_degrees_counterclockwise = 1, - IGGY_ROTATION_180_degrees = 2, - IGGY_ROTATION_90_degrees_clockwise = 3, -} Iggy90DegreeRotation; - -RADEXPFUNC void RADEXPLINK IggyPlayerSetDisplaySize(Iggy* f, S32 w, S32 h); -RADEXPFUNC void RADEXPLINK IggyPlayerSetPixelShape(Iggy* swf, F32 pixel_x, - F32 pixel_y); -RADEXPFUNC void RADEXPLINK IggyPlayerSetStageRotation(Iggy* f, - Iggy90DegreeRotation rot); -RADEXPFUNC void RADEXPLINK IggyPlayerDraw(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerSetStageSize(Iggy* f, S32 w, S32 h); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFaux3DStage(Iggy* f, F32* top_left, - F32* top_right, - F32* bottom_left, - F32* bottom_right, - F32 depth_scale); -RADEXPFUNC void RADEXPLINK IggyPlayerForceMipmaps(Iggy* f, - rrbool force_mipmaps); - -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTile(Iggy* f, S32 x0, S32 y0, S32 x1, - S32 y1, S32 padding); -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesStart(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesEnd(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerSetRootTransform(Iggy* f, F32 mat[4], - F32 tx, F32 ty); -RADEXPFUNC void RADEXPLINK IggyPlayerFlushAll(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyLibraryFlushAll(IggyLibrary h); -RADEXPFUNC void RADEXPLINK IggySetTextCursorPixelWidth(S32 width); -RADEXPFUNC void RADEXPLINK IggyForceBitmapSmoothing(rrbool force_on); -RADEXPFUNC void RADEXPLINK IggyFlushInstalledFonts(void); -RADEXPFUNC void RADEXPLINK IggyFastTextFilterEffects(rrbool enable); - -typedef enum IggyAntialiasing { - IGGY_ANTIALIASING_FontsOnly = 2, // Anti-aliasing of bitmapped fonts only - IGGY_ANTIALIASING_FontsAndLinesOnly = - 4, // Anti-aliasing of fonts and lines, but nothing else - IGGY_ANTIALIASING_PrettyGood = - 8, // High-quality anti-aliasing on everything, but no rendertargets - // required - IGGY_ANTIALIASING_Good = - 10, // High-quality anti-aliasing on everything (on platforms where - // GDraw doesn't support rendertargets, such as the Wii, this - // behaves the same as PrettyGood) -} IggyAntialiasing; - -RADEXPFUNC void RADEXPLINK -IggyPlayerSetAntialiasing(Iggy* f, IggyAntialiasing antialias_mode); - -RADEXPFUNC void RADEXPLINK -IggyPlayerSetBitmapFontCaching(Iggy* f, S32 tex_w, S32 tex_h, - S32 max_char_pix_width, S32 max_char_pix_height); - -RADEXPFUNC void RADEXPLINK -IggySetFontCachingCalculationBuffer(S32 max_chars, void* optional_temp_buffer, - S32 optional_temp_buffer_size_in_bytes); - -typedef struct IggyGeneric IggyGeneric; - -RADEXPFUNC IggyGeneric* RADEXPLINK IggyPlayerGetGeneric(Iggy* player); -RADEXPFUNC IggyGeneric* RADEXPLINK IggyLibraryGetGeneric(IggyLibrary lib); - -// each texture metadata block contains one of these, where -// texture_info is an array of per-format data -IDOCN typedef struct { - U16 num_textures; - U16 load_alignment_log2; - U32 texture_file_size; - void* texture_info; -} IggyTextureResourceMetadata; - -RADEXPFUNC void RADEXPLINK IggyGenericInstallResourceFile(IggyGeneric* g, - void* data, - S32 data_length, - rrbool* can_free_now); -RADEXPFUNC IggyTextureResourceMetadata* RADEXPLINK -IggyGenericGetTextureResourceMetadata(IggyGeneric* f); -RADEXPFUNC void RADEXPLINK -IggyGenericSetTextureFromResource(IggyGeneric* f, U16 id, GDrawTexture* handle); - -// this is the encoding for the "raw" texture type, which doesn't -// depend on any platform headers -typedef enum { - IFT_FORMAT_rgba_8888, - IFT_FORMAT_rgba_4444_LE, - IFT_FORMAT_rgba_5551_LE, - IFT_FORMAT_la_88, - IFT_FORMAT_la_44, - IFT_FORMAT_i_8, - IFT_FORMAT_i_4, - IFT_FORMAT_l_8, - IFT_FORMAT_l_4, - IFT_FORMAT_DXT1, - IFT_FORMAT_DXT3, - IFT_FORMAT_DXT5, -} IggyFileTexture_Format; - -typedef struct { - U32 file_offset; - U8 format; - U8 mipmaps; - U16 w, h; - U16 swf_id; -} IggyFileTextureRaw; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U16 padding; - struct { - U32 data[13]; - } texture; -} IggyFileTexture360; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data[6]; - } texture; -} IggyFileTexturePS3; - -IDOCN typedef struct { - U32 file_offset1; - U32 file_offset2; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data1[39]; - } texture; -} IggyFileTextureWiiu; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data[8]; - } texture; -} IggyFileTexturePS4; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 format; - U32 type; - U16 width; - U16 height; - U8 mip_count; - U8 pad[3]; - } texture; -} IggyFileTexturePSP2; - -//////////////////////////////////////////////////////////// -// -// AS3 -// - -typedef rrbool RADLINK Iggy_AS3ExternalFunctionUTF8( - void* user_callback_data, Iggy* player, IggyExternalFunctionCallUTF8* call); -typedef rrbool RADLINK -Iggy_AS3ExternalFunctionUTF16(void* user_callback_data, Iggy* player, - IggyExternalFunctionCallUTF16* call); - -RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF8( - Iggy_AS3ExternalFunctionUTF8* as3_external_function_utf8, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF16( - Iggy_AS3ExternalFunctionUTF16* as3_external_function_utf16, - void* user_callback_data); -RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastName(Iggy* f, - IggyUTF16 const* name, - S32 len); -RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastNameUTF8(Iggy* f, - char const* name, - S32 len); -RADEXPFUNC IggyResult RADEXPLINK IggyPlayerCallFunctionRS(Iggy* player, - IggyDataValue* result, - IggyName function, - S32 numargs, - IggyDataValue* args); -RADEXPFUNC IggyResult RADEXPLINK -IggyPlayerCallMethodRS(Iggy* f, IggyDataValue* result, IggyValuePath* target, - IggyName methodname, S32 numargs, IggyDataValue* args); -RADEXPFUNC void RADEXPLINK IggyPlayerGarbageCollect(Iggy* player, S32 strength); - -#define IGGY_GC_MINIMAL 0 -#define IGGY_GC_NORMAL 30 -#define IGGY_GC_MAXIMAL 100 - -typedef struct { - U32 young_heap_size; // the size of the young heap is the smaller of this - // number and the size the young heap was originally - // allocated when the Iggy was created - U32 base_old_amount; // the base number of words to process on each minor - // cycle, default 200 - F32 old_heap_fraction; // the fraction 0..1 (default 0.125) of the - // outstanding allocations from the last major GC - // cycle to traverse during one GC cycle - F32 new_allocation_multiplier; // a number from 1..infinity (default 2) - // which is the amount of the allocations in - // the last cycle to traverse - F32 sweep_multiplier; // a positive number (default 2) which weights the - // amount of data swept vs marked -} IggyGarbageCollectorControl; - -typedef enum { - IGGY_GC_EVENT_tenure, - IGGY_GC_EVENT_mark_increment, - IGGY_GC_EVENT_mark_roots, - IGGY_GC_EVENT_sweep_finalize, - IGGY_GC_EVENT_sweep_increment, - IGGY_GC_WARNING_greylist_overflow, // the grey list overflowed, increase - // the size of - // $(IggyPlayerGCSizes::greylist_size_in_bytes). - IGGY_GC_WARNING_remembered_overflow, // the remembered set overflowed, - // increase the size of - // $(IggyPlayerGCSizes::remembered_set_size_in_bytes). -} IggyGarbageCollectionEvent; - -typedef struct { - U64 event_time_in_microseconds; - U64 total_marked_bytes; // total bytes ever marked by the GC - U64 total_swept_bytes; // total bytes ever swept by the GC - U64 total_allocated_bytes; // total bytes ever allocated from the old heap - U64 total_gc_time_in_microseconds; // total time spent in GC while notify - // callback was active - - char* name; - - IggyGarbageCollectionEvent - event; // the type of garbage collection event that was just performed - - U32 increment_processing_bytes; // the number of bytes that were processed - // in that event - - U32 last_slice_tenured_bytes; // the number of bytes that were tenured from - // young-to-old heap since the previous GC - // step - U32 last_slice_old_allocation_bytes; // the number of bytes that were - // tenured or were directly allocated - // from the old heap since the - // previous GC step - - U32 heap_used_bytes; // the number of bytes in use in the old heap (the - // young heap is empty) - U32 heap_size_bytes; // the number of bytes allocated for the old heap - - U32 onstage_display_objects; // the number of on-stage display objects - // (MovieClips, TextFields, Shapes, etc) - // visited during tenuring only - U32 offstage_display_objects; // the number of off-stage display objects - // visited during tenuring only -} IggyGarbageCollectionInfo; - -typedef void RADLINK -Iggy_GarbageCollectionCallback(Iggy* player, IggyGarbageCollectionInfo* info); -RADEXPFUNC void RADEXPLINK IggyPlayerConfigureGCBehavior( - Iggy* player, Iggy_GarbageCollectionCallback* notify_callack, - IggyGarbageCollectorControl* control); -RADEXPFUNC void RADEXPLINK IggyPlayerQueryGCSizes(Iggy* player, - IggyPlayerGCSizes* sizes); - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetValid(Iggy* f); - -IDOCN struct IggyValuePath { - Iggy* f; - IggyValuePath* parent; - // align 0 mod 8 - IggyName name; - IggyValueRef ref; - // align 0 mod 8 - S32 index; - S32 type; - // align 0 mod 8 -}; - -typedef enum { - IGGY_ValueRef, - IGGY_ValueRef_Weak, -} IggyValueRefType; - -RADEXPFUNC rrbool RADEXPLINK IggyValueRefCheck(IggyValueRef ref); -RADEXPFUNC void RADEXPLINK IggyValueRefFree(Iggy* p, IggyValueRef ref); -RADEXPFUNC IggyValueRef RADEXPLINK -IggyValueRefFromPath(IggyValuePath* var, IggyValueRefType reftype); -RADEXPFUNC rrbool RADEXPLINK -IggyIsValueRefSameObjectAsTempRef(IggyValueRef value_ref, IggyTempRef temp_ref); -RADEXPFUNC rrbool RADEXPLINK IggyIsValueRefSameObjectAsValuePath( - IggyValueRef value_ref, IggyValuePath* path, IggyName sub_name, - char const* sub_name_utf8); -RADEXPFUNC void RADEXPLINK IggySetValueRefLimit(Iggy* f, S32 max_value_refs); -RADEXPFUNC S32 RADEXPLINK IggyDebugGetNumValueRef(Iggy* f); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateArray(Iggy* f, - S32 num_slots); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateEmptyObject(Iggy* f); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefFromTempRef( - Iggy* f, IggyTempRef temp_ref, IggyValueRefType reftype); - -RADEXPFUNC IggyValuePath* RADEXPLINK IggyPlayerRootPath(Iggy* f); -RADEXPFUNC IggyValuePath* RADEXPLINK IggyPlayerCallbackResultPath(Iggy* f); -RADEXPFUNC rrbool RADEXPLINK IggyValuePathMakeNameRef(IggyValuePath* result, - IggyValuePath* parent, - char const* text_utf8); -RADEXPFUNC void RADEXPLINK IggyValuePathFromRef(IggyValuePath* result, - Iggy* iggy, IggyValueRef ref); - -RADEXPFUNC void RADEXPLINK IggyValuePathMakeNameRefFast(IggyValuePath* result, - IggyValuePath* parent, - IggyName name); -RADEXPFUNC void RADEXPLINK IggyValuePathMakeArrayRef(IggyValuePath* result, - IggyValuePath* array_path, - int array_index); - -RADEXPFUNC void RADEXPLINK IggyValuePathSetParent(IggyValuePath* result, - IggyValuePath* new_parent); -RADEXPFUNC void RADEXPLINK IggyValuePathSetArrayIndex(IggyValuePath* result, - int new_index); - -RADEXPFUNC void RADEXPLINK IggyValuePathSetName(IggyValuePath* result, - IggyName name); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetTypeRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - IggyDatatype* result); - -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF64RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F64* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetS32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - S32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetU32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - U32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF8RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - S32 max_result_len, char* utf8_result, S32* result_len); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF16RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - S32 max_result_len, IggyUTF16* utf16_result, S32* result_len); -RADEXPFUNC IggyResult RADEXPLINK -IggyValueGetBooleanRS(IggyValuePath* var, IggyName sub_name, - char const* sub_name_utf8, rrbool* result); -RADEXPFUNC IggyResult RADEXPLINK -IggyValueGetArrayLengthRS(IggyValuePath* var, IggyName sub_name, - char const* sub_name_utf8, S32* result); - -RADEXPFUNC rrbool RADEXPLINK IggyValueSetF64RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F64 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetF32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetS32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - S32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetU32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - U32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF8RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - char const* utf8_string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF16RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - IggyUTF16 const* utf16_string, S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetBooleanRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - rrbool value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetValueRefRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - IggyValueRef value_ref); - -RADEXPFUNC rrbool RADEXPLINK IggyValueSetUserDataRS(IggyValuePath* result, - void const* userdata); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetUserDataRS(IggyValuePath* result, - void** userdata); - -//////////////////////////////////////////////////////////// -// -// Input Events -// - -typedef enum IggyEventType { - IGGY_EVENTTYPE_None, - IGGY_EVENTTYPE_MouseLeftDown, - IGGY_EVENTTYPE_MouseLeftUp, - IGGY_EVENTTYPE_MouseRightDown, - IGGY_EVENTTYPE_MouseRightUp, - IGGY_EVENTTYPE_MouseMiddleDown, - IGGY_EVENTTYPE_MouseMiddleUp, - IGGY_EVENTTYPE_MouseMove, - IGGY_EVENTTYPE_MouseWheel, - IGGY_EVENTTYPE_KeyUp, - IGGY_EVENTTYPE_KeyDown, - IGGY_EVENTTYPE_Char, - IGGY_EVENTTYPE_Activate, - IGGY_EVENTTYPE_Deactivate, - IGGY_EVENTTYPE_Resize, - IGGY_EVENTTYPE_MouseLeave, - IGGY_EVENTTYPE_FocusLost, -} IggyEventType; - -typedef enum IggyKeyloc { - IGGY_KEYLOC_Standard = 0, // For keys that have no variants - // TODO(casey): Shouldn't these work for ALT and CONTROL too? The code in - // D3DTEST looks like it only handles VK_SHIFT... - IGGY_KEYLOC_Left = - 1, // Specifies the left-hand-side key for keys with left/right - // variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), - // $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */ - IGGY_KEYLOC_Right = - 2, // Specifies the right-hand-side key for keys with left/right - // variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), - // $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */ - IGGY_KEYLOC_Numpad = 3, // TODO(casey): Is this ever used? -} IggyKeyloc; - -typedef enum IggyKeyevent { - IGGY_KEYEVENT_Up = IGGY_EVENTTYPE_KeyUp, - IGGY_KEYEVENT_Down = IGGY_EVENTTYPE_KeyDown, -} IggyKeyevent; - -typedef enum IggyMousebutton { - IGGY_MOUSEBUTTON_LeftDown = IGGY_EVENTTYPE_MouseLeftDown, - IGGY_MOUSEBUTTON_LeftUp = IGGY_EVENTTYPE_MouseLeftUp, - IGGY_MOUSEBUTTON_RightDown = IGGY_EVENTTYPE_MouseRightDown, - IGGY_MOUSEBUTTON_RightUp = IGGY_EVENTTYPE_MouseRightUp, - IGGY_MOUSEBUTTON_MiddleDown = IGGY_EVENTTYPE_MouseMiddleDown, - IGGY_MOUSEBUTTON_MiddleUp = IGGY_EVENTTYPE_MouseMiddleUp, -} IggyMousebutton; - -typedef enum IggyActivestate { - IGGY_ACTIVESTATE_Activated = IGGY_EVENTTYPE_Activate, - IGGY_ACTIVESTATE_Deactivated = IGGY_EVENTTYPE_Deactivate, -} IggyActivestate; - -typedef enum IggyKeycode { - IGGY_KEYCODE_A = 65, - IGGY_KEYCODE_B = 66, - IGGY_KEYCODE_C = 67, - IGGY_KEYCODE_D = 68, - IGGY_KEYCODE_E = 69, - IGGY_KEYCODE_F = 70, - IGGY_KEYCODE_G = 71, - IGGY_KEYCODE_H = 72, - IGGY_KEYCODE_I = 73, - IGGY_KEYCODE_J = 74, - IGGY_KEYCODE_K = 75, - IGGY_KEYCODE_L = 76, - IGGY_KEYCODE_M = 77, - IGGY_KEYCODE_N = 78, - IGGY_KEYCODE_O = 79, - IGGY_KEYCODE_P = 80, - IGGY_KEYCODE_Q = 81, - IGGY_KEYCODE_R = 82, - IGGY_KEYCODE_S = 83, - IGGY_KEYCODE_T = 84, - IGGY_KEYCODE_U = 85, - IGGY_KEYCODE_V = 86, - IGGY_KEYCODE_W = 87, - IGGY_KEYCODE_X = 88, - IGGY_KEYCODE_Y = 89, - IGGY_KEYCODE_Z = 90, - - IGGY_KEYCODE_0 = 48, - IGGY_KEYCODE_1 = 49, - IGGY_KEYCODE_2 = 50, - IGGY_KEYCODE_3 = 51, - IGGY_KEYCODE_4 = 52, - IGGY_KEYCODE_5 = 53, - IGGY_KEYCODE_6 = 54, - IGGY_KEYCODE_7 = 55, - IGGY_KEYCODE_8 = 56, - IGGY_KEYCODE_9 = 57, - - IGGY_KEYCODE_F1 = 112, - IGGY_KEYCODE_F2 = 113, - IGGY_KEYCODE_F3 = 114, - IGGY_KEYCODE_F4 = 115, - IGGY_KEYCODE_F5 = 116, - IGGY_KEYCODE_F6 = 117, - IGGY_KEYCODE_F7 = 118, - IGGY_KEYCODE_F8 = 119, - IGGY_KEYCODE_F9 = 120, - IGGY_KEYCODE_F10 = 121, - IGGY_KEYCODE_F11 = 122, - IGGY_KEYCODE_F12 = 123, - IGGY_KEYCODE_F13 = 124, - IGGY_KEYCODE_F14 = 125, - IGGY_KEYCODE_F15 = 126, - - IGGY_KEYCODE_COMMAND = 15, - IGGY_KEYCODE_SHIFT = 16, - IGGY_KEYCODE_CONTROL = 17, - IGGY_KEYCODE_ALTERNATE = 18, - - IGGY_KEYCODE_BACKQUOTE = 192, - IGGY_KEYCODE_BACKSLASH = 220, - IGGY_KEYCODE_BACKSPACE = 8, - IGGY_KEYCODE_CAPS_LOCK = 20, - IGGY_KEYCODE_COMMA = 188, - IGGY_KEYCODE_DELETE = 46, - IGGY_KEYCODE_DOWN = 40, - IGGY_KEYCODE_END = 35, - IGGY_KEYCODE_ENTER = 13, - IGGY_KEYCODE_EQUAL = 187, - IGGY_KEYCODE_ESCAPE = 27, - IGGY_KEYCODE_HOME = 36, - IGGY_KEYCODE_INSERT = 45, - IGGY_KEYCODE_LEFT = 37, - IGGY_KEYCODE_LEFTBRACKET = 219, - IGGY_KEYCODE_MINUS = 189, - IGGY_KEYCODE_NUMPAD = 21, - IGGY_KEYCODE_NUMPAD_0 = 96, - IGGY_KEYCODE_NUMPAD_1 = 97, - IGGY_KEYCODE_NUMPAD_2 = 98, - IGGY_KEYCODE_NUMPAD_3 = 99, - IGGY_KEYCODE_NUMPAD_4 = 100, - IGGY_KEYCODE_NUMPAD_5 = 101, - IGGY_KEYCODE_NUMPAD_6 = 102, - IGGY_KEYCODE_NUMPAD_7 = 103, - IGGY_KEYCODE_NUMPAD_8 = 104, - IGGY_KEYCODE_NUMPAD_9 = 105, - IGGY_KEYCODE_NUMPAD_ADD = 107, - IGGY_KEYCODE_NUMPAD_DECIMAL = 110, - IGGY_KEYCODE_NUMPAD_DIVIDE = 111, - IGGY_KEYCODE_NUMPAD_ENTER = 108, - IGGY_KEYCODE_NUMPAD_MULTIPLY = 106, - IGGY_KEYCODE_NUMPAD_SUBTRACT = 109, - IGGY_KEYCODE_PAGE_DOWN = 34, - IGGY_KEYCODE_PAGE_UP = 33, - IGGY_KEYCODE_PERIOD = 190, - IGGY_KEYCODE_QUOTE = 222, - IGGY_KEYCODE_RIGHT = 39, - IGGY_KEYCODE_RIGHTBRACKET = 221, - IGGY_KEYCODE_SEMICOLON = 186, - IGGY_KEYCODE_SLASH = 191, - IGGY_KEYCODE_SPACE = 32, - IGGY_KEYCODE_TAB = 9, - IGGY_KEYCODE_UP = 38, -} IggyKeycode; - -typedef enum IggyEventFlag { - IGGY_EVENTFLAG_PreventDispatchToObject = 0x1, - IGGY_EVENTFLAG_PreventFocusTabbing = 0x2, - IGGY_EVENTFLAG_PreventDefault = 0x4, - IGGY_EVENTFLAG_RanAtLeastOneHandler = 0x8, -} IggyEventFlag; - -typedef struct IggyEvent { - S32 type; // an $IggyEventType - U32 flags; - S32 x, y; // mouse position at time of event - S32 keycode, keyloc; // keyboard inputs -} IggyEvent; - -typedef enum IggyFocusChange { - IGGY_FOCUS_CHANGE_None, // The keyboard focus didn't change - IGGY_FOCUS_CHANGE_TookFocus, // The keyboard focus changed to something in - // this Iggy - IGGY_FOCUS_CHANGE_LostFocus, // The keyboard focus was lost from this Iggy -} IggyFocusChange; - -typedef struct IggyEventResult { - U32 new_flags; - S32 focus_change; // an $IggyFocusChange that indicates how the focus (may - // have) changed in response to the event - S32 focus_direction; // -} IggyEventResult; - -RADEXPFUNC void RADEXPLINK IggyMakeEventNone(IggyEvent* event); - -RADEXPFUNC void RADEXPLINK IggyMakeEventResize(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventActivate(IggyEvent* event, - IggyActivestate event_type); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseLeave(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseMove(IggyEvent* event, S32 x, - S32 y); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseButton(IggyEvent* event, - IggyMousebutton event_type); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseWheel(IggyEvent* event, - S16 mousewheel_delta); -RADEXPFUNC void RADEXPLINK IggyMakeEventKey(IggyEvent* event, - IggyKeyevent event_type, - IggyKeycode keycode, - IggyKeyloc keyloc); -RADEXPFUNC void RADEXPLINK IggyMakeEventChar(IggyEvent* event, S32 charcode); -RADEXPFUNC void RADEXPLINK IggyMakeEventFocusLost(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventFocusGained(IggyEvent* event, - S32 focus_direction); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerDispatchEventRS(Iggy* player, - IggyEvent* event, - IggyEventResult* result); -RADEXPFUNC void RADEXPLINK IggyPlayerSetShiftState(Iggy* f, rrbool shift, - rrbool control, rrbool alt, - rrbool command); -RADEXPFUNC void RADEXPLINK -IggySetDoubleClickTime(S32 time_in_ms_from_first_down_to_second_up); -RADEXPFUNC void RADEXPLINK IggySetTextCursorFlash(U32 cycle_time_in_ms, - U32 visible_time_in_ms); - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerHasFocusedEditableTextfield(Iggy* f); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF16(Iggy* f, U16* string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF8(Iggy* f, char* string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerCut(Iggy* f); - -#define IGGY_PLAYER_COPY_no_focused_textfield -1 -#define IGGY_PLAYER_COPY_textfield_has_no_selection 0 -RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF16(Iggy* f, U16* buffer, - S32 bufferlen); -RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF8(Iggy* f, char* buffer, - S32 bufferlen); - -//////////////////////////////////////////////////////////// -// -// IME -// - -#ifdef __RADNT__ -#define IGGY_IME_SUPPORT -#endif - -RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF8(Iggy* f, - const char* font_name_utf8, - S32 namelen_in_bytes); -RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF16( - Iggy* f, const IggyUTF16* font_name_utf16, S32 namelen_in_2byte_words); - -#ifdef IGGY_IME_SUPPORT - -#define IGGY_IME_MAX_CANDIDATE_LENGTH \ - 256 // matches def in ImeUi.cpp, so no overflow checks needed when copying - // out. - -IDOCN typedef enum { - IGGY_IME_COMPOSITION_STYLE_NONE, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED_THICK, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID_THICK, -} IggyIMECompositionDrawStyle; - -IDOCN typedef enum { - IGGY_IME_COMPOSITION_CLAUSE_NORMAL, - IGGY_IME_COMPOSITION_CLAUSE_START, -} IggyIMECompositionClauseState; - -IDOCN typedef struct { - IggyUTF16 str[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionDrawStyle char_style[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionClauseState clause_state[IGGY_IME_MAX_CANDIDATE_LENGTH]; - S32 cursor_pos; - rrbool display_block_cursor; - int candicate_clause_start_pos; - int candicate_clause_end_pos; // inclusive -} IggyIMECompostitionStringState; - -IDOCN RADEXPFUNC void RADEXPLINK -IggyIMEWin32SetCompositionState(Iggy* f, IggyIMECompostitionStringState* s); - -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEGetTextExtents(Iggy* f, U32* pdw, - U32* pdh, - const IggyUTF16* str, - U32 text_height); -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawString(Iggy* f, S32 px, S32 py, - const IggyUTF16* str, - U32 text_height, - const U8 rgba[4]); - -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32GetCandidatePosition( - Iggy* f, F32* pdx, F32* pdy, F32* pdcomp_str_height); -IDOCN RADEXPFUNC void* RADEXPLINK IggyIMEGetFocusedTextfield(Iggy* f); -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, - const U8 rgb[3]); - -#endif - -//////////////////////////////////////////////////////////// -// -// Input focus handling -// - -typedef void* IggyFocusHandle; - -#define IGGY_FOCUS_NULL 0 - -typedef struct { - IggyFocusHandle object; // unique identifier of Iggy object - F32 x0, y0, x1, y1; // bounding box of displayed shape -} IggyFocusableObject; - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetFocusableObjects( - Iggy* f, IggyFocusHandle* current_focus, IggyFocusableObject* objs, - S32 max_obj, S32* num_obj); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFocusRS(Iggy* f, IggyFocusHandle object, - int focus_key_char); - -//////////////////////////////////////////////////////////// -// -// GDraw helper functions accessors -// - -RADEXPFUNC void* RADEXPLINK IggyGDrawMalloc(SINTa size); -#define IggyGDrawMalloc(size) \ - IggyGDrawMallocAnnotated(size, __FILE__, __LINE__) IDOCN -IDOCN RADEXPFUNC void* RADEXPLINK IggyGDrawMallocAnnotated(SINTa size, - const char* file, - int line); - -RADEXPFUNC void RADEXPLINK IggyGDrawFree(void* ptr); -RADEXPFUNC void RADEXPLINK IggyGDrawSendWarning(Iggy* f, char const* message, - ...); -RADEXPFUNC void RADEXPLINK IggyWaitOnFence(void* id, U32 fence); -RADEXPFUNC void RADEXPLINK IggyDiscardVertexBufferCallback(void* owner, - void* vertex_buffer); -RADEXPFUNC void RADEXPLINK IggyPlayerDebugEnableFilters(Iggy* f, rrbool enable); -RADEXPFUNC void RADEXPLINK IggyPlayerDebugSetTime(Iggy* f, F64 time); - -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchStartFrame(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchInit(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchMove(S32 dir); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchSplit(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchChooseEnd(S32 end); - -//////////////////////////////////////////////////////////// -// -// debugging -// - -IDOCN RADEXPFUNC void RADEXPLINK -IggyPlayerDebugUpdateReadyToTickWithFakeRender(Iggy* f); -IDOCN RADEXPFUNC void RADEXPLINK IggyDebugBreakOnAS3Exception(void); - -typedef struct { - S32 size; - char* source_file; - S32 source_line; - char* iggy_file; - char* info; -} IggyLeakResultData; - -typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData* data); - -typedef struct { - char* subcategory; - S32 subcategory_stringlen; - - S32 static_allocation_count; // number of non-freeable allocations for this - // subcategory - S32 static_allocation_bytes; // bytes of non-freeable allocations for this - // subcategory - - S32 dynamic_allocation_count; // number of freeable allocations for this - // subcategory - S32 dynamic_allocation_bytes; // estimated bytes of freeable allocations - // for this subcategory -} IggyMemoryUseInfo; - -RADEXPFUNC rrbool RADEXPLINK IggyDebugGetMemoryUseInfo( - Iggy* player, IggyLibrary lib, char const* category_string, - S32 category_stringlen, S32 iteration, IggyMemoryUseInfo* data); -RADEXPFUNC void RADEXPLINK -IggyDebugSetLeakResultCallback(IggyLeakResultCallback* leak_result_func); - -IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_todisk(char* filename_or_null, - U32 flags); -IDOCN RADEXPFUNC void RADEXPLINK -iggy_sync_check_fromdisk(char* filename_or_null, U32 flags); -IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_end(void); -#define IGGY_SYNCCHECK_readytotick 1U IDOCN - -RADDEFEND - -#endif diff --git a/targets/app/windows/Iggy/include/iggyexpruntime.h b/targets/app/windows/Iggy/include/iggyexpruntime.h deleted file mode 100644 index b9221bf7b..000000000 --- a/targets/app/windows/Iggy/include/iggyexpruntime.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __RAD_INCLUDE_IGGYEXPRUNTIME_H__ -#define __RAD_INCLUDE_IGGYEXPRUNTIME_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -#ifndef __RAD_HIGGYEXP_ -#define __RAD_HIGGYEXP_ -typedef void* HIGGYEXP; -#endif - -// idoc(parent,IggyExpRuntime_API) - -#define IGGYEXP_MIN_STORAGE 1024 IDOC -/* The minimum-sized block you must provide to $IggyExpCreate */ - -IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char* ip_address, S32 port, - void* storage, - S32 storage_size_in_bytes); -/* Opens a connection to $IggyExplorer and returns an $HIGGYEXP wrapping the -connection. - - $:ip_address The address of the machine running Iggy Explorer (can be numeric -with dots, or textual, including "localhost") - $:port The port number on which Iggy Explorer is listening for a network -connection (the default is 9190) - $:storage A small block of storage that needed to store the $HIGGYEXP, must -be at least $IGGYEXP_MIN_STORAGE - $:storage_size_in_bytes The size of the block pointer to by storage - -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy -Explorer can be contacted at the specified address/port. Otherwise returns a -non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ - -IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); -/* Closes and destroys a connection to $IggyExplorer */ - -IDOC RADEXPFUNC rrbool RADEXPLINK IggyExpCheckValidity(HIGGYEXP p); -/* Checks if the connection represented by an $HIGGYEXP is still valid, i.e. -still connected to $IggyExplorer. - -Returns true if the connection is still valid; returns false if it is not valid. - -This might happen if someone closes Iggy Explorer, Iggy Explorer crashes, or -the network fails. You can this to poll and detect these conditions and do -something in response, such as trying to open a new connection. - -An invalid $HIGGYEXP must still be shutdown with $IggyExpDestroy. */ - -RADDEFEND - -#endif //__RAD_INCLUDE_IGGYEXPRUNTIME_H__ \ No newline at end of file diff --git a/targets/app/windows/Iggy/include/iggyperfmon.h b/targets/app/windows/Iggy/include/iggyperfmon.h deleted file mode 100644 index 68f70b728..000000000 --- a/targets/app/windows/Iggy/include/iggyperfmon.h +++ /dev/null @@ -1,106 +0,0 @@ -// $$COPYRIGHT$$ - -#ifndef __RAD_INCLUDE_IGGYPERFMON_H__ -#define __RAD_INCLUDE_IGGYPERFMON_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -#ifndef __RAD_HIGGYPERFMON_ -#define __RAD_HIGGYPERFMON_ -typedef void* HIGGYPERFMON; -#endif - -// idoc(parent,IggyPerfmon_API) - -typedef void* RADLINK iggyperfmon_malloc(void* handle, U32 size); -typedef void RADLINK iggyperfmon_free(void* handle, void* ptr); - -IDOC RADEXPFUNC HIGGYPERFMON RADEXPLINK -IggyPerfmonCreate(iggyperfmon_malloc* perf_malloc, iggyperfmon_free* perf_free, - void* callback_handle); -/* Creates an IggyPerfmon. - -You must supply allocator functions. The amount allocated depends on the -complexity of the Iggys being profiled. */ - -typedef struct Iggy Iggy; -typedef struct GDrawFunctions GDrawFunctions; - -IDOC typedef union { - U32 bits; - struct { - U32 dpad_up : 1; - U32 dpad_down : 1; - U32 dpad_left : 1; - U32 dpad_right : 1; - U32 button_up : 1; // XBox Y, PS3 tri - U32 button_down : 1; // XBox A, PS3 X - U32 button_left : 1; // XBox X, PS3 square - U32 button_right : 1; // XBox B, PS3 circle - U32 shoulder_left_hi : 1; // LB/L1 - U32 shoulder_right_hi : 1; // RB/R1 - U32 trigger_left_low : 1; - U32 trigger_right_low : 1; - } field; -} IggyPerfmonPad; - -#define IggyPerfmonPadFromXInputStatePointer(pad, xis) \ - (pad).bits = 0, \ - (pad).field.dpad_up = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP), \ - (pad).field.dpad_down = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN), \ - (pad).field.dpad_left = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT), \ - (pad).field.dpad_right = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT), \ - (pad).field.button_up = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_Y), \ - (pad).field.button_down = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_A), \ - (pad).field.button_left = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_X), \ - (pad).field.button_right = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_B), \ - (pad).field.shoulder_left_hi = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER), \ - (pad).field.shoulder_right_hi = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER), \ - (pad).field.trigger_left_low = 0 != ((xis)->Gamepad.bLeftTrigger >= \ - XINPUT_GAMEPAD_TRIGGER_THRESHOLD), \ - (pad).field.trigger_right_low = 0 != ((xis)->Gamepad.bRightTrigger >= \ - XINPUT_GAMEPAD_TRIGGER_THRESHOLD) - -// All positions in window coords -IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonTickAndDraw( - HIGGYPERFMON p, GDrawFunctions* gdraw_funcs, const IggyPerfmonPad* pad, - int pm_tile_ul_x, int pm_tile_ul_y, int pm_tile_lr_x, int pm_tile_lr_y); -/* Draw and tick an IggyPerfmon. - -$:p A perfmon context previously created with IggyPerfmonCreate -$:gdraw_functions The same GDraw handle used for rendering Iggy -$:pad An abstracted gamepad state structure. iggyperfmon.h -includes an example that initializes the abstract gamepad from a 360 controller -as defined by XInput; this will work on both Windows and the Xbox 360. -$:pm_tile_ul_x The left coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_ul_y The top coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_lr_x The right coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_lr_y The bottom coordinate of the rectangle where the perfmon display -should be drawn - -You should only call this function when you want Iggy Perfmon to be visible. -See $IggyPerfmon for more information. */ - -IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonDestroy(HIGGYPERFMON p, - GDrawFunctions* iggy_draw); -/* Closes and destroys an IggyPerfmon */ - -RADDEFEND - -#endif //__RAD_INCLUDE_IGGYPERFMON_H__ \ No newline at end of file diff --git a/targets/app/windows/Iggy/include/rrCore.h b/targets/app/windows/Iggy/include/rrCore.h deleted file mode 100644 index 83110cabc..000000000 --- a/targets/app/windows/Iggy/include/rrCore.h +++ /dev/null @@ -1,2322 +0,0 @@ -/// ======================================================================== -// (C) Copyright 1994- 2014 RAD Game Tools, Inc. Global types header file -// ======================================================================== - -#ifndef __RADRR_COREH__ -#define __RADRR_COREH__ -#define RADCOPYRIGHT "Copyright (C) 1994-2014, RAD Game Tools, Inc." - -// __RAD16__ means 16 bit code (Win16) -// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac AND Win64) -// __RAD64__ means 64 bit code (x64) - -// Note oddness - __RAD32__ essentially means "at *least* 32-bit code". -// So, on 64-bit systems, both __RAD32__ and __RAD64__ will be defined. - -// __RADDOS__ means DOS code (16 or 32 bit) -// __RADWIN__ means Windows API (Win16, Win386, Win32s, Win64, Xbox, Xenon) -// __RADWINEXT__ means Windows 386 extender (Win386) -// __RADNT__ means Win32 or Win64 code -// __RADWINRTAPI__ means Windows RT API (Win 8, Win Phone, ARM, Durango) -// __RADMAC__ means Macintosh -// __RADCARBON__ means Carbon -// __RADMACH__ means MachO -// __RADXBOX__ means the XBox console -// __RADXENON__ means the Xenon console -// __RADDURANGO__ or __RADXBOXONE__ means Xbox One -// __RADNGC__ means the Nintendo GameCube -// __RADWII__ means the Nintendo Wii -// __RADWIIU__ means the Nintendo Wii U -// __RADNDS__ means the Nintendo DS -// __RADTWL__ means the Nintendo DSi (__RADNDS__ also defined) -// __RAD3DS__ means the Nintendo 3DS -// __RADPS2__ means the Sony PlayStation 2 -// __RADPSP__ means the Sony PlayStation Portable -// __RADPS3__ means the Sony PlayStation 3 -// __RADPS4__ means the Sony PlayStation 4 -// __RADANDROID__ means Android NDK -// __RADNACL__ means Native Client SDK -// __RADNTBUILDLINUX__ means building Linux on NT -// __RADLINUX__ means actually building on Linux (most likely with GCC) -// __RADPSP2__ means NGP -// __RADBSD__ means a BSD-style UNIX (OS X, FreeBSD, OpenBSD, NetBSD) -// __RADPOSIX__ means POSIX-compliant -// __RADQNX__ means QNX -// __RADIPHONE__ means iphone -// __RADIPHONESIM__ means iphone simulator - -// __RADX86__ means Intel x86 -// __RADMMX__ means Intel x86 MMX instructions are allowed -// __RADX64__ means Intel/AMD x64 (NOT IA64=Itanium) -// __RAD68K__ means 68K -// __RADPPC__ means PowerPC -// __RADMIPS__ means Mips (only R5900 right now) -// __RADARM__ mean ARM processors - -// __RADLITTLEENDIAN__ means processor is little-endian (x86) -// __RADBIGENDIAN__ means processor is big-endian (680x0, PPC) - -// __RADNOVARARGMACROS__ means #defines can't use ... - - #ifdef WINAPI_FAMILY - // If this is #defined, we might be in a Windows Store App. But - // VC++ by default #defines this to a symbolic name, not an integer - // value, and those names are defined in "winapifamily.h". So if - // WINAPI_FAMILY is #defined, #include the header so we can parse it. - #include - #define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) - #else - #define RAD_WINAPI_IS_APP 0 - #endif - - #ifndef __RADRES__ - // Theoretically, this is to pad structs on platforms that don't support pragma pack or do it poorly. (PS3, PS2) - // In general it is assumed that your padding is set via pragma, so this is just a struct. - #define RADSTRUCT struct - - #ifdef __GNUC_MINOR__ - // make a combined GCC version for testing : - - #define __RAD_GCC_VERSION__ (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - - /* Test for GCC > 3.2.0 */ - // #if GCC_VERSION > 30200 - #endif - - #if defined(__RADX32__) - - #define __RADX86__ - #define __RADMMX__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - // known platforms under the RAD generic build type - #if defined(_WIN32) || defined(_Windows) || defined(WIN32) || defined(__WINDOWS__) || defined(_WINDOWS) - #define __RADNT__ - #define __RADWIN__ - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #define __RADMAC__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #elif defined(__linux__) - #define __RADLINUX__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - -#elif defined(ANDROID) - #define __RADANDROID__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #ifdef __i386__ - #define __RADX86__ - #else - #define __RADARM__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(__QNX__) - #define __RAD32__ - #define __RADQNX__ - -#ifdef __arm__ - #define __RADARM__ -#elif defined __i386__ - #define __RADX86__ -#else - #error Unknown processor -#endif - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) -#elif defined(__linux__) && defined(__arm__) //This should pull in Raspberry Pi as well - - #define __RAD32__ - #define __RADLINUX__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(__native_client__) - #define __RADNACL__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || defined(_XBOX_ONE) - - #define __RADDURANGO__ 1 - #define __RADXBOXONE__ 1 - #if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat - #define __RADSEKRIT__ 1 - #endif - - #define __RADWIN__ - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - #define __RADWINRTAPI__ - - #elif defined(__ORBIS__) - - #define __RADPS4__ - #if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat - #define __RADSEKRIT2__ 1 - #endif - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP - - #define __RADWINRTAPI__ - #define __RADWIN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #if defined(_M_IX86) // WinRT on x86 - - #define __RAD32__ - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_X64) // WinRT on x64 - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RADMMX__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_ARM) // WinRT on ARM - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - - #else - - #error Unrecognized WinRT platform! - - #endif - - #elif defined(_WIN64) - - #define __RADWIN__ - #define __RADNT__ - // See note at top for why both __RAD32__ and __RAD64__ are defined. - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #elif defined(GENERIC_ARM) - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it - - #define __RADWIIU__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - - #elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) - - #define __RADWII__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #elif defined(NN_PLATFORM_CTR) - - #define __RAD3DS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(GEKKO) - - #define __RADNGC__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT // __restrict not supported on cw - - #elif defined(SDK_ARM9) || defined(SDK_TWL) || (defined(__arm) && defined(__MWERKS__)) - - #define __RADNDS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - - #if defined(SDK_TWL) - #define __RADTWL__ - #endif - - #elif defined(R5900) - - #define __RADPS2__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RAD64REGS__ - #define U128 u_long128 - - #if !defined(__MWERKS__) - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #elif defined(__psp__) - - #define __RADPSP__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(__psp2__) - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #define __RADPSP2__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - // need packed attribute for struct with snc? - #elif defined(__CELLOS_LV2__) - - // CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU - - #ifdef __SPU__ - #define __RADSPU__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #else - #define __RAD64REGS__ - #define __RADPS3__ - #define __RADPPC__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADALTIVEC__ - #endif - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #ifndef __LP32__ - #error "PS3 32bit ABI support only" - #endif - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #ifdef __APPLE__ - #include "TargetConditionals.h" - #endif - - #if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) - - // iPhone/iPad/iOS - #define __RADIPHONE__ - #define __RADMACAPI__ - - #define __RAD32__ - #if defined(__x86_64__) - #define __RAD64__ - #endif - - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADMACH__ - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR - #if defined( __x86_64__) - #define __RADX64__ - #else - #define __RADX86__ - #endif - #define __RADIPHONESIM__ - #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE - #define __RADARM__ - #endif - #else - - // An actual MacOSX machine - #define __RADMAC__ - #define __RADMACAPI__ - - #if defined(powerc) || defined(__powerc) || defined(__ppc__) - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #elif defined(__i386__) - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #elif defined(__x86_64__) - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RAD64REGS__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #else - #define __RAD68K__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #endif - - #define __RAD32__ - - #if defined(__MWERKS__) - #if (defined(__cplusplus) || ! __option(only_std_keywords)) - #define RADINLINE inline - #endif - #ifdef __MACH__ - #define __RADMACH__ - #endif - #elif defined(__MRC__) - #if defined(__cplusplus) - #define RADINLINE inline - #endif - #elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) - #define RADINLINE inline - #define __RADMACH__ - - #undef RADRESTRICT /* could have been defined above... */ - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #ifdef __RADX86__ - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - - #ifdef TARGET_API_MAC_CARBON - #if TARGET_API_MAC_CARBON - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - #endif - #endif - #elif defined(__linux__) - - #define __RADLINUX__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #ifdef __x86_64 - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RAD64REGS__ - #else - #define __RAD32__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #else - - #if _MSC_VER >= 1400 - #undef RADRESTRICT - #define RADRESTRICT __restrict - #else - #define RADRESTRICT - #define __RADNOVARARGMACROS__ - #endif - - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #else - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #endif - - #ifdef __MWERKS__ - #define _WIN32 - #endif - - #ifdef __DOS__ - #define __RADDOS__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #define __RADNOVARARGMACROS__ - #endif - - #ifdef __386__ - #define __RAD32__ - #endif - - #ifdef _Windows //For Borland - #ifdef __WIN32__ - #define WIN32 - #else - #define __WINDOWS__ - #endif - #endif - - #ifdef _WINDOWS //For MS - #ifndef _WIN32 - #define __WINDOWS__ - #endif - #endif - - #ifdef _WIN32 - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #elif !defined(__RADWINRTAPI__) - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __NT__ - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __WINDOWS_386__ - #define __RADWIN__ - #define __RADWINEXT__ - #define __RAD32__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #else - #ifdef __WINDOWS__ - #define __RADWIN__ - #define __RAD16__ - #else - #ifdef WIN32 - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #endif - #endif - #endif - #endif - #endif - - #ifdef __WATCOMC__ - #define RADINLINE - #else - #define RADINLINE __inline - #endif - #endif - - #if defined __RADMAC__ || defined __RADIPHONE__ - #define __RADBSD__ - #endif - - #if defined __RADBSD__ || defined __RADLINUX__ - #define __RADPOSIX__ - #endif - - #if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ - !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ - !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ - !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && !defined(__RADSPU__) && \ - !defined(__RADWII__) && !defined(__RADIPHONE__) && !defined(__RADX32__) && !defined(__RADARM__) && \ - !defined(__RADWIIU__) && !defined(__RADANDROID__) && !defined(__RADNACL__) && !defined (__RADQNX__) ) - #error "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." - #endif - - - #ifdef __RADFINAL__ - #define RADTODO(str) { char __str[0]=str; } - #else - #define RADTODO(str) - #endif - - #ifdef __RADX32__ - #if defined(_MSC_VER) - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #else - #define RADLINK __attribute__((stdcall)) - #define RADEXPLINK __attribute__((stdcall)) - #endif - #define RADEXPFUNC RADDEFFUNC - - #elif (defined(__RADNGC__) || defined(__RADWII__) || defined( __RADPS2__) || \ - defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ - defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ - (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || defined(__RADWIIU__) || defined(__RADPS4__) ) - - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADANDROID__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADNACL__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADLINUX__) || defined (__RADQNX__) - - #ifdef __RAD64__ - #define RADLINK - #define RADEXPLINK - #else - #define RADLINK __attribute__((cdecl)) - #define RADEXPLINK __attribute__((cdecl)) - #endif - - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADMAC__) - - // this define is for CodeWarrior 11's stupid new libs (even though - // we don't use longlong's). - - #define __MSL_LONGLONG_SUPPORT__ - - #define RADLINK - #define RADEXPLINK - - #if defined(__CFM68K__) || defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(export) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(import) - #endif - #else - #if defined(__RADMACH__) && !defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #define RADASMLINK - - #else - - #ifdef __RADNT__ - #ifndef _WIN32 - #define _WIN32 - #endif - #ifndef WIN32 - #define WIN32 - #endif - #endif - - #ifdef __RADWIN__ - #ifdef __RAD32__ - - #ifdef __RADXBOX__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADXENON__) || defined(__RADDURANGO__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADWINRTAPI__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - - #elif defined(__RADNTBUILDLINUX__) - - #define RADLINK __cdecl - #define RADEXPLINK __cdecl - #define RADEXPFUNC RADDEFFUNC - - #else - #ifdef __RADNT__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #ifdef __BORLANDC__ - #if __BORLANDC__<=0x460 - #undef RADEXPFUNC - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal __export - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - - #define RADASMLINK __cdecl - - #endif - - #if !defined(__RADXBOX__) && !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) - #ifdef __RADWIN__ - #ifndef _WINDOWS - #define _WINDOWS - #endif - #endif - #endif - - #ifdef __RADLITTLEENDIAN__ - #ifdef __RADBIGENDIAN__ - #error both endians !? - #endif - #endif - - #if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) - #error neither endian! - #endif - - - //----------------------------------------------------------------- - - #ifndef RADDEFFUNC - - #ifdef __cplusplus - #define RADDEFFUNC extern "C" - #define RADDEFSTART extern "C" { - #define RADDEFEND } - #define RADDEFINEDATA extern "C" - #define RADDECLAREDATA extern "C" - #define RADDEFAULT( val ) =val - - #define RR_NAMESPACE rr - #define RR_NAMESPACE_START namespace RR_NAMESPACE { - #define RR_NAMESPACE_END }; - #define RR_NAMESPACE_USE using namespace RR_NAMESPACE; - - #else - #define RADDEFFUNC - #define RADDEFSTART - #define RADDEFEND - #define RADDEFINEDATA - #define RADDECLAREDATA extern - #define RADDEFAULT( val ) - - #define RR_NAMESPACE - #define RR_NAMESPACE_START - #define RR_NAMESPACE_END - #define RR_NAMESPACE_USE - - #endif - - #endif - - // probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) - #if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || defined(__RADPSP2__) || \ - defined(__RADPS3__) || defined(__RADSPU__) || defined(__RADPS4__) || \ - defined(__RADLINUX__) || defined(__RADMAC__)) || defined(__RADNDS__) || defined(__RAD3DS__) || \ - defined(__RADIPHONE__) || defined(__RADANDROID__) || defined (__RADQNX__) - #define RAD_ALIGN(type,var,num) type __attribute__ ((aligned (num))) var - #elif (defined(__RADNGC__) || defined(__RADPS2__)) - #define RAD_ALIGN(type,var,num) __attribute__ ((aligned (num))) type var - #elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) - #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var - #else - // NOTE: / / is a guaranteed parse error in C/C++. - #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / - #endif - - // WARNING : RAD_TLS should really only be used for debug/tools stuff - // it's not reliable because even if we are built as a lib, our lib can - // be put into a DLL and then it doesn't work - #if defined(__RADNT__) || defined(__RADXENON__) - #ifndef __RADINDLL__ - // note that you can't use this in windows DLLs - #define RAD_TLS(type,var) __declspec(thread) type var - #endif - #elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) - // works on PS3/gcc I believe : - #define RAD_TLS(type,var) __thread type var - #else - // RAD_TLS not defined - #endif - - // Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. - // The size of integers is specified explicitly in the code, i.e. u32 or whatever. - - #define RAD_S8 signed char - #define RAD_U8 unsigned char - - #if defined(__RAD64__) - // Remember that __RAD32__ will also be defined! - #if defined(__RADX64__) - // x64 still has 32-bit ints! - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // But pointers are 64 bits. - #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) - #define RAD_SINTa __w64 signed int64_t - #define RAD_UINTa __w64 unsigned int64_t - #else // non-vc.net compiler or /Wp64 turned off - #define RAD_UINTa unsigned long long - #define RAD_SINTa signed long long - #endif - #else - #error Unknown 64-bit processor (see radbase.h) - #endif - #elif defined(__RAD32__) - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // Pointers are 32 bits. - - #if ( ( defined(_MSC_VER) && (_MSC_VER >= 1300 ) ) && ( defined(_Wp64) && ( _Wp64 ) ) ) - #define RAD_SINTa __w64 signed long - #define RAD_UINTa __w64 unsigned long - #else // non-vc.net compiler or /Wp64 turned off - #ifdef _Wp64 - #define RAD_SINTa signed long - #define RAD_UINTa unsigned long - #else - #define RAD_SINTa signed int - #define RAD_UINTa unsigned int - #endif - #endif - #else - #define RAD_U32 unsigned long - #define RAD_S32 signed long - // Pointers in 16-bit land are still 32 bits. - #define RAD_UINTa unsigned long - #define RAD_SINTa signed long - #endif - - #define RAD_F32 float - #if defined(__RADPS2__) || defined(__RADPSP__) - typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_F64; - #define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 - #else - #define RAD_F64 double - #define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 - #endif - - #if (defined(__RADMAC__) || defined(__MRC__) || defined( __RADNGC__ ) || \ - defined(__RADLINUX__) || defined( __RADWII__ ) || defined(__RADWIIU__) || \ - defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADPS4__) || \ - defined(__RADSPU__) || defined(__RADIPHONE__) || defined(__RADNACL__) || defined( __RADANDROID__) || defined( __RADQNX__ ) ) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADPS2__) - #define RAD_U64 unsigned long - #define RAD_S64 signed long - #elif defined(__RADARM__) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADX64__) || defined(__RAD32__) - #define RAD_U64 unsigned int64_t - #define RAD_S64 signed int64_t - #else - // 16-bit - typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_U64; - typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s - { // while using the same space - RAD_S32 vals[ 2 ]; - } RAD_S64; - #endif - - #if defined(__RAD32__) - #define PTR4 - #define RAD_U16 unsigned short - #define RAD_S16 signed short - #else - #define PTR4 __far - #define RAD_U16 unsigned int - #define RAD_S16 signed int - #endif - - //------------------------------------------------- - // RAD_PTRBITS and such defined here without using sizeof() - // so that they can be used in align() and other macros - - #ifdef __RAD64__ - - #define RAD_PTRBITS 64 - #define RAD_PTRBYTES 8 - #define RAD_TWOPTRBYTES 16 - - #else - - #define RAD_PTRBITS 32 - #define RAD_PTRBYTES 4 - #define RAD_TWOPTRBYTES 8 - - #endif - - - //------------------------------------------------- - // UINTr = int the size of a register - - #ifdef __RAD64REGS__ - - #define RAD_UINTr RAD_U64 - #define RAD_SINTr RAD_S64 - - #else - - #define RAD_UINTr RAD_U32 - #define RAD_SINTr RAD_S32 - - #endif - - //=========================================================================== - - /* - // CB : meh this is enough of a mess that it's probably best to just let each - #if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define __RADX86INTRIN2003__ - #endif - */ - - // RADASSUME(expr) tells the compiler that expr is always true - // RADUNREACHABLE must never be reachable - even in event of error - // eg. it's okay for compiler to generate completely invalid code after RADUNREACHABLE - - #ifdef _MSC_VER - #define RADFORCEINLINE __forceinline - #if _MSC_VER >= 1300 - #define RADNOINLINE __declspec(noinline) - #else - #define RADNOINLINE - #endif - #define RADUNREACHABLE __assume(0) - #define RADASSUME(exp) __assume(exp) - #elif defined(__clang__) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #define RADUNREACHABLE __builtin_unreachable() - - #if __has_builtin(__builtin_assume) - #define RADASSUME(exp) __builtin_assume(exp) - #else - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #endif - #elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #if __RAD_GCC_VERSION__ >= 40500 - #define RADUNREACHABLE __builtin_unreachable() - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #else - #define RADUNREACHABLE RAD_INFINITE_LOOP( RR_BREAK(); ) - #define RADASSUME(exp) - #endif - #elif defined(__CWCC__) - #define RADFORCEINLINE inline - #define RADNOINLINE __attribute__((never_inline)) - #define RADUNREACHABLE - #define RADASSUME(x) (void)0 - #else - // ? #define RADFORCEINLINE ? - #define RADFORCEINLINE inline - #define RADNOINLINE - #define RADASSUME(x) (void)0 - #endif - - //=========================================================================== - - // RAD_ALIGN_HINT tells the compiler how a given pointer is aligned - // it *must* be true, but the compiler may or may not use that information - // it is not for cases where the pointer is to an inherently aligned data type, - // it's when the compiler cannot tell the alignment but you have extra information. - // eg : - // U8 * ptr = rrMallocAligned(256,16); - // RAD_ALIGN_HINT(ptr,16,0); - - #ifdef __RADSPU__ - #define RAD_ALIGN_HINT(ptr,alignment,offset) __align_hint(ptr,alignment,offset); RR_ASSERT( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #else - #define RAD_ALIGN_HINT(ptr,alignment,offset) RADASSUME( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #endif - - //=========================================================================== - - // RAD_EXPECT is to tell the compiler the *likely* value of an expression - // different than RADASSUME in that expr might not have that value - // it's use for branch code layout and static branch prediction - // condition can technically be a variable but should usually be 0 or 1 - - #if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) - - // __builtin_expect returns value of expr - #define RAD_EXPECT(expr,cond) __builtin_expect(expr,cond) - - #else - - #define RAD_EXPECT(expr,cond) (expr) - - #endif - - // helpers for doing an if ( ) with expect : - // if ( RAD_LIKELY(expr) ) { ... } - - #define RAD_LIKELY(expr) RAD_EXPECT(expr,1) - #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) - - //=========================================================================== - - // __RADX86ASM__ means you can use __asm {} style inline assembly - #if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) - #define __RADX86ASM__ - #endif - - //------------------------------------------------- - // typedefs : - - #ifndef RADNOTYPEDEFS - - #ifndef S8_DEFINED - #define S8_DEFINED - typedef RAD_S8 S8; - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - typedef RAD_U8 U8; - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - typedef RAD_S16 S16; - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - typedef RAD_U16 U16; - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - typedef RAD_S32 S32; - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - typedef RAD_U32 U32; - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - typedef RAD_S64 S64; - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - typedef RAD_U64 U64; - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - typedef RAD_F32 F32; - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - typedef RAD_F64 F64; - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - typedef RAD_F64_OR_32 F64_OR_32; - #endif - - // UINTa and SINTa are the ints big enough for an address - - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - typedef RAD_SINTa SINTa; - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - typedef RAD_UINTa UINTa; - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - typedef RAD_UINTr UINTr; - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - typedef RAD_SINTr SINTr; - #endif - - #elif !defined(RADNOTYPEDEFINES) - - #ifndef S8_DEFINED - #define S8_DEFINED - #define S8 RAD_S8 - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - #define U8 RAD_U8 - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - #define S16 RAD_S16 - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - #define U16 RAD_U16 - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - #define S32 RAD_S32 - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - #define U32 RAD_U32 - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - #define S64 RAD_S64 - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - #define U64 RAD_U64 - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - #define F32 RAD_F32 - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - #define F64 RAD_F64 - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - #define F64_OR_32 RAD_F64_OR_32 - #endif - - // UINTa and SINTa are the ints big enough for an address (pointer) - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - #define SINTa RAD_SINTa - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - #define UINTa RAD_UINTa - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - #define UINTr RAD_UINTr - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - #define SINTr RAD_SINTr - #endif - - #endif - - /// Some error-checking. - #if defined(__RAD64__) && !defined(__RAD32__) - // See top of file for why this is. - #error __RAD64__ must not be defined without __RAD32__ (see radbase.h) - #endif - -#ifdef _MSC_VER - // microsoft compilers - - #if _MSC_VER >= 1400 - #define RAD_STATEMENT_START \ - do { - - #define RAD_STATEMENT_END_FALSE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(0) \ - __pragma(warning(pop)) - - #define RAD_STATEMENT_END_TRUE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(1) \ - __pragma(warning(pop)) - - #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT - #endif -#else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT -#endif - -#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT - #define RAD_STATEMENT_START \ - do { - - #define RAD_STATEMENT_END_FALSE \ - } while ( (void)0,0 ) - - #define RAD_STATEMENT_END_TRUE \ - } while ( (void)1,1 ) - -#endif - -#define RAD_STATEMENT_WRAPPER( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_FALSE - -#define RAD_INFINITE_LOOP( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_TRUE - - -// Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later -# define RR_UNUSED_VARIABLE(x) (void) x -#else -# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) -#endif - -//----------------------------------------------- -// RR_UINT3264 is a U64 in 64-bit code and a U32 in 32-bit code -// eg. it's pointer sized and the same type as a U32/U64 of the same size -// -// @@ CB 05/21/2012 : I think RR_UINT3264 may be deprecated -// it was useful back when UINTa was /Wp64 -// but since we removed that maybe it's not anymore ? -// - -#ifdef __RAD64__ -#define RR_UINT3264 U64 -#else -#define RR_UINT3264 U32 -#endif - -//RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); - -//-------------------------------------------------- - -// RR_LINESTRING is the current line number as a string -#define RR_STRINGIZE( L ) #L -#define RR_DO_MACRO( M, X ) M(X) -#define RR_STRINGIZE_DELAY( X ) RR_DO_MACRO( RR_STRINGIZE, X ) -#define RR_LINESTRING RR_STRINGIZE_DELAY( __LINE__ ) - -#define RR_CAT(X,Y) X ## Y - -// RR_STRING_JOIN joins strings in the preprocessor and works with LINESTRING -#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) -#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) -#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2 - -// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to declare -// variable names and they won't conflict with each other -// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works - -#ifdef _MSC_VER - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__COUNTER__) -#else - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__LINE__) -#endif - -//-------------------------------------------------- -// current plan is to use "rrbool" with plain old "true" and "false" -// if true and false give us trouble we might have to go to rrtrue and rrfalse -// BTW there's a danger for evil bugs here !! If you're checking == true -// then the rrbool must be set to exactly "1" not just "not zero" !! - -#ifndef RADNOTYPEDEFS - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - typedef S32 rrbool; - typedef S32 RRBOOL; - #endif -#elif !defined(RADNOTYPEDEFINES) - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - #define rrbool S32 - #define RRBOOL S32 - #endif -#endif - -//-------------------------------------------------- -// Range macros - - #ifndef RR_MIN - #define RR_MIN(a,b) ( (a) < (b) ? (a) : (b) ) - #endif - - #ifndef RR_MAX - #define RR_MAX(a,b) ( (a) > (b) ? (a) : (b) ) - #endif - - #ifndef RR_ABS - #define RR_ABS(a) ( ((a) < 0) ? -(a) : (a) ) - #endif - - #ifndef RR_CLAMP - #define RR_CLAMP(val,lo,hi) RR_MAX( RR_MIN(val,hi), lo ) - #endif - -//-------------------------------------------------- -// Data layout macros - - #define RR_ARRAY_SIZE(array) ( sizeof(array)/sizeof(array[0]) ) - - // MEMBER_OFFSET tells you the offset of a member in a type - #ifdef __RAD3DS__ - #define RR_MEMBER_OFFSET(type,member) (unsigned int)(( (char *) &(((type *)0)->member) - (char *) 0 )) - #elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADSPU__) - // offsetof() gets mucked with by system headers on android, making things dependent on #include order. - #define RR_MEMBER_OFFSET(type,member) __builtin_offsetof(type, member) - #elif defined(__RADLINUX__) - #define RR_MEMBER_OFFSET(type,member) (offsetof(type, member)) - #else - #define RR_MEMBER_OFFSET(type,member) ( (size_t) (UINTa) &(((type *)0)->member) ) - #endif - - // MEMBER_SIZE tells you the size of a member in a type - #define RR_MEMBER_SIZE(type,member) ( sizeof( ((type *) 0)->member) ) - - // just to make gcc shut up about derefing null : - #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) - #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) - - // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object - // you should then RR_ASSERT( &(ret->member) == ptr ); - #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) - -//-------------------------------------------------- -// Cache / prefetch macros : - -// RR_PREFETCH for various platforms : -// -// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan -// platforms that automatically prefetch sequential (eg. PC) should be a no-op here -// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined -// (may be a no-op, may be a normal prefetch, may zero memory) -// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't do it past the end of buffers - -#ifdef __RADX86__ - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // nop -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop - -#elif defined(__RADXENON__) - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((int)(offset),(void *)(ptr)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz128((int)(offset),(void *)(ptr)) - -#elif defined(__RADPS3__) - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz((char *)(ptr) + (int)(offset)) - -#elif defined(__RADSPU__) - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop - -#elif defined(__RADWII__) || defined(__RADWIIU__) - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP for now -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop - -#elif defined(__RAD3DS__) - -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __pld((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __pldw((char *)(ptr) + (int)(offset)) - -#else - -// other platform -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // need_prefetch // compile error -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // need_writezero // error - -#endif - -//-------------------------------------------------- -// LIGHTWEIGHT ASSERTS without rrAssert.h - -RADDEFSTART - -// set up RR_BREAK : - - #ifdef __RADNGC__ - - #define RR_BREAK() asm(" .long 0x00000001") - #define RR_CACHE_LINE_SIZE xxx - - #elif defined(__RADWII__) - - #define RR_BREAK() __asm__ volatile("trap") - #define RR_CACHE_LINE_SIZE 32 - - #elif defined(__RADWIIU__) - - #define RR_BREAK() asm("trap") - #define RR_CACHE_LINE_SIZE 32 - - #elif defined(__RAD3DS__) - - #define RR_BREAK() *((int volatile*)0)=0 - #define RR_CACHE_LINE_SIZE 32 - - #elif defined(__RADNDS__) - - #define RR_BREAK() asm("BKPT 0") - #define RR_CACHE_LINE_SIZE xxx - - #elif defined(__RADPS2__) - - #define RR_BREAK() __asm__ volatile("break") - #define RR_CACHE_LINE_SIZE 64 - - #elif defined(__RADPSP__) - - #define RR_BREAK() __asm__("break 0") - #define RR_CACHE_LINE_SIZE 64 - - #elif defined(__RADPSP2__) - - #define RR_BREAK() { __asm__ volatile("bkpt 0x0000"); } - #define RR_CACHE_LINE_SIZE 32 - - #elif defined (__RADQNX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined (__RADARM__) && defined (__RADLINUX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADSPU__) - - #define RR_BREAK() __asm volatile ("stopd 0,1,1") - #define RR_CACHE_LINE_SIZE 128 - - #elif defined(__RADPS3__) - - // #ifdef snPause // in LibSN.h - // snPause - // __asm__ volatile ( "tw 31,1,1" ) - - #define RR_BREAK() __asm__ volatile ( "tw 31,1,1" ) - //#define RR_BREAK() __asm__ volatile("trap"); - - #define RR_CACHE_LINE_SIZE 128 - - #elif defined(__RADMAC__) - - #if defined(__GNUG__) || defined(__GNUC__) - #ifdef __RADX86__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #else - #define RR_BREAK() __builtin_trap() - #endif - #else - #ifdef __RADMACH__ - void DebugStr(unsigned char const *); - #else - void pascal DebugStr(unsigned char const *); - #endif - #define RR_BREAK() DebugStr("\pRR_BREAK() was called") - #endif - - #define RR_CACHE_LINE_SIZE 64 - - #elif defined(__RADIPHONE__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADXENON__) - #define RR_BREAK() assert(0) - #define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADANDROID__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADPS4__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADNACL__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #else - // x86 : - #define RR_CACHE_LINE_SIZE 64 - - #ifdef __RADLINUX__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #elif defined(__WATCOMC__) - - void RR_BREAK( void ); - #pragma aux RR_BREAK = "int 0x3"; - - #elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 - - #define RR_BREAK __debugbreak - - #else - - #define RR_BREAK() RAD_STATEMENT_WRAPPER( __asm {int 3} ) - - #endif - - #endif - -// simple RR_ASSERT : - -// CB 5-27-10 : use RR_DO_ASSERTS to toggle asserts on and off : -#if (defined(_DEBUG) && !defined(NDEBUG)) || defined(ASSERT_IN_RELEASE) - #define RR_DO_ASSERTS -#endif - -/********* - -rrAsserts : - -RR_ASSERT(exp) - the normal assert thing, toggled with RR_DO_ASSERTS -RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds (including final!) -RR_ASSERT_RELEASE(exp) - assert that you want to test even in release builds (not for final!) -RR_ASSERT_LITE(exp) - normal assert is not safe from threads or inside malloc; use this instead -RR_DURING_ASSERT(exp) - wrap operations that compute stuff for assert in here -RR_DO_ASSERTS - toggle tells you if asserts are enabled or not - -RR_BREAK() - generate a debug break - always ! -RR_ASSERT_BREAK() - RR_BREAK for asserts ; disable with RAD_NO_BREAK - -RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no condition -RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds too -RR_CANT_GET_HERE() - put in spots execution should never go -RR_COMPILER_ASSERT(exp) - checks constant conditions at compile time - -RADTODO - note to search for nonfinal stuff -RR_PRAGMA_MESSAGE - message dealy, use with #pragma in MSVC - -*************/ - -//----------------------------------------------------------- - - -#if defined(__GNUG__) || defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER > 1200) - #define RR_FUNCTION_NAME __FUNCTION__ -#else - #define RR_FUNCTION_NAME 0 - - // __func__ is in the C99 standard -#endif - -//----------------------------------------------------------- - -// rrDisplayAssertion might just log, or it might pop a message box, depending on settings -// rrDisplayAssertion returns whether you should break or not -typedef rrbool (RADLINK fp_rrDisplayAssertion)(int * Ignored, const char * fileName,const int line,const char * function,const char * message); - -extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; - -// if I have func pointer, call it, else true ; true = do int 3 -#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) - -//----------------------------------------------------------- - -// RAD_NO_BREAK : option if you don't like your assert to break -// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional -#ifdef RAD_NO_BREAK -#define RR_ASSERT_BREAK() 0 -#else -#define RR_ASSERT_BREAK() RR_BREAK() -#endif - -// assert_always is on FINAL ! -#define RR_ASSERT_ALWAYS(exp) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( ! (exp) ) { if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,#exp) ) RR_ASSERT_BREAK(); } ) - -// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, you're bad -#define RR_ASSERT_FAILURE_ALWAYS(str) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,str) ) RR_ASSERT_BREAK(); ) - -#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) - -//----------------------------------- -#ifdef RR_DO_ASSERTS - -#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) -#define RR_ASSERT_NO_ASSUME(exp) RR_ASSERT_ALWAYS(exp) -// RR_DURING_ASSERT is to set up expressions or declare variables that are only used in asserts -#define RR_DURING_ASSERT(exp) exp - -#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) - -// RR_CANT_GET_HERE is for like defaults in switches that should never be hit -#define RR_CANT_GET_HERE() RAD_STATEMENT_WRAPPER( RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE; ) - - -#else // RR_DO_ASSERTS //----------------------------------- - -#define RR_ASSERT(exp) (void)0 -#define RR_ASSERT_LITE(exp) (void)0 -#define RR_ASSERT_NO_ASSUME(exp) (void)0 - -#define RR_DURING_ASSERT(exp) (void)0 - -#define RR_ASSERT_FAILURE(str) (void)0 - -#define RR_CANT_GET_HERE() RADUNREACHABLE - -#endif // RR_DO_ASSERTS //----------------------------------- - -//================================================================= - -// RR_ASSERT_RELEASE is on in release build, but not final - -#ifndef __RADFINAL__ - -#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) - -#else - -#define RR_ASSERT_RELEASE(exp) (void)0 -#define RR_ASSERT_LITE_RELEASE(exp) (void)0 - -#endif - -// BH: This never gets compiled away except for __RADFINAL__ -#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE - -#define rrAssert RR_ASSERT -#define rrassert RR_ASSERT - -#ifdef _MSC_VER - // without this, our assert errors... - #if _MSC_VER >= 1300 - #pragma warning( disable : 4127) // conditional expression is constant - #endif -#endif - -//--------------------------------------- -// Get/Put from memory in little or big endian : -// -// val = RR_GET32_BE(ptr) -// RR_PUT32_BE(ptr,val) -// -// available here : -// RR_[GET/PUT][16/32]_[BE/LE][_UNALIGNED][_OFFSET] -// -// if you don't specify _UNALIGNED , then ptr & offset shoud both be aligned to type size -// _OFFSET is in *bytes* ! - -// you can #define RR_GET_RESTRICT to make all RR_GETs be RESTRICT -// if you set nothing they are not - -#ifdef RR_GET_RESTRICT -#define RR_GET_PTR_POST RADRESTRICT -#endif -#ifndef RR_GET_PTR_POST -#define RR_GET_PTR_POST -#endif - -// native version of get/put is always trivial : - -#define RR_GET16_NATIVE(ptr) *((const U16 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT16_NATIVE(ptr,val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U16_PTR_OFFSET(ptr,offset) ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET16_NATIVE_OFFSET(ptr,offset) *( RR_U16_PTR_OFFSET((ptr),offset) ) -#define RR_PUT16_NATIVE_OFFSET(ptr,val,offset) *( RR_U16_PTR_OFFSET((ptr),offset)) = (val) - -#define RR_GET32_NATIVE(ptr) *((const U32 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT32_NATIVE(ptr,val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U32_PTR_OFFSET(ptr,offset) ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_NATIVE_OFFSET(ptr,offset) *( RR_U32_PTR_OFFSET((ptr),offset) ) -#define RR_PUT32_NATIVE_OFFSET(ptr,val,offset) *( RR_U32_PTR_OFFSET((ptr),offset)) = (val) - -#define RR_GET64_NATIVE(ptr) *((const U64 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT64_NATIVE(ptr,val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U64_PTR_OFFSET(ptr,offset) ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET64_NATIVE_OFFSET(ptr,offset) *( RR_U64_PTR_OFFSET((ptr),offset) ) -#define RR_PUT64_NATIVE_OFFSET(ptr,val,offset) *( RR_U64_PTR_OFFSET((ptr),offset)) = (val) - -//--------------------------------------------------- - -#ifdef __RADLITTLEENDIAN__ - -#define RR_GET16_LE RR_GET16_NATIVE -#define RR_PUT16_LE RR_PUT16_NATIVE -#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET - -#define RR_GET32_LE RR_GET32_NATIVE -#define RR_PUT32_LE RR_PUT32_NATIVE -#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET - -#define RR_GET64_LE RR_GET64_NATIVE -#define RR_PUT64_LE RR_PUT64_NATIVE -#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET - -#else - -#define RR_GET16_BE RR_GET16_NATIVE -#define RR_PUT16_BE RR_PUT16_NATIVE -#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET - -#define RR_GET32_BE RR_GET32_NATIVE -#define RR_PUT32_BE RR_PUT32_NATIVE -#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET - -#define RR_GET64_BE RR_GET64_NATIVE -#define RR_PUT64_BE RR_PUT64_NATIVE -#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET - -#endif - -//------------------------- -// non-native Get/Put implementations go here : - -#if defined(__RADX86__) -// good implementation for X86 : - -#if (_MSC_VER >= 1300) - -unsigned short __cdecl _byteswap_ushort (unsigned short _Short); -unsigned long __cdecl _byteswap_ulong (unsigned long _Long); -#pragma intrinsic(_byteswap_ushort, _byteswap_ulong) - -#define RR_BSWAP16 _byteswap_ushort -#define RR_BSWAP32 _byteswap_ulong - -unsigned int64_t __cdecl _byteswap_uint64 (unsigned int64_t val); -#pragma intrinsic(_byteswap_uint64) -#define RR_BSWAP64 _byteswap_uint64 - -#elif defined(_MSC_VER) // VC6 - -RADFORCEINLINE unsigned long RR_BSWAP16 (unsigned long _Long) -{ - __asm { - mov eax, [_Long] - rol ax, 8 - mov [_Long], eax; - } - return _Long; -} - -RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long) -{ - __asm { - mov eax, [_Long] - bswap eax - mov [_Long], eax - } - return _Long; -} - -RADFORCEINLINE unsigned int64_t RR_BSWAP64 (unsigned int64_t _Long) -{ - __asm { - mov eax, DWORD PTR _Long - mov edx, DWORD PTR _Long+4 - bswap eax - bswap edx - mov DWORD PTR _Long, edx - mov DWORD PTR _Long+4, eax - } - return _Long; -} - -#elif defined(__GNUC__) || defined(__clang__) - -// GCC has __builtin_bswap16, but Clang only seems to have added it recently. -// We use __builtin_bswap32/64 but 16 just uses the macro version. (No big -// deal if that turns into shifts anyway) -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32 __builtin_bswap32 -#define RR_BSWAP64 __builtin_bswap64 - -#endif - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = (U16) RR_BSWAP16(val) -#define RR_GET16_BE_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,val,offset) *RR_U16_PTR_OFFSET(ptr,offset) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#define RR_GET32_BE_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,val,offset) *RR_U32_PTR_OFFSET(ptr,offset) = RR_BSWAP32(val) - -#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) -#define RR_PUT64_BE(ptr,val) *((U64 *)(ptr)) = RR_BSWAP64(val) -#define RR_GET64_BE_OFFSET(ptr,offset) RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_BE_OFFSET(ptr,val,offset) *RR_U64_PTR_OFFSET(ptr,offset) = RR_BSWAP64(val) - -// end _MSC_VER - -#elif defined(__RADXENON__) // Xenon has built-in funcs for this - -unsigned short __loadshortbytereverse(int offset, const void *base); -unsigned long __loadwordbytereverse (int offset, const void *base); - -void __storeshortbytereverse(unsigned short val, int offset, void *base); -void __storewordbytereverse (unsigned int val, int offset, void *base); - -#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) -#define RR_PUT16_LE(ptr,val) __storeshortbytereverse((U16) (val), 0, ptr) - -#define RR_GET16_LE_OFFSET(ptr,offset) __loadshortbytereverse(offset, ptr) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __storeshortbytereverse((U16) (val), offset, ptr) - -#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) -#define RR_PUT32_LE(ptr,val) __storewordbytereverse((U32) (val), 0, ptr) - -#define RR_GET32_LE_OFFSET(ptr,offset) __loadwordbytereverse(offset, ptr) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __storewordbytereverse((U32) (val), offset, ptr) - -#define RR_GET64_LE(ptr) ( ((U64)RR_GET32_OFFSET_LE(ptr,4)<<32) | RR_GET32_LE(ptr) ) -#define RR_PUT64_LE(ptr,val) RR_PUT32_LE(ptr, (U32) (val)), RR_PUT32_OFFSET_LE(ptr, (U32) ((val)>>32),4) - -#elif defined(__RADPS3__) - -#include - -#define RR_GET16_LE(ptr) __lhbrx(ptr) -#define RR_PUT16_LE(ptr,val) __sthbrx(ptr, (U16) (val)) - -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16) (val)) - -#define RR_GET32_LE(ptr) __lwbrx(ptr) -#define RR_PUT32_LE(ptr,val) __stwbrx(ptr, (U32) (val)) - -#define RR_GET64_LE(ptr) __ldbrx(ptr) -#define RR_PUT64_LE(ptr,val) __stdbrx(ptr, (U32) (val)) - -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32) (val)) - -#elif defined(__RADWII__) - -#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) -#define RR_PUT16_LE(ptr,val) __sthbrx((U16) (val), ptr, 0) - -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(ptr, offset) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx((U16) (val), ptr, offset) - -#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) -#define RR_PUT32_LE(ptr,val) __stwbrx((U32) (val), ptr, 0) - -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(ptr, offset) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx((U32) (val), ptr, offset) - -#elif defined(__RAD3DS__) - -#define RR_GET16_BE(ptr) __rev16(*(U16 *) (ptr)) -#define RR_PUT16_BE(ptr,val) *(U16 *) (ptr) = __rev16(val) - -#define RR_GET16_BE_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,offset,val) *RR_U16_PTR_OFFSET(ptr,offset) = __rev16(val) - -#define RR_GET32_BE(ptr) __rev(*(U32 *) (ptr)) -#define RR_PUT32_BE(ptr,val) *(U32 *) (ptr) = __rev(val) - -#define RR_GET32_BE_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,offset,val) *RR_U32_PTR_OFFSET(ptr,offset) = __rev(val) - -#elif defined(__RADIPHONE__) - -// iPhone does not seem to have intrinsics for this, so use generic fallback! - -// Bswap is just here for use of implementing get/put -// caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#elif defined(__RADWIIU__) - -#include - -#define RR_GET16_LE(ptr) (*(__bytereversed U16 *) (ptr)) -#define RR_PUT16_LE(ptr,val) *(__bytereversed U16 *) (ptr) = val - -#define RR_GET16_LE_OFFSET(ptr,offset) (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset) = val - -#define RR_GET32_LE(ptr) (*(__bytereversed U32 *) (ptr)) -#define RR_PUT32_LE(ptr,val) *(__bytereversed U32 *) (ptr) = val - -#define RR_GET32_LE_OFFSET(ptr,offset) (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset) = val - -#define RR_GET64_LE(ptr) (*(__bytereversed U64 *) (ptr)) -#define RR_PUT64_LE(ptr,val) *(__bytereversed U64 *) (ptr) = val - -#define RR_GET64_LE_OFFSET(ptr,offset) (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_LE_OFFSET(ptr,val,offset) *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset) = val - -#elif defined(__RADWINRTAPI__) && defined(__RADARM__) - -#include - -#define RR_BSWAP16(u16) _arm_rev16(u16) -#define RR_BSWAP32(u32) _arm_rev(u32) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#elif defined(__RADPSP2__) - -// no rev16 exposed -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) __builtin_rev(u32) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#else // other platforms ? - -// fall back : - -// Bswap is just here for use of implementing get/put -// caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) -#define RR_BSWAP64(u64) ( ((U64) RR_BSWAP32((U32) (u64)) << 32) | (U64) RR_BSWAP32((U32) ((u64) >> 32)) ) - -#ifdef __RADLITTLEENDIAN__ - -// comment out fallbacks so users will get errors -//#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#else - -// comment out fallbacks so users will get errors -//#define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#endif - -#endif - -//=================================================================== -// @@ TEMP : Aliases for old names : remove me when possible : - -#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET -#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET -#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET -#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET -#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET -#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET -#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET -#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET - - -//=================================================================== -// UNALIGNED VERSIONS : - -#if defined(__RADX86__) || defined(__RADPPC__) // platforms where unaligned is fast : - -#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_BE_OFFSET(ptr,offset) -#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_BE_OFFSET(ptr,offset) - -#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_LE_OFFSET(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_LE_OFFSET(ptr,offset) - -#elif defined(__RAD3DS__) - -// arm has a "__packed" qualifier to tell the compiler to do unaligned accesses -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) - -#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) - -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) - -#elif defined(__RADPSP2__) - -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) - -#define RR_GET32_BE_UNALIGNED(ptr) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) - -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) - -#else -// Unaligned via bytes : - -#define RR_GET32_BE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 0 ) ) - -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 0 ) ) - -#define RR_GET16_BE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 0 ) ) - -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 0 ) ) - -#define RR_GET32_LE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) - -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) - -#define RR_GET16_LE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) - -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) - -#endif - -//=================================================================== -// RR_ROTL32 : 32-bit rotate -// - -#ifdef _MSC_VER - - unsigned long __cdecl _lrotl(unsigned long, int); - #pragma intrinsic(_lrotl) - - #define RR_ROTL32(x,k) _lrotl((unsigned long)(x),(int)(k)) - -#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || defined(__RADPSP2__) - - // Compiler turns this into rotate correctly : - #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) - -#elif defined(__RAD3DS__) - - #define RR_ROTL32(u32,num) __ror(u32, (-(num))&31) - -#else - -// comment out fallbacks so users will get errors -// fallback implementation using shift and or : -//#define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) - -#endif - - -//=================================================================== -// RR_ROTL64 : 64-bit rotate - -#if ( defined(_MSC_VER) && _MSC_VER >= 1300) - -unsigned int64_t __cdecl _rotl64(unsigned int64_t _Val, int _Shift); -#pragma intrinsic(_rotl64) - -#define RR_ROTL64(x,k) _rotl64((unsigned int64_t)(x),(int)(k)) - -#elif defined(__RADCELL__) - -// PS3 GCC turns this into rotate correctly : -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) - -#elif defined(__RADLINUX__) || defined(__RADMACAPI__) - -//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) - -#else - -// comment out fallbacks so users will get errors -// fallback implementation using shift and or : -//#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) - -#endif - -//=================================================================== - -RADDEFEND - -//=================================================================== - -// RR_COMPILER_ASSERT -#if defined(__cplusplus) && !defined(RR_COMPILER_ASSERT) - #if defined(_MSC_VER) && (_MSC_VER >=1400) - - // better version of COMPILER_ASSERT using boost technique - template struct RR_COMPILER_ASSERT_FAILURE; - - template <> struct RR_COMPILER_ASSERT_FAILURE<1> { enum { value = 1 }; }; - - template struct rr_compiler_assert_test{}; - - // __LINE__ macro broken when -ZI is used see Q199057 - #define RR_COMPILER_ASSERT( B ) \ - typedef rr_compiler_assert_test<\ - sizeof(RR_COMPILER_ASSERT_FAILURE< (B) ? 1 : 0 >)\ - > rr_compiler_assert_typedef_ - - #endif -#endif - -#ifndef RR_COMPILER_ASSERT - // this happens at declaration time, so if it's inside a function in a C file, drop {} around it - #define RR_COMPILER_ASSERT(exp) typedef char RR_STRING_JOIN(_dummy_array, __LINE__) [ (exp) ? 1 : -1 ] -#endif - -//=================================================================== -// some error checks : - - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == sizeof( RR_STRING_JOIN(RAD_U,RAD_PTRBITS) ) ); - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == RAD_PTRBYTES ); - RR_COMPILER_ASSERT( RAD_TWOPTRBYTES == 2* RAD_PTRBYTES ); - -//=================================================================== - - #endif // __RADRES__ - -//include "testconstant.inl" // uncomment and include to test statement constants - -#endif // __RADRR_COREH__ - - diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp deleted file mode 100644 index 8a1ef2297..000000000 --- a/targets/app/windows/Windows64_App.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -#include "WindowsGame.h" - -#include "app/common/Game.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/User.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/server/PlayerList.h" -#include "minecraft/server/level/ServerPlayer.h" -#include "minecraft/world/level/Level.h" -#include "minecraft/world/level/LevelSettings.h" -#include "minecraft/world/level/LevelType.h" -#include "minecraft/world/level/biome/BiomeSource.h" - -WindowsGame app; - -#define CONTEXT_GAME_STATE 0 - -WindowsGame::WindowsGame() : Game() {} - -void WindowsGame::SetRichPresenceContext(int iPad, int contextId) { - PlatformProfile.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, - contextId); -} - -void WindowsGame::StoreLaunchData() {} -void WindowsGame::ExitGame() {} -void WindowsGame::FatalLoadError() {} - -void WindowsGame::CaptureSaveThumbnail() {} -void WindowsGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} -void WindowsGame::ReleaseSaveThumbnail() {} - -void WindowsGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} - -void WindowsGame::TemporaryCreateGameStart() { - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_Main::OnInit - - app.setLevelGenerationOptions(nullptr); - - // From CScene_Main::RunPlayGame - Minecraft* pMinecraft = Minecraft::GetInstance(); - app.ReleaseSaveThumbnail(); - PlatformProfile.SetLockedProfile(0); - pMinecraft->user->name = "Windows"; - app.ApplyGameSettingsChanged(0); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameJoinLoad::OnInit - MinecraftServer::resetFlags(); - - // From CScene_MultiGameJoinLoad::OnNotifyPressEx - app.SetTutorialMode(false); - app.SetCorruptSaveDeleted(false); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameCreate::CreateGame - - app.ClearTerrainFeaturePosition(); - std::string wWorldName = "TestWorld"; - - PlatformStorage.ResetSaveData(); - PlatformStorage.SetSaveTitle(wWorldName.c_str()); - - bool isFlat = false; - int64_t seedValue = - 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); - // // 4J - was (new Random())->nextLong() - now trying to actually - // find a seed to suit our requirements - - NetworkGameInitData* param = new NetworkGameInitData(); - param->seed = seedValue; - param->saveData = nullptr; - - app.SetGameHostOption(eGameHostOption_Difficulty, 0); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends, 0); - app.SetGameHostOption(eGameHostOption_Gamertags, 1); - app.SetGameHostOption(eGameHostOption_BedrockFog, 1); - - app.SetGameHostOption( - eGameHostOption_GameType, - GameType::CREATIVE->getId()); // LevelSettings::GAMETYPE_SURVIVAL - app.SetGameHostOption(eGameHostOption_LevelType, 0); - app.SetGameHostOption(eGameHostOption_Structures, 1); - app.SetGameHostOption(eGameHostOption_BonusChest, 0); - - app.SetGameHostOption(eGameHostOption_PvP, 1); - app.SetGameHostOption(eGameHostOption_TrustPlayers, 1); - app.SetGameHostOption(eGameHostOption_FireSpreads, 1); - app.SetGameHostOption(eGameHostOption_TNT, 1); - app.SetGameHostOption(eGameHostOption_HostCanFly, 1); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1); - - param->settings = app.GetGameHostOption(eGameHostOption_All); - - g_NetworkManager.FakeLocalPlayerJoined(); - - LoadingInputParams* loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = param; - - // Reset the autosave time - app.SetAutosaveTimerTime(); - - C4JThread* thread = new C4JThread(loadingParams->func, - loadingParams->lpParam, "RunNetworkGame"); - thread->run(); -} - -int WindowsGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { - return -1; -} - -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } - -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { - return -1; -} - -void WindowsGame::FreeLocalTMSFiles(eTMSFileType eType) {} diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp deleted file mode 100644 index 5b1a825ad..000000000 --- a/targets/app/windows/Windows64_UIController.cpp +++ /dev/null @@ -1,178 +0,0 @@ - -#include "Windows64_UIController.h" - -// Temp -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/renderer/Textures.h" - -#define _ENABLEIGGY - -ConsoleUIController ui; - -void ConsoleUIController::init(ID3D11Device* dev, ID3D11DeviceContext* ctx, - ID3D11RenderTargetView* pRenderTargetView, - ID3D11DepthStencilView* pDepthStencilView, S32 w, - S32 h) { -#ifdef _ENABLEIGGY - m_pRenderTargetView = pRenderTargetView; - m_pDepthStencilView = pDepthStencilView; - - // Shared init - preInit(w, h); - - gdraw_funcs = gdraw_D3D11_CreateContext(dev, ctx, w, h); - - if (!gdraw_funcs) { - app.DebugPrintf("Failed to initialise GDraw!\n"); -#ifndef _CONTENT_PACKAGE - assert(0); -#endif - app.FatalLoadError(); - } - - /* For each of the resource types, we specify the size of the cache that - GDraw will use. We specify both the number of possible objects - (the number of "handles") of each type, and the maximum memory - to use for each one. - - For some platforms, we would actually pass - in the memory to use, and the GDraw will strictly obey the resource - request. For D3D, storage is managed by D3D, and GDraw only - approximates the requested storage amount. In fact, you don't - even have to set these at all for D3D, which has some "reasonable" defaults, - but we'll set it here for clarity. - (The storage required for - the handles is separate, and always allocated through the global allocator - specified in IggyInit.) - - The size that's actually needed here depends on the content of your - Flash file. There's more info in the documentation about how to - determine how big they should be. But for now, we'll just set them - really big so if you substitute a different file it should work. */ - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_vertexbuffer, 5000, - 16 * 1024 * 1024); - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_texture, 5000, - 128 * 1024 * 1024); - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_rendertarget, 10, - 32 * 1024 * 1024); - - /* GDraw is all set, so we'll point Iggy at it. */ - IggySetGDraw(gdraw_funcs); - - /* Flash content can have audio embedded. We'd like to be able - to play back any audio there is in the Flash that we load, - but in this tutorial we don't care about processing the sound - ourselves. So we call $IggyAudioUseDirectSound to tell Iggy - to go ahead and send any sound from the Flash movie directly - to Win32's default DirectSound device. */ - IggyAudioUseDirectSound(); - - // Shared init - postInit(); -#endif -} - -void ConsoleUIController::render() { -#ifdef _ENABLEIGGY - /* Now that we've cleared, we need to tell GDraw which - render target to use, what depth/stencil buffer to use, - and where the origin should be. - - If we were using multisampling, we'd also need to give - GDraw a render target view for a non-multisampled texture - the size of main_rtv as a resolve target (this is the third - parameter). But since we're not using multisampling in this - example, no resolve targets are required. */ - gdraw_D3D11_SetTileOrigin(m_pRenderTargetView, m_pDepthStencilView, nullptr, - 0, 0); - - renderScenes(); - - /* Finally we're ready to display the frame. We call GDraw to - let it know we're done rendering, so it can do any finalization - it needs to do. */ - gdraw_D3D11_NoMoreGDrawThisFrame(); -#endif -} - -void ConsoleUIController::beginIggyCustomDraw4J( - IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) { - // get the correct object-to-world matrix from GDraw, and set the render - // state to a normal state - gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); -} - -CustomDrawData* ConsoleUIController::setupCustomDraw( - UIScene* scene, IggyCustomDrawCallbackRegion* region) { - CustomDrawData* customDrawRegion = new CustomDrawData(); - customDrawRegion->x0 = region->x0; - customDrawRegion->x1 = region->x1; - customDrawRegion->y0 = region->y0; - customDrawRegion->y1 = region->y1; - - // get the correct object-to-world matrix from GDraw, and set the render - // state to a normal state - gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); - - setupCustomDrawGameStateAndMatrices(scene, customDrawRegion); - - return customDrawRegion; -} - -CustomDrawData* ConsoleUIController::calculateCustomDraw( - IggyCustomDrawCallbackRegion* region) { - CustomDrawData* customDrawRegion = new CustomDrawData(); - customDrawRegion->x0 = region->x0; - customDrawRegion->x1 = region->x1; - customDrawRegion->y0 = region->y0; - customDrawRegion->y1 = region->y1; - - gdraw_D3D11_CalculateCustomDraw_4J(region, customDrawRegion->mat); - - return customDrawRegion; -} - -void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion* region) { - endCustomDrawGameStateAndMatrices(); - - gdraw_D3D11_EndCustomDraw(region); -} - -void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { - gdraw_D3D11_SetTileOrigin(m_pRenderTargetView, m_pDepthStencilView, nullptr, - xPos, yPos); -} - -GDrawTexture* ConsoleUIController::getSubstitutionTexture(int textureId) { - /* Create a wrapped texture from a shader resource view. - A wrapped texture can be used to let Iggy draw using the contents of a - texture you create and manage on your own. For example, you might render to - this texture, or stream video into it. Wrapped textures take up a handle. - They will never be freed or otherwise modified by GDraw; nor will GDraw - change any reference counts. All this is up to the application. */ - ID3D11ShaderResourceView* tex = PlatformRenderer.TextureGetTexture(textureId); - ID3D11Resource* resource; - tex->GetResource(&resource); - ID3D11Texture2D* tex2d = (ID3D11Texture2D*)resource; - D3D11_TEXTURE2D_DESC desc; - tex2d->GetDesc(&desc); - GDrawTexture* gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); - return gdrawTex; -} - -void ConsoleUIController::destroySubstitutionTexture(void* destroyCallBackData, - GDrawTexture* handle) { - /* Destroys the GDraw wrapper for a wrapped texture object. This will free - up a GDraw texture handle but not release the associated D3D texture; that - is up to you. */ - gdraw_D3D11_WrappedTextureDestroy(handle); -} - -void ConsoleUIController::shutdown() { -#ifdef _ENABLEIGGY - /* Destroy the GDraw context. This frees all resources, shaders etc. - allocated by GDraw. Note this is only safe to call after all - active Iggy player have been destroyed! */ - gdraw_D3D11_DestroyContext(); -#endif -} \ No newline at end of file diff --git a/targets/app/windows/Windows64_UIController.h b/targets/app/windows/Windows64_UIController.h deleted file mode 100644 index 70e05b148..000000000 --- a/targets/app/windows/Windows64_UIController.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "app/common/UI/UIController.h" - -class ConsoleUIController : public UIController { -private: - ID3D11RenderTargetView* m_pRenderTargetView; - ID3D11DepthStencilView* m_pDepthStencilView; - -public: - void init(ID3D11Device* dev, ID3D11DeviceContext* ctx, - ID3D11RenderTargetView* pRenderTargetView, - ID3D11DepthStencilView* pDepthStencilView, S32 w, S32 h); - - void render(); - void beginIggyCustomDraw4J(IggyCustomDrawCallbackRegion* region, - CustomDrawData* customDrawRegion); - virtual CustomDrawData* setupCustomDraw( - UIScene* scene, IggyCustomDrawCallbackRegion* region); - virtual CustomDrawData* calculateCustomDraw( - IggyCustomDrawCallbackRegion* region); - virtual void endCustomDraw(IggyCustomDrawCallbackRegion* region); - -protected: - virtual void setTileOrigin(S32 xPos, S32 yPos); - -public: - GDrawTexture* getSubstitutionTexture(int textureId); - void destroySubstitutionTexture(void* destroyCallBackData, - GDrawTexture* handle); - -public: - void shutdown(); -}; - -extern ConsoleUIController ui; \ No newline at end of file diff --git a/targets/app/windows/WindowsGame.h b/targets/app/windows/WindowsGame.h deleted file mode 100644 index f04abc674..000000000 --- a/targets/app/windows/WindowsGame.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -class WindowsGame : public Game { -public: - WindowsGame(); - - virtual void SetRichPresenceContext(int iPad, int contextId); - - virtual void StoreLaunchData(); - virtual void ExitGame(); - virtual void FatalLoadError(); - - virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize); - virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize); - - virtual int LoadLocalTMSFile(char* wchTMSFile); - virtual int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt); - - virtual void FreeLocalTMSFiles(eTMSFileType eType); - virtual int GetLocalTMSFileIndex( - char* wchTMSFile, bool bFilenameIncludesExtension, - eFileExtensionType eEXT = eFileExtensionType_PNG); - - // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false) {} - - C4JStringTable* GetStringTable() { return nullptr; } - - // original code - virtual void TemporaryCreateGameStart(); -}; - -extern WindowsGame app; - diff --git a/targets/app/windows/XML/ATGXmlParser.cpp b/targets/app/windows/XML/ATGXmlParser.cpp deleted file mode 100644 index 6b804aa58..000000000 --- a/targets/app/windows/XML/ATGXmlParser.cpp +++ /dev/null @@ -1,821 +0,0 @@ -// 4J-PB - -// The ATG Framework is a common set of C++ class libraries that is used by the -// samples in the XDK, and was developed by the Advanced Technology Group (ATG). -// The ATG Framework offers a clean and consistent format for the samples. These -// classes define functions used by all the samples. The ATG Framework together -// with the samples demonstrates best practices and innovative techniques for -// Xbox 360. There are many useful sections of code in the samples. You are -// encouraged to incorporate this code into your titles. - -//------------------------------------------------------------------------------------- -// AtgXmlParser.cpp -// -// Simple callback non-validating XML parser implementation. -// -// Xbox Advanced Technology Group. -// Copyright (C) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------------- - -#include "ATGXmlParser.h" - -#include - -namespace ATG { - -//------------------------------------------------------------------------------------- -// Name: XMLParser::XMLParser -//------------------------------------------------------------------------------------- -XMLParser::XMLParser() { - m_pWritePtr = m_pWriteBuf; - m_pReadPtr = m_pReadBuf; - m_pISAXCallback = nullptr; - m_hFile = INVALID_HANDLE_VALUE; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::~XMLParser -//------------------------------------------------------------------------------------- -XMLParser::~XMLParser() {} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::FillBuffer -// Desc: Reads a block from the current open file -//------------------------------------------------------------------------------------- -void XMLParser::FillBuffer() { - uint32_t NChars; - - m_pReadPtr = m_pReadBuf; - - if (m_hFile == nullptr) { - if (m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE) - NChars = XML_READ_BUFFER_SIZE; - else - NChars = m_uInXMLBufferCharsLeft; - - std::memcpy(m_pReadBuf, m_pInXMLBuffer, NChars); - m_uInXMLBufferCharsLeft -= NChars; - m_pInXMLBuffer += NChars; - } else { - if (!ReadFile(m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, - nullptr)) { - return; - } - } - - m_dwCharsConsumed += NChars; - int64_t iProgress = - m_dwCharsTotal - ? (((int64_t)m_dwCharsConsumed * 1000) / (int64_t)m_dwCharsTotal) - : 0; - m_pISAXCallback->SetParseProgress((uint32_t)iProgress); - - m_pReadBuf[NChars] = '\0'; - m_pReadBuf[NChars + 1] = '\0'; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::SkipNextAdvance -// Desc: Puts the last character read back on the input stream -//------------------------------------------------------------------------------------- -void XMLParser::SkipNextAdvance() { m_bSkipNextAdvance = true; } - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ConsumeSpace -// Desc: Skips spaces in the current stream -//------------------------------------------------------------------------------------- -int32_t XMLParser::ConsumeSpace() { - int32_t hr; - - // Skip spaces - if (FAILED(hr = AdvanceCharacter())) return hr; - - while ((m_Ch == ' ') || (m_Ch == '\t') || (m_Ch == '\n') || - (m_Ch == '\r')) { - if (FAILED(hr = AdvanceCharacter())) return hr; - } - SkipNextAdvance(); - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ConvertEscape -// Desc: Copies and converts an escape sequence into m_pWriteBuf -//------------------------------------------------------------------------------------- -int32_t XMLParser::ConvertEscape() { - int32_t hr; - char wVal = 0; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // all escape sequences start with &, so ignore the first character - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '#') // character as hex or decimal - { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch == 'x') // hex number - { - if (FAILED(hr = AdvanceCharacter())) return hr; - - while (m_Ch != ';') { - wVal *= 16; - - if ((m_Ch >= '0') && (m_Ch <= '9')) { - wVal += m_Ch - '0'; - } else if ((m_Ch >= 'a') && (m_Ch <= 'f')) { - wVal += m_Ch - 'a' + 10; - } else if ((m_Ch >= 'A') && (m_Ch <= 'F')) { - wVal += m_Ch - 'A' + 10; - } else { - Error(E_INVALID_XML_SYNTAX, - "Expected hex digit as part of &#x escape sequence"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - } else // decimal number - { - while (m_Ch != ';') { - wVal *= 10; - - if ((m_Ch >= '0') && (m_Ch <= '9')) { - wVal += m_Ch - '0'; - } else { - Error( - E_INVALID_XML_SYNTAX, - "Expected decimal digit as part of &# escape sequence"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - } - - // copy character into the buffer - m_Ch = wVal; - - return 0; - } - - // must be an entity reference - - char* pEntityRefVal = m_pWritePtr; - uint32_t EntityRefLen; - - SkipNextAdvance(); - if (FAILED(hr = AdvanceName())) return hr; - - EntityRefLen = (uint32_t)(m_pWritePtr - pEntityRefVal); - m_pWritePtr = pEntityRefVal; - - if (EntityRefLen == 0) { - Error(E_INVALID_XML_SYNTAX, "Expecting entity name after &"); - return E_INVALID_XML_SYNTAX; - } - - if (!strncmp(pEntityRefVal, "lt", EntityRefLen)) - wVal = '<'; - else if (!strncmp(pEntityRefVal, "gt", EntityRefLen)) - wVal = '>'; - else if (!strncmp(pEntityRefVal, "amp", EntityRefLen)) - wVal = '&'; - else if (!strncmp(pEntityRefVal, "apos", EntityRefLen)) - wVal = '\''; - else if (!strncmp(pEntityRefVal, "quot", EntityRefLen)) - wVal = '"'; - else { - Error(E_INVALID_XML_SYNTAX, - "Unrecognized entity name after & - (should be lt, gt, amp, " - "apos, or quot)"); - return E_INVALID_XML_SYNTAX; // return false if unrecognized token - // sequence - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != ';') { - Error(E_INVALID_XML_SYNTAX, - "Expected terminating ; for entity reference"); - return E_INVALID_XML_SYNTAX; // malformed reference - needs terminating - // ; - } - - m_Ch = wVal; - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceAttrVal -// Desc: Copies an attribute value into m_pWrite buf, skipping surrounding -// quotes -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceAttrVal() { - int32_t hr; - char wQuoteChar; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if ((m_Ch != '"') && (m_Ch != '\'')) { - Error(E_INVALID_XML_SYNTAX, - "Attribute values must be enclosed in quotes"); - return E_INVALID_XML_SYNTAX; - } - - wQuoteChar = m_Ch; - - for (;;) { - if (FAILED(hr = AdvanceCharacter())) - return hr; - else if (m_Ch == wQuoteChar) - break; - else if (m_Ch == '&') { - SkipNextAdvance(); - if (FAILED(hr = ConvertEscape())) return hr; - } else if (m_Ch == '<') { - Error(E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag"); - return E_INVALID_XML_SYNTAX; - } - - // copy character into the buffer - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - Error(E_INVALID_XML_SYNTAX, - "Total element tag size may not be more than %d characters", - XML_WRITE_BUFFER_SIZE); - return E_INVALID_XML_SYNTAX; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - } - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceName -// Desc: Copies a name into the m_pWriteBuf - returns true on success, false on -// failure -// Ignores leading whitespace. Currently does not support unicode names -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceName() { - int32_t hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (((m_Ch < 'A') || (m_Ch > 'Z')) && ((m_Ch < 'a') || (m_Ch > 'z')) && - (m_Ch != '_') && (m_Ch != ':')) { - Error(E_INVALID_XML_SYNTAX, - "Names must start with an alphabetic character or _ or :"); - return E_INVALID_XML_SYNTAX; - } - - while (((m_Ch >= 'A') && (m_Ch <= 'Z')) || - ((m_Ch >= 'a') && (m_Ch <= 'z')) || - ((m_Ch >= '0') && (m_Ch <= '9')) || (m_Ch == '_') || (m_Ch == ':') || - (m_Ch == '-') || (m_Ch == '.')) { - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - Error(E_INVALID_XML_SYNTAX, - "Total element tag size may not be more than %d characters", - XML_WRITE_BUFFER_SIZE); - return E_INVALID_XML_SYNTAX; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - - SkipNextAdvance(); - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceCharacter -// Desc: Copies the character at *m_pReadPtr to m_Ch -// handling difference in UTF16 / UTF8, and big/little endian -// and getting another chunk of the file if needed -// Returns S_OK if there are more characters, E_ABORT for no characters to -// read -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCharacter(bool bOkToFail) { - if (m_bSkipNextAdvance) { - m_bSkipNextAdvance = false; - return 0; - } - - // If we hit EOF in the middle of a character, - // it's ok-- we'll just have a corrupt last character - // (the buffer is padded with double NULLs ) - - if ((m_pReadPtr[0] == '\0') && (m_pReadPtr[1] == '\0')) { - // Read more from the file - FillBuffer(); - - // We are at EOF if it is still nullptr - if ((m_pReadPtr[0] == '\0') && (m_pReadPtr[1] == '\0')) { - if (!bOkToFail) { - Error(E_INVALID_XML_SYNTAX, - "Unexpected EOF while parsing XML file"); - return E_INVALID_XML_SYNTAX; - } else { - return E_FAIL; - } - } - } - - if (m_bUnicode == false) { - m_Ch = *((char*)m_pReadPtr); - m_pReadPtr++; - } else // if( m_bUnicode == true ) - { - m_Ch = *((char*)m_pReadPtr); - - if (m_bReverseBytes) { - m_Ch = (m_Ch << 8) + (m_Ch >> 8); - } - - m_pReadPtr += 2; - } - - if (m_Ch == '\n') { - m_pISAXCallback->m_LineNum++; - m_pISAXCallback->m_LinePos = 0; - } else if (m_Ch != '\r') - m_pISAXCallback->m_LinePos++; - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceElement -// Desc: Builds data, calls callback -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceElement() { - int32_t hr; - - // write ptr at the beginning of the buffer - m_pWritePtr = m_pWriteBuf; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // if first character wasn't '<', we wouldn't be here - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '!') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch == '-') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch != '-') { - Error(E_INVALID_XML_SYNTAX, "Expecting '-' after 'ElementEnd( - pEntityRefVal, (uint32_t)(m_pWritePtr - pEntityRefVal)))) - return E_ABORT; - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != '>') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '>' after name for closing entity reference"); - return E_INVALID_XML_SYNTAX; - } - } else if (m_Ch == '?') { - // just skip any xml header tag since not really important after - // identifying character set - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '>') return 0; - } - } else { - XMLAttribute Attributes[XML_MAX_ATTRIBUTES_PER_ELEMENT]; - uint32_t NumAttrs; - - char* pEntityRefVal = m_pWritePtr; - uint32_t EntityRefLen; - - NumAttrs = 0; - - SkipNextAdvance(); - - // Entity tag - if (FAILED(hr = AdvanceName())) return hr; - - EntityRefLen = (uint32_t)(m_pWritePtr - pEntityRefVal); - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // read attributes - while ((m_Ch != '>') && (m_Ch != '/')) { - SkipNextAdvance(); - - if (NumAttrs >= XML_MAX_ATTRIBUTES_PER_ELEMENT) { - Error(E_INVALID_XML_SYNTAX, - "Elements may not have more than %d attributes", - XML_MAX_ATTRIBUTES_PER_ELEMENT); - return E_INVALID_XML_SYNTAX; - } - - Attributes[NumAttrs].strName = m_pWritePtr; - - // Attribute name - if (FAILED(hr = AdvanceName())) return hr; - - Attributes[NumAttrs].NameLen = - (uint32_t)(m_pWritePtr - Attributes[NumAttrs].strName); - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != '=') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '=' character after attribute name"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = ConsumeSpace())) return hr; - - Attributes[NumAttrs].strValue = m_pWritePtr; - - if (FAILED(hr = AdvanceAttrVal())) return hr; - - Attributes[NumAttrs].ValueLen = - (uint32_t)(m_pWritePtr - Attributes[NumAttrs].strValue); - - ++NumAttrs; - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - - if (m_Ch == '/') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch != '>') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '>' after '/' in element tag"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(m_pISAXCallback->ElementBegin( - pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) - return E_ABORT; - - if (FAILED( - m_pISAXCallback->ElementEnd(pEntityRefVal, EntityRefLen))) - return E_ABORT; - } else { - if (FAILED(m_pISAXCallback->ElementBegin( - pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) - return E_ABORT; - } - } - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceCDATA -// Desc: Read a CDATA section -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCDATA() { - int32_t hr; - uint16_t wStage = 0; - - if (FAILED(m_pISAXCallback->CDATABegin())) return E_ABORT; - - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if ((m_Ch == ']') && (wStage == 0)) - wStage = 1; - else if ((m_Ch == ']') && (wStage == 1)) - wStage = 2; - else if ((m_Ch == '>') && (wStage == 2)) { - m_pWritePtr -= 3; - break; - } else - wStage = 0; - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - if (FAILED(m_pISAXCallback->CDATAData( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), true))) - return E_ABORT; - m_pWritePtr = m_pWriteBuf; - } - } - - if (FAILED(m_pISAXCallback->CDATAData( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), false))) - return E_ABORT; - - m_pWritePtr = m_pWriteBuf; - - if (FAILED(m_pISAXCallback->CDATAEnd())) return E_ABORT; - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceComment -// Desk: Skips over a comment -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceComment() { - int32_t hr; - uint16_t wStage; - - wStage = 0; - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - if ((m_Ch == '-') && (wStage == 0)) - wStage = 1; - else if ((m_Ch == '-') && (wStage == 1)) - wStage = 2; - else if ((m_Ch == '>') && (wStage == 2)) - break; - else - wStage = 0; - } - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::RegisterSAXCallbackInterface -// Desc: Registers callback interface -//------------------------------------------------------------------------------------- -void XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) { - m_pISAXCallback = pISAXCallback; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::GetSAXCallbackInterface -// Desc: Returns current callback interface -//------------------------------------------------------------------------------------- -ISAXCallback* XMLParser::GetSAXCallbackInterface() { return m_pISAXCallback; } - -//------------------------------------------------------------------------------------- -// Name: XMLParser::MainParseLoop -// Desc: Main Loop to Parse Data - source agnostic -//------------------------------------------------------------------------------------- -int32_t XMLParser::MainParseLoop() { - bool bWhiteSpaceOnly = true; - int32_t hr = 0; - - if (FAILED(m_pISAXCallback->StartDocument())) return E_ABORT; - - m_pWritePtr = m_pWriteBuf; - - FillBuffer(); - - if (*((char*)m_pReadBuf) == 0xFEFF) { - m_bUnicode = true; - m_bReverseBytes = false; - m_pReadPtr += 2; - } else if (*((char*)m_pReadBuf) == 0xFFFE) { - m_bUnicode = true; - m_bReverseBytes = true; - m_pReadPtr += 2; - } else if (*((char*)m_pReadBuf) == 0x003C) { - m_bUnicode = true; - m_bReverseBytes = false; - } else if (*((char*)m_pReadBuf) == 0x3C00) { - m_bUnicode = true; - m_bReverseBytes = true; - } else if (m_pReadBuf[0] == 0x3C) { - m_bUnicode = false; - m_bReverseBytes = false; - } else { - Error(E_INVALID_XML_SYNTAX, - "Unrecognized encoding (parser does not support UTF-8 language " - "encodings)"); - return E_INVALID_XML_SYNTAX; - } - - for (;;) { - if (FAILED(AdvanceCharacter(true))) { - if (((uint32_t)(m_pWritePtr - m_pWriteBuf) != 0) && - (!bWhiteSpaceOnly)) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - false))) - return E_ABORT; - - bWhiteSpaceOnly = true; - } - - if (FAILED(m_pISAXCallback->EndDocument())) return E_ABORT; - - return 0; - } - - if (m_Ch == '<') { - if (((uint32_t)(m_pWritePtr - m_pWriteBuf) != 0) && - (!bWhiteSpaceOnly)) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - false))) - return E_ABORT; - - bWhiteSpaceOnly = true; - } - - SkipNextAdvance(); - - m_pWritePtr = m_pWriteBuf; - - if (FAILED(hr = AdvanceElement())) return hr; - - m_pWritePtr = m_pWriteBuf; - } else { - if (m_Ch == '&') { - SkipNextAdvance(); - if (FAILED(hr = ConvertEscape())) return hr; - } - - if (bWhiteSpaceOnly && (m_Ch != ' ') && (m_Ch != '\n') && - (m_Ch != '\r') && (m_Ch != '\t')) { - bWhiteSpaceOnly = false; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - if (!bWhiteSpaceOnly) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - true))) { - return E_ABORT; - } - } - - m_pWritePtr = m_pWriteBuf; - bWhiteSpaceOnly = true; - } - } - } -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ParseXMLFile -// Desc: Builds element data -//------------------------------------------------------------------------------------- -int32_t XMLParser::ParseXMLFile(const char* strFilename) { - int32_t hr; - - if (m_pISAXCallback == nullptr) return E_NOINTERFACE; - - m_pISAXCallback->m_LineNum = 1; - m_pISAXCallback->m_LinePos = 0; - m_pISAXCallback->m_strFilename = - strFilename; // save this off only while we parse the file - - m_bSkipNextAdvance = false; - m_pReadPtr = m_pReadBuf; - - m_pReadBuf[0] = '\0'; - m_pReadBuf[1] = '\0'; - - m_pInXMLBuffer = nullptr; - m_uInXMLBufferCharsLeft = 0; - m_hFile = CreateFile(strFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, - OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); - - if (m_hFile == INVALID_HANDLE_VALUE) { - Error(E_COULD_NOT_OPEN_FILE, "Error opening file"); - hr = E_COULD_NOT_OPEN_FILE; - - } else { - LARGE_INTEGER iFileSize; - GetFileSizeEx(m_hFile, &iFileSize); - m_dwCharsTotal = (uint32_t)iFileSize.QuadPart; - m_dwCharsConsumed = 0; - hr = MainParseLoop(); - } - - // Close the file - if (m_hFile != INVALID_HANDLE_VALUE) CloseHandle(m_hFile); - m_hFile = INVALID_HANDLE_VALUE; - - // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; - - return hr; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ParseXMLFile -// Desc: Builds element data -//------------------------------------------------------------------------------------- -int32_t XMLParser::ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize) { - int32_t hr; - - if (m_pISAXCallback == nullptr) return E_NOINTERFACE; - - m_pISAXCallback->m_LineNum = 1; - m_pISAXCallback->m_LinePos = 0; - m_pISAXCallback->m_strFilename = - ""; // save this off only while we parse the file - - m_bSkipNextAdvance = false; - m_pReadPtr = m_pReadBuf; - - m_pReadBuf[0] = '\0'; - m_pReadBuf[1] = '\0'; - - m_hFile = nullptr; - m_pInXMLBuffer = strBuffer; - m_uInXMLBufferCharsLeft = uBufferSize; - m_dwCharsTotal = uBufferSize; - m_dwCharsConsumed = 0; - - hr = MainParseLoop(); - - // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; - - return hr; -} - -//------------------------------------------------------------------------------------- -// XMLParser::Error() -// Logs an error through the callback interface -//------------------------------------------------------------------------------------- -#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation -void XMLParser::Error(int32_t hErr, - _In_z_ _Printf_format_string_ const char* strFormat, ...) -#else -void XMLParser::Error(int32_t hErr, const char* strFormat, ...) -#endif -{ - const int32_t MAX_OUTPUT_STR = 160; - char strBuffer[MAX_OUTPUT_STR]; - va_list pArglist; - va_start(pArglist, strFormat); - - vsprintf(strBuffer, strFormat, pArglist); - - m_pISAXCallback->Error(hErr, strBuffer); - va_end(pArglist); -} - -} // namespace ATG diff --git a/targets/app/windows/XML/ATGXmlParser.h b/targets/app/windows/XML/ATGXmlParser.h deleted file mode 100644 index 2b8dabbe0..000000000 --- a/targets/app/windows/XML/ATGXmlParser.h +++ /dev/null @@ -1,159 +0,0 @@ -// 4J-PB - -// The ATG Framework is a common set of C++ class libraries that is used by the -// samples in the XDK, and was developed by the Advanced Technology Group (ATG). -// The ATG Framework offers a clean and consistent format for the samples. These -// classes define functions used by all the samples. The ATG Framework together -// with the samples demonstrates best practices and innovative techniques for -// Xbox 360. There are many useful sections of code in the samples. You are -// encouraged to incorporate this code into your titles. - -//------------------------------------------------------------------------------------- -// AtgXmlParser.h -// -// XMLParser and SAX interface declaration -// -// Xbox Advanced Technology Group -// Copyright (C) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------------- - -#pragma once -#ifndef ATGXMLPARSER_H -#define ATGXMLPARSER_H - -namespace ATG { - -//----------------------------------------------------------------------------- -// error returns from XMLParse -//----------------------------------------------------------------------------- -#define _ATGFAC 0x61B -#define E_COULD_NOT_OPEN_FILE MAKE_HRESULT(1, _ATGFAC, 0x0001) -#define E_INVALID_XML_SYNTAX MAKE_HRESULT(1, _ATGFAC, 0x0002) - -const uint32_t XML_MAX_ATTRIBUTES_PER_ELEMENT = 32; -const uint32_t XML_MAX_NAME_LENGTH = 128; -const uint32_t XML_READ_BUFFER_SIZE = 2048; -const uint32_t XML_WRITE_BUFFER_SIZE = 2048; - -// No tag can be longer than XML_WRITE_BUFFER_SIZE - an error will be returned -// if it is - -//------------------------------------------------------------------------------------- -struct XMLAttribute { - char* strName; - uint32_t NameLen; - char* strValue; - uint32_t ValueLen; -}; - -//------------------------------------------------------------------------------------- -class ISAXCallback { - friend class XMLParser; - -public: - ISAXCallback() {}; - virtual ~ISAXCallback() {}; - - virtual int32_t StartDocument() = 0; - virtual int32_t EndDocument() = 0; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) = 0; - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) = 0; - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) = 0; - - virtual int32_t CDATABegin() = 0; - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) = 0; - virtual int32_t CDATAEnd() = 0; - - virtual void Error(int32_t hError, const char* strMessage) = 0; - - virtual void SetParseProgress(uint32_t dwProgress) {} - - const char* GetFilename() { return m_strFilename; } - uint32_t GetLineNumber() { return m_LineNum; } - uint32_t GetLinePosition() { return m_LinePos; } - -private: - const char* m_strFilename; - uint32_t m_LineNum; - uint32_t m_LinePos; -}; - -//------------------------------------------------------------------------------------- -class XMLParser { -public: - XMLParser(); - ~XMLParser(); - - // Register an interface inheiriting from ISAXCallback - void RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback); - - // Get the registered interface - ISAXCallback* GetSAXCallbackInterface(); - - // ParseXMLFile returns one of the following: - // E_COULD_NOT_OPEN_FILE - couldn't open the file - // E_INVALID_XML_SYNTAX - bad XML syntax according to this parser - // E_NOINTERFACE - RegisterSAXCallbackInterface not called - // E_ABORT - callback returned a fail code - // S_OK - file parsed and completed - - int32_t ParseXMLFile(const char* strFilename); - - // Parses from a buffer- if you pass a char buffer (and cast it), it - // will - // correctly detect it and use unicode instead. Return codes are - // the same as for ParseXMLFile - - int32_t ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize); - -private: - int32_t MainParseLoop(); - - int32_t AdvanceCharacter(bool bOkToFail = false); - void SkipNextAdvance(); - - int32_t ConsumeSpace(); - int32_t ConvertEscape(); - int32_t AdvanceElement(); - int32_t AdvanceName(); - int32_t AdvanceAttrVal(); - int32_t AdvanceCDATA(); - int32_t AdvanceComment(); - - void FillBuffer(); - -#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation - void Error(int32_t hRet, - _In_z_ _Printf_format_string_ const char* strFormat, ...); -#else - void Error(int32_t hRet, const char* strFormat, ...); -#endif - - ISAXCallback* m_pISAXCallback; - - void* m_hFile; - const char* m_pInXMLBuffer; - uint32_t m_uInXMLBufferCharsLeft; - uint32_t m_dwCharsTotal; - uint32_t m_dwCharsConsumed; - - uint8_t m_pReadBuf[XML_READ_BUFFER_SIZE + 2]; // room for a trailing NULL - char m_pWriteBuf[XML_WRITE_BUFFER_SIZE]; - - uint8_t* m_pReadPtr; - char* m_pWritePtr; // write pointer within m_pBuf - - bool m_bUnicode; // true = 16-bits, false = 8-bits - bool m_bReverseBytes; // true = reverse bytes, false = don't reverse - - bool m_bSkipNextAdvance; - char m_Ch; // Current character being parsed -}; - -} // namespace ATG - -#endif diff --git a/targets/app/windows/XML/xmlFilesCallback.h b/targets/app/windows/XML/xmlFilesCallback.h deleted file mode 100644 index f3d940f73..000000000 --- a/targets/app/windows/XML/xmlFilesCallback.h +++ /dev/null @@ -1,304 +0,0 @@ - -#pragma once -#if !defined(XMLMOJANGCALLBACK_H) -#define XMLMOJANGCALLBACK_H -// xml reading - -using namespace ATG; - -class xmlMojangCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wAttName[32] = ""; - char wNameXUID[32] = ""; - char wNameSkin[32] = ""; - char wNameCloak[32] = ""; - PlayerUID xuid = 0LL; - - if (NameLen > 31) - return 1; - else - strncpy(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "name") == 0) { - if (pAttributes[i].ValueLen <= 32) - wcsncpy_s(wNameXUID, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } else if (_wcsicmp(wAttName, "xuid") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - xuid = _wcstoui64(wTemp, nullptr, 10); - } - } else if (_wcsicmp(wAttName, "cape") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameCloak, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "skin") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameSkin, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (xuid != 0LL) { - return Game::RegisterMojangData( - wNameXUID, xuid, wNameSkin, wNameCloak); - } else - return 1; - } else { - return 1; - } - }; - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing xuids.XML\n"); - }; -}; - -class xmlConfigCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wType[32] = ""; - char wAttName[32] = ""; - char wValue[32] = ""; - int iValue = -1; - - if (NameLen > 31) - return 1; - else - wcsncpy_s(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "Type") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wType, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Value") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wValue, pAttributes[i].strValue, - pAttributes[i].ValueLen); - - iValue = strtol(wValue, nullptr, 10); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (iValue != -1) { -#if defined(_DEBUG) - printf("Type - %s, Value - %d, ", wType, iValue); -#endif - - return Game::RegisterConfigValues(wType, - iValue); - } else { - return 1; - } - } else { - return 1; - } - } - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing xuids.XML\n"); - }; -}; - -class xmlDLCInfoCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wAttName[32] = ""; - char wNameBanner[32] = ""; - char wDataFile[32] = ""; - char wType[32] = ""; - char wFirstSkin[32] = ""; - char wConfig[32] = ""; - uint64_t ullFull = 0ll; - uint64_t ullTrial = 0ll; - unsigned int uiSortIndex = 0L; - int iGender = 0; - int iConfig = 0; - - if (NameLen > 31) - return 1; - else - wcsncpy_s(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "SortIndex") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - uiSortIndex = wcstoul(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "Banner") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameBanner, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Full") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - ullFull = _wcstoui64(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "Trial") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - ullTrial = _wcstoui64(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "FirstSkin") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wFirstSkin, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Type") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wType, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Gender") == 0) { - if (_wcsicmp(wAttName, "Male") == 0) { - iGender = 1; - } else if (_wcsicmp(wAttName, "Female") == 0) { - iGender = 2; - } else { - iGender = 0; - } - } else if (_wcsicmp(wAttName, "Config") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wConfig, pAttributes[i].strValue, - pAttributes[i].ValueLen); - - iConfig = strtol(wConfig, nullptr, 10); - } - } else if (_wcsicmp(wAttName, "DataFile") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wDataFile, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (ullFull != 0LL) { -#if defined(_DEBUG) - printf("Type - %s, Name - %s, ", wType, wNameBanner); -#endif - app.DebugPrintf("Full = %lld, Trial %lld\n", ullFull, ullTrial); - - return Game::RegisterDLCData( - wType, wNameBanner, iGender, ullFull, ullTrial, wFirstSkin, - uiSortIndex, iConfig, wDataFile); - } else { - return 1; - } - } else { - return 1; - } - }; - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing DLC.XML\n"); - }; -}; - -#endif diff --git a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp deleted file mode 100644 index fed315b0e..000000000 --- a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "WindowsLeaderboardManager.h" - -LeaderboardManager* LeaderboardManager::m_instance = - new WindowsLeaderboardManager(); // Singleton instance of the - // LeaderboardManager \ No newline at end of file diff --git a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h deleted file mode 100644 index df81e27d6..000000000 --- a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include "app/common/Leaderboards/LeaderboardManager.h" - -class WindowsLeaderboardManager : public LeaderboardManager { -public: - virtual void Tick() {} - - // Open a session - virtual bool OpenSession() { return true; } - - // Close a session - virtual void CloseSession() {} - - // Delete a session - virtual void DeleteSession() {} - - // Write the given stats - // This is called synchronously and will not free any memory allocated for - // views when it is done - - virtual bool WriteStats(unsigned int viewCount, ViewIn views) { - return false; - } - - virtual bool ReadStats_Friends(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID) { - return false; - } - virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID, unsigned int readCount) { - return false; - } - virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - return false; - } - - // Perform a flush of the stats - virtual void FlushStats() {} - - // Cancel the current operation - virtual void CancelOperation() {} - - // Is the leaderboard manager idle. - virtual bool isIdle() { return true; } -}; diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp deleted file mode 100644 index c71f2e217..000000000 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ /dev/null @@ -1,851 +0,0 @@ -// Minecraft.cpp : Defines the entry point for the application. -// - -#include - -#include - -#include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" -#include "minecraft/client/User.h" -#include "minecraft/client/multiplayer/ClientConnection.h" -#include "minecraft/client/multiplayer/ConnectScreen.h" -#include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/locale/Language.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/stats/StatsCounter.h" -#include "minecraft/world/item/ItemInstance.h" -#include "minecraft/world/item/MapItem.h" -#include "minecraft/world/item/crafting/Recipes.h" -#include "minecraft/world/item/crafting/Recipy.h" -#include "minecraft/world/level/Level.h" - -#include "minecraft/world/phys/AABB.h" -#include "minecraft/world/phys/Vec3.h" -// #include "Social/SocialManager.h" -// #include "app/common/Leaderboards/LeaderboardManager.h" -// #include "../Common/XUI/XUI_Scene_Container.h" -// #include "NetworkManager.h" -#include "../Resource.h" -#include "Sentient/SentientManager.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "minecraft/client/Options.h" -#include "minecraft/client/renderer/Tesselator.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/world/level/chunk/storage/OldChunkStorage.h" - -HINSTANCE hMyInst; -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, - LPARAM lParam); -char chGlobalText[256]; -uint16_t ui16GlobalText[256]; - -#define THEME_NAME "584111F70AAAAAAA" -#define THEME_FILESIZE 2797568 - -// #define THREE_MB 3145728 // minimum save size (checking for this on a -// selected device) #define FIVE_MB 5242880 // minimum save size (checking for -// this on a selected device) #define FIFTY_TWO_MB (1024*1024*52) // Maximum TCR -// space required for a save (checking for this on a selected device) -#define FIFTY_ONE_MB \ - (1000000 * 51) // Maximum TCR space required for a save is 52MB (checking - // for this on a selected device) - -// #define PROFILE_VERSION 3 // new version for the interim bug fix 166 TU -#define NUM_PROFILE_VALUES 5 -#define NUM_PROFILE_SETTINGS 4 -uint32_t dwProfileSettingsA[NUM_PROFILE_VALUES] = {0, 0, 0, 0, 0}; - -//------------------------------------------------------------------------------------- -// Time Since fAppTime is a float, we need to keep the quadword app -// time -// as a LARGE_INTEGER so that we don't lose precision after -// running for a long time. -//------------------------------------------------------------------------------------- - -bool g_bWidescreen = true; - -int g_iScreenWidth = 1920; -int g_iScreenHeight = 1080; - -void DefineActions(void) { - // The app needs to define the actions required, and the possible mappings - // for these - - // Split into Menu actions, and in-game actions - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); -} - -HINSTANCE g_hInst = nullptr; -HWND g_hWnd = nullptr; -D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; -D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = nullptr; -ID3D11DeviceContext* g_pImmediateContext = nullptr; -IDXGISwapChain* g_pSwapChain = nullptr; -ID3D11RenderTargetView* g_pRenderTargetView = nullptr; -ID3D11DepthStencilView* g_pDepthStencilView = nullptr; -ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; - -// -// FUNCTION: WndProc(HWND, uint32_t, WPARAM, LPARAM) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - process the application menu -// WM_PAINT - Paint the main window -// WM_DESTROY - post a quit message and return -// -// -LRESULT CALLBACK WndProc(HWND hWnd, uint32_t message, WPARAM wParam, - LPARAM lParam) { - int wmId, wmEvent; - PAINTSTRUCT ps; - HDC hdc; - - switch (message) { - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) { - case IDM_EXIT: - DestroyWindow(hWnd); - break; - - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - break; - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - // TODO: Add any drawing code here... - EndPaint(hWnd, &ps); - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - return 0; -} - -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -ATOM MyRegisterClass(HINSTANCE hInstance) { - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wcex.lpszMenuName = "Minecraft"; - wcex.lpszClassName = "MinecraftClass"; - wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); - - return RegisterClassEx(&wcex); -} - -// -// FUNCTION: InitInstance(HINSTANCE, int) -// -// PURPOSE: Saves instance handle and creates main window -// -// COMMENTS: -// -// In this function, we save the instance handle in a global variable and -// create and display the main program window. -// -bool InitInstance(HINSTANCE hInstance, int nCmdShow) { - g_hInst = hInstance; // Store instance handle in our global variable - - RECT wr = {0, 0, g_iScreenWidth, - g_iScreenHeight}; // set the size, but not the position - AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false); // adjust the size - - g_hWnd = CreateWindow("MinecraftClass", "Minecraft", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, - wr.right - wr.left, // width of the window - wr.bottom - wr.top, // height of the window - nullptr, nullptr, hInstance, nullptr); - - if (!g_hWnd) { - return false; - } - - ShowWindow(g_hWnd, nCmdShow); - UpdateWindow(g_hWnd); - - return true; -} - -// 4J Stu - These functions are referenced from the Windows Input library -void ClearGlobalText() { - // clear the global text - memset(chGlobalText, 0, 256); - memset(ui16GlobalText, 0, 512); -} - -uint16_t* GetGlobalText() { - // copy the ch text to ui16 - char* pchBuffer = (char*)ui16GlobalText; - for (int i = 0; i < 256; i++) { - pchBuffer[i * 2] = chGlobalText[i]; - } - return ui16GlobalText; -} -void SeedEditBox() { - DialogBox(hMyInst, MAKEINTRESOURCE(IDD_SEED), g_hWnd, - reinterpret_cast(DlgProc)); -} - -//--------------------------------------------------------------------------- -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, - LPARAM lParam) { - switch (Msg) { - case WM_INITDIALOG: - return true; - - case WM_COMMAND: - switch (wParam) { - case IDOK: - // Set the text - GetDlgItemText(hWndDlg, IDC_EDIT, chGlobalText, 256); - EndDialog(hWndDlg, 0); - return true; - } - break; - } - - return false; -} - -//-------------------------------------------------------------------------------------- -// Create Direct3D device and swap chain -//-------------------------------------------------------------------------------------- -int32_t InitDevice() { - int32_t hr = 0; - - RECT rc; - GetClientRect(g_hWnd, &rc); - uint32_t width = rc.right - rc.left; - uint32_t height = rc.bottom - rc.top; - // app.DebugPrintf("width: %d, height: %d\n", width, height); - width = g_iScreenWidth; - height = g_iScreenHeight; - app.DebugPrintf("width: %d, height: %d\n", width, height); - - uint32_t createDeviceFlags = 0; -#if defined(_DEBUG) - createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; -#endif - - D3D_DRIVER_TYPE driverTypes[] = { - D3D_DRIVER_TYPE_HARDWARE, - D3D_DRIVER_TYPE_WARP, - D3D_DRIVER_TYPE_REFERENCE, - }; - uint32_t numDriverTypes = ARRAYSIZE(driverTypes); - - D3D_FEATURE_LEVEL featureLevels[] = { - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - }; - uint32_t numFeatureLevels = ARRAYSIZE(featureLevels); - - DXGI_SWAP_CHAIN_DESC sd; - memset(&sd, 0, sizeof(sd)); - sd.BufferCount = 1; - sd.BufferDesc.Width = width; - sd.BufferDesc.Height = height; - sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - sd.BufferDesc.RefreshRate.Numerator = 60; - sd.BufferDesc.RefreshRate.Denominator = 1; - sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - sd.OutputWindow = g_hWnd; - sd.SampleDesc.Count = 1; - sd.SampleDesc.Quality = 0; - sd.Windowed = true; - - for (uint32_t driverTypeIndex = 0; driverTypeIndex < numDriverTypes; - driverTypeIndex++) { - g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( - nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, - numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, - &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext); - if (HRESULT_SUCCEEDED(hr)) break; - } - if (FAILED(hr)) return hr; - - // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; - hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), - (void**)&pBackBuffer); - if (FAILED(hr)) return hr; - - // Create a depth stencil buffer - D3D11_TEXTURE2D_DESC descDepth; - - descDepth.Width = width; - descDepth.Height = height; - descDepth.MipLevels = 1; - descDepth.ArraySize = 1; - descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDepth.SampleDesc.Count = 1; - descDepth.SampleDesc.Quality = 0; - descDepth.Usage = D3D11_USAGE_DEFAULT; - descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; - descDepth.CPUAccessFlags = 0; - descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, - &g_pDepthStencilBuffer); - - D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; - descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; - descDSView.Texture2D.MipSlice = 0; - - hr = g_pd3dDevice->CreateDepthStencilView( - g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - - hr = g_pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, - &g_pRenderTargetView); - pBackBuffer->Release(); - if (FAILED(hr)) return hr; - - g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, - g_pDepthStencilView); - - // Setup the viewport - D3D11_VIEWPORT vp; - vp.Width = (float)width; - vp.Height = (float)height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - vp.TopLeftX = 0; - vp.TopLeftY = 0; - g_pImmediateContext->RSSetViewports(1, &vp); - - PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); - - return 0; -} - -//-------------------------------------------------------------------------------------- -// Render the frame -//-------------------------------------------------------------------------------------- -void Render() { - // Just clear the backbuffer - float ClearColor[4] = {0.0f, 0.125f, 0.3f, 1.0f}; // red,green,blue,alpha - - g_pImmediateContext->ClearRenderTargetView(g_pRenderTargetView, ClearColor); - g_pSwapChain->Present(0, 0); -} - -//-------------------------------------------------------------------------------------- -// Clean up the objects we've created -//-------------------------------------------------------------------------------------- -void CleanupDevice() { - if (g_pImmediateContext) g_pImmediateContext->ClearState(); - - if (g_pRenderTargetView) g_pRenderTargetView->Release(); - if (g_pSwapChain) g_pSwapChain->Release(); - if (g_pImmediateContext) g_pImmediateContext->Release(); - if (g_pd3dDevice) g_pd3dDevice->Release(); -} - -int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, - _In_ int nCmdShow) { - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); - - if (lpCmdLine) { - if (lpCmdLine[0] == '1') { - g_iScreenWidth = 1280; - g_iScreenHeight = 720; - } else if (lpCmdLine[0] == '2') { - g_iScreenWidth = 640; - g_iScreenHeight = 480; - } else if (lpCmdLine[0] == '3') { - // Vita - g_iScreenWidth = 720; - g_iScreenHeight = 408; - - // Vita native - // g_iScreenWidth = 960; - // g_iScreenHeight = 544; - } - } - - // Initialize global strings - MyRegisterClass(hInstance); - - // Perform application initialization: - if (!InitInstance(hInstance, nCmdShow)) { - return false; - } - - hMyInst = hInstance; - - if (FAILED(InitDevice())) { - CleanupDevice(); - return 0; - } - - static bool bTrialTimerDisplayed = true; - - app.loadMediaArchive(); - - PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); - - app.loadStringTable(); - ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, - g_pDepthStencilView, g_iScreenWidth, g_iScreenHeight); - - //////////////// - // Initialise // - //////////////// - - // Set the number of possible joypad layouts that the user can switch - // between, and the number of actions - PlatformInput.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); - - // Set the default joypad action mappings for Minecraft - DefineActions(); - PlatformInput.SetJoypadMapVal(0, 0); - PlatformInput.SetKeyRepeatRate(0.3f, 0.2f); - - // Initialise the profile manager with the game Title ID, Offer ID, a - // profile version number, and the number of profile values and settings - PlatformProfile.Initialise( - TITLEID_MINECRAFT, app.m_dwOfferID, PROFILE_VERSION_10, - NUM_PROFILE_VALUES, NUM_PROFILE_SETTINGS, dwProfileSettingsA, - app.GAME_DEFINED_PROFILE_DATA_BYTES * XUSER_MAX_COUNT, - &app.uiGameDefinedDataChangedBitmask); - // Set a callback for the default player options to be set - when there is - // no profile data for the player - PlatformProfile.SetDefaultOptionsCallback( - [](IPlatformProfile::PROFILESETTINGS* pSettings, int iPad) { - return Game::DefaultOptionsCallback(&app, pSettings, - iPad); - }); - // QNet needs to be setup after profile manager, as we do not want its - // Notify listener to handle XN_SYS_SIGNINCHANGED notifications. This does - // mean that we need to have a callback in the PlatformProfile for - // XN_LIVE_INVITE_ACCEPTED for QNet. - g_NetworkManager.Initialise(); - - // 4J-PB moved further down - // app.InitGameSettings(); - - // debug switch to trial version - PlatformProfile.SetDebugFullOverride(true); - - // Initialise TLS for tesselator, for this main thread - Tesselator::CreateNewThreadStorage(1024 * 1024); - // Initialise TLS for AABB and Vec3 pools, for this main thread - Compression::CreateNewThreadStorage(); - OldChunkStorage::CreateNewThreadStorage(); - Level::enableLightingCache(); - Tile::CreateNewThreadStorage(); - - Minecraft::main(); - Minecraft* pMinecraft = Minecraft::GetInstance(); - - app.InitGameSettings(); - - app.InitialiseTips(); - - // Set the default sound levels - pMinecraft->options->set(Options::Option::MUSIC, 1.0f); - pMinecraft->options->set(Options::Option::SOUND, 1.0f); - - // app.TemporaryCreateGameStart(); - - // Sleep(10000); - MSG msg = {0}; - while (WM_QUIT != msg.message) { - if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - continue; - } - PlatformRenderer.StartFrame(); - - // static bool bPlay=false; - // if(bPlay) - // { - // bPlay=false; - // app.audio.PlaySound(); - // } - - app.UpdateTime(); - PlatformInput.Tick(); - - // PlatformProfile.Tick(); - - PlatformStorage.Tick(); - - PlatformRenderer.Tick(); - - // Tick the social networking manager. - // CSocialManager::Instance()->Tick(); - - // Tick sentient. - // SentientManager.Tick(); - - // g_NetworkManager.DoWork(); - - // LeaderboardManager::Instance()->Tick(); - // Render game graphics. - if (app.GetGameStarted()) { - pMinecraft->run_middle(); - app.SetAppPaused( - g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1 && - ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())); - } else { - pMinecraft->soundEngine->tick(nullptr, 0.0f); - pMinecraft->textures->tick(true, false); - if (app.GetReallyChangingSessionType()) { - pMinecraft - ->tickAllConnections(); // Added to stop timing out when we - // are waiting after converting to - // an offline game - } - } - - pMinecraft->soundEngine->playMusicTick(); - - ui.tick(); - ui.render(); - // Present the frame. - PlatformRenderer.Present(); - - ui.CheckMenuDisplayed(); - // Any threading type things to deal with from the xui side? - app.HandleXuiActions(); - - // need to turn off the trial timer if it was on - if (bTrialTimerDisplayed) { - ui.ShowTrialTimer(false); - bTrialTimerDisplayed = false; - } - - // Fix for #7318 - Title crashes after short soak in the leaderboards - } - - // Free resources, unregister custom classes, and exit. - // app.Uninit(); - g_pd3dDevice->Release(); -} diff --git a/targets/java/include/java/ByteBuffer.h b/targets/java/include/java/ByteBuffer.h index 4213b3de1..f088ac0ef 100644 --- a/targets/java/include/java/ByteBuffer.h +++ b/targets/java/include/java/ByteBuffer.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include #include "Buffer.h" -#include class IntBuffer; class FloatBuffer; diff --git a/targets/java/include/java/Class.h b/targets/java/include/java/Class.h index ce61e1bcf..c0d45ecf0 100644 --- a/targets/java/include/java/Class.h +++ b/targets/java/include/java/Class.h @@ -350,7 +350,7 @@ inline bool eTYPE_FLAGSET(eINSTANCEOF flag, eINSTANCEOF claz) { /// FOR CHECKING /// -#if !(defined _WINDOWS64) +#if 1 class SubClass { static void checkDerivations() {} diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index ccc96a374..48ff31e73 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -8,9 +8,9 @@ #include #include -#include "util/StringHelpers.h" // 4jcraft TODO -#include "platform/fs/fs.h" #include "java/FileFilter.h" +#include "platform/fs/fs.h" +#include "util/StringHelpers.h" // 4jcraft TODO const char File::pathSeparator = '/'; @@ -20,9 +20,7 @@ const std::string File::pathRoot = namespace { namespace fs = std::filesystem; -fs::path ToFilesystemPath(const std::string& path) { - return fs::path(path); -} +fs::path ToFilesystemPath(const std::string& path) { return fs::path(path); } std::string ToFilename(const fs::path& path) { const std::string filename = path.filename().string(); @@ -63,7 +61,6 @@ File::File(const std::string& pathname) { if (fixedPath.find("GAME:/") == 0) fixedPath = fixedPath.substr(6); m_abstractPathName = fixedPath; -#if defined(__linux__) std::string request = std::filesystem::path(m_abstractPathName).string(); while (!request.empty() && request[0] == '/') request.erase(0, 1); if (request.find("res/") == 0) request.erase(0, 4); @@ -93,14 +90,14 @@ File::File(const std::string& pathname) { return; } } -#endif + // #ifdef _WINDOWS64 + // std::string path = + // std::filesystem::path(m_abstractPathName).string(); std::string + // finalPath = PlatformStorage.GetMountedPath(path.c_str()); if + // (finalPath.size() == 0) finalPath = path; m_abstractPathName = + // finalPath; + // #endif -#ifdef _WINDOWS64 - std::string path = std::filesystem::path(m_abstractPathName).string(); - std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); - if (finalPath.size() == 0) finalPath = path; - m_abstractPathName = finalPath; -#endif /* std::vector path = stringSplit( pathname, pathSeparator ); @@ -125,9 +122,8 @@ File::File(const std::string& pathname) { File::File(const std::string& parent, const std::string& child) //: m_abstractPathName( child ) { - m_abstractPathName = - pathRoot + pathSeparator + parent + pathSeparator + child; - // this->parent = new File( parent ); + // Using std::filesystem::path to join paths properly + m_abstractPathName = (std::filesystem::path(parent) / child).string(); } // Creates a new File instance by converting the given path vector into an @@ -201,11 +197,9 @@ bool File::mkdirs() const { return fs::is_directory(path, error); } - if (error) { - return false; - } + fs::create_directories(path, error); - return fs::create_directories(path, error); + return error.value() == 0; } /* diff --git a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp index c2bf9123f..39f8b1e0d 100644 --- a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp +++ b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp @@ -28,10 +28,10 @@ ByteArrayInputStream::ByteArrayInputStream(std::vector& buf) this->buf = buf; } -// 4jcraft: helper function to create a ByteArrayInputStream from a vector of bytes to avoid one copy +// 4jcraft: helper function to create a ByteArrayInputStream from a vector of +// bytes to avoid one copy ByteArrayInputStream::ByteArrayInputStream(std::vector&& buf) - : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) { -} + : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) {} // Reads the next byte of data from this input stream. The value byte is // returned as an int in the range 0 to 255. If no byte is available because the diff --git a/targets/java/src/InputOutputStream/FileInputStream.cpp b/targets/java/src/InputOutputStream/FileInputStream.cpp index c59f25e81..a6d8d93a7 100644 --- a/targets/java/src/InputOutputStream/FileInputStream.cpp +++ b/targets/java/src/InputOutputStream/FileInputStream.cpp @@ -7,11 +7,10 @@ #include #include #include +#include #include #include -#include - #include "java/File.h" namespace { @@ -50,12 +49,9 @@ bool FileSeek(std::FILE* file, int64_t offset, int origin) { // SecurityException - if a security manager exists and its checkRead method // denies read access to the file. FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) { -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "rb"); -#else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "rb"); -#endif if (m_fileHandle == nullptr) { assert(0); diff --git a/targets/java/src/InputOutputStream/FileOutputStream.cpp b/targets/java/src/InputOutputStream/FileOutputStream.cpp index 59f64750f..ae8971a52 100644 --- a/targets/java/src/InputOutputStream/FileOutputStream.cpp +++ b/targets/java/src/InputOutputStream/FileOutputStream.cpp @@ -2,11 +2,10 @@ #include #include +#include #include #include -#include - #include "java/File.h" // Creates a file output stream to write to the file represented by the @@ -27,12 +26,9 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) { return; } -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "wb"); -#else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "wb"); -#endif if (m_fileHandle == nullptr) { // TODO 4J Stu - Any form of error/exception handling diff --git a/targets/app/common/BuildVer/BuildVer.h b/targets/minecraft/BuildVer.h similarity index 87% rename from targets/app/common/BuildVer/BuildVer.h rename to targets/minecraft/BuildVer.h index 9215df6c7..e8481b9d0 100644 --- a/targets/app/common/BuildVer/BuildVer.h +++ b/targets/minecraft/BuildVer.h @@ -10,6 +10,11 @@ #define VER_PRODUCTBUILD 560 // This goes up if there is any change to network traffic or code in a build #define VER_NETWORK 560 + +// Network protocol version. Sent in the pre-login packet so client and +// server can detect mismatched builds. +#define MINECRAFT_NET_VERSION VER_NETWORK + #define VER_PRODUCTBUILD_QFE 0 #define VER_FILEVERSION_STRING "1.6" @@ -43,9 +48,9 @@ #define VER_FILEVERSION_STR2(x, y) \ VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y -#define VER_FILEVERSION_STR2_W(x, y) \ - VER_FILEVERSION_STRING_W "." VER_FILEBPAD_W VER_WIDE_PREFIX( \ - #x) "." VER_WIDE_PREFIX(#y) +#define VER_FILEVERSION_STR2_W(x, y) \ + VER_FILEVERSION_STRING_W \ + "." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y) #define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y) #define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y) diff --git a/targets/app/common/Console_Debug_enum.h b/targets/minecraft/Console_Debug_enum.h similarity index 100% rename from targets/app/common/Console_Debug_enum.h rename to targets/minecraft/Console_Debug_enum.h diff --git a/targets/minecraft/Facing.cpp b/targets/minecraft/Facing.cpp index 49e1ccb14..11a5592b0 100644 --- a/targets/minecraft/Facing.cpp +++ b/targets/minecraft/Facing.cpp @@ -9,4 +9,4 @@ const int Facing::STEP_Y[6] = {-1, 1, 0, 0, 0, 0}; const int Facing::STEP_Z[6] = {0, 0, -1, 1, 0, 0}; const std::string Facing::NAMES[] = {"DOWN", "UP", "NORTH", - "SOUTH", "WEST", "EAST"}; \ No newline at end of file + "SOUTH", "WEST", "EAST"}; \ No newline at end of file diff --git a/targets/minecraft/GameEnums.h b/targets/minecraft/GameEnums.h index 27499d143..f429e10d2 100644 --- a/targets/minecraft/GameEnums.h +++ b/targets/minecraft/GameEnums.h @@ -100,25 +100,6 @@ enum eTMSAction { eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly, }; -// The server runs on its own thread, so we need to call its actions there -// rather than where all other Xui actions are performed In general these are -// debugging options -enum eXuiServerAction { - eXuiServerAction_Idle = 0, - eXuiServerAction_DropItem, // Debug - eXuiServerAction_SaveGame, - eXuiServerAction_AutoSaveGame, - eXuiServerAction_SpawnMob, // Debug - eXuiServerAction_PauseServer, - eXuiServerAction_ToggleRain, // Debug - eXuiServerAction_ToggleThunder, // Debug - eXuiServerAction_ServerSettingChanged_Gamertags, - eXuiServerAction_ServerSettingChanged_Difficulty, - eXuiServerAction_ExportSchematic, // Debug - eXuiServerAction_ServerSettingChanged_BedrockFog, - eXuiServerAction_SetCameraLocation, // Debug -}; - enum eGameSetting { eGameSetting_MusicVolume = 0, eGameSetting_SoundFXVolume, diff --git a/targets/minecraft/GameHostOptions.cpp b/targets/minecraft/GameHostOptions.cpp index 33bd30311..69569a5bd 100644 --- a/targets/minecraft/GameHostOptions.cpp +++ b/targets/minecraft/GameHostOptions.cpp @@ -91,31 +91,43 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { switch (option) { case eGameHostOption_FriendsOfFriends: - setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); break; + setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + break; case eGameHostOption_Difficulty: settings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; - settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); break; + settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); + break; case eGameHostOption_Gamertags: - setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); break; + setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); + break; case eGameHostOption_GameType: settings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; - settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); break; + settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); + break; case eGameHostOption_LevelType: - setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); break; + setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); + break; case eGameHostOption_Structures: - setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); break; + setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); + break; case eGameHostOption_BonusChest: - setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); break; + setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); + break; case eGameHostOption_HasBeenInCreative: - setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); break; + setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + break; case eGameHostOption_PvP: - setBit(GAME_HOST_OPTION_BITMASK_PVP); break; + setBit(GAME_HOST_OPTION_BITMASK_PVP); + break; case eGameHostOption_TrustPlayers: - setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); break; + setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + break; case eGameHostOption_TNT: - setBit(GAME_HOST_OPTION_BITMASK_TNT); break; + setBit(GAME_HOST_OPTION_BITMASK_TNT); + break; case eGameHostOption_FireSpreads: - setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); break; + setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); + break; case eGameHostOption_CheatsEnabled: if (value != 0) { settings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; @@ -125,40 +137,56 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { settings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } break; + } + break; case eGameHostOption_HostCanFly: - setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); + break; case eGameHostOption_HostCanChangeHunger: - setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + break; case eGameHostOption_HostCanBeInvisible: - setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + break; case eGameHostOption_BedrockFog: - setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); break; + setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + break; case eGameHostOption_DisableSaving: - setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); break; + setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); + break; case eGameHostOption_WasntSaveOwner: - setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); break; + setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); + break; case eGameHostOption_MobGriefing: - setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + break; case eGameHostOption_KeepInventory: - setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); break; + setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + break; case eGameHostOption_DoMobSpawning: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + break; case eGameHostOption_DoMobLoot: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + break; case eGameHostOption_DoTileDrops: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + break; case eGameHostOption_NaturalRegeneration: - setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); + break; case eGameHostOption_DoDaylightCycle: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + break; case eGameHostOption_WorldSize: settings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; - settings |= (GAME_HOST_OPTION_BITMASK_WORLDSIZE & - (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); + settings |= + (GAME_HOST_OPTION_BITMASK_WORLDSIZE & + (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); break; case eGameHostOption_All: - settings = value; break; + settings = value; + break; default: break; } diff --git a/targets/minecraft/GameHostOptions.h b/targets/minecraft/GameHostOptions.h index 0d27f5dae..100ca67e1 100644 --- a/targets/minecraft/GameHostOptions.h +++ b/targets/minecraft/GameHostOptions.h @@ -2,12 +2,53 @@ #include -#include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" -// Stateless bitfield utilities - no app dependency. -// The global-state overloads (get/set with no settings arg) have moved -// to IgameServices().getGameHostOption / setGameHostOption. +// Bitmask layout for the game host option settings word, plus the +// stateless bitfield utilities used to read and write it. +// +// The global-state overloads (get/set with no settings arg) have moved to +// IGameServices::getGameHostOption / setGameHostOption. + +#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 +// 3 bits, 5 values: unset(0), classic(1), small(2), medium(3), large(4) +#define GAME_HOST_OPTION_BITMASK_WORLDSIZE 0x00700000 +#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 +}; + namespace GameHostOptions { unsigned int get(unsigned int settings, eGameHostOption option); diff --git a/targets/minecraft/GameTypes.h b/targets/minecraft/GameTypes.h index b233aa461..b95591a0c 100644 --- a/targets/minecraft/GameTypes.h +++ b/targets/minecraft/GameTypes.h @@ -4,9 +4,22 @@ #include "minecraft/GameEnums.h" -#ifndef MAX_CAPENAME_SIZE +// Vocabulary types and small game constants shared across minecraft/. +// Anything that used to live in app/common/App_Defines.h and represents a +// game-side concept (asset name sizes, default control indices, etc.) lives +// here. + #define MAX_CAPENAME_SIZE 32 -#endif +#define MAX_BANNERNAME_SIZE 32 +#define MAX_TMSFILENAME_SIZE 40 +#define MAX_TYPE_SIZE 32 +#define MAX_EXTENSION_TYPES 3 + +// Default UI controller index for non-splitscreen menus. +#define DEFAULT_XUI_MENU_USER 0 + +// Default sound/music volume level (0-100). +#define DEFAULT_VOLUME_LEVEL 100 struct MOJANG_DATA { eXUID eXuid; diff --git a/targets/minecraft/IGameServices.cpp b/targets/minecraft/IGameServices.cpp index a854ef3ef..3d801d9b6 100644 --- a/targets/minecraft/IGameServices.cpp +++ b/targets/minecraft/IGameServices.cpp @@ -4,9 +4,7 @@ static IGameServices* s_services = nullptr; -void initGameServices(IGameServices* services) { - s_services = services; -} +void initGameServices(IGameServices* services) { s_services = services; } IGameServices& gameServices() { assert(s_services && diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index 8e53f54ee..54141a47b 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -11,15 +11,15 @@ class LevelChunk; class ModelPart; // Forward declarations -class DLCSkinFile; +class ISkinAssetData; class DLCPack; -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" -#include "platform/PlatformTypes.h" -#include "minecraft/network/packet/DisconnectPacket.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/IMenuService.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/PlatformTypes.h" // eINSTANCEOF lives in java/Class.h which is heavyweight. using EntityTypeId = int; @@ -36,21 +36,23 @@ public: [[nodiscard]] virtual bool debugSettingsOn() = 0; [[nodiscard]] virtual bool debugArtToolsOn() = 0; - [[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1, - bool overridePlayer = false) = 0; + [[nodiscard]] virtual unsigned int debugGetMask( + int iPad = -1, bool overridePlayer = false) = 0; [[nodiscard]] virtual bool debugMobsDontAttack() = 0; [[nodiscard]] virtual bool debugMobsDontTick() = 0; [[nodiscard]] virtual bool debugFreezePlayers() = 0; // -- Game host options (global settings via stored pointer) -- - [[nodiscard]] virtual unsigned int getGameHostOption(eGameHostOption option) = 0; + [[nodiscard]] virtual unsigned int getGameHostOption( + eGameHostOption option) = 0; virtual void setGameHostOption(eGameHostOption option, unsigned int value) = 0; // -- Level generation -- - [[nodiscard]] virtual LevelGenerationOptions* getLevelGenerationOptions() = 0; + [[nodiscard]] virtual LevelGenerationOptions* + getLevelGenerationOptions() = 0; [[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0; // -- Texture cache -- @@ -59,14 +61,15 @@ public: std::uint8_t* data, unsigned int size) = 0; virtual void removeMemoryTextureFile(const std::string& name) = 0; - virtual void getMemFileDetails(const std::string& name, - std::uint8_t** data, + virtual void getMemFileDetails(const std::string& name, std::uint8_t** data, unsigned int* size) = 0; - [[nodiscard]] virtual bool isFileInMemoryTextures(const std::string& name) = 0; + [[nodiscard]] virtual bool isFileInMemoryTextures( + const std::string& name) = 0; // -- Player settings -- - [[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0; + [[nodiscard]] virtual unsigned char getGameSettings(int iPad, + int setting) = 0; [[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0; // -- App time -- @@ -108,11 +111,7 @@ public: virtual void setAction(int iPad, eXuiAction action, void* param = nullptr) = 0; - virtual void setXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr) = 0; [[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0; - [[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0; - [[nodiscard]] virtual void* getXuiServerActionParam(int iPad) = 0; virtual void setGlobalXuiAction(eXuiAction action) = 0; virtual void handleButtonPresses() = 0; virtual void setTMSAction(int iPad, eTMSAction action) = 0; @@ -123,9 +122,9 @@ public: [[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0; [[nodiscard]] virtual std::string getPlayerCapeName(int iPad) = 0; [[nodiscard]] virtual std::uint32_t getPlayerCapeId(int iPad) = 0; - [[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad(int iPad) = 0; - virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID, - SKIN_BOX* boxA, + [[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad( + int iPad) = 0; + virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA, unsigned int boxC) = 0; [[nodiscard]] virtual std::vector* getAdditionalSkinBoxes( std::uint32_t dwSkinID) = 0; @@ -137,8 +136,10 @@ public: unsigned int bitmask) = 0; [[nodiscard]] virtual unsigned int getAnimOverrideBitmask( std::uint32_t dwSkinID) = 0; - [[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::string& skin) = 0; - [[nodiscard]] virtual std::string getSkinPathFromId(std::uint32_t skinId) = 0; + [[nodiscard]] virtual std::uint32_t getSkinIdFromPath( + const std::string& skin) = 0; + [[nodiscard]] virtual std::string getSkinPathFromId( + std::uint32_t skinId) = 0; [[nodiscard]] virtual bool defaultCapeExists() = 0; [[nodiscard]] virtual bool isXuidNotch(PlayerUID xuid) = 0; [[nodiscard]] virtual bool isXuidDeadmau5(PlayerUID xuid) = 0; @@ -148,8 +149,7 @@ public: virtual void fatalLoadError() = 0; virtual void setRichPresenceContext(int iPad, int contextId) = 0; virtual void captureSaveThumbnail() = 0; - virtual void getSaveThumbnail(std::uint8_t** data, - unsigned int* size) = 0; + virtual void getSaveThumbnail(std::uint8_t** data, unsigned int* size) = 0; virtual void readBannedList(int iPad, eTMSAction action = (eTMSAction)0, bool bCallback = false) = 0; virtual void updatePlayerInfo(std::uint8_t networkSmallId, @@ -157,17 +157,16 @@ public: unsigned int playerPrivileges) = 0; [[nodiscard]] virtual unsigned int getPlayerPrivileges( std::uint8_t networkSmallId) = 0; - virtual void setGameSettingsDebugMask(int iPad, - unsigned int uiVal) = 0; + virtual void setGameSettingsDebugMask(int iPad, unsigned int uiVal) = 0; // -- Schematics / terrain -- virtual void processSchematics(LevelChunk* chunk) = 0; virtual void processSchematicsLighting(LevelChunk* chunk) = 0; - virtual void addTerrainFeaturePosition(_eTerrainFeatureType type, - int x, int z) = 0; - [[nodiscard]] virtual bool getTerrainFeaturePosition(_eTerrainFeatureType type, - int* pX, int* pZ) = 0; + virtual void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, + int z) = 0; + [[nodiscard]] virtual bool getTerrainFeaturePosition( + _eTerrainFeatureType type, int* pX, int* pZ) = 0; virtual void loadDefaultGameRules() = 0; // -- Archive / resources -- @@ -185,37 +184,36 @@ public: [[nodiscard]] virtual unsigned int createImageTextData( std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0; - [[nodiscard]] virtual std::string getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint = "TPACK:") = 0; + [[nodiscard]] virtual std::string getFilePath( + std::uint32_t packId, std::string filename, bool bAddDataFolder, + std::string mountPoint = "TPACK:") = 0; [[nodiscard]] virtual char* getUniqueMapName() = 0; virtual void setUniqueMapName(char* name) = 0; [[nodiscard]] virtual unsigned int getOpacityTimer(int iPad) = 0; virtual void setOpacityTimer(int iPad) = 0; virtual void tickOpacityTimer(int iPad) = 0; [[nodiscard]] virtual bool isInBannedLevelList(int iPad, PlayerUID xuid, - char* levelName) = 0; + char* levelName) = 0; [[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0; virtual void debugPrintf(const char* msg) = 0; // -- DLC -- - [[nodiscard]] virtual DLCSkinFile* getDLCSkinFile( + [[nodiscard]] virtual ISkinAssetData* getSkinAssetData( const std::string& name) = 0; [[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0; virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0; [[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, DLCPack* pack, - bool fromArchive = false) = 0; + const std::string& path, + DLCPack* pack, + bool fromArchive = false) = 0; virtual void dlcRemovePack(DLCPack* pack) = 0; // -- Game rules -- virtual LevelGenerationOptions* loadGameRules(std::uint8_t* data, - unsigned int size) = 0; - virtual void saveGameRules(std::uint8_t** data, - unsigned int* size) = 0; + unsigned int size) = 0; + virtual void saveGameRules(std::uint8_t** data, unsigned int* size) = 0; virtual void unloadCurrentGameRules() = 0; virtual void setLevelGenerationOptions( LevelGenerationOptions* levelGen) = 0; diff --git a/targets/app/common/Minecraft_Macros.h b/targets/minecraft/Minecraft_Macros.h similarity index 100% rename from targets/app/common/Minecraft_Macros.h rename to targets/minecraft/Minecraft_Macros.h diff --git a/targets/minecraft/SharedConstants.h b/targets/minecraft/SharedConstants.h index 6699867d6..dc4cc1726 100644 --- a/targets/minecraft/SharedConstants.h +++ b/targets/minecraft/SharedConstants.h @@ -25,8 +25,7 @@ public: static std::string acceptableLetters; static inline constexpr int ILLEGAL_FILE_CHARACTERS_LENGTH = 15; - static const char - ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; + static const char ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; static const bool TEXTURE_LIGHTING; // 4J - change brought forward from 1.8.2 diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 3e2ab00c9..22ebdf4a9 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,15 +6,11 @@ #include #include -#include "platform/renderer/renderer.h" -#include "app/common/DLC/DLCFile.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" #include "minecraft/IGameServices.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "PlatformTypes.h" -#include "util/StringHelpers.h" +#include "platform/PlatformTypes.h" #include "platform/fs/fs.h" +#include "platform/renderer/renderer.h" +#include "util/StringHelpers.h" BufferedImage::BufferedImage(int width, int height, int type) { data[0] = new int[width * height]; @@ -37,8 +33,7 @@ void BufferedImage::ByteFlip4(unsigned int& data) { // with a valid alpha channel. // 4jcraft: mostly rewrote this function -BufferedImage::BufferedImage(const std::string& File, - bool filenameHasExtension, +BufferedImage::BufferedImage(const std::string& File, bool filenameHasExtension, bool bTitleUpdateTexture, const std::string& drive) { int32_t hr = -1; @@ -95,17 +90,18 @@ BufferedImage::BufferedImage(const std::string& File, if (foundOnDisk) { std::string nativePath = std::filesystem::path(finalPath).string(); hr = PlatformRenderer.LoadTextureData(nativePath.c_str(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } else { std::string archiveKey = "res/" + fileName; if (gameServices().hasArchiveFile(archiveKey)) { - std::vector ba = gameServices().getArchiveFile(archiveKey); + std::vector ba = + gameServices().getArchiveFile(archiveKey); hr = PlatformRenderer.LoadTextureData(ba.data(), ba.size(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } } - if (hr == ERROR_SUCCESS) { + if (hr == 0) { if (l == 0) { width = ImageInfo.Width; height = ImageInfo.Height; @@ -122,43 +118,28 @@ BufferedImage::BufferedImage(const std::string& File, } } } -BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, - bool filenameHasExtension) { - int32_t hr; - std::string filePath = File; - std::uint8_t* pbData = nullptr; - std::uint32_t dataBytes = 0; +BufferedImage::BufferedImage() { for (int l = 0; l < 10; l++) data[l] = nullptr; + width = 0; + height = 0; +} - for (int l = 0; l < 10; l++) { - std::string name; - std::string mipMapPath = - (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; - name = "res" + (filenameHasExtension - ? filePath - : filePath.substr(0, filePath.length() - 4) + - mipMapPath + ".png"); - - if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { - if (l == 0) gameServices().fatalLoadError(); - return; - } - - DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); - pbData = dlcFile->getData(dataBytes); - if (pbData == nullptr || dataBytes == 0) { - if (l == 0) gameServices().fatalLoadError(); - return; - } - - D3DXIMAGE_INFO ImageInfo; - hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, - &data[l]); - if (hr == ERROR_SUCCESS && l == 0) { - width = ImageInfo.Width; - height = ImageInfo.Height; - } +bool BufferedImage::loadMipmapPng(int level, std::uint8_t* bytes, + std::uint32_t numBytes) { + if (level < 0 || level >= 10 || bytes == nullptr || numBytes == 0) { + return false; } + D3DXIMAGE_INFO ImageInfo; + int32_t hr = PlatformRenderer.LoadTextureData(bytes, numBytes, &ImageInfo, + &data[level]); + if (hr != 0) { + return false; + } + if (level == 0) { + width = ImageInfo.Width; + height = ImageInfo.Height; + } + return true; } BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { @@ -168,10 +149,10 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { D3DXIMAGE_INFO ImageInfo; memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); - int32_t hr = - PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); + int32_t hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, + &data[0]); - if (hr == ERROR_SUCCESS) { + if (hr == 0) { width = ImageInfo.Width; height = ImageInfo.Height; } else { diff --git a/targets/minecraft/client/BufferedImage.h b/targets/minecraft/client/BufferedImage.h index a5d04d790..c75d933ac 100644 --- a/targets/minecraft/client/BufferedImage.h +++ b/targets/minecraft/client/BufferedImage.h @@ -4,7 +4,6 @@ #include class Graphics; -class DLCPack; class BufferedImage { private: @@ -15,15 +14,19 @@ private: public: static const int TYPE_INT_ARGB = 0; static const int TYPE_INT_RGB = 1; + BufferedImage(); // empty image; fill with loadMipmapPng() BufferedImage(int width, int height, int type); BufferedImage(const std::string& File, bool filenameHasExtension = false, bool bTitleUpdateTexture = false, - const std::string& drive = ""); // 4J added - BufferedImage(DLCPack* dlcPack, const std::string& File, - bool filenameHasExtension = false); // 4J Added + const std::string& drive = ""); // 4J added BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes); // 4J added ~BufferedImage(); + // Decode `numBytes` of PNG-encoded texture data into mipmap slot + // `level`. The first call (level == 0) populates width/height. + // Returns true on success. + bool loadMipmapPng(int level, std::uint8_t* bytes, std::uint32_t numBytes); + int getWidth(); int getHeight(); void getRGB(int startX, int startY, int w, int h, std::vector& out, diff --git a/targets/minecraft/client/Camera.cpp b/targets/minecraft/client/Camera.cpp index b5b31e63f..1e8f2d924 100644 --- a/targets/minecraft/client/Camera.cpp +++ b/targets/minecraft/client/Camera.cpp @@ -1,14 +1,12 @@ #include "Camera.h" - -#include #include #include +#include #include #include "MemoryTracker.h" -#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -18,6 +16,7 @@ #include "minecraft/world/level/tile/LiquidTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/stubs.h" float Camera::xPlayerOffs = 0.0f; float Camera::yPlayerOffs = 0.0f; diff --git a/targets/minecraft/client/ClientConstants.cpp b/targets/minecraft/client/ClientConstants.cpp index ed9df059c..89fc249d8 100644 --- a/targets/minecraft/client/ClientConstants.cpp +++ b/targets/minecraft/client/ClientConstants.cpp @@ -1,6 +1,6 @@ #include "ClientConstants.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" const std::string ClientConstants::VERSION_STRING = std::string("Minecraft Xbox ") + VER_FILEVERSION_STR_W + diff --git a/targets/minecraft/client/IMenuService.h b/targets/minecraft/client/IMenuService.h index deac5a411..2a782bccc 100644 --- a/targets/minecraft/client/IMenuService.h +++ b/targets/minecraft/client/IMenuService.h @@ -44,8 +44,7 @@ public: std::shared_ptr trap) = 0; virtual bool openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) = 0; - virtual bool openSign(int iPad, - std::shared_ptr sign) = 0; + virtual bool openSign(int iPad, std::shared_ptr sign) = 0; virtual bool openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) = 0; virtual bool openTrading(int iPad, std::shared_ptr inventory, @@ -55,9 +54,9 @@ public: int iPad, std::shared_ptr commandBlock) = 0; virtual bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) = 0; - virtual bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) = 0; + virtual bool openHopperMinecart(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) = 0; virtual bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) = 0; diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index e2a03d56f..4811b786e 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -1,10 +1,9 @@ #include "Lighting.h" - - -#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FloatBuffer* Lighting::lb = new FloatBuffer(16); diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index f8830d3c3..41a7a60a2 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -3,9 +3,9 @@ #include #include - -#include "platform/renderer/renderer.h" #include "java/ByteBuffer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" std::unordered_map MemoryTracker::GL_LIST_IDS; std::vector MemoryTracker::TEXTURE_IDS; diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 91fbb8db1..310ab240c 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -17,14 +17,10 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/GameEnums.h" @@ -54,9 +50,9 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/util/Log.h" @@ -85,6 +81,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/CompressedTileStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" @@ -95,23 +92,24 @@ #include "minecraft/world/level/tile/TallGrassPlantTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/HitResult.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "platform/XboxStubs.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" +#include "platform/stubs.h" #include "strings.h" #if defined(ENABLE_JAVA_GUIS) #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif -#include "app/common/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" -#include "app/common/DLC/DLCPack.h" -#include "app/common/Minecraft_Macros.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" #include "java/File.h" #include "java/System.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/StaticConstructors.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/gui/Font.h" @@ -123,7 +121,8 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" #include "minecraft/client/renderer/texture/TextureManager.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/resources/Colours/ColourTable.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/world/entity/npc/Villager.h" #include "minecraft/world/item/alchemy/PotionMacros.h" #include "minecraft/world/level/chunk/SparseDataStorage.h" @@ -157,7 +156,8 @@ ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); Minecraft::Minecraft(Component* mouseComponent, Canvas* parent, MinecraftApplet* minecraftApplet, int width, int height, - bool fullscreen) { + bool fullscreen, IPlatformLeaderboard& leaderboard_) + : leaderboard(leaderboard_) { // 4J - added this block of initialisers gameMode = nullptr; hasCrashed = false; @@ -324,7 +324,7 @@ void Minecraft::init() { EntityRenderDispatcher::instance->itemInHandRenderer = new ItemInHandRenderer(this, false); - for (int i = 0; i < 4; ++i) stats[i] = new StatsCounter(); + for (int i = 0; i < 4; ++i) stats[i] = new StatsCounter(leaderboard); /* 4J - TODO, 4J-JEV: Unnecessary. Achievements::openInventory->setDescFormatter(nullptr); @@ -467,35 +467,27 @@ File Minecraft::getWorkingDirectory() { } File Minecraft::getWorkingDirectory(const std::string& applicationName) { - // 4J - original version - // 4jcraft: ported to C++ - std::string userHome = getenv("HOME"); - File* workingDirectory; -#if defined(__linux__) - workingDirectory = new File(userHome, '.' + applicationName + '/'); -#elif defined(_WINDOWS64) - std::string applicationData = getenv("APPDATA"); - if (!applicationData.empty()) { - workingDirectory = - new File(applicationData, '.' + applicationName + '/'); - } else { - workingDirectory = new File(userHome, '.' + applicationName + '/'); - } -// #elif defined(_MACOS) -// workingDirectory = new File(userHome, "Library/Application -// Support/" + applicationName); +#ifndef _WIN32 + const char* homedir = getenv("HOME"); #else - workingDirectory = new File(userHome, applicationName + '/'); + const char* homedir = getenv("USERPROFILE"); #endif - if (!workingDirectory->exists()) { - if (!workingDirectory->mkdirs()) { - Log::info("The working directory could not be created"); - assert(0); - // throw new RuntimeException("The working directory could not be - // created: " + workingDirectory); + + if (homedir != nullptr) { + File workingDirectory(std::string(homedir), '.' + applicationName + '/'); + + if (!workingDirectory.exists()) { + if (!workingDirectory.mkdirs()) { + Log::info("The working directory could not be created.\n"); + assert(0); + } } + + return workingDirectory; + } else { + Log::info("Could not locate user's home directory. This platform is likely missing an implementation of Minecraft::getWorkingDirectory.\n"); + assert(0); } - return *workingDirectory; } LevelStorageSource* Minecraft::getLevelSource() { return levelSource; } @@ -806,7 +798,7 @@ bool Minecraft::addLocalPlayer(int idx) { m_connectionFailed[idx] = false; m_pendingLocalConnections[idx] = nullptr; - bool success = g_NetworkManager.AddLocalPlayerByUserIndex(idx); + bool success = NetworkService.AddLocalPlayerByUserIndex(idx); if (success) { Log::info("Adding temp local player on pad %d\n", idx); @@ -827,7 +819,7 @@ bool Minecraft::addLocalPlayer(int idx) { ui.NavigateToScene(idx, eUIScene_ConnectingProgress, param); } else { - Log::info("g_NetworkManager.AddLocalPlayerByUserIndex failed\n"); + Log::info("NetworkService.AddLocalPlayerByUserIndex failed\n"); } return success; @@ -957,7 +949,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { ->removeClientConnection(mplp->connection, true); delete mplp->connection; mplp->connection = nullptr; - g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); + NetworkService.RemoveLocalPlayerByUserIndex(idx); } getLevel(localplayers[idx]->dimension)->removeEntity(localplayers[idx]); @@ -975,7 +967,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { ; delete m_pendingLocalConnections[idx]; m_pendingLocalConnections[idx] = nullptr; - g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); + NetworkService.RemoveLocalPlayerByUserIndex(idx); } else { // Not sure how this works on qnet, but for other platforms, calling // RemoveLocalPlayerByUserIndex won't do anything if there isn't a local @@ -1062,7 +1054,7 @@ void Minecraft::run_middle() { // } // 4J-PB - AUTOSAVE TIMER - if the player is the host - if (level != nullptr && g_NetworkManager.IsHost()) { + if (level != nullptr && NetworkService.IsHost()) { /*if(!bAutosaveTimerSet) { // set the timer @@ -1096,18 +1088,8 @@ void Minecraft::run_middle() { TexturePack* tPack = Minecraft::GetInstance() ->skins->getSelected(); - DLCTexturePack* pDLCTexPack = - (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = - pDLCTexPack->getDLCInfoParentPack(); - - if (pDLCPack) { - if (!pDLCPack->hasPurchasedFile( - DLCManager::e_DLCType_Texture, - "")) { - bTrialTexturepack = true; - } + if (tPack->needsPurchase()) { + bTrialTexturepack = true; } } @@ -1131,21 +1113,15 @@ void Minecraft::run_middle() { #if !defined(_CONTENT_PACKAGE) { // print the time - auto now_tp = std::chrono:: - system_clock::now(); - std::time_t now_tt = std::chrono:: - system_clock::to_time_t(now_tp); - std::tm utcTime{}; -#if defined(_WIN32) - gmtime_s(&utcTime, &now_tt); -#else - gmtime_r(&now_tt, &utcTime); -#endif + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::hh_mm_ss hms{std::chrono::floor(now - dp)}; Log::info("%02d:%02d:%02d\n", - utcTime.tm_hour, - utcTime.tm_min, - utcTime.tm_sec); + (int)hms.hours().count(), + (int)hms.minutes().count(), + (int)hms.seconds().count()); + } #endif } else { @@ -1184,7 +1160,7 @@ void Minecraft::run_middle() { // list get the unique save name and xuid from // whoever is the host INetworkPlayer* pHostPlayer = - g_NetworkManager.GetHostPlayer(); + NetworkService.GetHostPlayer(); PlayerUID xuid = pHostPlayer->GetUID(); if (gameServices().isInBannedLevelList( @@ -1216,7 +1192,7 @@ void Minecraft::run_middle() { // quadrant display to remind them to press start (if the // session has space) if (level != nullptr && bFirstTimeIntoGame && - g_NetworkManager.SessionHasSpace()) { + NetworkService.SessionHasSpace()) { // have a short delay before the display if (iFirstTimeCountdown == 0) { bFirstTimeIntoGame = false; @@ -1390,7 +1366,7 @@ void Minecraft::run_middle() { bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed( PlatformInput.GetPrimaryPad()) && - g_NetworkManager.SessionHasSpace() && + NetworkService.SessionHasSpace() && PlatformRenderer.IsHiDef() && PlatformInput.ButtonPressed(i); if (tryJoin) { @@ -1408,7 +1384,7 @@ void Minecraft::run_middle() { if (PlatformProfile.IsSignedIn(i)) { // if this is a local game, then the // player just needs to be signed in - if (g_NetworkManager.IsLocalGame() || + if (NetworkService.IsLocalGame() || (PlatformProfile.IsSignedInLive( i) && PlatformProfile @@ -1425,7 +1401,7 @@ void Minecraft::run_middle() { "ui\n"); PlatformProfile.RequestSignInUI( false, - g_NetworkManager + NetworkService .IsLocalGame(), true, false, true, [this](bool b, int p) { @@ -1443,7 +1419,8 @@ void Minecraft::run_middle() { player = createExtraLocalPlayer( i, - PlatformProfile.GetGamertag(i), + PlatformProfile + .GetGamertag(i), i, level->dimension ->id); @@ -1497,7 +1474,7 @@ void Minecraft::run_middle() { "ui\n"); PlatformProfile.RequestSignInUI( false, - g_NetworkManager + NetworkService .IsLocalGame(), true, false, true, [this](bool b, int p) { @@ -1512,8 +1489,7 @@ void Minecraft::run_middle() { Log::info( "Bringing up the sign in ui\n"); PlatformProfile.RequestSignInUI( - false, - g_NetworkManager.IsLocalGame(), + false, NetworkService.IsLocalGame(), true, false, true, [this](bool b, int p) { return InGame_SignInReturned( @@ -1739,7 +1715,7 @@ void Minecraft::run_middle() { Packet::renderAllPacketStats(); #else // To show the size of the QNet queue in bytes and messages - g_NetworkManager.renderQueueMeter(); + NetworkService.renderQueueMeter(); #endif } else { lastTimer = System::nanoTime(); @@ -1778,8 +1754,8 @@ void Minecraft::run_middle() { // pause = !isClientSide() && screen != nullptr && // screen->isPauseScreen(); #if defined(ENABLE_JAVA_GUIS) - pause = g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1 && + pause = NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1 && screen != nullptr && screen->isPauseScreen(); #else pause = gameServices().isAppPaused(); @@ -3980,12 +3956,12 @@ std::string Minecraft::gatherStats1() { } std::string Minecraft::gatherStats2() { - return g_NetworkManager.GatherStats(); + return NetworkService.GatherStats(); // return levelRenderer->gatherStats2(); } std::string Minecraft::gatherStats3() { - return g_NetworkManager.GatherRTTStats(); + return NetworkService.GatherRTTStats(); // return "P: " + particleEngine->countParticles() + ". T: " + // level->gatherStats(); } @@ -4101,13 +4077,15 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { gameRenderer->EnableUpdateThread(); } -void Minecraft::start(const std::string& name, const std::string& sid) { - startAndConnectTo(name, sid, ""); +void Minecraft::start(const std::string& name, const std::string& sid, + IPlatformLeaderboard& leaderboard) { + startAndConnectTo(name, sid, "", leaderboard); } void Minecraft::startAndConnectTo(const std::string& name, const std::string& sid, - const std::string& url) { + const std::string& url, + IPlatformLeaderboard& leaderboard) { bool fullScreen = false; std::string userName = name; @@ -4130,7 +4108,8 @@ void Minecraft::startAndConnectTo(const std::string& name, Minecraft* minecraft; // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); - minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen); + minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen, + leaderboard); /* - 4J - removed { @@ -4202,7 +4181,7 @@ bool useLomp = false; int g_iMainThreadId; -void Minecraft::main() { +void Minecraft::main(IPlatformLeaderboard& leaderboard) { std::string name; std::string sessionId; @@ -4214,7 +4193,7 @@ void Minecraft::main() { EntityRenderDispatcher::staticCtor(); TileEntityRenderDispatcher::staticCtor(); User::staticCtor(); - Tutorial::staticCtor(); + ITutorial::staticInit(); ColourTable::staticCtor(); gameServices().loadDefaultGameRules(); @@ -4242,7 +4221,7 @@ void Minecraft::main() { // On PS4, we call Minecraft::Start from another thread, as this has been // timed taking ~2.5 seconds and we need to do some basic rendering stuff so // that we don't break the TRCs on SubmitDone calls - Minecraft::start(name, sessionId); + Minecraft::start(name, sessionId, leaderboard); } bool Minecraft::renderNames() { @@ -4465,7 +4444,7 @@ void Minecraft::playerLeftTutorial(int iPad) { int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { Minecraft* pMinecraftClass = (Minecraft*)pParam; - if (g_NetworkManager.IsInSession()) { + if (NetworkService.IsInSession()) { // 4J Stu - There seems to be a bug in the signin ui call that enables // guest sign in. We never allow this within game, so make sure that // it's disabled Fix for #66516 - TCR #124: MPS Guest Support ; #001: @@ -4477,19 +4456,19 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { // If sign in succeded, we're in game and this player isn't already playing, // continue - if (bContinue == true && g_NetworkManager.IsInSession() && + if (bContinue == true && NetworkService.IsInSession() && pMinecraftClass->localplayers[iPad] == nullptr) { // It's possible that the player has not signed in - they can back out // or choose no for the converttoguest if (PlatformProfile.IsSignedIn(iPad)) { - if (!g_NetworkManager.SessionHasSpace()) { + if (!NetworkService.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); } // if this is a local game then profiles just need to be signed in - else if (g_NetworkManager.IsLocalGame() || + else if (NetworkService.IsLocalGame() || (PlatformProfile.IsSignedInLive(iPad) && PlatformProfile.AllowedToPlayMultiplayer(iPad))) { if (pMinecraftClass->level->isClientSide) { @@ -4500,8 +4479,8 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { pMinecraftClass->localplayers[iPad]; if (player == nullptr) { player = pMinecraftClass->createExtraLocalPlayer( - iPad, PlatformProfile.GetGamertag(iPad), - iPad, pMinecraftClass->level->dimension->id); + iPad, PlatformProfile.GetGamertag(iPad), iPad, + pMinecraftClass->level->dimension->id); } } } else if (PlatformProfile.IsSignedInLive( diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 44ca6988a..efb538884 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -6,12 +6,13 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/C4JThread.h" #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/PlatformTypes.h" +#include "platform/leaderboard/leaderboard.h" #include "platform/stubs.h" +#include "platform/thread/C4JThread.h" class Timer; class MultiPlayerLevel; @@ -31,7 +32,7 @@ class BackgroundDownloader; class HumanoidModel; class HitResult; class Options; -class SoundEngine; +class ConsoleSoundEngine; class MinecraftApplet; class MouseHandler; class TexturePackRepository; @@ -69,7 +70,7 @@ public: static const std::string VERSION_STRING; Minecraft(Component* mouseComponent, Canvas* parent, MinecraftApplet* minecraftApplet, int width, int height, - bool fullscreen); + bool fullscreen, IPlatformLeaderboard& leaderboard); void init(); // 4J - removed @@ -190,7 +191,7 @@ protected: MinecraftApplet* minecraftApplet; public: - SoundEngine* soundEngine; + ConsoleSoundEngine* soundEngine; MouseHandler* mouseHandler; public: @@ -215,6 +216,11 @@ public: // 4J- this should really be in localplayer StatsCounter* stats[4]; + // Borrowed from the composition root - Minecraft does not own the + // backend. The reference is valid for the lifetime of the Minecraft + // singleton (the leaderboard outlives Minecraft). + IPlatformLeaderboard& leaderboard; + private: std::string connectToIp; int connectToPort; @@ -337,12 +343,14 @@ public: std::string gatherStats4(); void respawnPlayer(int iPad, int dimension, int newEntityId); - static void start(const std::string& name, const std::string& sid); + static void start(const std::string& name, const std::string& sid, + IPlatformLeaderboard& leaderboard); static void startAndConnectTo(const std::string& name, const std::string& sid, - const std::string& url); + const std::string& url, + IPlatformLeaderboard& leaderboard); ClientConnection* getConnection(int iPad); // 4J Stu added iPad param - static void main(); + static void main(IPlatformLeaderboard& leaderboard); static bool renderNames(); static bool useFancyGraphics(); static bool useAmbientOcclusion(); diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index a02461ef7..2efeb1b09 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,10 +1,7 @@ -#include "minecraft/util/Log.h" #include "Options.h" #include "KeyMapping.h" -#include "app/common/Audio/SoundEngine.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -16,7 +13,9 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "platform/stubs.h" +#include "util/StringHelpers.h" // 4J - the Option sub-class used to be an java enumerated type, trying to // emulate that functionality here @@ -104,8 +103,8 @@ const std::string Options::FRAMERATE_LIMITS[] = { #endif const std::string Options::PARTICLES[] = {"options.particles.all", - "options.particles.decreased", - "options.particles.minimal"}; + "options.particles.decreased", + "options.particles.minimal"}; // 4J added void Options::init() { @@ -375,7 +374,7 @@ void Options::load() { std::string line = ""; while ((line = br->readLine()) != "") // 4J - was check against nullptr - do we need to distinguish - // between empty lines and a fail here? + // between empty lines and a fail here? { // 4J - removed try/catch // try { @@ -395,8 +394,7 @@ void Options::load() { if (cmds[0] == "fov") fov = readFloat(cmds[1]); if (cmds[0] == "gamma") gamma = readFloat(cmds[1]); if (cmds[0] == "invertYMouse") invertYMouse = cmds[1] == "true"; - if (cmds[0] == "viewDistance") - viewDistance = fromWString(cmds[1]); + if (cmds[0] == "viewDistance") viewDistance = fromWString(cmds[1]); if (cmds[0] == "guiScale") guiScale = fromWString(cmds[1]); if (cmds[0] == "particles") particles = fromWString(cmds[1]); if (cmds[0] == "bobView") bobView = cmds[1] == "true"; @@ -445,8 +443,8 @@ void Options::save() { dos.writeChars("music:" + toWString(music) + "\n"); dos.writeChars("sound:" + toWString(sound) + "\n"); - dos.writeChars("invertYMouse:" + - std::string(invertYMouse ? "true" : "false") + "\n"); + dos.writeChars( + "invertYMouse:" + std::string(invertYMouse ? "true" : "false") + "\n"); dos.writeChars("mouseSensitivity:" + toWString(sensitivity)); dos.writeChars("fov:" + toWString(fov)); dos.writeChars("gamma:" + toWString(gamma)); @@ -454,16 +452,14 @@ void Options::save() { dos.writeChars("guiScale:" + toWString(guiScale)); dos.writeChars("particles:" + toWString(particles)); dos.writeChars("bobView:" + std::string(bobView ? "true" : "false")); - dos.writeChars("anaglyph3d:" + - std::string(anaglyph3d ? "true" : "false")); + dos.writeChars("anaglyph3d:" + std::string(anaglyph3d ? "true" : "false")); dos.writeChars("advancedOpengl:" + std::string(advancedOpengl ? "true" : "false")); dos.writeChars("fpsLimit:" + toWString(framerateLimit)); dos.writeChars("difficulty:" + toWString(difficulty)); dos.writeChars("fancyGraphics:" + std::string(fancyGraphics ? "true" : "false")); - dos.writeChars("ao:" + - std::string(ambientOcclusion ? "true" : "false")); + dos.writeChars("ao:" + std::string(ambientOcclusion ? "true" : "false")); dos.writeChars("clouds:" + toWString(renderClouds)); dos.writeChars("skin:" + skin); dos.writeChars("lastServer:" + lastMpIp); diff --git a/targets/minecraft/client/gui/Button.cpp b/targets/minecraft/client/gui/Button.cpp index f2ea78386..d4b48ad3c 100644 --- a/targets/minecraft/client/gui/Button.cpp +++ b/targets/minecraft/client/gui/Button.cpp @@ -1,9 +1,10 @@ #include "Button.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Minecraft; #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/ChatScreen.cpp b/targets/minecraft/client/gui/ChatScreen.cpp index 69eb819e7..224962a8d 100644 --- a/targets/minecraft/client/gui/ChatScreen.cpp +++ b/targets/minecraft/client/gui/ChatScreen.cpp @@ -2,16 +2,15 @@ #include -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" -const std::string ChatScreen::allowedChars = - SharedConstants::acceptableLetters; +const std::string ChatScreen::allowedChars = SharedConstants::acceptableLetters; ChatScreen::ChatScreen() { frame = 0; } diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index a423d9c9c..341baec9c 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CreateWorldScreen.h" #include @@ -8,19 +6,20 @@ #include #include -#include "platform/storage/storage.h" #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/network/INetworkService.h" +#include "minecraft/util/Log.h" +#include "platform/storage/storage.h" +// Needed for the &CGameNetworkManager::RunNetworkGameThreadProc address-of +// below. Static thread procs can't be virtual; this one consumer keeps the +// concrete type include. #include "app/common/Network/GameNetworkManager.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -29,6 +28,9 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/network/NetTypes.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" CreateWorldScreen::CreateWorldScreen(Screen* lastScreen) { done = false; // 4J added @@ -253,44 +255,46 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->settings = 0; gameServices().setGameHostOption(eGameHostOption_Difficulty, - minecraft->options->difficulty); - gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends, - moreOptionsParams->bAllowFriendsOfFriends); + minecraft->options->difficulty); + gameServices().setGameHostOption( + eGameHostOption_FriendsOfFriends, + moreOptionsParams->bAllowFriendsOfFriends); gameServices().setGameHostOption(eGameHostOption_Gamertags, 1); gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0); gameServices().setGameHostOption(eGameHostOption_GameType, - (gameMode == "survival") - ? GameType::SURVIVAL->getId() - : GameType::CREATIVE->getId()); + (gameMode == "survival") + ? GameType::SURVIVAL->getId() + : GameType::CREATIVE->getId()); gameServices().setGameHostOption(eGameHostOption_LevelType, - moreOptionsParams->bFlatWorld); + moreOptionsParams->bFlatWorld); gameServices().setGameHostOption(eGameHostOption_Structures, - moreOptionsParams->bStructures); + moreOptionsParams->bStructures); gameServices().setGameHostOption(eGameHostOption_BonusChest, - moreOptionsParams->bBonusChest); - gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); + moreOptionsParams->bBonusChest); + gameServices().setGameHostOption(eGameHostOption_PvP, + moreOptionsParams->bPVP); gameServices().setGameHostOption(eGameHostOption_TrustPlayers, - moreOptionsParams->bTrust); + moreOptionsParams->bTrust); gameServices().setGameHostOption(eGameHostOption_FireSpreads, - moreOptionsParams->bFireSpreads); - gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); + moreOptionsParams->bFireSpreads); + gameServices().setGameHostOption(eGameHostOption_TNT, + moreOptionsParams->bTNT); gameServices().setGameHostOption(eGameHostOption_HostCanFly, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_CheatsEnabled, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); param->settings = gameServices().getGameHostOption(eGameHostOption_All); param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; - g_NetworkManager.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, - 0); + NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, 0); - g_NetworkManager.FakeLocalPlayerJoined(); + NetworkService.FakeLocalPlayerJoined(); LoadingInputParams* loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; @@ -405,8 +409,7 @@ void CreateWorldScreen::render(int xm, int ym, float a) { width / 2 - 100, 85, 0xa0a0a0); drawString(font, language->getElement("selectWorld.mapFeatures.info"), width / 2 - 150, 122, 0xa0a0a0); - drawString(font, - language->getElement("selectWorld.allowCommands.info"), + drawString(font, language->getElement("selectWorld.allowCommands.info"), width / 2 - 150, 157, 0xa0a0a0); seedEdit->render(); diff --git a/targets/minecraft/client/gui/CreateWorldScreen.h b/targets/minecraft/client/gui/CreateWorldScreen.h index 550a650d5..4aee42a54 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.h +++ b/targets/minecraft/client/gui/CreateWorldScreen.h @@ -44,7 +44,7 @@ private: public: static std::string findAvailableFolderName(LevelStorageSource* levelSource, - const std::string& folder); + const std::string& folder); virtual void removed() override; protected: diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 723d88fd9..a59bfcf92 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -4,13 +4,14 @@ #include #include -#include "platform/renderer/renderer.h" #include "Button.h" #include "PauseScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void DeathScreen::init() { buttons.clear(); diff --git a/targets/minecraft/client/gui/DeathScreen.h b/targets/minecraft/client/gui/DeathScreen.h index 96e0d6260..a20c9ea55 100644 --- a/targets/minecraft/client/gui/DeathScreen.h +++ b/targets/minecraft/client/gui/DeathScreen.h @@ -6,7 +6,7 @@ public: virtual void init() override; protected: - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; virtual void buttonClicked(Button* button) override; public: diff --git a/targets/minecraft/client/gui/EditBox.cpp b/targets/minecraft/client/gui/EditBox.cpp index 9af8859d3..af4085859 100644 --- a/targets/minecraft/client/gui/EditBox.cpp +++ b/targets/minecraft/client/gui/EditBox.cpp @@ -1,8 +1,8 @@ #include "EditBox.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" EditBox::EditBox(Screen* screen, Font* font, int x, int y, int width, int height, const std::string& value) { diff --git a/targets/minecraft/client/gui/ErrorScreen.cpp b/targets/minecraft/client/gui/ErrorScreen.cpp index 73cbb843d..05c60e996 100644 --- a/targets/minecraft/client/gui/ErrorScreen.cpp +++ b/targets/minecraft/client/gui/ErrorScreen.cpp @@ -2,8 +2,7 @@ #include "minecraft/client/gui/Screen.h" -ErrorScreen::ErrorScreen(const std::string& title, - const std::string& message) { +ErrorScreen::ErrorScreen(const std::string& title, const std::string& message) { this->title = title; this->message = message; } diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index bc2b164ba..2120533d0 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -13,6 +13,7 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" Font::Font(Options* options, const std::string& name, Textures* textures, @@ -187,8 +188,8 @@ void Font::draw(const std::string& str, bool dropShadow) { // 4jcraft: this is a check for §. This was easy in UTF-16, since a // single widechar can fit §, but it's encoded as 0xA7 0xC2 in UTF-8, so // we need to check both characters. - if (i + 2 < cleanStr.length() && c == '\xC2' && - (unsigned char)cleanStr[i + 1] == '\xA7') { + if (i + 2 < cleanStr.length() && c == 0xC2u && + (unsigned char)cleanStr[i + 1] == 0xA7u) { // 4J - following block was: // int colorN = // "0123456789abcdefk".indexOf(str.toLowerCase().charAt(i + 1)); diff --git a/targets/minecraft/client/gui/Font.h b/targets/minecraft/client/gui/Font.h index 83b0a4ce1..03a84f04c 100644 --- a/targets/minecraft/client/gui/Font.h +++ b/targets/minecraft/client/gui/Font.h @@ -64,8 +64,7 @@ private: std::string reorderBidi(const std::string& str); void draw(const std::string& str, bool dropShadow); - void draw(const std::string& str, int x, int y, int color, - bool dropShadow); + void draw(const std::string& str, int x, int y, int color, bool dropShadow); int MapCharacter(char c); // 4J added bool CharacterExists(char c); // 4J added diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index b967cf608..e9d83a348 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,23 +1,16 @@ -#include "minecraft/IGameServices.h" #include "Gui.h" -#include #include +#include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Facing.h" -#include "minecraft/GameEnums.h" -#include "app/common/App_structs.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" +#include "java/Color.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" -#include "java/Color.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/Lighting.h" @@ -37,28 +30,30 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/resources/ResourceLocation.h" - #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/entity/Entity.h" +#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" +#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" -#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" -#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/food/FoodConstants.h" - #include "minecraft/world/item/ItemInstance.h" - #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/PortalTile.h" #include "minecraft/world/level/tile/Tile.h" - +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" +#include "util/StringHelpers.h" ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR); @@ -113,10 +108,12 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J-PB - selected the gui scale based on the slider settings if (minecraft->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { - guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; - } else { guiScale = - gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; + gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; + } else { + guiScale = gameServices().getGameSettings( + iPad, eGameSetting_UISizeSplitscreen) + + 2; } ScreenSizeCalculator ssc(minecraft->options, minecraft->width, @@ -251,7 +248,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { eAppAction_AutosaveSaveGameCapturedThumbnail); // if tooltips are off, set the y offset to zero - if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { + if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && + bDisplayGui) { switch (minecraft->player->m_iScreenSection) { case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: iTooltipsYOffset = screenHeight / 10; @@ -359,7 +357,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { } PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); currentGuiBlendFactor = fVal / 255.0f; // PlatformRenderer.StateSetBlendFactor(0x40ffffff); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); @@ -411,7 +409,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { &GUI_ICONS_LOCATION); // "/gui/icons.png")); glEnable(GL_BLEND); PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); // glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); // 4J Stu - We don't want to adjust the cursor by the safezone, we @@ -729,7 +727,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // positions worked out by hand from the xui implementation of the // crouch icon - if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { + if (gameServices().getGameSettings(iPad, + eGameSetting_AnimatedCharacter)) { // int playerIdx = minecraft->player->GetXboxPad(); static int characterDisplayTimer[4] = {0}; @@ -951,9 +950,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { if (minecraft->options->renderDebug) { glPushMatrix(); if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0); - font->drawShadow(ClientConstants::VERSION_STRING + " (" + - minecraft->fpsString + ")", - iSafezoneXHalf + 2, 20, 0xffffff); + font->drawShadow( + ClientConstants::VERSION_STRING + " (" + minecraft->fpsString + ")", + iSafezoneXHalf + 2, 20, 0xffffff); font->drawShadow( "Seed: " + toWString(minecraft->level->getLevelData()->getSeed()), @@ -978,8 +977,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { wfeature[eTerrainFeature_Village] = "Village: "; wfeature[eTerrainFeature_Ravine] = "Ravine: "; - for (int i = 0; i < gameServices().getTerrainFeatures().size(); i++) { - FEATURE_DATA* pFeatureData = gameServices().getTerrainFeatures()[i]; + for (int i = 0; i < gameServices().getTerrainFeatures().size(); + i++) { + FEATURE_DATA* pFeatureData = + gameServices().getTerrainFeatures()[i]; std::string itemInfo = "[" + toWString(pFeatureData->x * 16) + ", " + @@ -1016,8 +1017,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth double zBlockPos = floor(minecraft->player->z); drawString(font, "x: " + toWString(minecraft->player->x) + - "/ Head: " + toWString(xBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(xBlockPos) + "/ Chunk: " + toWString(minecraft->player->xChunk), iSafezoneXHalf + 2, iYPos + 8 * 0, 0xe0e0e0); drawString(font, @@ -1026,8 +1026,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth iSafezoneXHalf + 2, iYPos + 8 * 1, 0xe0e0e0); drawString(font, "z: " + toWString(minecraft->player->z) + - "/ Head: " + toWString(zBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(zBlockPos) + "/ Chunk: " + toWString(minecraft->player->zChunk), iSafezoneXHalf + 2, iYPos + 8 * 2, 0xe0e0e0); drawString( @@ -1048,10 +1047,10 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth LevelChunk* chunkAt = minecraft->level->getChunkAt(px, pz); Biome* biome = chunkAt->getBiome( px & 15, pz & 15, minecraft->level->getBiomeSource()); - drawString(font, - "b: " + biome->m_name + " (" + - toWString(biome->id) + ")", - iSafezoneXHalf + 2, iYPos, 0xe0e0e0); + drawString( + font, + "b: " + biome->m_name + " (" + toWString(biome->id) + ")", + iSafezoneXHalf + 2, iYPos, 0xe0e0e0); } glPopMatrix(); @@ -1085,7 +1084,8 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth int col = 0xffffff; if (animateOverlayMessageColor) { - col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & 0xffffff; + col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & + 0xffffff; } // 4J-PB - this is the string displayed when cds are placed in a // jukebox @@ -1465,8 +1465,8 @@ void Gui::addMessage(const std::string& _string, int iPad, // add to all for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (minecraft->localplayers[i] && - !(bIsDeathMessage && - gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) { + !(bIsDeathMessage && gameServices().getGameSettings( + i, eGameSetting_DeathMessages) == 0)) { guiMessages[i].insert(guiMessages[i].begin(), GuiMessage(string)); while (guiMessages[i].size() > 50) { @@ -1475,7 +1475,8 @@ void Gui::addMessage(const std::string& _string, int iPad, } } } else if (!(bIsDeathMessage && - gameServices().getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) { + gameServices().getGameSettings( + iPad, eGameSetting_DeathMessages) == 0)) { guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string)); while (guiMessages[iPad].size() > 50) { guiMessages[iPad].pop_back(); @@ -1517,8 +1518,8 @@ void Gui::setNowPlaying(const std::string& string) { void Gui::displayClientMessage(int messageId, int iPad) { // Language *language = Language::getInstance(); - std::string languageString = - gameServices().getString(messageId); // language->getElement(messageId); + std::string languageString = gameServices().getString( + messageId); // language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/targets/minecraft/client/gui/Gui.h b/targets/minecraft/client/gui/Gui.h index 7cee85007..b60408898 100644 --- a/targets/minecraft/client/gui/Gui.h +++ b/targets/minecraft/client/gui/Gui.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "GuiComponent.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "platform/PlatformTypes.h" class Random; class Minecraft; diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index 11b209f2c..c6918b199 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -1,13 +1,13 @@ #include "GuiComponent.h" - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void GuiComponent::hLine(int x0, int x1, int y, int col) { if (x1 < x0) { @@ -92,8 +92,8 @@ void GuiComponent::fillGradient(int x0, int y0, int x1, int y1, int col1, GuiComponent::GuiComponent() { blitOffset = 0; } -void GuiComponent::drawCenteredString(Font* font, const std::string& str, - int x, int y, int color) { +void GuiComponent::drawCenteredString(Font* font, const std::string& str, int x, + int y, int color) { font->drawShadow(str, x - (font->width(str)) / 2, y, color); } diff --git a/targets/minecraft/client/gui/InBedChatScreen.cpp b/targets/minecraft/client/gui/InBedChatScreen.cpp index 65cac4711..ec0ab8e10 100644 --- a/targets/minecraft/client/gui/InBedChatScreen.cpp +++ b/targets/minecraft/client/gui/InBedChatScreen.cpp @@ -5,12 +5,12 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/ChatScreen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void InBedChatScreen::init() { Keyboard::enableRepeatEvents(true); diff --git a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp index 14555085d..c15972f95 100644 --- a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp +++ b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" JoinMultiplayerScreen::JoinMultiplayerScreen(Screen* lastScreen) { ipEdit = nullptr; @@ -103,10 +103,10 @@ void JoinMultiplayerScreen::render(int xm, int ym, float a) { drawCenteredString(font, language->getElement("multiplayer.title"), width / 2, height / 4 - 60 + 20, 0xffffff); - drawString(font, language->getElement("multiplayer.info1"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); - drawString(font, language->getElement("multiplayer.info2"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info1"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info2"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); drawString(font, language->getElement("multiplayer.ipinfo"), width / 2 - 140, height / 4 - 60 + 60 + 9 * 4, 0xa0a0a0); diff --git a/targets/minecraft/client/gui/MessageScreen.h b/targets/minecraft/client/gui/MessageScreen.h index 83b3d3383..d04100717 100644 --- a/targets/minecraft/client/gui/MessageScreen.h +++ b/targets/minecraft/client/gui/MessageScreen.h @@ -13,7 +13,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index cae204f9c..55cd03f07 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -1,23 +1,23 @@ #include "Minimap.h" - #include #include #include #include -#include "platform/renderer/renderer.h" #include "Font.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/material/MaterialColor.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" int Minimap::LUT[256]; // 4J added bool Minimap::genLUT = true; // 4J added @@ -71,7 +71,7 @@ void Minimap::reloadColours() { int b = ((color) & 0xff) * br / 255; // 4J - changed byte order to save having to reorder later -#if defined(_WIN64) || __linux__ +#if 1 LUT[i] = 255 << 24 | b << 16 | g << 8 | r; #else LUT[i] = r << 24 | g << 16 | b << 8 | 255; diff --git a/targets/minecraft/client/gui/NameEntryScreen.cpp b/targets/minecraft/client/gui/NameEntryScreen.cpp index 3eb92a8ed..f66185978 100644 --- a/targets/minecraft/client/gui/NameEntryScreen.cpp +++ b/targets/minecraft/client/gui/NameEntryScreen.cpp @@ -3,17 +3,17 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string NameEntryScreen::allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " ",.:-_'*!\"#%/()=+?[]{}<>"; -NameEntryScreen::NameEntryScreen(Screen* lastScreen, - const std::string& oldName, int slot) { +NameEntryScreen::NameEntryScreen(Screen* lastScreen, const std::string& oldName, + int slot) { frame = 0; // 4J added this->lastScreen = lastScreen; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 941edff8f..de6095493 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "PauseScreen.h" #include @@ -8,18 +7,19 @@ #include #include -#include "platform/input/input.h" #include "Button.h" #include "MessageScreen.h" -#include "minecraft/GameEnums.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "OptionsScreen.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/I18n.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "platform/input/input.h" PauseScreen::PauseScreen() { saveStep = 0; @@ -31,13 +31,12 @@ void PauseScreen::init() { buttons.clear(); int yo = -16; // 4jcraft: solves the issue of client-side only pausing in the java gui - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { buttons[0]->msg = I18n::get("menu.disconnect"); } @@ -68,10 +67,11 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { MinecraftServer* server = MinecraftServer::getInstance(); minecraft->setScreen(new MessageScreen("Leaving world")); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { server->setSaveOnExit(save); } - gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); + gameServices().setAction(minecraft->player->GetXboxPad(), + eAppAction_ExitWorld); } void PauseScreen::buttonClicked(Button* button) { @@ -91,8 +91,8 @@ void PauseScreen::buttonClicked(Button* button) { exitWorld(minecraft, true); } if (button->id == 4) { - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } diff --git a/targets/minecraft/client/gui/RenameWorldScreen.cpp b/targets/minecraft/client/gui/RenameWorldScreen.cpp index fb060ff2b..da2decafc 100644 --- a/targets/minecraft/client/gui/RenameWorldScreen.cpp +++ b/targets/minecraft/client/gui/RenameWorldScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" #include "minecraft/world/level/storage/LevelStorageSource.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" RenameWorldScreen::RenameWorldScreen(Screen* lastScreen, const std::string& levelId) { diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 9c681564d..d3f7ba96f 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,20 +1,21 @@ -#include "minecraft/IGameServices.h" #include "Screen.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "Button.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/GameEnums.h" -#include "app/common/Audio/SoundEngine.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" -#include "platform/stubs.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" -#include "minecraft/client/gui/particle/GuiParticles.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" +#include "minecraft/client/gui/particle/GuiParticles.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/network/INetworkService.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/stubs.h" Screen::Screen() // 4J added { @@ -41,10 +42,10 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { // minecraft->grabMouse(); // 4J - removed // 4jcraft: moved here from PauseScreen to ensure that serverside // unpausing is done in all scenarios - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + if (NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1) + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } } diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index edcefd9c0..310826442 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -1,24 +1,25 @@ -#include "minecraft/util/Log.h" #include "SelectWorldScreen.h" #include +#include #include +#include +#include #include #include "Button.h" #include "ConfirmScreen.h" #include "CreateWorldScreen.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "RenameWorldScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/ScrolledSelectionList.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/LevelStorageSource.h" #include "minecraft/world/level/storage/LevelSummary.h" +#include "util/StringHelpers.h" SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) { // 4J - added initialisers @@ -109,8 +110,7 @@ void SelectWorldScreen::buttonClicked(Button* button) { std::string warning = "'" + worldName + "' " + language->getElement("selectWorld.deleteWarning"); - std::string yes = - language->getElement("selectWorld.deleteButton"); + std::string yes = language->getElement("selectWorld.deleteButton"); std::string no = language->getElement("gui.cancel"); ConfirmScreen* confirmScreen = @@ -259,22 +259,25 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, std::string id = levelSummary->getLevelId(); - ULARGE_INTEGER rawtime; - rawtime.QuadPart = levelSummary->getLastPlayed() * - 10000; // Convert it from milliseconds back to FileTime + // levelSummary->getLastPlayed() is milliseconds since the FILETIME + // epoch (1601-01-01 UTC). Convert to chrono::system_clock (1970 + // epoch) by subtracting the constant offset, then break down with + // gmtime_r for display. + constexpr int64_t kFileTimeEpochToUnixEpochMs = 11644473600000LL; + const int64_t lastPlayedUnixMs = + levelSummary->getLastPlayed() - kFileTimeEpochToUnixEpochMs; + const auto tp = std::chrono::system_clock::time_point{ + std::chrono::milliseconds{lastPlayedUnixMs}}; + auto dp = std::chrono::floor(tp); + std::chrono::year_month_day ymd{dp}; + std::chrono::hh_mm_ss hms{ + std::chrono::floor(tp - dp)}; - FILETIME timeasfiletime; - timeasfiletime.dwHighDateTime = rawtime.HighPart; - timeasfiletime.dwLowDateTime = rawtime.LowPart; - - SYSTEMTIME time; - FileTimeToSystemTime(&timeasfiletime, &time); - - char buffer[20]; // 4J Stu - Currently shows years as 4 digits, where java only showed 2 - snprintf(buffer, 20, "%d/%d/%d %d:%02d", time.wDay, time.wMonth, - time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this - id = id + " (" + buffer; + // 4J - TODO Localise this + id += std::format(" ({}/{}/{} {}:{:02d}", (unsigned)ymd.day(), + (unsigned)ymd.month(), (int)ymd.year(), + (int)hms.hours().count(), (int)hms.minutes().count()); int64_t size = levelSummary->getSizeOnDisk(); id = id + ", " + toWString(size / 1024 * 100 / 1024 / 100.0f) + diff --git a/targets/minecraft/client/gui/SlideButton.cpp b/targets/minecraft/client/gui/SlideButton.cpp index d617e1bef..95bd9b608 100644 --- a/targets/minecraft/client/gui/SlideButton.cpp +++ b/targets/minecraft/client/gui/SlideButton.cpp @@ -1,9 +1,10 @@ #include "SlideButton.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Button.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SlideButton::SlideButton(int id, int x, int y, const Options::Option* option, const std::string& msg, float value) diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index ee0063317..844be43b1 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -2,11 +2,11 @@ #include - #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index 1830e3a22..62ac5def1 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -1,16 +1,16 @@ #include "AchievementPopup.h" - - -#include "platform/renderer/renderer.h" #include "java/System.h" +#include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" -#include "minecraft/client/Lighting.h" +#include "minecraft/SharedConstants.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementPopup::AchievementPopup(Minecraft* mc) { // 4J - added initialisers @@ -77,7 +77,7 @@ void AchievementPopup::render() { prepareWindow(); std::string title = "Minecraft " + SharedConstants::VERSION_STRING + - " Unlicensed Copy :("; + " Unlicensed Copy :("; std::string msg1 = "(Or logged in from another location)"; std::string msg2 = "Purchase at minecraft.net"; diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index 1789ce69e..6b34dc186 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -1,12 +1,8 @@ #include "AchievementScreen.h" - - #include #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -17,6 +13,8 @@ #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementScreen::AchievementScreen(StatsCounter* statsCounter) { // 4J - added initialisers diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.h b/targets/minecraft/client/gui/achievement/AchievementScreen.h index 1b4d35934..5e780812e 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.h +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.h @@ -2,7 +2,6 @@ #include "minecraft/client/gui/Screen.h" #include "minecraft/stats/Achievements.h" - class StatsCounter; class AchievementScreen : public Screen { @@ -49,7 +48,7 @@ public: protected: virtual void buttonClicked(Button* button) override; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void render(int mouseX, int mouseY, float a) override; diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index d9dbee6b6..8e8f129c2 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,8 +1,7 @@ #include "StatsScreen.h" -#include "app/common/Audio/SoundEngine.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" @@ -11,11 +10,12 @@ #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/ItemStat.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class Tesselator; diff --git a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp index b862f511c..c64f49710 100644 --- a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp @@ -2,11 +2,12 @@ #include -#include "platform/renderer/renderer.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index a9a53c044..5c552d809 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -1,12 +1,10 @@ -#include "minecraft/IGameServices.h" #include "AbstractContainerScreen.h" #include #include -#include "app/linux/LinuxGame.h" -#include "platform/stubs.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -16,11 +14,12 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/Rarity.h" -#include "minecraft/world/entity/player/Inventory.h" +#include "platform/stubs.h" ItemRenderer* AbstractContainerScreen::itemRenderer = new ItemRenderer(); @@ -249,7 +248,8 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr item, } if (!cleanedLines.empty()) { - lineColors[0] = gameServices().getHTMLColour(item->getRarity()->color); + lineColors[0] = + gameServices().getHTMLColour(item->getRarity()->color); } renderTooltipInternal(cleanedLines, lineColors, xm, ym); diff --git a/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp index 4226697e6..34a6b3137 100644 --- a/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp @@ -23,6 +23,6 @@ BeaconCancelButton::BeaconCancelButton(BeaconScreen* screen, int id, int x, } void BeaconCancelButton::renderTooltip(int xm, int ym) { - screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), - xm, ym); + screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), xm, + ym); } \ No newline at end of file diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp index 14f9d2198..b4a2acdbb 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -1,14 +1,13 @@ -#include "minecraft/IGameServices.h" #include "BeaconPowerButton.h" #include #include "BeaconScreen.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/gui/inventory/AbstractBeaconButton.h" -#include "minecraft/world/effect/MobEffect.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/world/effect/MobEffect.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h index 9a6750239..f29a10cb7 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h @@ -1,7 +1,6 @@ #pragma once #include "AbstractBeaconButton.h" - class BeaconScreen; class BeaconPowerButton : public AbstractBeaconButton { diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 07bfa39aa..012514558 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -1,12 +1,9 @@ #include "BeaconScreen.h" - - #include #include #include -#include "platform/renderer/renderer.h" #include "BeaconCancelButton.h" #include "BeaconConfirmButton.h" #include "BeaconPowerButton.h" @@ -27,6 +24,8 @@ #include "minecraft/world/inventory/BeaconMenu.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes (and iggy too) diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.h b/targets/minecraft/client/gui/inventory/BeaconScreen.h index 4a977ac58..531b7c551 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.h +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BeaconMenu.h" - class BeaconConfirmButton; class BeaconCancelButton; class BeaconMenu; diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index 49f4b940b..20533c5b8 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -2,15 +2,15 @@ #include - +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h index 45f4a16bc..51d2a1bd3 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BrewingStandMenu.h" - class BrewingStandMenu; class BrewingStandTileEntity; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp index 87d7d5cbf..5a8dc4c16 100644 --- a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp @@ -1,10 +1,11 @@ #include "ContainerScreen.h" -#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/world/Container.h" +#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/Container.h" #include "minecraft/world/inventory/ContainerMenu.h" +#include "platform/stubs.h" ContainerScreen::ContainerScreen(std::shared_ptr inventory, std::shared_ptr container) diff --git a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp index 49e40f26e..f842e5277 100644 --- a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp @@ -10,6 +10,7 @@ #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/CraftingMenu.h" +#include "platform/stubs.h" class Player; diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index 028578462..435c4333b 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,25 +1,19 @@ -#include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" - - #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "app/linux/LinuxGame.h" -#include "platform/stubs.h" -#include "minecraft/client/Minecraft.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "minecraft/client/gui/Font.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" @@ -29,6 +23,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // Static member initialization int CreativeInventoryScreen::selectedTabIndex = @@ -258,8 +255,8 @@ void CreativeInventoryScreen::updateEvents() { currentScroll -= step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); - } else if (PlatformInput.ButtonDown(0, - MINECRAFT_ACTION_RIGHT_SCROLL)) { + } else if (PlatformInput.ButtonDown( + 0, MINECRAFT_ACTION_RIGHT_SCROLL)) { currentScroll += step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); @@ -411,7 +408,8 @@ void CreativeInventoryScreen::renderLabels() { IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex]; if (spec) { - std::string tabName = gameServices().getString(spec->m_descriptionId); + std::string tabName = + gameServices().getString(spec->m_descriptionId); font->draw(tabName, 8, 6, 0x404040); } } @@ -588,9 +586,9 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX, if (isMouseOverIcon(tab, x, y)) { glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - renderTooltip( - gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), - mouseX, mouseY); + renderTooltip(gameServices().getString( + IUIScene_CreativeMenu::specs[tab]->m_descriptionId), + mouseX, mouseY); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); return true; diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index 13b01596e..bd1703ed2 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -7,7 +7,6 @@ #include #include - #include "AbstractContainerScreen.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -22,6 +21,7 @@ #include "minecraft/world/inventory/EnchantmentMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/stubs.h" class Level; @@ -316,11 +316,10 @@ EnchantmentScreen::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string EnchantmentScreen::EnchantmentNames::getRandomName() { diff --git a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp index a1823b4c5..054d1371e 100644 --- a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp +++ b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp @@ -2,14 +2,15 @@ #include +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_FURNACE_LOCATION = ResourceLocation(TN_GUI_FURNACE); diff --git a/targets/minecraft/client/gui/inventory/HopperScreen.cpp b/targets/minecraft/client/gui/inventory/HopperScreen.cpp index fb3f5611e..8d88dda59 100644 --- a/targets/minecraft/client/gui/inventory/HopperScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HopperScreen.cpp @@ -1,12 +1,13 @@ #include "HopperScreen.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HopperMenu.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/renderer/Textures.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 0ff98dac2..1568b13ea 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -3,7 +3,6 @@ #include #include - #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -15,6 +14,7 @@ #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HorseInventoryMenu.h" +#include "platform/stubs.h" class EntityHorse; diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h index c543c563b..4a08c9be5 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h @@ -3,7 +3,6 @@ #include "AbstractContainerScreen.h" - class Container; class EntityHorse; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp index f31715916..8e6f17b80 100644 --- a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -18,6 +17,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" InventoryScreen::InventoryScreen(std::shared_ptr player) : AbstractContainerScreen(player->inventoryMenu) { diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index d7e7a540d..9f6a995dc 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -4,7 +4,6 @@ #include #include - #include "AbstractContainerScreen.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -22,8 +21,9 @@ #include "minecraft/world/inventory/MerchantContainer.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/trading/Merchant.h" -#include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "minecraft/world/item/trading/MerchantRecipeList.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.h b/targets/minecraft/client/gui/inventory/MerchantScreen.h index 698fc394c..d48ab2028 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.h +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/MerchantMenu.h" - class TradeSwitchButton; class Inventory; class Level; diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index 67e1cb606..4f9cad4a8 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -1,11 +1,8 @@ #include "RepairScreen.h" - - #include #include -#include "platform/renderer/renderer.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" @@ -21,6 +18,8 @@ #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Inventory; class Level; @@ -72,8 +71,7 @@ void RepairScreen::render(int xm, int ym, float a) { } void RepairScreen::renderLabels() { - std::string title = - Language::getInstance()->getElement("container.repair"); + std::string title = Language::getInstance()->getElement("container.repair"); font->draw(title, 60, 6, 0x404040); if (repairMenu->cost > 0) { diff --git a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp index c3ddf2b66..d52f28bc8 100644 --- a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -14,6 +12,8 @@ #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const std::string TextEditScreen::allowedChars = SharedConstants::acceptableLetters; diff --git a/targets/minecraft/client/gui/inventory/TrapScreen.cpp b/targets/minecraft/client/gui/inventory/TrapScreen.cpp index 98fdcaab4..8b68a5b12 100644 --- a/targets/minecraft/client/gui/inventory/TrapScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TrapScreen.cpp @@ -4,11 +4,11 @@ #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_TRAP_LOCATION = ResourceLocation(TN_GUI_TRAP); diff --git a/targets/minecraft/client/gui/particle/GuiParticle.cpp b/targets/minecraft/client/gui/particle/GuiParticle.cpp index 9d46a83b7..8fed392ce 100644 --- a/targets/minecraft/client/gui/particle/GuiParticle.cpp +++ b/targets/minecraft/client/gui/particle/GuiParticle.cpp @@ -1,8 +1,8 @@ #include "GuiParticle.h" -#include "platform/stubs.h" -#include "java/Random.h" #include "java/Color.h" +#include "java/Random.h" +#include "platform/stubs.h" Random* GuiParticle::random = new Random(); diff --git a/targets/minecraft/client/level/DemoLevel.h b/targets/minecraft/client/level/DemoLevel.h index b9ab5932d..7f161c714 100644 --- a/targets/minecraft/client/level/DemoLevel.h +++ b/targets/minecraft/client/level/DemoLevel.h @@ -6,7 +6,6 @@ #include "minecraft/world/level/Level.h" - class Dimension; class LevelSettings; class LevelStorage; diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index 80f849e8e..830f20cdd 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,7 +1,8 @@ #include "ChestModel.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChestModel::ChestModel() { lid = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64); diff --git a/targets/minecraft/client/model/ChickenModel.cpp b/targets/minecraft/client/model/ChickenModel.cpp index 6604567ef..509b05feb 100644 --- a/targets/minecraft/client/model/ChickenModel.cpp +++ b/targets/minecraft/client/model/ChickenModel.cpp @@ -5,9 +5,10 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChickenModel::ChickenModel() : Model() { int yo = 16; diff --git a/targets/minecraft/client/model/GhastModel.cpp b/targets/minecraft/client/model/GhastModel.cpp index 676797e77..269345fdb 100644 --- a/targets/minecraft/client/model/GhastModel.cpp +++ b/targets/minecraft/client/model/GhastModel.cpp @@ -4,10 +4,11 @@ #include -#include "platform/renderer/renderer.h" #include "java/Random.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" GhastModel::GhastModel() : Model() { int yoffs = -16; diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index 436183517..f21e2f572 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -1,15 +1,15 @@ -#include "minecraft/util/Log.h" #include "HumanoidModel.h" #include #include #include -#include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added @@ -218,8 +218,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, arm1->zRot = 0.0f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront)) { - arm0->xRot = -M_PI_2; - arm1->xRot = -M_PI_2; + arm0->xRot = -(std::numbers::pi / 2.0); + arm1->xRot = -(std::numbers::pi / 2.0); arm0->zRot = 0.0f; arm1->zRot = 0.0f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleArms)) { @@ -256,23 +256,23 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, if (riding) { if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) { - arm0->xRot += -M_PI_2 * 0.4f; - arm1->xRot += -M_PI_2 * 0.4f; - leg0->xRot = -M_PI_2 * 0.8f; - leg1->xRot = -M_PI_2 * 0.8f; - leg0->yRot = M_PI_2 * 0.2f; - leg1->yRot = -M_PI_2 * 0.2f; + arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f; + arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f; + leg0->xRot = -(std::numbers::pi / 2.0) * 0.8f; + leg1->xRot = -(std::numbers::pi / 2.0) * 0.8f; + leg0->yRot = (std::numbers::pi / 2.0) * 0.2f; + leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f; } else { - arm0->xRot += -M_PI_2 * 0.4f; - arm1->xRot += -M_PI_2 * 0.4f; - leg0->xRot = -M_PI_2 * 0.4f; - leg1->xRot = -M_PI_2 * 0.4f; + arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f; + arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f; + leg0->xRot = -(std::numbers::pi / 2.0) * 0.4f; + leg1->xRot = -(std::numbers::pi / 2.0) * 0.4f; } } else if (idle && !sneaking) { - leg0->xRot = -M_PI_2; - leg1->xRot = -M_PI_2; - leg0->yRot = M_PI_2 * 0.2f; - leg1->yRot = -M_PI_2 * 0.2f; + leg0->xRot = -(std::numbers::pi / 2.0); + leg1->xRot = -(std::numbers::pi / 2.0); + leg0->yRot = (std::numbers::pi / 2.0) * 0.2f; + leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim)) { leg0->xRot = 0.0f; leg0->zRot = 0.0f; @@ -289,10 +289,10 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, } if (holdingLeftHand != 0) { - arm1->xRot = arm1->xRot * 0.5f - M_PI_2 * 0.2f * holdingLeftHand; + arm1->xRot = arm1->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingLeftHand; } if (holdingRightHand != 0) { - arm0->xRot = arm0->xRot * 0.5f - M_PI_2 * 0.2f * holdingRightHand; + arm0->xRot = arm0->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingRightHand; } arm0->yRot = 0.0f; @@ -425,8 +425,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, arm1->zRot = 0.0f; arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot; arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f; - arm0->xRot = -M_PI_2 + head->xRot; - arm1->xRot = -M_PI_2 + head->xRot; + arm0->xRot = -(std::numbers::pi / 2.0) + head->xRot; + arm1->xRot = -(std::numbers::pi / 2.0) + head->xRot; arm0->xRot -= attack2 * 1.2f - attack * 0.4f; arm1->xRot -= attack2 * 1.2f - attack * 0.4f; arm0->zRot += ((float)(cosf(bob * 0.09f)) * 0.05f + 0.05f); diff --git a/targets/minecraft/client/model/ModelHorse.cpp b/targets/minecraft/client/model/ModelHorse.cpp index 43c598547..8404face9 100644 --- a/targets/minecraft/client/model/ModelHorse.cpp +++ b/targets/minecraft/client/model/ModelHorse.cpp @@ -5,13 +5,14 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ModelHorse::ModelHorse() { texWidth = 128; diff --git a/targets/minecraft/client/model/OcelotModel.cpp b/targets/minecraft/client/model/OcelotModel.cpp index 088d8d1a1..b92b62dc4 100644 --- a/targets/minecraft/client/model/OcelotModel.cpp +++ b/targets/minecraft/client/model/OcelotModel.cpp @@ -6,10 +6,11 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float OcelotModel::xo = 0; const float OcelotModel::yo = 16; diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 5fc29c030..e85d7cd47 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -5,10 +5,10 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" - +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() { yHeadOffs = 8; diff --git a/targets/minecraft/client/model/WolfModel.cpp b/targets/minecraft/client/model/WolfModel.cpp index f9b86fee1..4847bc56e 100644 --- a/targets/minecraft/client/model/WolfModel.cpp +++ b/targets/minecraft/client/model/WolfModel.cpp @@ -5,11 +5,12 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" WolfModel::WolfModel() { float g = 0; diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 69aeb7c5c..1c2919e77 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -7,12 +7,12 @@ #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" DragonModel::DragonModel(float g) : Model() { // 4J-PB diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index f84bac143..c92b278bd 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -3,9 +3,9 @@ #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" EnderCrystalModel::EnderCrystalModel(float g) { glass = new ModelPart(this, "glass"); diff --git a/targets/minecraft/client/model/geom/Model.h b/targets/minecraft/client/model/geom/Model.h index 3951fd120..7becdc889 100644 --- a/targets/minecraft/client/model/geom/Model.h +++ b/targets/minecraft/client/model/geom/Model.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "java/Random.h" +#include "minecraft/client/model/SkinBox.h" class Mob; class ModelPart; diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index 2f003f8f0..e9766fa44 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -1,15 +1,14 @@ #include "ModelPart.h" - - #include -#include "platform/renderer/renderer.h" #include "Cube.h" #include "TexOffs.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float ModelPart::RAD = (180.0f / std::numbers::pi); diff --git a/targets/minecraft/client/model/geom/ModelPart.h b/targets/minecraft/client/model/geom/ModelPart.h index fb1eace16..0dbba593a 100644 --- a/targets/minecraft/client/model/geom/ModelPart.h +++ b/targets/minecraft/client/model/geom/ModelPart.h @@ -2,9 +2,9 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Model.h" #include "minecraft/client/model/Polygon.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/Vertex.h" class Cube; diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index fbc53d387..fc7039ecf 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ClientConnection.h" #include @@ -12,43 +10,27 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "app/common/App_structs.h" -#include "app/common/ConsoleGameMode.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "app/common/Tutorial/FullTutorialMode.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" -#include "app/common/Tutorial/TutorialMode.h" -#include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "MultiPlayerLevel.h" #include "ReceivingLevelScreen.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/ConsoleGameMode.h" +#include "app/common/Tutorial/FullTutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" +#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/particle/CritParticle.h" @@ -57,10 +39,12 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/player/RemotePlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/ISkinAssetData.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/AddEntityPacket.h" #include "minecraft/network/packet/AddExperienceOrbPacket.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" @@ -129,8 +113,8 @@ #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/XZPacket.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/EntityIO.h" @@ -182,6 +166,7 @@ #include "minecraft/world/item/trading/Merchant.h" #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/Explosion.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" @@ -203,7 +188,14 @@ #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/ITutorial.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Packet; class TexturePack; @@ -275,11 +267,11 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { PlatformProfile.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid MOJANG_DATA* pMojangData = nullptr; - if (!g_NetworkManager.IsLocalGame()) { + if (!NetworkService.IsLocalGame()) { pMojangData = gameServices().getMojangDataForXuid(OnlineXuid); } - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCLoginReceived * 100) / (eCCConnected)); } @@ -297,7 +289,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { // find the pad number of this local player for (int i = 0; i < XUSER_MAX_COUNT; i++) { INetworkPlayer* networkLocalPlayer = - g_NetworkManager.GetLocalPlayerByUserIndex(i); + NetworkService.GetLocalPlayerByUserIndex(i); if (networkLocalPlayer == networkPlayer) { iUserID = i; } @@ -377,15 +369,17 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { } Log::info("ClientConnection - DIFFICULTY --- %d\n", - packet->difficulty); + packet->difficulty); level->difficulty = packet->difficulty; // 4J Added level->isClientSide = true; minecraft->setLevel(level); } minecraft->player->setPlayerIndex(packet->m_playerIndex); - minecraft->player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); - minecraft->player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); + minecraft->player->setCustomSkin( + gameServices().getPlayerSkinId(m_userIndex)); + minecraft->player->setCustomCape( + gameServices().getPlayerCapeId(m_userIndex)); minecraft->createPrimaryLocalPlayer(PlatformInput.GetPrimaryPad()); @@ -395,7 +389,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -412,8 +406,9 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - gameServices().setGameSettingsDebugMask(PlatformInput.GetPrimaryPad(), - gameServices().debugGetMask(-1, true)); + gameServices().setGameSettingsDebugMask( + PlatformInput.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want // level = (MultiPlayerLevel *)minecraft->level; @@ -445,10 +440,10 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added dimensionLevel->isClientSide = true; level = dimensionLevel; - // 4J Stu - At time of writing PlatformProfile.GetGamertag() does not - // always return the correct name, if sign-ins are turned off while - // the player signed in. Using the qnetPlayer instead. need to have - // a level before create extra local player + // 4J Stu - At time of writing PlatformProfile.GetGamertag() does + // not always return the correct name, if sign-ins are turned off + // while the player signed in. Using the qnetPlayer instead. need to + // have a level before create extra local player MultiPlayerLevel* levelpassedin = (MultiPlayerLevel*)level; player = minecraft->createExtraLocalPlayer( m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, @@ -476,7 +471,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -558,8 +553,7 @@ void ClientConnection::handleAddEntity( int ix = (int)x; int iy = (int)y; int iz = (int)z; - Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, - iy, iz); + Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); } e = std::shared_ptr( new ItemFrame(level, (int)x, (int)y, (int)z, packet->data)); @@ -875,8 +869,7 @@ void ClientConnection::handleAddPlayer( PlatformProfile.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || (playerXUIDOffline != INVALID_XUID && PlatformProfile.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { - Log::info( - "AddPlayerPacket received with XUID of local player\n"); + Log::info("AddPlayerPacket received with XUID of local player\n"); return; } } @@ -933,13 +926,15 @@ void ClientConnection::handleAddPlayer( 0))); } } else if (!player->customTextureUrl.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, + 0); } Log::info("Custom skin for player %s is %s\n", player->name.c_str(), - player->customTextureUrl.c_str()); + player->customTextureUrl.c_str()); if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare("def") != 0 && @@ -954,13 +949,15 @@ void ClientConnection::handleAddPlayer( new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl2)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, + 0); } Log::info("Custom cape for player %s is %s\n", player->name.c_str(), - player->customTextureUrl2.c_str()); + player->customTextureUrl2.c_str()); level->putEntity(packet->id, player); @@ -1093,7 +1090,7 @@ void ClientConnection::handleMovePlayer( packet->yView = player->y; connection->send(packet); if (!started) { - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCConnected * 100) / (eCCConnected)); } @@ -1276,7 +1273,7 @@ void ClientConnection::handleTileUpdate( MultiPlayerLevel* dimensionLevel = (MultiPlayerLevel*)minecraft->levels[packet->levelIdx]; if (dimensionLevel) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { // 4J Stu - Unshare before we make any changes incase the server is // already another step ahead of us Fix for #7904 - Gameplay: // Players can dupe torches by throwing them repeatedly into water. @@ -1320,20 +1317,6 @@ void ClientConnection::handleTileUpdate( void ClientConnection::handleDisconnect( std::shared_ptr packet) { -#if defined(__linux__) - // Linux fix: On local host connections, ignore DisconnectPacket. The - // singleplayer internal server should never disconnect itself. If we see - // this, it's likely stream desync reading garbage data as a - // DisconnectPacket. - if (connection && connection->getSocket() && - connection->getSocket()->isLocal()) { - fprintf(stderr, - "[CONN] Ignoring DisconnectPacket on local connection " - "(reason=%d)\n", - packet->reason); - return; - } -#endif connection->close(DisconnectPacket::eDisconnect_Kicked); done = true; @@ -1359,7 +1342,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, // Fix for #13191 - The host of a game can get a message informing them that // the connection to the server has been lost In the (now unlikely) event // that the host connections times out, allow the player to save their game - if (g_NetworkManager.IsHost() && + if (NetworkService.IsHost() && (reason == DisconnectPacket::eDisconnect_TimeOut || reason == DisconnectPacket::eDisconnect_Overflow) && m_userIndex == PlatformInput.GetPrimaryPad() && @@ -1371,7 +1354,8 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, &ClientConnection::HostDisconnectReturned, nullptr); } else { - gameServices().setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); + gameServices().setAction(m_userIndex, eAppAction_ExitWorld, + (void*)true); } // minecraft->setLevel(nullptr); @@ -1763,7 +1747,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = gameServices().getString(IDS_MAX_VILLAGERS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxChickens: message = gameServices().getString(IDS_MAX_CHICKENS_SPAWNED); @@ -1783,7 +1768,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredChickens: message = gameServices().getString(IDS_MAX_CHICKENS_BRED); @@ -1822,9 +1808,9 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = replaceAll(message, "{*DESTINATION*}", sourceDisplayName); } else { - message = replaceAll( - message, "{*DESTINATION*}", - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0])); + message = replaceAll(message, "{*DESTINATION*}", + gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0])); } break; case ChatPacket::e_ChatCommandTeleportMe: @@ -1856,8 +1842,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { !packet->m_stringArgs[1].empty()) { entityName = packet->m_stringArgs[1]; } else { - entityName = - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0]); + entityName = gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0]); } message = replaceAll(message, "{*SOURCE*}", entityName); @@ -1920,24 +1906,26 @@ void ClientConnection::handleEntityActionAtPosition( void ClientConnection::handlePreLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", - (int)g_NetworkManager.IsHost(), m_userIndex); + (int)NetworkService.IsHost(), m_userIndex); // 4J - Check that we can play with all the players already in the game who // have Friends-Only UGC set bool canPlay = true; bool canPlayLocal = true; - bool isAtLeastOneFriend = g_NetworkManager.IsHost(); + bool isAtLeastOneFriend = NetworkService.IsHost(); bool isFriendsWithHost = true; bool cantPlayContentRestricted = false; - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { // set the game host settings - gameServices().setGameHostOption(eGameHostOption_All, packet->m_serverSettings); + gameServices().setGameHostOption(eGameHostOption_All, + packet->m_serverSettings); // 4J-PB - if we go straight in from the menus via an invite, we won't // have the DLC info if (gameServices().getTMSGlobalFileListRead() == false) { - gameServices().setTMSAction(PlatformInput.GetPrimaryPad(), - eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); + gameServices().setTMSAction( + PlatformInput.GetPrimaryPad(), + eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1967,8 +1955,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "privileges: %d\n", reason); gameServices().setDisconnectReason(reason); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ExitWorld, - (void*)true); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost; @@ -2005,7 +1993,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // gameServices().setAction(m_userIndex,eAppAction_ExitPlayer); // 4J-PB - doing this instead - gameServices().setAction(m_userIndex, eAppAction_ExitPlayerPreLogin); + gameServices().setAction(m_userIndex, + eAppAction_ExitPlayerPreLogin); } } else { // Texture pack handling @@ -2018,9 +2007,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->skins->selectTexturePackById( packet->m_texturePackId)) { - Log::info( - "Selected texture pack %d from Pre-Login packet\n", - packet->m_texturePackId); + Log::info("Selected texture pack %d from Pre-Login packet\n", + packet->m_texturePackId); } else { Log::info( "Could not select texture pack %d from Pre-Login packet, " @@ -2033,7 +2021,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { } } - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCPreLoginReceived * 100) / (eCCConnected)); } @@ -2062,16 +2050,17 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "isHost=%d\n", minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, - (int)g_NetworkManager.IsHost()); + (int)NetworkService.IsHost()); send(std::make_shared( minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), - packet->m_ugcPlayersVersion, gameServices().getPlayerSkinId(m_userIndex), + packet->m_ugcPlayersVersion, + gameServices().getPlayerSkinId(m_userIndex), gameServices().getPlayerCapeId(m_userIndex), PlatformProfile.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCLoginSent * 100) / (eCCConnected)); } @@ -2264,11 +2253,12 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Client received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -2278,10 +2268,10 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived( packet->textureName); } @@ -2297,23 +2287,22 @@ void ClientConnection::handleTextureAndGeometry( if (packet->dwTextureBytes == 0) { // Request for texture #if !defined(_CONTENT_PACKAGE) - printf( - "Client received request for custom texture and geometry %s\n", - packet->textureName.c_str()); + printf("Client received request for custom texture and geometry %s\n", + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(packet->textureName); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(packet->textureName); if (dwBytes != 0) { - if (pDLCSkinFile) { - if (pDLCSkinFile->getAdditionalBoxesCount() != 0) { + if (pSkinAsset) { + if (pSkinAsset->getAdditionalBoxesCount() != 0) { send(std::shared_ptr( - new TextureAndGeometryPacket(packet->textureName, - pbData, dwBytes, - pDLCSkinFile))); + new TextureAndGeometryPacket( + packet->textureName, pbData, dwBytes, pSkinAsset))); } else { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, @@ -2334,19 +2323,19 @@ void ClientConnection::handleTextureAndGeometry( // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom TextureAndGeometry %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif // Add the texture data gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // Add the geometry data if (packet->dwBoxC != 0) { - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); // clear out the pending texture request Minecraft::GetInstance()->handleClientTextureReceived( @@ -2373,11 +2362,12 @@ void ClientConnection::handleTextureChange( switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); + player->setCustomSkin( + gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -2385,7 +2375,7 @@ void ClientConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for remote player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -2432,8 +2422,8 @@ void ClientConnection::handleTextureAndGeometryChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && @@ -2492,7 +2482,7 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added Log::info("dimensionLevel->difficulty - Difficulty = %d\n", - packet->difficulty); + packet->difficulty); dimensionLevel->isClientSide = true; } else { @@ -2518,9 +2508,11 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { // minecraft->addPendingLocalConnection(m_userIndex, this); if (minecraft->localgameModes[m_userIndex] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_userIndex]; - gameMode->getTutorial()->showTutorialPopup(false); + ITutorial* tutorial = + minecraft->localgameModes[m_userIndex]->getTutorial(); + if (tutorial != nullptr) { + tutorial->showTutorialPopup(false); + } } // 4J-JEV: Fix for Durango #156334 - Content: UI: Rich Presence 'In the @@ -2551,7 +2543,8 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } - gameServices().setAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); + gameServices().setAction(m_userIndex, + eAppAction_WaitForDimensionChangeComplete); } // minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, @@ -2890,8 +2883,8 @@ void ClientConnection::handleSignUpdate( ste->SetMessage(i, packet->lines[i]); } - Log::info("verified = %d\tCensored = %d\n", - packet->m_bVerified, packet->m_bCensored); + Log::info("verified = %d\tCensored = %d\n", packet->m_bVerified, + packet->m_bCensored); ste->SetVerified(packet->m_bVerified); ste->SetCensored(packet->m_bCensored); @@ -3006,8 +2999,7 @@ void ClientConnection::handleGameEvent( } else if (event == GameEventPacket::WIN_GAME) { ui.SetWinUserIndex(static_cast(gameEventPacket->param)); - Log::info("handleGameEvent packet for WIN_GAME - %d\n", - m_userIndex); + Log::info("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown if (minecraft->localgameModes[PlatformInput.GetPrimaryPad()] != nullptr) minecraft->localgameModes[PlatformInput.GetPrimaryPad()] @@ -3016,16 +3008,16 @@ void ClientConnection::handleGameEvent( ui.NavigateToScene(PlatformInput.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen); } else if (event == GameEventPacket::START_SAVING) { - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { // Move app started to here so that it happens immediately otherwise // back-to-back START/STOP packets leave the client stuck in the // loading screen gameServices().setGameStarted(false); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_RemoteServerSave); + eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { - if (!g_NetworkManager.IsHost()) gameServices().setGameStarted(true); + if (!NetworkService.IsHost()) gameServices().setGameStarted(true); } else if (event == GameEventPacket::SUCCESSFUL_BOW_HIT) { std::shared_ptr player = minecraft->localplayers[m_userIndex]; @@ -3111,7 +3103,7 @@ void ClientConnection::handlePlayerInfo( gameServices().getPlayerPrivileges(packet->m_networkSmallId); INetworkPlayer* networkPlayer = - g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); + NetworkService.GetPlayerBySmallId(packet->m_networkSmallId); if (networkPlayer != nullptr && networkPlayer->IsHost()) { // Some settings should always be considered on for the host player @@ -3121,8 +3113,9 @@ void ClientConnection::handlePlayerInfo( } // 4J Stu - Repurposed this packet for player info that we want - gameServices().updatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, - packet->m_playerPrivileges); + gameServices().updatePlayerInfo(packet->m_networkSmallId, + packet->m_playerColourIndex, + packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { @@ -3163,27 +3156,32 @@ void ClientConnection::displayPrivilegeChanges( Player::getPlayerGamePrivilege(oldPrivileges, priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges, priv); std::string message = ""; - if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) == 0) { switch (priv) { case Player::ePlayerGamePrivilege_CannotMine: if (privOn) - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotBuild: if (privOn) - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches: if (privOn) - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseContainers: if (privOn) @@ -3195,24 +3193,24 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CannotAttackAnimals: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackMobs: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackPlayers: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF); @@ -3224,59 +3222,65 @@ void ClientConnection::displayPrivilegeChanges( switch (priv) { case Player::ePlayerGamePrivilege_Op: if (privOn) - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_OFF); break; default: break; }; - if (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0) { + if (gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0) { switch (priv) { case Player::ePlayerGamePrivilege_CanFly: if (privOn) - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_ClassicHunger: if (privOn) - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invulnerable: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleInvisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleFly: if (privOn) - message = gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleClassicHunger: if (privOn) @@ -3288,11 +3292,11 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CanTeleport: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); break; default: break; @@ -3381,7 +3385,8 @@ void ClientConnection::handleServerSettingsChanged( } else { // options // minecraft->options->SetGamertagSetting((packet->data==0)?false:true); - gameServices().setGameHostOption(eGameHostOption_Gamertags, packet->data); + gameServices().setGameHostOption(eGameHostOption_Gamertags, + packet->data); } } @@ -3395,7 +3400,7 @@ void ClientConnection::handleXZ(std::shared_ptr packet) { void ClientConnection::handleUpdateProgress( std::shared_ptr packet) { - if (!g_NetworkManager.IsHost()) + if (!NetworkService.IsHost()) Minecraft::GetInstance()->progressRenderer->progressStagePercentage( packet->m_percentage); } @@ -3420,7 +3425,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( "handleUpdateGameRuleProgressPacket: Data tag is in range, so " "updating profile data\n"); gameServices().setSpecialTutorialCompletionFlag(m_userIndex, - packet->m_dataTag - 1); + packet->m_dataTag - 1); } } @@ -3433,11 +3438,7 @@ int ClientConnection::HostDisconnectReturned( // world if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = - pDLCTexPack->getDLCInfoParentPack(); // tPack->getDLCPack(); - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, "")) { + if (tPack->needsPurchase()) { // no upsell, we're about to quit MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game @@ -3578,7 +3579,9 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) { // Only consider recently deferred packets auto tickInterval = - std::chrono::duration_cast(time_util::clock::now() - deferred->m_recievedTick).count(); + std::chrono::duration_cast( + time_util::clock::now() - deferred->m_recievedTick) + .count(); if (tickInterval < MAX_ENTITY_LINK_DEFERRAL_INTERVAL) { // Note: we assume it's the destination entity if (deferred->m_packet->destId == newEntityId) { diff --git a/targets/minecraft/client/multiplayer/ClientConnection.h b/targets/minecraft/client/multiplayer/ClientConnection.h index 5764e310f..1c08a7d75 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.h +++ b/targets/minecraft/client/multiplayer/ClientConnection.h @@ -5,13 +5,12 @@ #include #include -#include "util/Timer.h" -#include "platform/storage/storage.h" #include "minecraft/network/Connection.h" - #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/world/entity/Entity.h" +#include "platform/storage/storage.h" +#include "util/Timer.h" class Minecraft; class MultiPlayerLevel; diff --git a/targets/minecraft/client/multiplayer/ConnectScreen.h b/targets/minecraft/client/multiplayer/ConnectScreen.h index 9544d9895..90a4874f2 100644 --- a/targets/minecraft/client/multiplayer/ConnectScreen.h +++ b/targets/minecraft/client/multiplayer/ConnectScreen.h @@ -16,7 +16,7 @@ public: virtual void tick() override; protected: - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/multiplayer/DisconnectedScreen.h b/targets/minecraft/client/multiplayer/DisconnectedScreen.h index 7b0b91ee2..32115e525 100644 --- a/targets/minecraft/client/multiplayer/DisconnectedScreen.h +++ b/targets/minecraft/client/multiplayer/DisconnectedScreen.h @@ -15,7 +15,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 980cb0192..0b00ebc9b 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -3,9 +3,9 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/StringHelpers.h" +#include + +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" @@ -19,6 +19,7 @@ #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) { XZSIZE = level->dimension->getXZSize(); // 4J Added @@ -167,7 +168,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { std::unique_lock lock(m_csLoadCreate); // LevelChunk *chunk; - if (g_NetworkManager + if (NetworkService .IsHost()) // force here to disable sharing of data { // 4J-JEV: We are about to use shared data, abort if the server @@ -175,8 +176,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { if (MinecraftServer::getInstance()->serverHalted()) return nullptr; - // If we're the host, then don't create the chunk, share data - // from the server's copy + // If we're the host, then don't create the chunk, share + // data from the server's copy #ifdef _LARGE_WORLDS LevelChunk* serverChunk = MinecraftServer::getInstance() @@ -210,20 +211,14 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { chunk->loaded = true; } -#if (defined _WIN64 || defined __LP64__) - if (InterlockedCompareExchangeRelease64( - (int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) == - (int64_t)lastChunk) -#else - if (InterlockedCompareExchangeRelease( - (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == - (int32_t)lastChunk) -#endif // 0 - { + LevelChunk* expected = lastChunk; + if (std::atomic_ref(cache[idx]) + .compare_exchange_strong(expected, chunk, + std::memory_order_release)) { // If we're sharing with the server, we'll need to calculate our // heightmap now, which isn't shared. If we aren't sharing with the // server, then this will be calculated when the chunk data arrives. - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { chunk->recalcHeightmapOnly(); } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h index 82a068da7..dad40c3b1 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h @@ -5,10 +5,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" - #include "minecraft/world/level/levelgen/RandomLevelSource.h" - class ServerChunkCache; class Level; class LevelChunk; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 274eed236..c9b3e47f7 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerGameMode.h" #include #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" #include "MultiPlayerLevel.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ContainerButtonClickPacket.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h index bd08c3e5b..2eaceb854 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h @@ -12,7 +12,7 @@ class Entity; class Level; class Minecraft; class Player; -class Tutorial; +class ITutorial; class MultiPlayerGameMode { private: @@ -91,5 +91,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial* getTutorial() { return nullptr; } + virtual ITutorial* getTutorial() { return nullptr; } }; \ No newline at end of file diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 12ae6a211..14ea4f553 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerLevel.h" #include @@ -10,22 +9,20 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/FireworksParticles.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" @@ -39,6 +36,8 @@ #include "minecraft/world/level/storage/SavedDataStorage.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" class LevelSettings; class Scoreboard; @@ -105,13 +104,13 @@ MultiPlayerLevel::~MultiPlayerLevel() { } void MultiPlayerLevel::unshareChunkAt(int x, int z) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { Level::getChunkAt(x, z)->stopSharingTilesAndData(); } } void MultiPlayerLevel::shareChunkAt(int x, int z) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { Level::getChunkAt(x, z)->startSharingTilesAndData(); } } @@ -194,12 +193,12 @@ void MultiPlayerLevel::tick() { // chunks become unshared over time. int ls = dimension->getXZSize(); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { if (Level::reallyHasChunk(unshareCheckX - (ls / 2), unshareCheckZ - (ls / 2))) { LevelChunk* lc = Level::getChunk(unshareCheckX - (ls / 2), unshareCheckZ - (ls / 2)); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { lc->startSharingTilesAndData(1000 * 60 * 2); } } @@ -612,8 +611,8 @@ bool MultiPlayerLevel::doSetTileAndData(int x, int y, int z, int tile, // don't change things as the host might have been sharing data and so set // it already, but the renderer won't know to update if ((Level::setTileAndData(x, y, z, tile, data, Tile::UPDATE_ALL) || - g_NetworkManager.IsHost())) { - if (g_NetworkManager.IsHost() && visuallyImportant) { + NetworkService.IsHost())) { + if (NetworkService.IsHost() && visuallyImportant) { // 4J Stu - This got removed from the tileUpdated function in TU14. // Adding it back here as we need it to handle the cases where the // chunk data is shared so the normal paths never call this diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h index c0773c45e..dee97d45d 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h @@ -9,10 +9,8 @@ #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" - #include "minecraft/world/level/Level.h" - class ClientConnection; class MultiPlayerChunkCache; class LevelSettings; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 3fb436eec..34e40f06c 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MultiPlayerLocalPlayer.h" #include @@ -7,10 +5,7 @@ #include #include "ClientConnection.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" -#include "app/common/Tutorial/TutorialMode.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" @@ -27,6 +22,7 @@ #include "minecraft/network/packet/TextureAndGeometryChangePacket.h" #include "minecraft/network/packet/TextureChangePacket.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Abilities.h" @@ -36,6 +32,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/ITutorial.h" class User; class ItemEntity; @@ -71,16 +68,17 @@ void MultiplayerLocalPlayer::heal(float heal) {} void MultiplayerLocalPlayer::tick() { // 4J Added // 4J-PB - changing this to a game host option ot hide gamertags - // bool bIsisPrimaryHost=g_NetworkManager.IsHost() && + // bool bIsisPrimaryHost=NetworkService.IsHost() && // (PlatformInput.GetPrimaryPad()==m_iPad); - /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != - m_bShownOnMaps) + /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) + != m_bShownOnMaps) { m_bShownOnMaps = - (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if - (m_bShownOnMaps) connection->send( std::shared_ptr( new - PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) + (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); + if (m_bShownOnMaps) connection->send( std::shared_ptr( + new PlayerCommandPacket(shared_from_this(), + PlayerCommandPacket::SHOW_ON_MAPS) ) ); else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); @@ -235,10 +233,10 @@ void MultiplayerLocalPlayer::actuallyHurt(DamageSource* source, float dmg) { void MultiplayerLocalPlayer::completeUsingItem() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (useItem != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->completeUsingItem(useItem); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->completeUsingItem(useItem); + } } Player::completeUsingItem(); } @@ -246,10 +244,10 @@ void MultiplayerLocalPlayer::completeUsingItem() { void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + } } Player::onEffectAdded(effect); } @@ -258,10 +256,10 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, bool doRefreshAttributes) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + } } Player::onEffectUpdated(effect, doRefreshAttributes); } @@ -269,10 +267,11 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()], true); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()], + true); + } } Player::onEffectRemoved(effect); } @@ -352,13 +351,13 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr e) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - if (wasRiding && !isRiding) { - gameMode->getTutorial()->changeTutorialState( - e_Tutorial_State_Gameplay); - } else if (!wasRiding && isRiding) { - gameMode->getTutorial()->onRideEntity(e); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + if (wasRiding && !isRiding) { + tutorial->changeTutorialState(e_Tutorial_State_Gameplay); + } else if (!wasRiding && isRiding) { + tutorial->onRideEntity(e); + } } } } @@ -373,13 +372,14 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { std::uint32_t oldSkinIndex = getCustomSkin(); LocalPlayer::setCustomSkin(skinId); #if !defined(_CONTENT_PACKAGE) - printf("Skin for local player %s has changed to %s (%d)\n", - name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin()); + printf("Skin for local player %s has changed to %s (%d)\n", name.c_str(), + customTextureUrl.c_str(), static_cast(getPlayerDefaultSkin())); #endif if (getCustomSkin() != oldSkinIndex) connection->send(std::shared_ptr( new TextureAndGeometryChangePacket( - shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad())))); + shared_from_this(), + gameServices().getPlayerSkinName(GetXboxPad())))); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { @@ -387,7 +387,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { LocalPlayer::setCustomCape(capeId); #if !defined(_CONTENT_PACKAGE) printf("Cape for local player %s has changed to %s\n", name.c_str(), - customTextureUrl2.c_str()); + customTextureUrl2.c_str()); #endif if (getCustomCape() != oldCapeIndex) connection->send(std::make_shared( diff --git a/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h b/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h index 91d0f13d6..a5eca2bf7 100644 --- a/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h +++ b/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h @@ -13,7 +13,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index 95fb45e85..2712591fa 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,11 +1,11 @@ #include "DragonBreathParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index a91826588..9cf893b7a 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index 5f1fc3a4c..ef5d8ec21 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,11 +1,11 @@ #include "EnchantmentTableParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" EchantmentTableParticle::EchantmentTableParticle(Level* level, double x, double y, double z, double xd, diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index 09b440886..c8eac5285 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,11 +1,11 @@ #include "EnderParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index 497e50880..dbfeb9c35 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,11 +1,11 @@ #include "ExplodeParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/FireworksParticles.cpp b/targets/minecraft/client/particle/FireworksParticles.cpp index e0194f81a..a95e5fa8d 100644 --- a/targets/minecraft/client/particle/FireworksParticles.cpp +++ b/targets/minecraft/client/particle/FireworksParticles.cpp @@ -6,13 +6,13 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/item/FireworksItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index fb35d73a9..8b2070194 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -1,16 +1,15 @@ #include "FootstepParticle.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FootstepParticle::FOOTPRINT_LOCATION = ResourceLocation(TN_MISC_FOOTSTEP); diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index b29c58a9b..d43cc32d6 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -1,18 +1,17 @@ #include "HugeExplosionParticle.h" - - -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index 2f74cf654..9cce8a408 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,11 +1,11 @@ #include "NetherPortalParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index e9544152e..781e17c08 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -3,9 +3,9 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/Particle.cpp b/targets/minecraft/client/particle/Particle.cpp index 2713ce19f..e44bd6a71 100644 --- a/targets/minecraft/client/particle/Particle.cpp +++ b/targets/minecraft/client/particle/Particle.cpp @@ -4,7 +4,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -212,6 +211,6 @@ bool Particle::isAttackable() { return false; } //@Override std::string Particle::toString() { return "A particle"; // getClass()->getSimpleName() + ", Pos (" + x + "," - // + y + "," + z + "), RGBA (" + rCol + "," + gCol + - // "," + bCol + "," + alpha + "), Age " + age; + // + y + "," + z + "), RGBA (" + rCol + "," + gCol + + // "," + bCol + "," + alpha + "), Age " + age; } \ No newline at end of file diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 7267e750f..969e07fba 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -1,15 +1,12 @@ #include "ParticleEngine.h" - #include #include #include -#include "platform/renderer/renderer.h" #include "Particle.h" #include "TerrainParticle.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -22,6 +19,9 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTICLES); diff --git a/targets/minecraft/client/particle/SmokeParticle.cpp b/targets/minecraft/client/particle/SmokeParticle.cpp index a4cd52689..e80824432 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,10 +1,10 @@ #include "SmokeParticle.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 2251c52ab..a23a9bee8 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index c71e150e4..8f9265dd0 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -1,16 +1,15 @@ #include "TakeAnimationParticle.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TakeAnimationParticle::TakeAnimationParticle(Level* level, std::shared_ptr item, diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index 3dded71b6..00ad1e807 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -1,15 +1,14 @@ -#include "minecraft/IGameServices.h" #include "Input.h" #include -#include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" Input::Input() { xa = 0; @@ -87,16 +86,18 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) tx = PlatformInput.GetJoypadStick_RX(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look if (pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_UP) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) ty = PlatformInput.GetJoypadStick_RY(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index ab5d556bf..0febaf741 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -1,6 +1,3 @@ -#include "minecraft/client/IMenuService.h" -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LocalPlayer.h" #include @@ -12,6 +9,8 @@ #include "Input.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/IMenuService.h" #include "minecraft/client/Options.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -21,6 +20,7 @@ #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/renderer/ItemInHandRenderer.h" #include "minecraft/stats/StatsCounter.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/entity/TileEntity.h" @@ -28,19 +28,10 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "app/common/App_structs.h" -#include "app/common/Audio/SoundEngine.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialMode.h" -#include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "PlatformTypes.h" #include "Pos.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -60,7 +51,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/CommonStats.h" #include "minecraft/stats/GenericStats.h" @@ -74,6 +65,7 @@ #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/food/FoodConstants.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/item/BowItem.h" @@ -81,11 +73,17 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/entity/CommandBlockEntity.h" -#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/ITutorial.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, int dimension) @@ -116,7 +114,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, this->name = user->name; // printf("Created LocalPlayer with name %s\n", name.c_str() ); // check to see if this player's xuid is in the list of special players - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { customTextureUrl = pMojangData->wchSkin; } @@ -124,7 +123,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, input = nullptr; m_iPad = -1; m_iScreenSection = - IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer + // default m_bPlayerRespawned = false; ullButtonsPressed = 0LL; ullDpad_last = ullDpad_this = ullDpad_filtered = 0; @@ -486,14 +486,14 @@ void LocalPlayer::aiStep() { // Check if the player is idle and the rich presence needs updated if (!m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) > PLAYER_IDLE_TIME) { PlatformProfile.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, - false); + false); m_bIsIdle = true; } else if (m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { // Are we offline or online, and how many players are there - if (g_NetworkManager.GetPlayerCount() > 1) { + if (NetworkService.GetPlayerCount() > 1) { // only do it for this player here - each player will run this code - if (g_NetworkManager.IsLocalGame()) { + if (NetworkService.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { @@ -501,7 +501,7 @@ void LocalPlayer::aiStep() { m_iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); } } else { - if (g_NetworkManager.IsLocalGame()) { + if (NetworkService.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { @@ -609,7 +609,8 @@ bool LocalPlayer::openContainer(std::shared_ptr container) { minecraft->setScreen(new ContainerScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, + container); if (success) ui.PlayUISFX(eSFX_Press); #endif // minecraft->setScreen(new ContainerScreen(inventory, container)); @@ -621,7 +622,8 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openHopper(GetXboxPad(), inventory, container); + bool success = + gameServices().menus().openHopper(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -632,7 +634,8 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openHopperMinecart(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopperMinecart( + GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -644,7 +647,8 @@ bool LocalPlayer::openHorseInventory(std::shared_ptr horse, minecraft->setScreen(new HorseInventoryScreen(inventory, container, horse)); bool success = true; #else - bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, container, horse); + bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, + container, horse); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -679,8 +683,8 @@ bool LocalPlayer::startEnchanting(int x, int y, int z, minecraft->setScreen(new EnchantmentScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name); + bool success = gameServices().menus().openEnchanting( + GetXboxPad(), inventory, x, y, z, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -691,8 +695,8 @@ bool LocalPlayer::startRepairing(int x, int y, int z) { minecraft->setScreen(new RepairScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); + bool success = gameServices().menus().openRepairing(GetXboxPad(), inventory, + level, x, y, z); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -703,7 +707,8 @@ bool LocalPlayer::openFurnace(std::shared_ptr furnace) { minecraft->setScreen(new FurnaceScreen(inventory, furnace)); bool success = true; #else - bool success = gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); + bool success = + gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -715,8 +720,8 @@ bool LocalPlayer::openBrewingStand( minecraft->setScreen(new BrewingStandScreen(inventory, brewingStand)); bool success = true; #else - bool success = - gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); + bool success = gameServices().menus().openBrewingStand( + GetXboxPad(), inventory, brewingStand); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -727,7 +732,8 @@ bool LocalPlayer::openBeacon(std::shared_ptr beacon) { minecraft->setScreen(new BeaconScreen(inventory, beacon)); bool success = true; #else - bool success = gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); + bool success = + gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -738,7 +744,8 @@ bool LocalPlayer::openTrap(std::shared_ptr trap) { minecraft->setScreen(new TrapScreen(inventory, trap)); bool success = true; #else - bool success = gameServices().menus().openTrap(GetXboxPad(), inventory, trap); + bool success = + gameServices().menus().openTrap(GetXboxPad(), inventory, trap); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -750,8 +757,8 @@ bool LocalPlayer::openTrading(std::shared_ptr traderTarget, minecraft->setScreen(new MerchantScreen(inventory, traderTarget, level)); bool success = true; #else - bool success = - gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); + bool success = gameServices().menus().openTrading( + GetXboxPad(), inventory, traderTarget, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -849,8 +856,8 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { // especially if you are surrounded by mobs! We cannot pause the // game unless in offline single player, but lets at least do it // then - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1 && + if (NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1 && PlatformProfile.GetAwardType(ach->getAchievementID()) != EAwardType::Achievement) { ui.CloseUIScenes(m_iPad); @@ -1214,9 +1221,10 @@ bool LocalPlayer::hasPermission(EGameCommand command) { void LocalPlayer::onCrafted(std::shared_ptr item) { if (minecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_iPad]; - gameMode->getTutorial()->onCrafted(item); + ITutorial* tutorial = minecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onCrafted(item); + } } } @@ -1575,23 +1583,30 @@ void LocalPlayer::updateRichPresence() { std::shared_ptr selectedItem = inventory->getSelected(); if (selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_FISHING); } else if (selectedItem != nullptr && selectedItem->id == Item::map_Id) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { gameServices().setRichPresenceContext(m_iPad, - CONTEXT_GAME_STATE_RIDING_MINECART); + CONTEXT_GAME_STATE_MAP); + } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { + gameServices().setRichPresenceContext( + m_iPad, CONTEXT_GAME_STATE_RIDING_MINECART); } else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_BOATING); } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); + gameServices().setRichPresenceContext( + m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); } else if (this->dimension == -1) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_NETHER); } else if (minecraft->soundEngine->GetIsPlayingStreamingCDMusic()) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_CD); } else { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_BLANK); } } } @@ -1632,10 +1647,10 @@ void LocalPlayer::handleCollectItem(std::shared_ptr item) { } } } - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_iPad]; - gameMode->getTutorial()->onTake(item, itemCountAnyAux, - itemCountThisAux); + ITutorial* tutorial = minecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onTake(item, itemCountAnyAux, itemCountThisAux); + } } if (ui.IsContainerMenuDisplayed(m_iPad)) { diff --git a/targets/minecraft/client/player/LocalPlayer.h b/targets/minecraft/client/player/LocalPlayer.h index 5b73c8679..9b3dbf959 100644 --- a/targets/minecraft/client/player/LocalPlayer.h +++ b/targets/minecraft/client/player/LocalPlayer.h @@ -10,7 +10,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Level; class User; class CompoundTag; diff --git a/targets/minecraft/client/player/RemotePlayer.cpp b/targets/minecraft/client/player/RemotePlayer.cpp index 2f447a4ad..1370532e5 100644 --- a/targets/minecraft/client/player/RemotePlayer.cpp +++ b/targets/minecraft/client/player/RemotePlayer.cpp @@ -1,12 +1,11 @@ -#include "minecraft/util/Log.h" #include "RemotePlayer.h" #include #include #include -#include "app/linux/LinuxGame.h" #include "Pos.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/client/player/RemotePlayer.h b/targets/minecraft/client/player/RemotePlayer.h index 1492e4653..64ad6a08e 100644 --- a/targets/minecraft/client/player/RemotePlayer.h +++ b/targets/minecraft/client/player/RemotePlayer.h @@ -7,7 +7,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Input; class Level; diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 454700b87..ec1716642 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -1,6 +1,5 @@ #include "Chunk.h" - #include #include @@ -9,10 +8,7 @@ #include #include -#include "platform/renderer/renderer.h" #include "LevelRenderer.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/FrameProfiler.h" #include "TileRenderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/culling/Culler.h" @@ -25,6 +21,9 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" int Chunk::updates = 0; diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 91a2ee532..1081c7bf3 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "GameRenderer.h" #include @@ -8,31 +6,22 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "BossMobGuiInfo.h" #include "Chunk.h" #include "ItemInHandRenderer.h" #include "LevelRenderer.h" -#include "minecraft/GameEnums.h" -#include "platform/ShutdownManager.h" -#include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" -#include "util/FrameProfiler.h" -#include "platform/stubs.h" #include "Tesselator.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" - +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/FloatBuffer.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Camera.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -55,10 +44,11 @@ #include "minecraft/client/renderer/culling/Frustum.h" #include "minecraft/client/renderer/culling/FrustumCuller.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -80,10 +70,17 @@ #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "platform/thread/ShutdownManager.h" +#include "util/FrameProfiler.h" bool GameRenderer::anaglyph3d = false; int GameRenderer::anaglyphPass = 0; @@ -610,7 +607,8 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, aspect = mc->width / (float)mc->height; fov = getFov(a, applyEffects); - if ((mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || + if ((mc->player->m_iScreenSection == + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || (mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM)) { aspect *= 2.0f; @@ -665,7 +663,8 @@ void GameRenderer::setupCamera(float a, int eye) { bool bNoBobbingAnim = (mc->player->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_NoBobbing)) != 0; - if (gameServices().getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(mc->player->GetXboxPad(), + eGameSetting_ViewBob) && !mc->player->abilities.flying && !bNoLegAnim && !bNoBobbingAnim) bobView(a); @@ -720,7 +719,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { localplayer->inventory->getSelected(); if (!(item && item->getItem()->id == Item::map_Id) && gameServices().getGameSettings(localplayer->GetXboxPad(), - eGameSetting_DisplayHand) == 0) + eGameSetting_DisplayHand) == 0) renderHand = false; } @@ -760,7 +759,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { bool bNoLegAnim = (localplayer->getAnimOverrideBitmask() & ((1 << HumanoidModel::eAnim_NoLegAnim) | (1 << HumanoidModel::eAnim_NoBobbing))) != 0; - if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), + eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); @@ -792,7 +792,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-PB - changing this to be per player // if (mc->options->bobView) bobView(a); - if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), + eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); } @@ -800,25 +801,26 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J - change brought forward from 1.8.2 void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO FRAME_PROFILE_SCOPE(Lightmap); -#if defined(__linux__) + + // 4jcraft if (SharedConstants::TEXTURE_LIGHTING) { PlatformRenderer.TextureBindVertex(-1); } -#else - // 4jcraft: manually handle this in order to ensure that the light layer is - // turned off correctly - if (SharedConstants::TEXTURE_LIGHTING) { - glClientActiveTexture(GL_TEXTURE1); - glActiveTexture(GL_TEXTURE1); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glDisable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, 0); - glClientActiveTexture(GL_TEXTURE0); - glActiveTexture(GL_TEXTURE0); - } -#endif + + // // 4jcraft: manually handle this in order to ensure that the light layer + // is + // // turned off correctly + // if (SharedConstants::TEXTURE_LIGHTING) { + // glClientActiveTexture(GL_TEXTURE1); + // glActiveTexture(GL_TEXTURE1); + // glMatrixMode(GL_TEXTURE); + // glLoadIdentity(); + // glMatrixMode(GL_MODELVIEW); + // glDisable(GL_TEXTURE_2D); + // glBindTexture(GL_TEXTURE_2D, 0); + // glClientActiveTexture(GL_TEXTURE0); + // glActiveTexture(GL_TEXTURE0); + // } } // 4J - change brought forward from 1.8.2 @@ -826,7 +828,7 @@ void GameRenderer::turnOnLightLayer( double alpha, bool scaleLight) { // 4jcraft: added scaleLight for entity lighting FRAME_PROFILE_SCOPE(Lightmap); -#if defined(__linux__) +#if 1 if (!SharedConstants::TEXTURE_LIGHTING) return; const int textureId = getLightTexture(mc->player->GetXboxPad(), mc->level); @@ -835,7 +837,7 @@ void GameRenderer::turnOnLightLayer( if (logCount < 16) { ++logCount; Log::info("[linux-lightmap] turnOnLightLayer tex=%d scale=%d\n", - textureId, scaleLight ? 1 : 0); + textureId, scaleLight ? 1 : 0); } PlatformRenderer.TextureBindVertex(textureId, scaleLight); @@ -986,10 +988,10 @@ void GameRenderer::updateLightTexture(float a) { int g = (int)(_g * 255); int b = (int)(_b * 255); -#if defined(_WIN64) || __linux__ +#if 1 lightPixels[j][i] = alpha << 24 | b << 16 | g << 8 | r; #else - lightPixels[j][i] = r << 24 | g << 16 | b << 8 | alpha; +// lightPixels[j][i] = r << 24 | g << 16 | b << 8 | alpha; #endif } @@ -1199,8 +1201,7 @@ void GameRenderer::EnableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (updateRunning) return; - Log::info( - "------------------EnableUpdateThread--------------------\n"); + Log::info("------------------EnableUpdateThread--------------------\n"); updateRunning = true; m_updateEvents->set(eUpdateCanRun); m_updateEvents->set(eUpdateEventIsFinished); @@ -1213,8 +1214,7 @@ void GameRenderer::DisableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (!updateRunning) return; - Log::info( - "------------------DisableUpdateThread--------------------\n"); + Log::info("------------------DisableUpdateThread--------------------\n"); updateRunning = false; m_updateEvents->clear(eUpdateCanRun); m_updateEvents->waitForSingle(eUpdateEventIsFinished, @@ -1397,7 +1397,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); PlatformRenderer.StateSetDepthMask(true); setupFog(0, a); glEnable(GL_BLEND); @@ -1419,7 +1420,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); if (visibleWaterChunks > 0) { levelRenderer->render( diff --git a/targets/minecraft/client/renderer/GameRenderer.h b/targets/minecraft/client/renderer/GameRenderer.h index 708e078dd..84e835c31 100644 --- a/targets/minecraft/client/renderer/GameRenderer.h +++ b/targets/minecraft/client/renderer/GameRenderer.h @@ -6,11 +6,10 @@ #include #include -#include "app/common/App_Defines.h" -#include "platform/C4JThread.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/thread/C4JThread.h" class Minecraft; class Entity; diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 3a868f133..67dec6abd 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,21 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" - - #include #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" #include "Tesselator.h" #include "Textures.h" #include "TileRenderer.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -27,7 +21,9 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/entity/PlayerRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Inventory.h" @@ -40,6 +36,8 @@ #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class EntityRenderer; class MapItemSavedData; @@ -462,15 +460,15 @@ void ItemInHandRenderer::render(float a) { std::floor(player->z), 0); int u = col % 65536; int v = col / 65536; -#if defined(__linux__) + + // 4jcraft static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - Log::info( - "[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, u, - v); + Log::info("[4jcraft-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", + col, u, v); } -#endif + glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); glColor4f(1, 1, 1, 1); } @@ -550,7 +548,8 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != + 0) { playerRenderer->renderHand(); } glPopMatrix(); @@ -767,7 +766,7 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } glPopMatrix(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index de14d43a0..9af935f7f 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,8 +1,5 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LevelRenderer.h" - #include #include #include @@ -15,24 +12,18 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Chunk.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Audio/SoundEngine.h" -#include "app/common/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" -#include "util/FrameProfiler.h" -#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "Tesselator.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -69,6 +60,7 @@ #include "minecraft/client/particle/SuspendedTownParticle.h" #include "minecraft/client/particle/TerrainParticle.h" #include "minecraft/client/player/LocalPlayer.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "minecraft/client/renderer/OffsettedRenderList.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/TileRenderer.h" @@ -79,9 +71,10 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -108,6 +101,12 @@ #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" +#include "util/StringHelpers.h" class Icon; class ItemInstance; @@ -681,16 +680,16 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { std::string LevelRenderer::gatherStats1() { return "C: " + toWString(renderedChunks) + "/" + - toWString(totalChunks) + ". F: " + - toWString(offscreenChunks) + ", O: " + - toWString(occludedChunks) + ", E: " + - toWString(emptyChunks); + toWString(totalChunks) + + ". F: " + toWString(offscreenChunks) + + ", O: " + toWString(occludedChunks) + + ", E: " + toWString(emptyChunks); } std::string LevelRenderer::gatherStats2() { return "E: " + toWString(renderedEntities) + "/" + - toWString(totalEntities) + ". B: " + - toWString(culledEntities) + ", I: " + + toWString(totalEntities) + + ". B: " + toWString(culledEntities) + ", I: " + toWString((totalEntities - culledEntities) - renderedEntities); } @@ -862,8 +861,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { // 4jcraft: replaced glPushMatrix/glTranslatef/glPopMatrix per chunk // no more full MVP upload per chunk, can also be bkwards compat PlatformRenderer.SetChunkOffset((float)chunk->chunk->x, - (float)chunk->chunk->y, - (float)chunk->chunk->z); + (float)chunk->chunk->y, + (float)chunk->chunk->z); if (PlatformRenderer.CBuffCall(list, first)) { first = false; @@ -1168,7 +1167,7 @@ void LevelRenderer::renderClouds(float alpha) { // if the primary player has clouds off, so do all players on this machine if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), - eGameSetting_Clouds) == 0) { + eGameSetting_Clouds) == 0) { return; } @@ -2223,7 +2222,8 @@ void LevelRenderer::renderHitOutline(std::shared_ptr player, const float ss = 0.002f; // 4J-PB - If Display HUD is false, don't render the hit outline - if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) + return; PlatformRenderer.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); @@ -3518,7 +3518,7 @@ void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, if (!mc->soundEngine->GetIsPlayingStreamingGameMusic()) { level[playerIndex]->playStreamingMusic( "", x, y, z); // 4J - used to pass nullptr, but using - // empty string here now instead + // empty string here now instead } } mc->localplayers[playerIndex]->updateRichPresence(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index 9adda8ec3..d948d23a2 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -1,14 +1,13 @@ #pragma once -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "OffsettedRenderList.h" -#include "platform/C4JThread.h" -#include "util/Definitions.h" #include "java/JavaIntHash.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" +#include "platform/network/NetTypes.h" +#include "platform/thread/C4JThread.h" class ClipChunk; class HitResult; @@ -17,9 +16,6 @@ class ItemInstance; class LivingEntity; class Player; class ResourceLocation; -#if !defined(__linux__) -#include -#endif #include #include @@ -72,13 +68,8 @@ public: static const int CHUNK_SIZE = 16; #endif static const int CHUNK_Y_COUNT = Level::maxBuildHeight / CHUNK_SIZE; -#if defined(_WINDOWS64) static const int MAX_COMMANDBUFFER_ALLOCATIONS = 512 * 1024 * 1024; // 4J - added -#else - static const int MAX_COMMANDBUFFER_ALLOCATIONS = - 55 * 1024 * 1024; // 4J - added -#endif public: LevelRenderer(Minecraft* mc, Textures* textures); diff --git a/targets/minecraft/client/renderer/OffsettedRenderList.cpp b/targets/minecraft/client/renderer/OffsettedRenderList.cpp index 58e57e81f..9c9c18426 100644 --- a/targets/minecraft/client/renderer/OffsettedRenderList.cpp +++ b/targets/minecraft/client/renderer/OffsettedRenderList.cpp @@ -1,8 +1,9 @@ #include "OffsettedRenderList.h" -#include "platform/renderer/renderer.h" #include "java/IntBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added OffsettedRenderList::OffsettedRenderList() { diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 9bdc09508..f851e13b0 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -1,14 +1,11 @@ -#include "minecraft/util/Log.h" #include "Tesselator.h" - - #include -#include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" -#include "platform/stubs.h" #include "minecraft/client/MemoryTracker.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" bool Tesselator::TRIANGLE_MODE = false; bool Tesselator::USE_VBO = false; @@ -133,7 +130,8 @@ void Tesselator::end() { PlatformRenderer.DrawVertices( (IPlatformRenderer::ePrimitiveType)mode, vertexCount, _array->data(), - IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, + IPlatformRenderer:: + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, IPlatformRenderer::PIXEL_SHADER_TYPE_PROJECTION); } else { PlatformRenderer.DrawVertices( @@ -414,7 +412,7 @@ typedef unsigned short hfloat; extern hfloat convertFloatToHFloat(float f); extern float convertHFloatToFloat(hfloat hf); -#if defined(__linux__) +#if 1 namespace { void packLinuxLightmapCoords(int tex2, std::int16_t& u, std::int16_t& v) { u = static_cast(tex2 & 0xffff); @@ -471,7 +469,7 @@ void Tesselator::vertex(float x, float y, float z) { pShortData[5] = (((int)(v * 8192.0f)) & 0xffff); std::int16_t u2 = static_cast(_tex2 & 0xffff); std::int16_t v2 = static_cast((_tex2 >> 16) & 0xffff); -#if defined(__linux__) +#if 1 packLinuxLightmapCoords(_tex2, u2, v2); logLinuxPackedLightmapCoords("compact", _tex2, u2, v2); #endif @@ -526,7 +524,7 @@ void Tesselator::vertex(float x, float y, float z) { } if (hasTexture2) { // 4jcraft: we will be lighting the blocks right in here -#if defined(__linux__) +#if 1 std::int16_t tex2U; std::int16_t tex2V; packLinuxLightmapCoords(_tex2, tex2U, tex2V); @@ -539,8 +537,8 @@ void Tesselator::vertex(float x, float y, float z) { #endif } else { // -512 each for u/v will mean that the renderer will use global - // settings (set via PlatformRenderer.StateSetVertexTextureUV) rather - // than these local ones + // settings (set via PlatformRenderer.StateSetVertexTextureUV) + // rather than these local ones *(unsigned int*)(&_array->data()[p + 7]) = 0xfe00fe00; } diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index a76612b4b..040b73adc 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Textures.h" #include @@ -8,20 +7,16 @@ #include #include - -#include "platform/renderer/renderer.h" #include "HttpTexture.h" -#include "app/linux/LinuxGame.h" +#include "java/Buffer.h" +#include "java/ByteBuffer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/BufferedImage.h" +#include "minecraft/client/MemoryTracker.h" +#include "minecraft/client/Options.h" #include "minecraft/client/renderer/MemTexture.h" #include "minecraft/client/renderer/MemTextureProcessor.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" -#include "util/StringHelpers.h" - -#include "java/Buffer.h" -#include "java/ByteBuffer.h" -#include "minecraft/client/MemoryTracker.h" -#include "minecraft/client/Options.h" #include "minecraft/client/renderer/texture/PreStitchedTextureMap.h" #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -32,6 +27,9 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" // Linux/PC port: disable mipmapping globally so textures are always sampled // from the full-resolution level 0 with GL_NEAREST, giving pixel-crisp @@ -526,8 +524,8 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { mergedWidth, mergedHeight, BufferedImage::TYPE_INT_ARGB); memcpy(mergedImage->getData(), mergedPixels.data(), mergedWidth * mergedHeight * sizeof(int)); - id = getTexture(mergedImage, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + id = getTexture(mergedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); } else { id = 0; } @@ -573,8 +571,7 @@ ResourceLocation* Textures::getTextureLocation(int iconType) { void Textures::clearLastBoundId() { lastBoundId = -1; } -int Textures::loadTexture(TEXTURE_NAME texId, - const std::string& resourceName) { +int Textures::loadTexture(TEXTURE_NAME texId, const std::string& resourceName) { // char buf[256]; // strncpy(buf, resourceName.c_str(), 256); // printf("Textures::loadTexture name - %s\n",buf); @@ -606,8 +603,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, (resourceName == "%clamp%misc/shadow.png") || (resourceName == "%blur%misc/pumpkinblur.png") || (resourceName == "%clamp%misc/shadow.png") || - (resourceName == "gui/icons.png") || - (resourceName == "gui/gui.png") || + (resourceName == "gui/icons.png") || (resourceName == "gui/gui.png") || (resourceName == "misc/footprint.png")) { MIPMAP = false; } @@ -654,7 +650,8 @@ return id; */ } -int Textures::getTexture(BufferedImage* img, IPlatformRenderer::eTextureFormat format, +int Textures::getTexture(BufferedImage* img, + IPlatformRenderer::eTextureFormat format, bool mipmap) { int id = MemoryTracker::genTextures(); TEXTURE_FORMAT = format; @@ -805,7 +802,7 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) { } delete[] tempData; PlatformRenderer.TextureData(ww, hh, pixels->getBuffer(), level, - TEXTURE_FORMAT); + TEXTURE_FORMAT); } } @@ -905,7 +902,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } // 4J - added. This is a more minimal version of replaceTexture that assumes the @@ -925,7 +922,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } void Textures::releaseTexture(int id) { @@ -1019,9 +1016,9 @@ int Textures::loadMemTexture(const std::string& url, } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1056,9 +1053,9 @@ int Textures::loadMemTexture(const std::string& url, int backup) { MIPMAP = false; } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1303,16 +1300,16 @@ TEXTURE_NAME TUImages[] = { }; // This is for any TU textures that aren't part of our enum indexed preload set -const char* const TUImagePaths[] = { - "font/Default", "font/Mojangles_7", "font/Mojangles_11", +const char* const TUImagePaths[] = {"font/Default", "font/Mojangles_7", + "font/Mojangles_11", - // TU12 - "armor/cloth_1.png", "armor/cloth_1_b.png", "armor/cloth_2.png", - "armor/cloth_2_b.png", + // TU12 + "armor/cloth_1.png", "armor/cloth_1_b.png", + "armor/cloth_2.png", "armor/cloth_2_b.png", - // + // - nullptr}; + nullptr}; bool Textures::IsTUImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; @@ -1344,7 +1341,7 @@ TEXTURE_NAME OriginalImages[] = {TN_MOB_CHAR, TN_MOB_CHAR1, TN_MOB_CHAR2, const char* const OriginalImagesPaths[] = {"misc/watercolor.png", - nullptr}; + nullptr}; bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; diff --git a/targets/minecraft/client/renderer/Textures.h b/targets/minecraft/client/renderer/Textures.h index 8d067f247..d8855ecbd 100644 --- a/targets/minecraft/client/renderer/Textures.h +++ b/targets/minecraft/client/renderer/Textures.h @@ -5,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "platform/renderer/renderer.h" class Icon; diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index aea9f3f63..acf089344 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -1,6 +1,5 @@ #include "TileRenderer.h" - #include #include #include @@ -9,18 +8,16 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "util/FrameProfiler.h" #include "Tesselator.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/Icon.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" @@ -65,6 +62,9 @@ #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" bool TileRenderer::fancy = true; diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index 203d20404..9d4191092 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -1,14 +1,14 @@ #include "Frustum.h" - #include #include #include -#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class FrustumData; diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index 123b26bc5..f9acc2b37 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -4,14 +4,13 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/Arrow.h" - +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS); diff --git a/targets/minecraft/client/renderer/entity/BatRenderer.cpp b/targets/minecraft/client/renderer/entity/BatRenderer.cpp index 9e24748ae..e24504373 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -3,8 +3,6 @@ #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -12,6 +10,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/ambient/Bat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT); diff --git a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp index a49cfdc8f..a0a0fe9b8 100644 --- a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp @@ -4,7 +4,6 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BoatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -12,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Boat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT); diff --git a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp index 7f1849475..f865cccac 100644 --- a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp @@ -2,10 +2,11 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/SpiderRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CaveSpiderRenderer::CAVE_SPIDER_LOCATION = ResourceLocation(TN_MOB_CAVE_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp index bc98542cc..44d1f3838 100644 --- a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp @@ -4,14 +4,14 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/CreeperModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Creeper.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CreeperRenderer::POWER_LOCATION = ResourceLocation(TN_POWERED_CREEPER); diff --git a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp index 2c7555fa1..d6f4feeed 100644 --- a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp @@ -1,6 +1,7 @@ #include "DefaultRenderer.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.h" void DefaultRenderer::render(std::shared_ptr entity, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp index 9cf89cbdc..fc6397d8a 100644 --- a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp @@ -3,13 +3,14 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/dragon/EnderCrystalModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderCrystalRenderer::ENDER_CRYSTAL_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_ENDERCRYSTAL); diff --git a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp index 24a68f593..b43e7e58e 100644 --- a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp @@ -5,9 +5,7 @@ #include #include -#include "platform/renderer/renderer.h" #include "SharedConstants.h" - #include "java/Random.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/model/dragon/DragonModel.h" @@ -21,6 +19,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderDragonRenderer::DRAGON_EXPLODING_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_SHUFFLE); diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index d62cc154a..082703e7a 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -2,9 +2,6 @@ #include - -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/EndermanModel.h" #include "minecraft/client/renderer/Textures.h" @@ -16,6 +13,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/EnderMan.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EndermanRenderer::ENDERMAN_EYES_LOCATION = ResourceLocation(TN_MOB_ENDERMAN_EYES); diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 31bda5f4f..9981db874 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityRenderDispatcher.h" #include @@ -6,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "ArrowRenderer.h" #include "BatRenderer.h" #include "BlazeRenderer.h" @@ -35,7 +33,6 @@ #include "LightningBoltRenderer.h" #include "MinecartRenderer.h" #include "MinecartSpawnerRenderer.h" -#include "app/linux/LinuxGame.h" #include "MobRenderer.h" #include "MushroomCowRenderer.h" #include "OcelotRenderer.h" @@ -59,7 +56,6 @@ #include "WitherSkullRenderer.h" #include "WolfRenderer.h" #include "ZombieRenderer.h" - #include "minecraft/client/model/ChickenModel.h" #include "minecraft/client/model/CowModel.h" #include "minecraft/client/model/HumanoidModel.h" @@ -73,6 +69,7 @@ #include "minecraft/client/model/WolfModel.h" #include "minecraft/client/model/ZombieModel.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -81,6 +78,8 @@ #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class IconRegister; diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index 02b24d18f..cac1c5b83 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -2,9 +2,7 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/Options.h" #include "minecraft/client/renderer/Tesselator.h" @@ -20,6 +18,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__MISC_SHADOW); diff --git a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp index b08b3cdeb..0e375fd88 100644 --- a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp @@ -5,15 +5,15 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/ExperienceOrb.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ExperienceOrbRenderer::XP_ORB_LOCATION = ResourceLocation(TN_ITEM_EXPERIENCE_ORB); diff --git a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp index 8648cf187..6d2551dbe 100644 --- a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -3,8 +3,6 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" @@ -14,6 +12,8 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/AnvilTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FallingTileRenderer::FallingTileRenderer() : EntityRenderer() { tileRenderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp index dba049c9d..5634860eb 100644 --- a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp @@ -2,9 +2,7 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -15,6 +13,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FireballRenderer::FireballRenderer(float scale) { this->scale = scale; } diff --git a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp index a9e292a14..39a1710e9 100644 --- a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp @@ -4,9 +4,7 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Tesselator.h" @@ -16,6 +14,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FishingHookRenderer::PARTICLE_LOCATION = ResourceLocation(TN_PARTICLES); diff --git a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp index 019d904b3..cdf0f5351 100644 --- a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/GhastModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -10,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Ghast.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation GhastRenderer::GHAST_LOCATION = ResourceLocation(TN_MOB_GHAST); ResourceLocation GhastRenderer::GHAST_SHOOTING_LOCATION = diff --git a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp index b92d2079d..55c91e273 100644 --- a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp @@ -2,10 +2,11 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index fb692c550..82e3ac25f 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -2,8 +2,6 @@ #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "MobRenderer.h" #include "minecraft/client/model/geom/Model.h" @@ -13,6 +11,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation HorseRenderer::HORSE_LOCATION = ResourceLocation(TN_MOB_HORSE_WHITE); diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index 8e3e496d4..6e1b6f8be 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -3,10 +3,7 @@ #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -24,6 +21,9 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string HumanoidMobRenderer::MATERIAL_NAMES[5] = { "cloth", "chain", "iron", "diamond", "gold"}; diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index aed9f0e74..9b742a276 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -4,8 +4,8 @@ #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/TileRenderer.h" +#include "platform/stubs.h" // #include "ItemFrame" -#include "platform/renderer/renderer.h" #include "ItemFrameRenderer.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" @@ -27,6 +27,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" +#include "platform/renderer/renderer.h" class MapItemSavedData; diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index d93de63ea..8190e98bb 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -4,10 +4,7 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" - #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -28,6 +25,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class ResourceLocation; diff --git a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp index aac8da2b3..71fde94d0 100644 --- a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp @@ -2,9 +2,7 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -14,6 +12,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ItemSpriteRenderer::ItemSpriteRenderer(Item* sourceItem, int sourceItemAuxValue /*= 0*/) diff --git a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp index 5ddfd6a5e..ab946b958 100644 --- a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp @@ -2,13 +2,14 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/LavaSlimeModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/LavaSlime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LavaSlimeRenderer::MAGMACUBE_LOCATION = ResourceLocation(TN_MOB_LAVA); diff --git a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp index 9f0c38482..e9b24215e 100644 --- a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/LeashKnotModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LeashKnotRenderer::KNOT_LOCATION = ResourceLocation(TN_ITEM_LEASHKNOT); diff --git a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp index 24c801a08..752008826 100644 --- a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/LightningBolt.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void LightningBoltRenderer::render(std::shared_ptr _bolt, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index 806435813..026b8e61c 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,17 +1,14 @@ -#include "minecraft/IGameServices.h" #include "LivingEntityRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" - #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -27,6 +24,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Arrow.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT); @@ -389,12 +388,14 @@ void LivingEntityRenderer::renderName(std::shared_ptr mob, if (!msg.empty()) { if (mob->isSneaking()) { - if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings( + eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } diff --git a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp index b91901b44..68fbb638f 100644 --- a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/MinecartModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -16,6 +15,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Tile; diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index 48fc3df65..5feeb17e1 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -4,19 +4,19 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" - #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index cfcf9f9ff..90aed102e 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -2,9 +2,6 @@ #include - -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/QuadrupedModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" @@ -16,6 +13,8 @@ #include "minecraft/world/entity/animal/MushroomCow.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp index 28787c7a1..0043aba52 100644 --- a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp @@ -2,13 +2,14 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index 31b9aef47..22a737c41 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -2,10 +2,7 @@ #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -13,6 +10,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PaintingRenderer::PAINTING_LOCATION(TN_ART_KZ); diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index f9f573919..0975aee47 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,18 +1,15 @@ -#include "minecraft/IGameServices.h" #include "PlayerRenderer.h" #include #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/HumanoidModel.h" @@ -36,6 +33,8 @@ #include "minecraft/world/item/UseAnim.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] = { @@ -459,8 +458,7 @@ bool b2 = !mob->isCapeHidden();*/ void PlayerRenderer::renderNameTags(std::shared_ptr player, double x, double y, double z, - std::string msg, float scale, - double dist) { + std::string msg, float scale, double dist) { LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); } @@ -524,7 +522,8 @@ void PlayerRenderer::setupRotations(std::shared_ptr _mob, // 4J Added override to stop rendering shadow if player is invisible void PlayerRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > + 0) { std::shared_ptr player = std::dynamic_pointer_cast(e); if (player != nullptr && player->hasInvisiblePrivilege()) return; } diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.h b/targets/minecraft/client/renderer/entity/PlayerRenderer.h index 5feabe813..821834b08 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -2,11 +2,11 @@ #include #include -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "MobRenderer.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/renderer/entity/LivingEntityRenderer.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/network/NetTypes.h" class HumanoidModel; class LivingEntity; diff --git a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp index 38907890b..cab34494a 100644 --- a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -12,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp index 1553b9ea1..b97c00e5e 100644 --- a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/SkeletonModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/HumanoidMobRenderer.h" @@ -10,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Skeleton.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SkeletonRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON); diff --git a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp index 84a0a7fda..fcc79f1a7 100644 --- a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp @@ -2,13 +2,13 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Slime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp index b5b1dbbc3..592633f8b 100644 --- a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/model/SnowManModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -16,6 +15,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SnowManRenderer::SNOWMAN_LOCATION = ResourceLocation(TN_MOB_SNOWMAN); diff --git a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp index 9e4c57b12..08b3ad8db 100644 --- a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/SpiderModel.h" #include "minecraft/client/renderer/Textures.h" @@ -11,6 +9,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Spider.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SpiderRenderer::SPIDER_LOCATION = ResourceLocation(TN_MOB_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp index 6a53e1937..a7a671baf 100644 --- a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp @@ -2,12 +2,13 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Squid.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp index 50d4613e0..74fd6eecb 100644 --- a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp @@ -2,13 +2,13 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/MinecartRenderer.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/entity/item/MinecartTNT.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void TntMinecartRenderer::renderMinecartContents( std::shared_ptr _cart, float a, Tile* tile, int tileData) { diff --git a/targets/minecraft/client/renderer/entity/TntRenderer.cpp b/targets/minecraft/client/renderer/entity/TntRenderer.cpp index 472c079ed..8f031b27a 100644 --- a/targets/minecraft/client/renderer/entity/TntRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntRenderer.cpp @@ -2,14 +2,14 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/PrimedTnt.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TntRenderer::TntRenderer() { renderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 0accf95db..f5e88b431 100644 --- a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -4,8 +4,6 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/VillagerGolemModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -18,6 +16,8 @@ #include "minecraft/world/entity/animal/VillagerGolem.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerGolemRenderer::GOLEM_LOCATION = ResourceLocation(TN_MOB_VILLAGER_GOLEM); diff --git a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp index 816846356..84a0e4740 100644 --- a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/VillagerModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -10,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/npc/Villager.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerRenderer::VILLAGER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_VILLAGER); diff --git a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp index 207d129e2..f135b4785 100644 --- a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/WitchModel.h" @@ -21,6 +20,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitchRenderer::WITCH_LOCATION = ResourceLocation(TN_MOB_WITCH); diff --git a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp index 847441fe8..89a98df5d 100644 --- a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp @@ -3,10 +3,8 @@ #include #include -#include "platform/renderer/renderer.h" #include "MobRenderer.h" #include "SharedConstants.h" - #include "minecraft/client/model/WitherBossModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/BossMobGuiInfo.h" @@ -15,6 +13,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/wither/WitherBoss.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherBossRenderer::WITHER_ARMOR_LOCATION = ResourceLocation(TN_MOB_WITHER_ARMOR); diff --git a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp index 14fcce976..f784f9a37 100644 --- a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp @@ -2,13 +2,13 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/WitherSkull.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherSkullRenderer::WITHER_ARMOR_LOCATION( TN_MOB_WITHER_INVULNERABLE); diff --git a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp index 5150f3449..526958b3e 100644 --- a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -13,6 +12,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index 969bf9473..fe8684843 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -1,16 +1,13 @@ -#include "minecraft/util/Log.h" #include "PreStitchedTextureMap.h" #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" #include "StitchedTexture.h" #include "Texture.h" #include "TextureManager.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" @@ -18,6 +15,7 @@ #include "minecraft/client/renderer/texture/custom/CompassTexture.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -175,9 +173,8 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, if (first->getWidth() != tex->getWidth() || first->getHeight() != tex->getHeight()) { Log::info("%s - first w - %d, h - %d, tex w - %d, h - %d\n", - textureFileName.c_str(), first->getWidth(), - tex->getWidth(), first->getHeight(), - tex->getHeight()); + textureFileName.c_str(), first->getWidth(), + tex->getWidth(), first->getHeight(), tex->getHeight()); assert(0); } #endif diff --git a/targets/minecraft/client/renderer/texture/StitchSlot.cpp b/targets/minecraft/client/renderer/texture/StitchSlot.cpp index da44be1fe..385bf4405 100644 --- a/targets/minecraft/client/renderer/texture/StitchSlot.cpp +++ b/targets/minecraft/client/renderer/texture/StitchSlot.cpp @@ -137,8 +137,9 @@ void StitchSlot::collectAssignments(std::vector* result) { //@Override std::string StitchSlot::toString() { - return "Slot{originX=" + toWString(originX) + ", originY=" + - toWString(originY) + ", width=" + toWString(width) + ", height=" + - toWString(height) + ", texture=" + toWString(textureHolder) + + return "Slot{originX=" + toWString(originX) + + ", originY=" + toWString(originY) + ", width=" + toWString(width) + + ", height=" + toWString(height) + + ", texture=" + toWString(textureHolder) + ", subSlots=" + toWString(subSlots) + '}'; } \ No newline at end of file diff --git a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp index 5bd407020..c6858f3ed 100644 --- a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp +++ b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp @@ -4,11 +4,11 @@ #include "Texture.h" #include "TextureManager.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/texture/custom/ClockTexture.h" #include "minecraft/client/renderer/texture/custom/CompassTexture.h" +#include "util/StringHelpers.h" StitchedTexture* StitchedTexture::create(const std::string& name) { // TODO: Generalize? diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 6ccc29570..805caefc2 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -1,14 +1,13 @@ -#include "minecraft/util/Log.h" #include "Stitcher.h" #include +#include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "StitchSlot.h" #include "Texture.h" #include "TextureHolder.h" #include "TextureManager.h" +#include "minecraft/util/Log.h" void Stitcher::_init(const std::string& name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index 1db756dcd..b1501ee40 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Texture.h" #include @@ -6,13 +5,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" -#include "minecraft/client/BufferedImage.h" #include "TextureManager.h" #include "java/Buffer.h" #include "java/ByteBuffer.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Rect2i.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #define MAX_MIP_LEVELS 5 @@ -575,24 +575,25 @@ void Texture::updateOnGPU() { if (!m_bInitialised) { PlatformRenderer.TextureSetTextureLevels(m_iMipLevels); // 4J added - PlatformRenderer.TextureData(width, height, data[0]->getBuffer(), 0, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData( + width, height, data[0]->getBuffer(), 0, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); if (mipmapped) { for (int level = 1; level < m_iMipLevels; level++) { int levelWidth = width >> level; int levelHeight = height >> level; - PlatformRenderer.TextureData(levelWidth, levelHeight, - data[level]->getBuffer(), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData( + levelWidth, levelHeight, data[level]->getBuffer(), level, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } } m_bInitialised = true; } else { PlatformRenderer.TextureDataUpdate(0, 0, width, height, - data[0]->getBuffer(), 0); + data[0]->getBuffer(), 0); if (mipmapped) { if (PlatformRenderer.TextureGetTextureLevels() > 1) { diff --git a/targets/minecraft/client/renderer/texture/Texture.h b/targets/minecraft/client/renderer/texture/Texture.h index 718e0ade1..06bf6ad1c 100644 --- a/targets/minecraft/client/renderer/texture/Texture.h +++ b/targets/minecraft/client/renderer/texture/Texture.h @@ -1,11 +1,12 @@ #pragma once -#include "platform/renderer/renderer.h" - #include #include #include +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" + class Rect2i; class ByteBuffer; class BufferedImage; @@ -68,8 +69,8 @@ public: ~Texture(); private: - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); void _init(const std::string& name, int mode, int width, int height, @@ -83,8 +84,8 @@ public: Texture(const std::string& name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); const Rect2i* getRect(); diff --git a/targets/minecraft/client/renderer/texture/TextureHolder.cpp b/targets/minecraft/client/renderer/texture/TextureHolder.cpp index 413beb484..e90be0e37 100644 --- a/targets/minecraft/client/renderer/texture/TextureHolder.cpp +++ b/targets/minecraft/client/renderer/texture/TextureHolder.cpp @@ -49,8 +49,8 @@ void TextureHolder::setForcedScale(int targetSize) { //@Override std::string TextureHolder::toString() { - return "TextureHolder{width=" + toWString(width) + ", height=" + - toWString(height) + '}'; + return "TextureHolder{width=" + toWString(width) + + ", height=" + toWString(height) + '}'; } int TextureHolder::compareTo(const TextureHolder* other) const { diff --git a/targets/minecraft/client/renderer/texture/TextureManager.cpp b/targets/minecraft/client/renderer/texture/TextureManager.cpp index 9c076aefc..6db5a2c32 100644 --- a/targets/minecraft/client/renderer/texture/TextureManager.cpp +++ b/targets/minecraft/client/renderer/texture/TextureManager.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureManager.h" #include @@ -6,14 +5,14 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "minecraft/client/BufferedImage.h" #include "Stitcher.h" #include "Texture.h" #include "java/File.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" TextureManager* TextureManager::instance = nullptr; diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index c74a3d57f..2aaec1b96 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureMap.h" #include @@ -6,9 +5,6 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" #include "StitchedTexture.h" #include "Stitcher.h" @@ -18,11 +14,13 @@ #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -159,7 +157,7 @@ void TextureMap::stitch() { // premade icon for " + textureName + " doing " + name); #ifndef _CONTENT_PACKAGE printf("Couldn't find premade icon for %s doing %s\n", - textureName.c_str(), name.c_str()); + textureName.c_str(), name.c_str()); #endif } } @@ -190,7 +188,7 @@ void TextureMap::stitch() { // for: " + animationDefinitionFile); #ifndef _CONTENT_PACKAGE printf("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); diff --git a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp index dab61cdc0..6c4b0c872 100644 --- a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -12,6 +11,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" ClockTexture::ClockTexture() : StitchedTexture("clock", "clock") { rot = rota = 0.0; diff --git a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp index 5abc49cab..29b3e1f41 100644 --- a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp @@ -7,7 +7,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" @@ -16,6 +15,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" CompassTexture* CompassTexture::instance = nullptr; diff --git a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp index 2ac5a27ba..bd8c0c78d 100644 --- a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp @@ -4,14 +4,14 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM); diff --git a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp index 7f4e18013..3d433ecd3 100644 --- a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp @@ -3,8 +3,6 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/LargeChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -15,6 +13,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ChestRenderer::CHEST_LARGE_TRAP_LOCATION = ResourceLocation(TN_TILE_LARGE_TRAP_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index 80777935b..687bb2d7e 100644 --- a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -4,14 +4,14 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/BookModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/tile/entity/EnchantmentTableTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnchantTableRenderer::BOOK_LOCATION = ResourceLocation(TN_ITEM_BOOK); diff --git a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp index 6ecc05db4..da1b16561 100644 --- a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp @@ -3,14 +3,14 @@ #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/EnderChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderChestRenderer::ENDER_CHEST_LOCATION = ResourceLocation(TN_TILE_ENDER_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp index 1c68944ea..bd12348c9 100644 --- a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp @@ -1,11 +1,12 @@ #include "MobSpawnerRenderer.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/BaseMobSpawner.h" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void MobSpawnerRenderer::render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, diff --git a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp index 59bb167bb..f1f6b2cfb 100644 --- a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/Lighting.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -16,6 +14,8 @@ #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 0751a1db3..1748209c4 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,25 +1,24 @@ -#include "minecraft/IGameServices.h" #include "SignRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" -#include "platform/XboxStubs.h" - +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/model/SignModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/XboxStubs.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" ResourceLocation SignRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); @@ -90,7 +89,8 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, msg = "Censored"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED); + msg = + gameServices().getString(IDS_STRINGVERIFY_CENSORED); break; } } else { @@ -101,11 +101,11 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_TCHINESE: - msg = - "Awaiting Approval"; // In-game font, so English only + msg = "Awaiting Approval"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_AWAITING_APPROVAL); + msg = gameServices().getString( + IDS_STRINGVERIFY_AWAITING_APPROVAL); break; } } diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index 3c21309ee..845bca4e3 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" - #include "minecraft/Facing.h" #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/model/geom/Model.h" @@ -14,6 +12,8 @@ #include "minecraft/world/level/tile/SkullTile.h" #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SkullTileRenderer* SkullTileRenderer::instance = nullptr; diff --git a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp index 3fc26a24d..dbbb5dcf8 100644 --- a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp @@ -2,9 +2,7 @@ #include -#include "platform/renderer/renderer.h" #include "TileEntityRenderDispatcher.h" - #include "java/FloatBuffer.h" #include "java/Random.h" #include "java/System.h" @@ -15,6 +13,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/TheEndPortalTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation TheEndPortalRenderer::END_SKY_LOCATION = ResourceLocation(TN_MISC_TUNNEL); diff --git a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp index bf8eda75b..2d91599cc 100644 --- a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "BeaconRenderer.h" #include "ChestRenderer.h" #include "EnchantTableRenderer.h" @@ -13,11 +12,12 @@ #include "SkullTileRenderer.h" #include "TheEndPortalRenderer.h" #include "TileEntityRenderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class Textures; diff --git a/targets/app/common/Colours/ColourTable.cpp b/targets/minecraft/client/resources/Colours/ColourTable.cpp similarity index 98% rename from targets/app/common/Colours/ColourTable.cpp rename to targets/minecraft/client/resources/Colours/ColourTable.cpp index 044e31b87..e01b360d9 100644 --- a/targets/app/common/Colours/ColourTable.cpp +++ b/targets/minecraft/client/resources/Colours/ColourTable.cpp @@ -1,16 +1,15 @@ -#include "ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include #include #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" +#include "minecraft/GameEnums.h" +#include "util/StringHelpers.h" -std::unordered_map - ColourTable::s_colourNamesMap; +std::unordered_map ColourTable::s_colourNamesMap; const char* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { "NOTSET", diff --git a/targets/app/common/Colours/ColourTable.h b/targets/minecraft/client/resources/Colours/ColourTable.h similarity index 100% rename from targets/app/common/Colours/ColourTable.h rename to targets/minecraft/client/resources/Colours/ColourTable.h diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index cf6b240e3..af529e6e5 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,24 +1,24 @@ -#include "minecraft/util/Log.h" #include "AbstractTexturePack.h" - #include +#include #include -#include "app/common/Colours/ColourTable.h" -#include "minecraft/IGameServices.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File* file, const std::string& name, @@ -97,8 +97,7 @@ void AbstractTexturePack::load(Textures* textures) { } } -bool AbstractTexturePack::hasFile(const std::string& name, - bool allowFallback) { +bool AbstractTexturePack::hasFile(const std::string& name, bool allowFallback) { bool hasFile = this->hasFile(name); return !hasFile && (allowFallback && fallback != nullptr) @@ -138,7 +137,7 @@ std::string AbstractTexturePack::getAnimationString( // " + animationDefinitionFile); #if !defined(_CONTENT_PACKAGE) Log::info("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); @@ -164,7 +163,7 @@ BufferedImage* AbstractTexturePack::getImageResource( std::string pchTexture = File; std::string pchDrive = drive; Log::info("AbstractTexturePack::getImageResource - %s, drive is %s\n", - pchTexture.c_str(), pchDrive.c_str()); + pchTexture.c_str(), pchDrive.c_str()); return new BufferedImage(TexturePack::getResource("/" + File), filenameHasExtension, bTitleUpdateTexture, drive); @@ -215,14 +214,14 @@ void AbstractTexturePack::unloadUI() { std::string AbstractTexturePack::getXuiRootPath() { // const uintptr_t c_ModuleHandle = (uintptr_t)GetModuleHandle(nullptr); - const uintptr_t c_ModuleHandle = 0; // 4jcraft changed + const uintptr_t c_ModuleHandle = 0; // 4jcraft changed // Load new skin constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string char szResourceLocator[LOCATOR_SIZE]; - snprintf(szResourceLocator, LOCATOR_SIZE, "section://%X,%s#%s", + snprintf(szResourceLocator, LOCATOR_SIZE, "section://%" PRIxPTR ",%s#%s", c_ModuleHandle, "media", "media/"); return szResourceLocator; } diff --git a/targets/minecraft/client/skins/AbstractTexturePack.h b/targets/minecraft/client/skins/AbstractTexturePack.h index 33bf00a3f..9982b62e4 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.h +++ b/targets/minecraft/client/skins/AbstractTexturePack.h @@ -75,12 +75,12 @@ public: virtual std::string getWorldName(); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback); + const std::string& path, + bool allowFallback); protected: virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); + const std::string& path); void loadDefaultUI(); void loadDefaultColourTable(); void loadDefaultHTMLColourTable(); diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 930a40ecc..67d849d01 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -1,44 +1,37 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DLCTexturePack.h" +#include #include #include #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Colours/ColourTable.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" -#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCLocalisationFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/Localisation/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" -#include "platform/fs/fs.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/AbstractTexturePack.h" #include "minecraft/client/skins/TexturePack.h" - -#if defined(_WINDOWS64) -#include "app/windows/XML/ATGXmlParser.h" -#include "app/windows/XML/xmlFilesCallback.h" -#endif +#include "minecraft/locale/StringTable.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "platform/fs/fs.h" +#include "platform/input/input.h" +#include "platform/storage/storage.h" +#include "util/StringHelpers.h" namespace { bool ReadPortableBinaryFile(File& file, std::uint8_t*& data, @@ -177,12 +170,12 @@ bool DLCTexturePack::hasFile(const std::string& name) { bool DLCTexturePack::isTerrainUpdateCompatible() { return true; } std::string DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { return ""; } std::string DLCTexturePack::getAnimationString(const std::string& textureName, - const std::string& path) { + const std::string& path) { std::string result = ""; std::string fullpath = "res/" + path + textureName + ".png"; @@ -197,12 +190,41 @@ std::string DLCTexturePack::getAnimationString(const std::string& textureName, BufferedImage* DLCTexturePack::getImageResource( const std::string& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::string& drive /*=""*/) { - if (m_dlcDataPack) - return new BufferedImage(m_dlcDataPack, "/" + File, - filenameHasExtension); - else + if (!m_dlcDataPack) { return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive); + } + auto* image = new BufferedImage(); + const std::string filePath = "/" + File; + for (int l = 0; l < 10; l++) { + std::string mipMapPath = + (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; + std::string name = + "res" + (filenameHasExtension + ? filePath + : filePath.substr(0, filePath.length() - 4) + + mipMapPath + ".png"); + + if (!m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_All, + name)) { + if (l == 0) gameServices().fatalLoadError(); + break; + } + + DLCFile* dlcFile = + m_dlcDataPack->getFile(DLCManager::e_DLCType_All, name); + std::uint32_t dataBytes = 0; + std::uint8_t* pbData = dlcFile->getData(dataBytes); + if (pbData == nullptr || dataBytes == 0) { + if (l == 0) gameServices().fatalLoadError(); + break; + } + + if (!image->loadMipmapPng(l, pbData, dataBytes)) { + break; + } + } + return image; } DLCPack* DLCTexturePack::getDLCPack() { return m_dlcDataPack; } @@ -243,30 +265,30 @@ void DLCTexturePack::loadData() { [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); }, - "TPACK") != ERROR_IO_PENDING) { + "TPACK") != 997) { // corrupt DLC m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); Log::info("Failed to mount texture pack DLC %d for pad %d\n", - mountIndex, PlatformInput.GetPrimaryPad()); + mountIndex, PlatformInput.GetPrimaryPad()); } else { m_bLoadingData = true; Log::info("Attempted to mount DLC data for texture pack %d\n", - mountIndex); + mountIndex); } } else { m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } std::string DLCTexturePack::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder) { + std::string filename, + bool bAddDataFolder) { return gameServices().getFilePath(packId, filename, bAddDataFolder); } @@ -274,12 +296,11 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { DLCTexturePack* texturePack = this; texturePack->m_bLoadingData = false; - if (dwErr != ERROR_SUCCESS) { + if (dwErr != 0) { // corrupt DLC Log::info("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); } else { - Log::info( - "Mounted DLC for texture pack, attempting to load data\n"); + Log::info("Mounted DLC for texture pack, attempting to load data\n"); texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); texturePack->setHasAudio(false); @@ -385,11 +406,13 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, iEndC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End); - Minecraft::GetInstance()->soundEngine->SetStreamingSounds( - iOverworldStart, iOverworldStart + iOverworldC, - iNetherStart, iNetherStart + iNetherC, iEndStart, - iEndStart + iEndC, - iEndStart + iEndC); // push the CD start to after + static_cast( + Minecraft::GetInstance()->soundEngine) + ->SetStreamingSounds( + iOverworldStart, iOverworldStart + iOverworldC, + iNetherStart, iNetherStart + iNetherC, iEndStart, + iEndStart + iEndC, + iEndStart + iEndC); // push the CD start to after } } texturePack->loadColourTable(); @@ -404,7 +427,8 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, texturePack->m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ReloadTexturePack); return 0; } @@ -453,8 +477,9 @@ std::string DLCTexturePack::getXuiRootPath() { constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string char szResourceLocator[LOCATOR_SIZE]; - snprintf(szResourceLocator, LOCATOR_SIZE, "memory://%08X,%04X#", - pbData, dwSize); + snprintf(szResourceLocator, LOCATOR_SIZE, + "memory://%08" PRIxPTR ",%04X#", + reinterpret_cast(pbData), dwSize); path = szResourceLocator; } return path; @@ -475,3 +500,14 @@ DLCPack* DLCTexturePack::getDLCInfoParentPack() { XCONTENTDEVICEID DLCTexturePack::GetDLCDeviceID() { return m_dlcInfoPack->GetDLCDeviceID(); } + +bool DLCTexturePack::needsPurchase() { + if (m_dlcInfoPack == nullptr) { + return false; + } + DLCPack* parent = m_dlcInfoPack->GetParentPack(); + if (parent == nullptr) { + return false; + } + return !parent->hasPurchasedFile(DLCManager::e_DLCType_Texture, ""); +} diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index 29914cddc..ed9824aa6 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -3,9 +3,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "AbstractTexturePack.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" +#include "platform/PlatformTypes.h" class DLCPack; class StringTable; @@ -27,65 +27,67 @@ public: using AbstractTexturePack::getResource; DLCTexturePack(std::uint32_t id, DLCPack* pack, TexturePack* fallback); - ~DLCTexturePack() {}; + ~DLCTexturePack() override = default; - virtual std::string getResource(const std::string& name); - virtual DLCPack* getDLCPack(); - virtual std::string getDesc1() { + std::string getResource(const std::string& name) override; + DLCPack* getDLCPack() override; + std::string getDesc1() override { return m_stringTable->getString("IDS_TP_DESCRIPTION"); } - virtual std::string getName() { + std::string getName() override { return m_stringTable->getString("IDS_DISPLAY_NAME"); } - virtual std::string getWorldName() { + std::string getWorldName() override { return m_stringTable->getString("IDS_WORLD_NAME"); } // Added for sound banks with MashUp packs protected: //@Override - void loadIcon(); - void loadComparison(); - void loadName(); - void loadDescription(); + void loadIcon() override; + void loadComparison() override; + void loadName() override; + void loadDescription() override; InputStream* getResourceImplementation( - const std::string& name); // throws IOException + const std::string& name) override; // throws IOException public: //@Override - bool hasFile(const std::string& name); - bool isTerrainUpdateCompatible(); + bool hasFile(const std::string& name) override; + bool isTerrainUpdateCompatible() override; // 4J Added - virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); - virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); - virtual BufferedImage* getImageResource(const std::string& File, - bool filenameHasExtension = false, - bool bTitleUpdateTexture = false, - const std::string& drive = ""); - virtual void loadColourTable(); - virtual bool hasData() { return m_bHasLoadedData; } - virtual bool isLoadingData() { return m_bLoadingData; } + std::string getPath(bool bTitleUpdateTexture = false, + const char* pchBDPatchFilename = nullptr) override; + std::string getAnimationString(const std::string& textureName, + const std::string& path) override; + BufferedImage* getImageResource(const std::string& File, + bool filenameHasExtension = false, + bool bTitleUpdateTexture = false, + const std::string& drive = "") override; + void loadColourTable() override; + bool hasData() override { return m_bHasLoadedData; } + bool isLoadingData() override { return m_bLoadingData; } private: static std::string getRootPath(std::uint32_t packId, bool allowOverride, - bool bAddDataFolder); + bool bAddDataFolder); static std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder = true); + bool bAddDataFolder = true); public: int onPackMounted(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask); - virtual void loadData(); - virtual void loadUI(); - virtual void unloadUI(); - virtual std::string getXuiRootPath(); - virtual ArchiveFile* getArchiveFile() { return m_archiveFile; } + void loadData() override; + void loadUI() override; + void unloadUI() override; + std::string getXuiRootPath() override; + ArchiveFile* getArchiveFile() override { return m_archiveFile; } - virtual unsigned int getDLCParentPackId(); + unsigned int getDLCParentPackId() override; virtual DLCPack* getDLCInfoParentPack(); - virtual unsigned char getDLCSubPackId(); + unsigned char getDLCSubPackId() override; XCONTENTDEVICEID GetDLCDeviceID(); + + [[nodiscard]] bool needsPurchase() override; }; diff --git a/targets/minecraft/client/skins/DefaultTexturePack.cpp b/targets/minecraft/client/skins/DefaultTexturePack.cpp index 7a344dcae..908018170 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.cpp +++ b/targets/minecraft/client/skins/DefaultTexturePack.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" - #include "DefaultTexturePack.h" #include #include #include "java/InputOutputStream/InputStream.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/skins/AbstractTexturePack.h" DefaultTexturePack::DefaultTexturePack() diff --git a/targets/minecraft/client/skins/DefaultTexturePack.h b/targets/minecraft/client/skins/DefaultTexturePack.h index 085b1d4ed..600b4fd34 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.h +++ b/targets/minecraft/client/skins/DefaultTexturePack.h @@ -22,7 +22,9 @@ public: bool hasFile(const std::string& name); bool isTerrainUpdateCompatible(); - std::string getDesc1() { return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); } + std::string getDesc1() { + return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); + } protected: //@Override diff --git a/targets/minecraft/client/skins/FolderTexturePack.cpp b/targets/minecraft/client/skins/FolderTexturePack.cpp index aa62fd4bc..06718f5a5 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.cpp +++ b/targets/minecraft/client/skins/FolderTexturePack.cpp @@ -44,7 +44,7 @@ bool FolderTexturePack::hasFile(const std::string& name) { bool FolderTexturePack::isTerrainUpdateCompatible() { return true; } std::string FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { std::string wDrive; wDrive = "Common\\" + file->getPath() + "\\"; return wDrive; diff --git a/targets/minecraft/client/skins/FolderTexturePack.h b/targets/minecraft/client/skins/FolderTexturePack.h index 637ef54d8..c6e1715b8 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.h +++ b/targets/minecraft/client/skins/FolderTexturePack.h @@ -28,7 +28,7 @@ public: // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/targets/minecraft/client/skins/ISkinAssetData.h b/targets/minecraft/client/skins/ISkinAssetData.h new file mode 100644 index 000000000..2b5df49c7 --- /dev/null +++ b/targets/minecraft/client/skins/ISkinAssetData.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include + +#include "minecraft/client/model/SkinBox.h" + +// Domain-shaped view of a custom skin asset. +// +// minecraft/ consumers (Player, the client/server connection layers, +// the texture packet) need a handful of fields off a custom skin +// asset: the skin id, the additional body parts geometry, and an +// animation override mask. Historically those fields were read off +// app/common/DLC/DLCSkinFile, which dragged the entire DLC subsystem +// up into minecraft/ headers and broke the layering invariant. +// +// This interface is the domain abstraction. The DLC implementation in +// app/ inherits from it; minecraft/ only ever sees ISkinAssetData. +class ISkinAssetData { +public: + virtual ~ISkinAssetData() = default; + + [[nodiscard]] virtual std::uint32_t getSkinID() = 0; + [[nodiscard]] virtual unsigned int getAnimOverrideBitmask() = 0; + [[nodiscard]] virtual int getAdditionalBoxesCount() = 0; + [[nodiscard]] virtual std::vector* getAdditionalBoxes() = 0; +}; diff --git a/targets/minecraft/client/skins/TexturePack.cpp b/targets/minecraft/client/skins/TexturePack.cpp index c323e5fb2..2c0f38a2f 100644 --- a/targets/minecraft/client/skins/TexturePack.cpp +++ b/targets/minecraft/client/skins/TexturePack.cpp @@ -1,8 +1,7 @@ #include "TexturePack.h" -std::string TexturePack::getPath( - bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFileName /*= nullptr*/) { +std::string TexturePack::getPath(bool bTitleUpdateTexture /*= false*/, + const char* pchBDPatchFileName /*= nullptr*/) { std::string wDrive; if (bTitleUpdateTexture) { diff --git a/targets/minecraft/client/skins/TexturePack.h b/targets/minecraft/client/skins/TexturePack.h index 53727ff40..3881ee2ca 100644 --- a/targets/minecraft/client/skins/TexturePack.h +++ b/targets/minecraft/client/skins/TexturePack.h @@ -38,7 +38,7 @@ public: virtual std::string getResource( const std::string& name) // 4J - changed to just return a name rather - // than an input stream + // than an input stream { /* 4J - TODO return TexturePack.class.getResourceAsStream(name); @@ -47,15 +47,22 @@ return TexturePack.class.getResourceAsStream(name); } virtual DLCPack* getDLCPack() { return nullptr; } + // True for trial skins / texture packs that the user has not yet + // purchased. The default (built-in) skin and any owned DLC pack + // returns false. Used by save and disconnect paths to refuse + // operations that would otherwise unlock paid content for free. + [[nodiscard]] virtual bool needsPurchase() { return false; } + // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback) = 0; - virtual BufferedImage* getImageResource( - const std::string& File, bool filenameHasExtension = false, - bool bTitleUpdateTexture = false, const std::string& drive = "") = 0; + const std::string& path, + bool allowFallback) = 0; + virtual BufferedImage* getImageResource(const std::string& File, + bool filenameHasExtension = false, + bool bTitleUpdateTexture = false, + const std::string& drive = "") = 0; virtual void loadColourTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index dc7005742..c04c55476 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TexturePackRepository.h" #include @@ -7,18 +5,19 @@ #include #include -#include "platform/input/input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Minimap.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/input/input.h" TexturePack* TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr; @@ -64,14 +63,11 @@ bool TexturePackRepository::selectSkin(TexturePack* skin) { } void TexturePackRepository::selectWebSkin(const std::string& url) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } -void TexturePackRepository::downloadWebSkin(const std::string& url, - File file) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); +void TexturePackRepository::downloadWebSkin(const std::string& url, File file) { + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } bool TexturePackRepository::isUsingWebSkin() { return usingWeb; } @@ -93,8 +89,7 @@ std::string TexturePackRepository::getIdOrNull(File file) { } std::vector TexturePackRepository::getWorkDirContents() { - Log::info( - "TexturePackRepository::getWorkDirContents is not implemented\n"); + Log::info("TexturePackRepository::getWorkDirContents is not implemented\n"); return std::vector(); } @@ -117,8 +112,7 @@ bool TexturePackRepository::shouldPromptForWebSkin() { } bool TexturePackRepository::canUseWebSkin() { - Log::info( - "TexturePackRepository::canUseWebSkin is not implemented\n"); + Log::info("TexturePackRepository::canUseWebSkin is not implemented\n"); return false; } @@ -152,7 +146,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { if (newPack->hasData()) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } else { newPack->loadData(); } @@ -163,12 +157,12 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { } bDidSelect = true; } else { - Log::info( - "Failed to select texture pack %d as it is not in the list\n", id); + Log::info("Failed to select texture pack %d as it is not in the list\n", + id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } return bDidSelect; @@ -200,10 +194,10 @@ TexturePack* TexturePackRepository::addTexturePackFromDLC(DLCPack* dlcPack, #if !defined(_CONTENT_PACKAGE) if (dlcPack->hasPurchasedFile(DLCManager::e_DLCType_TexturePack, "")) { printf("Added new FULL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } else { printf("Added new TRIAL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } #endif } diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 0e9f08a5d..eaeb70359 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,21 +1,20 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TitleScreen.h" #include +#include +#include #include +#include #include +#include -#include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -27,6 +26,10 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" Random* TitleScreen::random = new Random(); @@ -44,7 +47,8 @@ TitleScreen::TitleScreen() { std::string filename = "splashes.txt"; if (gameServices().hasArchiveFile(filename)) { - std::vector splashesArray = gameServices().getArchiveFile(filename); + std::vector splashesArray = + gameServices().getArchiveFile(filename); ByteArrayInputStream bais(splashesArray); InputStreamReader isr(&bais); BufferedReader br(&isr); @@ -65,18 +69,20 @@ TitleScreen::TitleScreen() { random->nextInt((int)splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - SYSTEMTIME LocalSysTime; - GetLocalTime(&LocalSysTime); - if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) { + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + const auto month = ymd.month(); + const uint32_t day = static_cast(ymd.day()); + + if (month == std::chrono::November && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) { + } else if (month == std::chrono::June && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (LocalSysTime.wMonth == 12 && - LocalSysTime.wDay == 24) // the Java game shows this on - // Christmas Eve, so we will too - { + } else if (month == std::chrono::December && day == 24) { + // the Java game shows this on Christmas Eve, so we will too splashIndex = eSplashMerryXmas; - } else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) { + } else if (month == std::chrono::January && day == 1) { splashIndex = eSplashHappyNewYear; } @@ -118,9 +124,9 @@ if (c.get(Calendar.MONTH) + 1 == 11 && c.get(Calendar.DAY_OF_MONTH) == 9) { buttons.push_back(new Button(1, width / 2 - 100, topPos, language->getElement("menu.singleplayer"))); - buttons.push_back(multiplayerButton = new Button( - 2, width / 2 - 100, topPos + spacing * 1, - language->getElement("menu.multiplayer"))); + buttons.push_back(multiplayerButton = + new Button(2, width / 2 - 100, topPos + spacing * 1, + language->getElement("menu.multiplayer"))); buttons.push_back(new Button(3, width / 2 - 100, topPos + spacing * 2, language->getElement("menu.mods"))); diff --git a/targets/minecraft/commands/AdminLogCommand.h b/targets/minecraft/commands/AdminLogCommand.h index a20713570..3a36b2e75 100644 --- a/targets/minecraft/commands/AdminLogCommand.h +++ b/targets/minecraft/commands/AdminLogCommand.h @@ -8,9 +8,10 @@ class AdminLogCommand { public: static const int LOGTYPE_DONT_SHOW_TO_SELF = 1; - virtual void logAdminCommand( - std::shared_ptr source, int type, - ChatPacket::EChatPacketMessage messageType, - const std::string& message = "", int customData = -1, - const std::string& additionalMessage = "") = 0; + virtual void logAdminCommand(std::shared_ptr source, + int type, + ChatPacket::EChatPacketMessage messageType, + const std::string& message = "", + int customData = -1, + const std::string& additionalMessage = "") = 0; }; \ No newline at end of file diff --git a/targets/minecraft/commands/Command.h b/targets/minecraft/commands/Command.h index ae308e167..b82fb83f4 100644 --- a/targets/minecraft/commands/Command.h +++ b/targets/minecraft/commands/Command.h @@ -9,9 +9,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "CommandsEnum.h" #include "minecraft/network/packet/ChatPacket.h" +#include "platform/PlatformTypes.h" class AdminLogCommand; class CommandSender; diff --git a/targets/minecraft/commands/CommandDispatcher.cpp b/targets/minecraft/commands/CommandDispatcher.cpp index 175b3dd94..cd6bd826e 100644 --- a/targets/minecraft/commands/CommandDispatcher.cpp +++ b/targets/minecraft/commands/CommandDispatcher.cpp @@ -1,13 +1,12 @@ -#include "minecraft/util/Log.h" #include "CommandDispatcher.h" #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" int CommandDispatcher::performCommand(std::shared_ptr sender, EGameCommand command, diff --git a/targets/minecraft/commands/common/EnchantItemCommand.cpp b/targets/minecraft/commands/common/EnchantItemCommand.cpp index dee0c25d3..09b7f19e3 100644 --- a/targets/minecraft/commands/common/EnchantItemCommand.cpp +++ b/targets/minecraft/commands/common/EnchantItemCommand.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -17,6 +16,7 @@ #include "minecraft/world/item/enchantment/Enchantment.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "platform/PlatformTypes.h" EGameCommand EnchantItemCommand::getId() { return eGameCommand_EnchantItem; } diff --git a/targets/minecraft/commands/common/GiveItemCommand.cpp b/targets/minecraft/commands/common/GiveItemCommand.cpp index bf3165ff2..b62f300d4 100644 --- a/targets/minecraft/commands/common/GiveItemCommand.cpp +++ b/targets/minecraft/commands/common/GiveItemCommand.cpp @@ -2,7 +2,6 @@ #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -15,6 +14,7 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/PlatformTypes.h" EGameCommand GiveItemCommand::getId() { return eGameCommand_Give; } diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index f3754bfee..7776bcfce 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" #include "ItemDispenseBehaviors.h" #include #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/AbstractProjectileDispenseBehavior.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp similarity index 76% rename from targets/app/common/Localisation/StringTable.cpp rename to targets/minecraft/locale/StringTable.cpp index 2c14c763b..e8cb41a36 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -1,31 +1,33 @@ -#include "StringTable.h" +#include "minecraft/locale/StringTable.h" +#include #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" +#include "minecraft/util/Log.h" StringTable::StringTable(void) {} // Load string table from a binary blob, filling out with the current -// localisation data only -StringTable::StringTable(std::uint8_t* pbData, unsigned int dataSize) { - src = std::vector(pbData, pbData + dataSize); - - ProcessStringTableData(); +// localisation data only. The caller passes the locale list it wants +// matched (typically obtained from the LocalizationManager) so that +// StringTable does not have to know about app-side singletons. +StringTable::StringTable(std::span data, + std::span locales) + : src(data.begin(), data.end()) { + ProcessStringTableData(locales); } -void StringTable::ReloadStringTable() { +void StringTable::ReloadStringTable(std::span locales) { m_stringsMap.clear(); m_stringsVec.clear(); - ProcessStringTableData(); + ProcessStringTableData(locales); } -void StringTable::ProcessStringTableData(void) { +void StringTable::ProcessStringTableData(std::span locales) { ByteArrayInputStream bais(src); DataInputStream dis(&bais); @@ -39,12 +41,9 @@ void StringTable::ProcessStringTableData(void) { langSizeMap.push_back( std::vector >::value_type(langId, - langSize)); + langSize)); } - std::vector locales; - app.getLocale(locales); - bool foundLang = false; int64_t bytesToSkip = 0; int dataSize = 0; @@ -56,8 +55,8 @@ void StringTable::ProcessStringTableData(void) { for (auto it = langSizeMap.begin(); it != langSizeMap.end(); ++it) { if (it->first.compare(*it_locales) == 0) { - app.DebugPrintf("StringTable:: Found language '%s'.\n", - it_locales->c_str()); + Log::info("StringTable:: Found language '%s'.\n", + it_locales->c_str()); dataSize = it->second; foundLang = true; break; @@ -67,8 +66,8 @@ void StringTable::ProcessStringTableData(void) { } if (!foundLang) - app.DebugPrintf("StringTable:: Can't find language '%s'.\n", - it_locales->c_str()); + Log::info("StringTable:: Can't find language '%s'.\n", + it_locales->c_str()); } if (foundLang) { @@ -92,8 +91,8 @@ void StringTable::ProcessStringTableData(void) { std::string langId = dis2.readUTF(); int totalStrings = dis2.readInt(); - app.DebugPrintf("IsStatic=%d totalStrings = %d\n", isStatic ? 1 : 0, - totalStrings); + Log::info("IsStatic=%d totalStrings = %d\n", isStatic ? 1 : 0, + totalStrings); if (!isStatic) { for (int i = 0; i < totalStrings; ++i) { @@ -113,7 +112,7 @@ void StringTable::ProcessStringTableData(void) { // We can't delete this data in the dtor, so clear the reference bais2.reset(); } else { - app.DebugPrintf("Failed to get language\n"); + Log::info("Failed to get language\n"); #ifdef _DEBUG assert(0); #endif diff --git a/targets/app/common/Localisation/StringTable.h b/targets/minecraft/locale/StringTable.h similarity index 82% rename from targets/app/common/Localisation/StringTable.h rename to targets/minecraft/locale/StringTable.h index 52b6ea04d..2090117c1 100644 --- a/targets/app/common/Localisation/StringTable.h +++ b/targets/minecraft/locale/StringTable.h @@ -1,11 +1,12 @@ #pragma once #include +#include #include #include #include -#define LOCALE_COUNT 11 +inline constexpr int kLocaleCount = 11; class StringTable { private: @@ -54,18 +55,17 @@ public: // }; StringTable(void); - StringTable(std::uint8_t* pbData, unsigned int dataSize); + StringTable(std::span data, + std::span locales); ~StringTable(void); - void ReloadStringTable(); + void ReloadStringTable(std::span locales); void getData(std::uint8_t** ppData, unsigned int* pSize); const char* getString(const std::string& id); const char* getString(int id); - // static const char* m_wchLocaleCode[LOCALE_COUNT]; - private: // std::string getLangId(uint32_t dwLanguage=0); - void ProcessStringTableData(void); + void ProcessStringTableData(std::span locales); }; diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index a01210c79..b8f25499c 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -1,73 +1,32 @@ -# sources that shouldn't be compiled for whatever reason -exclude_sources = [ - '! -name DurangoStats.cpp', # Durango-specific +# Source list lives in sources.txt and is regenerated by +# scripts/list_sources.py whenever files are added or removed. Reading +# the committed file means meson reconfigures only when the list itself +# changes, which is what we want. - # Incomplete/Unused - '! -name SkyIslandDimension.cpp', - '! -name MemoryChunkStorage.cpp', - '! -name MemoryLevelStorage.cpp', - '! -name MemoryLevelStorageSource.cpp', - '! -name NbtSlotFile.cpp', - '! -name ZonedChunkStorage.cpp', - '! -name ZoneFile.cpp', - '! -name ZoneIo.cpp', - '! -name LevelConflictException.cpp', - '! -name "SurvivalMode.cpp"', - '! -name "CreativeMode.cpp"', - '! -name "GameMode.cpp"', - '! -name "DemoMode.cpp"', -] - -# GET IT ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL -# TODO: make this process more portable using a python script :3 -minecraft_sources = run_command( - 'sh', '-c', - 'find "' - + meson.current_source_dir() - + '" \\( -name "*.cpp" -o -name "*.c" \\) ' - + ' '.join(exclude_sources), - check : true, -).stdout().strip().split('\n') - -occlusion_mode = get_option('occlusion_culling') -if occlusion_mode == 'off' - global_cpp_defs += ['-DOCCLUSION_MODE_NONE'] -elif occlusion_mode == 'frustum' - global_cpp_defs += ['-DOCCLUSION_MODE_FRUSTUM'] -elif occlusion_mode == 'bfs' - global_cpp_defs += ['-DOCCLUSION_MODE_BFS', '-DUSE_OCCLUSION_CULLING'] -elif occlusion_mode == 'hardware' - global_cpp_defs += ['-DOCCLUSION_MODE_HARDWARE', '-DUSE_OCCLUSION_CULLING'] -endif - -if get_option('ui_backend') == 'java' - global_cpp_defs += '-DENABLE_JAVA_GUIS' -endif +fs = import('fs') +minecraft_sources = files(fs.read('sources.txt').strip().split('\n')) lib_minecraft = static_library('minecraft', - minecraft_sources, - dependencies : [ - miniaudio_dep, # TODO: remove once a SoundEngine facade is present - render_dep, - input_dep, - profile_dep, - storage_dep, - glm_dep, - nbt_dep, - java_dep, - assets_localisation_dep, - platform_dep, - util_dep, - dependency('zlib'), - ], - include_directories : include_directories('..'), - cpp_args : global_cpp_args + global_cpp_defs, + minecraft_sources, + dependencies : [ + # dependency('libcrypto'), # for MD5 in Hasher.cpp on Linux + dependency('zlib'), + dependency('glm'), + dependency('glew'), # TODO remove + nbt_dep, + java_dep, + util_dep, + assets_localisation_dep, + platform_sound_dep, + platform_renderer_dep, + platform_input_dep, + platform_profile_dep, + platform_storage_dep, + platform_fs_dep, + platform_thread_dep, + ], + include_directories : include_directories('..'), + cpp_args : global_cpp_args + global_cpp_defs, ) -zlib_dep = dependency('zlib') -crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux - -minecraft_dep = declare_dependency( - link_with : lib_minecraft, - dependencies : [crypto_dep, zlib_dep], -) +minecraft_dep = declare_dependency(link_with : lib_minecraft) diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index e29dc6e21..463b1f3aa 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -6,21 +6,20 @@ #include #include -#include "platform/ShutdownManager.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/KeepAlivePacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/PacketListener.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/network/network.h" +#include "platform/thread/ShutdownManager.h" +#include "util/StringHelpers.h" class SocketAddress; @@ -201,10 +200,6 @@ bool Connection::writeTick() { } Packet::writePacket(packet, bufferedDos); -#if defined(__linux__) - bufferedDos->flush(); // Ensure buffered data reaches socket before any - // other writes -#endif #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging @@ -253,15 +248,6 @@ bool Connection::writeTick() { // write it to QNet as a single packet with priority flags Otherwise // just buffer the packet with other outgoing packets as the java game // did -#if defined(__linux__) - // Linux fix: For local connections, always use bufferedDos to avoid - // byte interleaving between the BufferedOutputStream buffer and direct - // sos writes. The shouldDelay/writeWithFlags path writes directly to - // sos, which can inject bytes BEFORE unflushed bufferedDos data. - Packet::writePacket(packet, bufferedDos); - bufferedDos->flush(); // Ensure data reaches socket immediately for - // delayed packets -#else if (packet->shouldDelay) { Packet::writePacket(packet, byteArrayDos); @@ -277,8 +263,6 @@ bool Connection::writeTick() { Packet::writePacket(packet, bufferedDos); } -#endif - #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging if (!socket->isLocal()) { @@ -471,8 +455,8 @@ void Connection::tick() { std::vector > packetsToHandle; { std::lock_guard lock(incoming_cs); - while (!disconnected && !g_NetworkManager.IsLeavingGame() && - g_NetworkManager.IsInSession() && !incoming.empty() && + while (!disconnected && !NetworkService.IsLeavingGame() && + NetworkService.IsInSession() && !incoming.empty() && max-- >= 0) { std::shared_ptr packet = incoming.front(); packetsToHandle.push_back(packet); diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index cdac099b3..be2106324 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -7,14 +7,12 @@ #include #include -#include "app/common/Network/Socket.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/DisconnectPacket.h" - +#include "platform/thread/C4JThread.h" class DataInputStream; class DataOutputStream; diff --git a/targets/minecraft/network/INetworkService.h b/targets/minecraft/network/INetworkService.h new file mode 100644 index 000000000..a0fb2b782 --- /dev/null +++ b/targets/minecraft/network/INetworkService.h @@ -0,0 +1,72 @@ +#pragma once + +#include +#include + +#include "platform/PlatformTypes.h" + +// Minimal interface that minecraft/ code uses to talk to the network +// subsystem. The concrete implementation lives in app/common/Network/ +// (CGameNetworkManager). Same shape as IGameServices: minecraft/ code +// calls the interface; the implementation can sit in a higher layer +// without minecraft/ needing to include its header. +// +// Method names match the existing CGameNetworkManager surface so the +// concrete class can implement the interface without rename churn. + +class INetworkPlayer; + +namespace minecraft::network { + +class INetworkService { +public: + virtual ~INetworkService() = default; + + // Player management + [[nodiscard]] virtual int GetPlayerCount() = 0; + virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0; + virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex( + int userIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId( + unsigned char smallId) = 0; + [[nodiscard]] virtual INetworkPlayer* GetHostPlayer() = 0; + + // Hosting / state + [[nodiscard]] virtual bool IsHost() = 0; + [[nodiscard]] virtual bool IsInSession() = 0; + [[nodiscard]] virtual bool IsLeavingGame() = 0; + [[nodiscard]] virtual bool IsLocalGame() = 0; + [[nodiscard]] virtual bool SessionHasSpace( + unsigned int spaceRequired = 1) = 0; + virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots, + unsigned char privateSlots) = 0; + virtual void FakeLocalPlayerJoined() = 0; + virtual void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0; + + // System flags + virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; + [[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) = 0; + + // Server lifecycle events + virtual void ServerReady() = 0; + virtual void ServerStopped() = 0; + + // Stats / debug + [[nodiscard]] virtual std::string GatherStats() = 0; + [[nodiscard]] virtual std::string GatherRTTStats() = 0; + virtual void renderQueueMeter() = 0; +}; + +namespace platform_internal { +INetworkService& NetworkService_get(); +} + +} // namespace minecraft::network + +#define NetworkService \ + (::minecraft::network::platform_internal::NetworkService_get()) diff --git a/targets/app/common/Network/Socket.cpp b/targets/minecraft/network/Socket.cpp similarity index 99% rename from targets/app/common/Network/Socket.cpp rename to targets/minecraft/network/Socket.cpp index 691e29d2e..99730677c 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/minecraft/network/Socket.cpp @@ -1,4 +1,4 @@ -#include "Socket.h" +#include "minecraft/network/Socket.h" #include @@ -6,12 +6,11 @@ #include #include -// 4jcraft TODO -#include "platform/ShutdownManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "platform/NetTypes.h" #include "minecraft/server/network/ServerConnection.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/thread/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/app/common/Network/Socket.h b/targets/minecraft/network/Socket.h similarity index 93% rename from targets/app/common/Network/Socket.h rename to targets/minecraft/network/Socket.h index e8d69ff85..db16b2716 100644 --- a/targets/app/common/Network/Socket.h +++ b/targets/minecraft/network/Socket.h @@ -2,25 +2,26 @@ #include #include #include -#include -#ifndef __linux__ -#include -#include -#endif #include #include +#include -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" +#include "platform/network/network.h" +#include "platform/thread/C4JThread.h" class INetworkPlayer; #define SOCKET_CLIENT_END 0 #define SOCKET_SERVER_END 1 +// Flag bit for Socket::SocketOutputStream::writeWithFlags. Marks +// the message as needing positive acknowledgement before the caller +// can consider it delivered. Defined here so consumers don't have to +// drag in the entire CGameNetworkManager header just for this constant. +inline constexpr int NON_QNET_SENDDATA_ACK_REQUIRED = 1; + class SocketAddress; class ServerConnection; diff --git a/targets/minecraft/network/packet/AddPlayerPacket.h b/targets/minecraft/network/packet/AddPlayerPacket.h index 240ee5737..90cbd7c85 100644 --- a/targets/minecraft/network/packet/AddPlayerPacket.h +++ b/targets/minecraft/network/packet/AddPlayerPacket.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/world/entity/SyncedEntityData.h" +#include "platform/PlatformTypes.h" class Player; diff --git a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp index 035cfdb9a..52c625178 100644 --- a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp +++ b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp @@ -1,17 +1,16 @@ -#include "minecraft/util/Log.h" #include "BlockRegionUpdatePacket.h" #include #include -#include "app/linux/LinuxGame.h" #include "PacketListener.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.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/storage/ConsoleSaveFileIO/compression.h" #define BLOCK_REGION_UPDATE_FULLCHUNK 0x01 #define BLOCK_REGION_UPDATE_ZEROHEIGHT \ @@ -119,8 +118,7 @@ void BlockRegionUpdatePacket::read(DataInputStream* dis) // throws IOException Compression::getCompression()->DecompressLZXRLE( buffer.data(), &outputSize, compressedBuffer.data(), size); } else { - Log::info( - "Not decompressing packet that wasn't fully read\n"); + Log::info("Not decompressing packet that wasn't fully read\n"); } // printf("Block (%d %d %d), (%d %d %d) coming in decomp from %d to diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 9baf33da4..563677e9e 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -1,13 +1,11 @@ -#include "minecraft/util/Log.h" #include "CustomPayloadPacket.h" #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" // Mojang-defined custom packets const std::string CustomPayloadPacket::CUSTOM_BOOK_PACKET = "MC|BEdit"; diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 2410169f7..bbb5a52e8 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -1,14 +1,12 @@ -#include "minecraft/util/Log.h" #include "GameCommandPacket.h" #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" GameCommandPacket::GameCommandPacket() { length = 0; } diff --git a/targets/minecraft/network/packet/LoginPacket.cpp b/targets/minecraft/network/packet/LoginPacket.cpp index cd180e13d..a4063e984 100644 --- a/targets/minecraft/network/packet/LoginPacket.cpp +++ b/targets/minecraft/network/packet/LoginPacket.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "LoginPacket.h" -#include "app/linux/LinuxGame.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/LoginPacket.h b/targets/minecraft/network/packet/LoginPacket.h index facc61ae7..a8938a4b3 100644 --- a/targets/minecraft/network/packet/LoginPacket.h +++ b/targets/minecraft/network/packet/LoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class LevelType; diff --git a/targets/minecraft/network/packet/MoveEntityPacket.cpp b/targets/minecraft/network/packet/MoveEntityPacket.cpp index 1f3bdadd4..91525d759 100644 --- a/targets/minecraft/network/packet/MoveEntityPacket.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacket.cpp @@ -2,7 +2,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp index 97410a0fe..3677770a1 100644 --- a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp @@ -2,7 +2,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 9a1946392..3ef25ece0 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Packet.h" #include @@ -13,8 +12,6 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Exceptions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -106,6 +103,7 @@ #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/UseItemPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "nbt/NbtIo.h" @@ -578,8 +576,8 @@ void Packet::writeUtf(const std::string& value, } std::string Packet::readUtf(DataInputStream* dis, - int maxLength) // throws IOException TODO 4J JEV, - // should this declare a throws? + int maxLength) // throws IOException TODO 4J JEV, + // should this declare a throws? { short stringLength = dis->readShort(); if (stringLength > maxLength) { diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index 7ea79b2a3..d98f09392 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,13 +1,11 @@ -#include "app/common/Network/NetworkPlayerInterface.h" +#include "PlayerInfoPacket.h" + #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#ifndef __linux__ -#include -#endif // __linux__ -#include "PlayerInfoPacket.h" +#include "platform/network/network.h" PlayerInfoPacket::PlayerInfoPacket() { m_networkSmallId = 0; diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 4d4de72b9..83a4d44d6 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -1,16 +1,14 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PreLoginPacket.h" #include #include -#include "app/common/BuildVer/BuildVer.h" -#include "platform/IPlatformNetwork.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/BuildVer.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" PreLoginPacket::PreLoginPacket() { loginKey = ""; diff --git a/targets/minecraft/network/packet/PreLoginPacket.h b/targets/minecraft/network/packet/PreLoginPacket.h index 14d47bb5e..35f5161a4 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.h +++ b/targets/minecraft/network/packet/PreLoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class PreLoginPacket : public Packet, public std::enable_shared_from_this { diff --git a/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp b/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp index 54a648628..50a4c2a07 100644 --- a/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp +++ b/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp @@ -38,6 +38,6 @@ int RemoveEntitiesPacket::getEstimatedSize() { return 1 + (ids.size() * 4); } 4J: These are necesary on the PS3. (and 4). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int RemoveEntitiesPacket::MAX_PER_PACKET; #endif diff --git a/targets/minecraft/network/packet/RespawnPacket.cpp b/targets/minecraft/network/packet/RespawnPacket.cpp index 01a0eeb68..54e1e731d 100644 --- a/targets/minecraft/network/packet/RespawnPacket.cpp +++ b/targets/minecraft/network/packet/RespawnPacket.cpp @@ -1,12 +1,11 @@ -#include "minecraft/util/Log.h" #include "RespawnPacket.h" #include -#include "app/linux/LinuxGame.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp index 80bc466de..bedb6c72a 100644 --- a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp +++ b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "ServerSettingsChangedPacket.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" const int ServerSettingsChangedPacket::HOST_DIFFICULTY = 0; const int ServerSettingsChangedPacket::HOST_OPTIONS = 1; diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 246ae4e95..ba2a003da 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -1,13 +1,11 @@ -#include "minecraft/util/Log.h" #include "SetPlayerTeamPacket.h" #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/scores/Objective.h" #include "minecraft/world/scores/PlayerTeam.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp index 65066922f..1f91ecde2 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp @@ -2,10 +2,10 @@ #include -#include "app/common/Minecraft_Macros.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/world/entity/Entity.h" TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() { diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 40cb83761..2f03ec0f7 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -3,11 +3,11 @@ #include #include -#include "app/common/Minecraft_Macros.h" -#include "app/common/DLC/DLCSkinFile.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" +#include "minecraft/client/skins/ISkinAssetData.h" TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = ""; @@ -51,7 +51,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( TextureAndGeometryPacket::TextureAndGeometryPacket( const std::string& textureName, std::uint8_t* pbData, - std::uint32_t dataBytes, DLCSkinFile* pDLCSkinFile) { + std::uint32_t dataBytes, ISkinAssetData* pSkinAssetData) { this->textureName = textureName; std::string skinValue = textureName.substr(7, textureName.size()); @@ -63,11 +63,12 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( this->pbData = pbData; this->dwTextureBytes = dataBytes; - this->uiAnimOverrideBitmask = pDLCSkinFile->getAnimOverrideBitmask(); - this->dwBoxC = pDLCSkinFile->getAdditionalBoxesCount(); + this->uiAnimOverrideBitmask = pSkinAssetData->getAnimOverrideBitmask(); + this->dwBoxC = pSkinAssetData->getAdditionalBoxesCount(); if (this->dwBoxC != 0) { this->BoxDataA = new SKIN_BOX[this->dwBoxC]; - std::vector* pSkinBoxes = pDLCSkinFile->getAdditionalBoxes(); + std::vector* pSkinBoxes = + pSkinAssetData->getAdditionalBoxes(); int iCount = 0; for (auto it = pSkinBoxes->begin(); it != pSkinBoxes->end(); ++it) { diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 9f8735587..d8e49fd16 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -5,12 +5,12 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Packet.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/network/packet/Packet.h" -class DLCSkinFile; +class ISkinAssetData; class TextureAndGeometryPacket : public Packet, @@ -30,7 +30,7 @@ public: std::uint8_t* pbData, std::uint32_t dataBytes); TextureAndGeometryPacket(const std::string& textureName, std::uint8_t* pbData, std::uint32_t dataBytes, - DLCSkinFile* pDLCSkinFile); + ISkinAssetData* pSkinAssetData); TextureAndGeometryPacket(const std::string& textureName, std::uint8_t* pbData, std::uint32_t dataBytes, std::vector* pvSkinBoxes, diff --git a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h index ce015a45e..971e7bdf5 100644 --- a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h +++ b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h @@ -6,9 +6,9 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class UpdateGameRuleProgressPacket : public Packet, diff --git a/targets/minecraft/server/ConsoleInput.cpp b/targets/minecraft/server/ConsoleInput.cpp index b638904df..970ed5405 100644 --- a/targets/minecraft/server/ConsoleInput.cpp +++ b/targets/minecraft/server/ConsoleInput.cpp @@ -2,8 +2,7 @@ class ConsoleInputSource; -ConsoleInput::ConsoleInput(const std::string& msg, - ConsoleInputSource* source) { +ConsoleInput::ConsoleInput(const std::string& msg, ConsoleInputSource* source) { this->msg = msg; this->source = source; } \ No newline at end of file diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index d1f984d39..73ce35362 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MinecraftServer.h" #include @@ -12,29 +10,22 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "PlayerList.h" #include "Settings.h" -#include "util/Timer.h" #include "java/Class.h" #include "java/File.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Options.h" #include "minecraft/commands/Command.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/network/packet/SetTimePacket.h" @@ -44,12 +35,15 @@ #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -62,20 +56,20 @@ #include "minecraft/world/level/storage/McRegionLevelStorage.h" #include "minecraft/world/level/storage/McRegionLevelStorageSource.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/PlatformTypes.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" +#include "util/Timer.h" #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "platform/input/input.h" -#include "platform/ShutdownManager.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/Network/Socket.h" -#include "app/common/UI/All Platforms/UIStructs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/network/Socket.h" #include "minecraft/server/commands/ServerCommandDispatcher.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/world/level/Level.h" @@ -83,7 +77,11 @@ #include "minecraft/world/level/chunk/CompressedTileStorage.h" #include "minecraft/world/level/chunk/SparseDataStorage.h" #include "minecraft/world/level/chunk/SparseLightStorage.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "platform/thread/ShutdownManager.h" class ConsoleInputSource; @@ -152,22 +150,26 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, Log::info("\n*** SERVER SETTINGS ***\n"); Log::info( "ServerSettings: host-friends-only is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" - : "off"); + (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) + ? "on" + : "off"); Log::info("ServerSettings: game-type is %s\n", - (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) - ? "Survival Mode" - : "Creative Mode"); + (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) + ? "Survival Mode" + : "Creative Mode"); + Log::info("ServerSettings: pvp is %s\n", + (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) + ? "on" + : "off"); Log::info( - "ServerSettings: pvp is %s\n", - (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); - Log::info("ServerSettings: fire spreads is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) - ? "on" - : "off"); - Log::info( - "ServerSettings: tnt explodes is %s\n", - (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off"); + "ServerSettings: fire spreads is %s\n", + (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) + ? "on" + : "off"); + Log::info("ServerSettings: tnt explodes is %s\n", + (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) + ? "on" + : "off"); Log::info("\n"); // TODO 4J Stu - Init a load of settings based on data passed as params @@ -262,7 +264,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, initData->saveData->fileSize = 0; } - g_NetworkManager.ServerReady(); // 4J added + NetworkService.ServerReady(); // 4J added return m_bLoaded; } @@ -385,7 +387,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, LevelSettings* levelSettings = new LevelSettings( levelSeed, gameType, - gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false, + gameServices().getGameHostOption(eGameHostOption_Structures) > 0 + ? true + : false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale); if (gameServices().getGameHostOption(eGameHostOption_BonusChest)) levelSettings->enableStartingBonusItems(); @@ -420,7 +424,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // We are loading a save from the storage manager #if defined(SPLIT_SAVES) bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && levelGen->requiresBaseSave()) { unsigned int fileSize = 0; std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -447,7 +452,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // McRegionLevelStorage *storage = new McRegionLevelStorage(File("."), // name, true); // TODO for (unsigned int i = 0; i < levels.size(); i++) { - if (s_bServerHalted || !g_NetworkManager.IsInSession()) { + if (s_bServerHalted || !NetworkService.IsInSession()) { return false; } @@ -486,7 +491,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, levels[i]->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; Log::info("MinecraftServer::loadLevel - Difficulty = %d\n", - levels[i]->difficulty); + levels[i]->difficulty); #if DEBUG_SERVER_DONT_SPAWN_MOBS levels[i]->setSpawnSettings(false, false); @@ -515,9 +520,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative()); gameServices().setGameHostOption(eGameHostOption_Structures, - levels[0]->isGenerateMapFeatures()); + levels[0]->isGenerateMapFeatures()); - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; // 4J - Make a new thread to do post processing @@ -560,10 +565,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int64_t lastTime = System::currentTimeMillis(); #if defined(_LARGE_WORLDS) - if (gameServices().getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { - if (!gameServices().getGameNewWorldSizeUseMoat()) // check the moat settings to - // see if we should be - // overwriting the edge tiles + if (gameServices().getGameNewWorldSize() > + levels[0]->getLevelData()->getXZSizeOld()) { + if (!gameServices() + .getGameNewWorldSizeUseMoat()) // check the moat settings to + // see if we should be + // overwriting the edge tiles { overwriteBordersForNewWorldSize(levels[0]); } @@ -591,7 +598,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int total = twoRPlusOne * twoRPlusOne; for (int x = -r; x <= r && running; x += 16) { for (int z = -r; z <= r && running; z += 16) { - if (s_bServerHalted || !g_NetworkManager.IsInSession()) { + if (s_bServerHalted || !NetworkService.IsInSession()) { delete spawnPos; m_postUpdateTerminate = true; postProcessTerminate(mcprogress); @@ -652,14 +659,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (!levels[0]->getLevelData()->getHasStronghold()) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { levels[0]->getLevelData()->setXStronghold(x); levels[0]->getLevelData()->setZStronghold(z); levels[0]->getLevelData()->setHasStronghold(); - Log::info( - "=== FOUND stronghold in terrain features list\n"); + Log::info("=== FOUND stronghold in terrain features list\n"); } else { // can't find the stronghold position in the terrain feature @@ -679,19 +685,19 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // printf("Lighting complete at %dms\n",System::currentTimeMillis() - // startTime); - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[1]->isNew) { levels[1]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[2]->isNew) { levels[2]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; // 4J - added - immediately save newly created level, like single player // game 4J Stu - We also want to immediately save the tutorial @@ -701,13 +707,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, levels[0]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[0]->isNew || levels[1]->isNew || levels[2]->isNew) { levels[0]->saveToDisc(mcprogress, false); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; /* * int r = 24; for (int x = -r; x <= r; x++) { @@ -881,7 +887,7 @@ void MinecraftServer::Suspend() { m_suspending = false; Log::info("Suspend server: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); } bool MinecraftServer::IsSuspending() { return m_suspending; } @@ -961,7 +967,7 @@ void MinecraftServer::stopServer(bool didInit) { delete settings; settings = nullptr; - g_NetworkManager.ServerStopped(); + NetworkService.ServerStopped(); } void MinecraftServer::halt() { running = false; } @@ -1079,8 +1085,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (pLevelData && pLevelData->getHasStronghold() == false) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { pLevelData->setXStronghold(x); pLevelData->setZStronghold(z); pLevelData->setHasStronghold(); @@ -1178,201 +1184,9 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { } } - // Process delayed actions - eXuiServerAction eAction; - void* param; - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - eAction = gameServices().getXuiServerAction(i); - param = gameServices().getXuiServerActionParam(i); - - switch (eAction) { - case eXuiServerAction_AutoSaveGame: - case eXuiServerAction_SaveGame: - gameServices().lockSaveNotification(); - if (players != nullptr) { - players->saveAll( - Minecraft::GetInstance()->progressRenderer); - } - - players->broadcastAll( - std::shared_ptr( - new UpdateProgressPacket(20))); - - for (unsigned int j = 0; j < levels.size(); j++) { - if (s_bServerHalted) break; - // 4J Stu - Save the levels in reverse order so we - // don't overwrite the level.dat with the data from - // the nethers leveldata. Fix for #7418 - - // Functional: Gameplay: Saving after sleeping in a - // bed will place player at nighttime when - // restarting. - ServerLevel* level = levels[levels.size() - 1 - j]; - level->save( - true, - Minecraft::GetInstance()->progressRenderer, - (eAction == eXuiServerAction_AutoSaveGame)); - - players->broadcastAll( - std::shared_ptr( - new UpdateProgressPacket(33 + (j * 33)))); - } - if (!s_bServerHalted) { - saveGameRules(); - - levels[0]->saveToDisc( - Minecraft::GetInstance()->progressRenderer, - (eAction == eXuiServerAction_AutoSaveGame)); - } - gameServices().unlockSaveNotification(); - break; - case eXuiServerAction_DropItem: - // Find the player, and drop the id at their feet - { - std::shared_ptr player = - players->players.at(0); - size_t id = (size_t)param; - player->drop(std::shared_ptr( - new ItemInstance(id, 1, 0))); - } - break; - case eXuiServerAction_SpawnMob: { - std::shared_ptr player = - players->players.at(0); - eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); - std::shared_ptr mob = - std::dynamic_pointer_cast( - EntityIO::newByEnumType(factory, - player->level)); - mob->moveTo(player->x + 1, player->y, player->z + 1, - player->level->random->nextFloat() * 360, - 0); - mob->setDespawnProtected(); // 4J added, default to - // being protected against - // despawning (has to be - // done after initial - // position is set) - player->level->addEntity(mob); - } break; - case eXuiServerAction_PauseServer: - m_isServerPaused = ((size_t)param == true); - if (m_isServerPaused) { - m_serverPausedEvent->set(); - } - break; - case eXuiServerAction_ToggleRain: { - bool isRaining = levels[0]->getLevelData()->isRaining(); - levels[0]->getLevelData()->setRaining(!isRaining); - levels[0]->getLevelData()->setRainTime( - levels[0]->random->nextInt(Level::TICKS_PER_DAY * - 7) + - Level::TICKS_PER_DAY / 2); - } break; - case eXuiServerAction_ToggleThunder: { - bool isThundering = - levels[0]->getLevelData()->isThundering(); - levels[0]->getLevelData()->setThundering(!isThundering); - levels[0]->getLevelData()->setThunderTime( - levels[0]->random->nextInt(Level::TICKS_PER_DAY * - 7) + - Level::TICKS_PER_DAY / 2); - } break; - case eXuiServerAction_ServerSettingChanged_Gamertags: - players->broadcastAll( - std::shared_ptr( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket::HOST_OPTIONS, - gameServices().getGameHostOption( - eGameHostOption_Gamertags)))); - break; - case eXuiServerAction_ServerSettingChanged_BedrockFog: - players->broadcastAll( - std::shared_ptr( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket:: - HOST_IN_GAME_SETTINGS, - gameServices().getGameHostOption( - eGameHostOption_All)))); - break; - - case eXuiServerAction_ServerSettingChanged_Difficulty: - players->broadcastAll(std::shared_ptr< - ServerSettingsChangedPacket>( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket::HOST_DIFFICULTY, - Minecraft::GetInstance() - ->options->difficulty))); - break; - case eXuiServerAction_ExportSchematic: -#if !defined(_CONTENT_PACKAGE) - gameServices().lockSaveNotification(); - - // players->broadcastAll( - // shared_ptr( new - // UpdateProgressPacket(20) ) ); - - if (!s_bServerHalted) { - ConsoleSchematicFile::XboxSchematicInitParam* - initData = (ConsoleSchematicFile:: - XboxSchematicInitParam*)param; - File targetFileDir("Schematics"); - if (!targetFileDir.exists()) targetFileDir.mkdir(); - - char filename[128]; - snprintf(filename, 128, "%s%dx%dx%d.sch", - initData->name, - (initData->endX - initData->startX + 1), - (initData->endY - initData->startY + 1), - (initData->endZ - initData->startZ + 1)); - - File dataFile = - File(targetFileDir, std::string(filename)); - if (dataFile.exists()) dataFile._delete(); - FileOutputStream fos = FileOutputStream(dataFile); - DataOutputStream dos = DataOutputStream(&fos); - ConsoleSchematicFile::generateSchematicFile( - &dos, levels[0], initData->startX, - initData->startY, initData->startZ, - initData->endX, initData->endY, initData->endZ, - initData->bSaveMobs, initData->compressionType); - dos.close(); - - delete initData; - } - gameServices().unlockSaveNotification(); -#endif - break; - case eXuiServerAction_SetCameraLocation: -#if !defined(_CONTENT_PACKAGE) - { - DebugSetCameraPosition* pos = - (DebugSetCameraPosition*)param; - - Log::info("DEBUG: Player=%i\n", pos->player); - Log::info( - "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), " - "looking at=(%f.2,%f.2)\n", - pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, - pos->m_elev); - - std::shared_ptr player = - players->players.at(pos->player); - player->debug_setPosition(pos->m_camX, pos->m_camY, - pos->m_camZ, pos->m_yRot, - pos->m_elev); - - // Doesn't work - // player->setYHeadRot(pos->m_yRot); - // player->absMoveTo(pos->m_camX, pos->m_camY, - // pos->m_camZ, pos->m_yRot, pos->m_elev); - } -#endif - break; - default: - break; - } - - gameServices().setXuiServerAction(i, eXuiServerAction_Idle); - } + // Drain typed action queue (queued by app/server consumers + // via MinecraftServer::queueServerAction). + drainServerActions(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } @@ -1604,11 +1418,11 @@ void MinecraftServer::chunkPacketManagement_PreTick() { s_tickStartTime = System::currentTimeMillis(); s_sentTo.clear(); - std::vector >* players = + std::vector>* players = connection->getPlayers(); if (players->size()) { - std::vector > playersOrig = *players; + std::vector> playersOrig = *players; players->clear(); do { @@ -1641,7 +1455,8 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { auto now = time_util::clock::now(); if (player->GetSessionIndex() == s_slowQueuePlayerIndex && - (now - s_slowQueueLastTime) > std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { + (now - s_slowQueueLastTime) > + std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { // Log::info("Slow queue OK for player #%d\n", // player->GetSessionIndex()); return true; @@ -1660,8 +1475,9 @@ void MinecraftServer::chunkPacketManagement_PostTick() { // 4J Ensure that the slow queue owner keeps cycling if it's not been used // in a while auto now = time_util::clock::now(); - if ((s_slowQueuePacketSent) || ((now - s_slowQueueLastTime) > - std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { + if ((s_slowQueuePacketSent) || + ((now - s_slowQueueLastTime) > + std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { // Log::info("Considering cycling: (%d) %d - %d -> %d //> %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - // s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); @@ -1678,13 +1494,13 @@ void MinecraftServer::chunkPacketManagement_PostTick() { } void MinecraftServer::cycleSlowQueueIndex() { - if (!g_NetworkManager.IsInSession()) return; + if (!NetworkService.IsInSession()) return; int startingIndex = s_slowQueuePlayerIndex; INetworkPlayer* currentPlayer = nullptr; int currentPlayerCount = 0; do { - currentPlayerCount = g_NetworkManager.GetPlayerCount(); + currentPlayerCount = NetworkService.GetPlayerCount(); if (startingIndex >= currentPlayerCount) startingIndex = 0; ++s_slowQueuePlayerIndex; @@ -1695,11 +1511,11 @@ void MinecraftServer::cycleSlowQueueIndex() { // join. The QNet session might be ending while we do this, so do a // few more checks that the player is real currentPlayer = - g_NetworkManager.GetPlayerByIndex(s_slowQueuePlayerIndex); + NetworkService.GetPlayerByIndex(s_slowQueuePlayerIndex); } else { s_slowQueuePlayerIndex = 0; } - } while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 && + } while (NetworkService.IsInSession() && currentPlayerCount > 0 && s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr && currentPlayer->IsLocal()); // Log::info("Cycled slow queue index to %d\n", @@ -1722,3 +1538,173 @@ bool MinecraftServer::flagEntitiesToBeRemoved(unsigned int* flags) { } return removedFound; } + +void MinecraftServer::queueServerAction( + minecraft::server::ServerAction action) { + std::lock_guard lock(m_actionQueueMutex); + m_actionQueue.push_back(std::move(action)); +} + +void MinecraftServer::drainServerActions() { + std::vector queue; + { + std::lock_guard lock(m_actionQueueMutex); + if (m_actionQueue.empty()) return; + queue.swap(m_actionQueue); + } + for (auto& action : queue) { + std::visit([this](auto& a) { handleServerAction(a); }, action); + } +} + +void MinecraftServer::handleServerAction(const minecraft::server::SaveGame& a) { + gameServices().lockSaveNotification(); + if (players != nullptr) { + players->saveAll(Minecraft::GetInstance()->progressRenderer); + } + + players->broadcastAll( + std::shared_ptr(new UpdateProgressPacket(20))); + + for (unsigned int j = 0; j < levels.size(); j++) { + if (s_bServerHalted) break; + // 4J Stu - Save the levels in reverse order so we don't overwrite + // the level.dat with the data from the nethers leveldata. Fix for + // #7418 - Functional: Gameplay: Saving after sleeping in a bed will + // place player at nighttime when restarting. + ServerLevel* level = levels[levels.size() - 1 - j]; + level->save(true, Minecraft::GetInstance()->progressRenderer, + a.autoSave); + + players->broadcastAll(std::shared_ptr( + new UpdateProgressPacket(33 + (j * 33)))); + } + if (!s_bServerHalted) { + saveGameRules(); + levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, + a.autoSave); + } + gameServices().unlockSaveNotification(); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::DropDebugItem& a) { + if (players == nullptr || players->players.empty()) return; + std::shared_ptr player = players->players.at(a.playerIndex); + player->drop( + std::shared_ptr(new ItemInstance(a.itemId, 1, 0))); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::SpawnDebugMob& a) { + if (players == nullptr || players->players.empty()) return; + std::shared_ptr player = players->players.at(a.playerIndex); + auto factory = static_cast(a.mobFactoryId); + std::shared_ptr mob = std::dynamic_pointer_cast( + EntityIO::newByEnumType(factory, player->level)); + if (mob == nullptr) return; + mob->moveTo(player->x + 1, player->y, player->z + 1, + player->level->random->nextFloat() * 360, 0); + mob->setDespawnProtected(); // 4J added, default to being protected against + // despawning (has to be done after initial + // position is set) + player->level->addEntity(mob); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::PauseServer& a) { + m_isServerPaused = a.paused; + if (m_isServerPaused) { + m_serverPausedEvent->set(); + } +} + +void MinecraftServer::handleServerAction(const minecraft::server::ToggleRain&) { + bool isRaining = levels[0]->getLevelData()->isRaining(); + levels[0]->getLevelData()->setRaining(!isRaining); + levels[0]->getLevelData()->setRainTime( + levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + + Level::TICKS_PER_DAY / 2); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::ToggleThunder&) { + bool isThundering = levels[0]->getLevelData()->isThundering(); + levels[0]->getLevelData()->setThundering(!isThundering); + levels[0]->getLevelData()->setThunderTime( + levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + + Level::TICKS_PER_DAY / 2); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::BroadcastSettingChanged& a) { + using Kind = minecraft::server::BroadcastSettingChanged::Kind; + switch (a.kind) { + case Kind::Gamertags: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_OPTIONS, + gameServices().getGameHostOption( + eGameHostOption_Gamertags)))); + break; + case Kind::BedrockFog: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, + gameServices().getGameHostOption(eGameHostOption_All)))); + break; + case Kind::Difficulty: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_DIFFICULTY, + Minecraft::GetInstance()->options->difficulty))); + break; + } +} + +void MinecraftServer::handleServerAction( + const minecraft::server::ExportSchematic& a) { +#if !defined(_CONTENT_PACKAGE) + gameServices().lockSaveNotification(); + if (!s_bServerHalted) { + File targetFileDir("Schematics"); + if (!targetFileDir.exists()) targetFileDir.mkdir(); + + char filename[128]; + snprintf(filename, 128, "%s%dx%dx%d.sch", a.name, + (a.endX - a.startX + 1), (a.endY - a.startY + 1), + (a.endZ - a.startZ + 1)); + + File dataFile = File(targetFileDir, std::string(filename)); + if (dataFile.exists()) dataFile._delete(); + FileOutputStream fos = FileOutputStream(dataFile); + DataOutputStream dos = DataOutputStream(&fos); + ConsoleSchematicFile::generateSchematicFile( + &dos, levels[0], a.startX, a.startY, a.startZ, a.endX, a.endY, + a.endZ, a.saveMobs, a.compressionType); + dos.close(); + } + gameServices().unlockSaveNotification(); +#else + (void)a; +#endif +} + +void MinecraftServer::handleServerAction( + const minecraft::server::SetCameraLocation& a) { +#if !defined(_CONTENT_PACKAGE) + Log::info("DEBUG: Player=%i\n", a.playerIndex); + Log::info( + "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking " + "at=(%f.2,%f.2)\n", + a.x, a.y, a.z, a.yRot, a.elev); + + if (players == nullptr || + a.playerIndex >= static_cast(players->players.size())) + return; + std::shared_ptr player = players->players.at(a.playerIndex); + player->debug_setPosition(a.x, a.y, a.z, a.yRot, a.elev); +#else + (void)a; +#endif +} diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index de67ec84e..659865b6e 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -7,11 +7,12 @@ #include #include "ConsoleInputSource.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" +#include "ServerAction.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/thread/C4JThread.h" +#include "util/Timer.h" class ServerConnection; class Settings; @@ -204,8 +205,7 @@ private: void tick(); public: - void handleConsoleInput(const std::string& msg, - ConsoleInputSource* source); + void handleConsoleInput(const std::string& msg, ConsoleInputSource* source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed static void main(int64_t seed, void* lpParameter); @@ -301,6 +301,25 @@ private: bool IsServerPaused() { return m_isServerPaused; } private: + // Drain the action queue and dispatch each one. Called from the + // server tick loop. The drain takes the mutex briefly to swap the + // queue out, then dispatches without holding the lock. + void drainServerActions(); + + void handleServerAction(const minecraft::server::SaveGame& a); + void handleServerAction(const minecraft::server::DropDebugItem& a); + void handleServerAction(const minecraft::server::SpawnDebugMob& a); + void handleServerAction(const minecraft::server::PauseServer& a); + void handleServerAction(const minecraft::server::ToggleRain& a); + void handleServerAction(const minecraft::server::ToggleThunder& a); + void handleServerAction( + const minecraft::server::BroadcastSettingChanged& a); + void handleServerAction(const minecraft::server::ExportSchematic& a); + void handleServerAction(const minecraft::server::SetCameraLocation& a); + + std::mutex m_actionQueueMutex; + std::vector m_actionQueue; + // 4J Added bool m_saveOnExit; bool m_suspending; @@ -315,6 +334,11 @@ public: void chunkPacketManagement_PreTick(); void chunkPacketManagement_PostTick(); + // Queue a typed action for the server to handle on its next tick. + // Safe to call from any thread; the queue is mutex-protected and + // drained from the server tick loop. + void queueServerAction(minecraft::server::ServerAction action); + void setSaveOnExit(bool save) { m_saveOnExit = save; s_bSaveOnExitAnswered = true; diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index a177ad9fc..717f9f318 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PlayerList.h" #include @@ -10,28 +8,18 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" #include "MinecraftServer.h" #include "Settings.h" -#include "minecraft/world/entity/player/SkinTypes.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "java/Class.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/GameEventPacket.h" @@ -56,6 +44,7 @@ #include "minecraft/server/network/PendingConnection.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -63,10 +52,13 @@ #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/PortalForcer.h" @@ -75,7 +67,11 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/storage/LevelStorage.h" #include "minecraft/world/level/storage/PlayerIO.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "nbt/CompoundTag.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" #include "strings.h" class MobEffectInstance; @@ -208,9 +204,11 @@ void PlayerList::placeNewPlayer(Connection* connection, 0))); } } else if (!player->customTextureUrl.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, + 0); } if (!player->customTextureUrl2.empty() && @@ -228,9 +226,11 @@ void PlayerList::placeNewPlayer(Connection* connection, new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl2)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, + 0); } player->setIsGuest(packet->m_isGuest); @@ -419,7 +419,7 @@ void PlayerList::validatePlayerSpawnPosition( // correct Make sure that the player is on the ground, and in the centre x/z // of the current column Log::info("Original pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + player->y, player->z, player->dimension); bool spawnForced = player->isRespawnForced(); @@ -439,15 +439,15 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(targetX, targetY, targetZ); - Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); ServerLevel* level = server->getLevel(player->dimension); while (level->getCubes(player, &player->bb)->size() != 0) { player->setPos(player->x, player->y + 1, player->z); } - Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); // 4J Stu - If we are in the nether and the above while loop has put us // above the nether then we have a problem Finding a valid, safe spawn point @@ -487,8 +487,8 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(player->x, player->y + 1, player->z); } - Log::info("Updated pos is %f, %f, %f in dimension %d\n", - player->x, player->y, player->z, player->dimension); + Log::info("Updated pos is %f, %f, %f in dimension %d\n", player->x, + player->y, player->z, player->dimension); } } @@ -917,7 +917,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, player->gameMode->setLevel(newLevel); // Resend the teleport if we haven't yet sent the chunk they will land on - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), ServerPlayer::getFlagIndexForChunk( ChunkPos(player->xChunk, player->zChunk), @@ -1071,7 +1071,7 @@ void PlayerList::tick() { std::uint8_t smallId = m_smallIdsToKick.front(); m_smallIdsToKick.pop_front(); INetworkPlayer* selectedPlayer = - g_NetworkManager.GetPlayerBySmallId(smallId); + NetworkService.GetPlayerBySmallId(smallId); if (selectedPlayer != nullptr) { if (selectedPlayer->IsLocal() != true) { // #if 0 @@ -1167,7 +1167,8 @@ bool PlayerList::isWhiteListed(const std::string& name) { return true; } bool PlayerList::isOp(const std::string& name) { return false; } bool PlayerList::isOp(std::shared_ptr player) { - bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); + bool cheatsEnabled = + gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); #if defined(_DEBUG_MENUS_ENABLED) cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug(); #endif @@ -1233,8 +1234,7 @@ std::vector* PlayerList::getPlayers( Pos* position, int rangeMin, int rangeMax, int count, int mode, int levelMin, int levelMax, std::unordered_map* scoreRequirements, - const std::string& playerName, const std::string& teamName, - Level* level) { + const std::string& playerName, const std::string& teamName, Level* level) { Log::info("getPlayers NOT IMPLEMENTED!"); return nullptr; @@ -1525,7 +1525,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, #if !defined(_CONTENT_PACKAGE) Log::info("Requesting remove player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + player->name.c_str(), dimIndex); #endif bool playerRemoved = false; @@ -1533,9 +1533,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) - Log::info( - "Remove: Removing player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + Log::info("Remove: Removing player %s as primary in dimension %d\n", + player->name.c_str(), dimIndex); #endif receiveAllPlayers[dimIndex].erase(it); playerRemoved = true; @@ -1617,7 +1616,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { #if !defined(_CONTENT_PACKAGE) Log::info("Requesting add player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif bool shouldAddPlayer = true; @@ -1648,7 +1647,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { if (shouldAddPlayer) { #if !defined(_CONTENT_PACKAGE) Log::info("Add: Adding player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif receiveAllPlayers[playerDim].push_back(player); } diff --git a/targets/minecraft/server/PlayerList.h b/targets/minecraft/server/PlayerList.h index 401c89ba1..3493c4087 100644 --- a/targets/minecraft/server/PlayerList.h +++ b/targets/minecraft/server/PlayerList.h @@ -8,8 +8,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ServerPlayer; class PlayerChunkMap; diff --git a/targets/minecraft/server/ServerAction.h b/targets/minecraft/server/ServerAction.h new file mode 100644 index 000000000..a1501a27a --- /dev/null +++ b/targets/minecraft/server/ServerAction.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include + +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" + +// Typed actions queued onto MinecraftServer from outside the server +// thread (UI, network, save manager). Each variant alternative is a +// plain data struct describing the requested operation; the server +// drains the queue in its tick loop and dispatches via std::visit. +// +// This replaces the old eXuiServerAction enum + per-pad polling + +// XuiActionPayload variant. The previous design forced the server to +// poll IGameServices every tick and pull a UI-shaped payload through a +// polymorphic base; now the server owns its own queue and the action +// types live alongside the consumer. + +namespace minecraft::server { + +struct SaveGame { + bool autoSave = false; +}; + +struct DropDebugItem { + int playerIndex = 0; + int itemId = 0; +}; + +struct SpawnDebugMob { + int playerIndex = 0; + int mobFactoryId = 0; +}; + +struct PauseServer { + bool paused = false; +}; + +struct ToggleRain {}; +struct ToggleThunder {}; + +struct BroadcastSettingChanged { + enum class Kind { + Gamertags, + BedrockFog, + Difficulty, + }; + Kind kind = Kind::Gamertags; +}; + +struct ExportSchematic { + char name[64] = {}; + int startX = 0; + int startY = 0; + int startZ = 0; + int endX = 0; + int endY = 0; + int endZ = 0; + bool saveMobs = false; + Compression::ECompressionTypes compressionType = + Compression::eCompressionType_None; +}; + +struct SetCameraLocation { + int playerIndex = 0; + double x = 0.0; + double y = 0.0; + double z = 0.0; + double yRot = 0.0; + double elev = 0.0; +}; + +using ServerAction = + std::variant; + +} // namespace minecraft::server diff --git a/targets/minecraft/server/ServerInterface.h b/targets/minecraft/server/ServerInterface.h index 29c42ae7b..d23f8a250 100644 --- a/targets/minecraft/server/ServerInterface.h +++ b/targets/minecraft/server/ServerInterface.h @@ -3,7 +3,7 @@ class ServerInterface { virtual int getConfigInt(const std::string& name, int defaultValue) = 0; virtual std::string getConfigString(const std::string& name, - const std::string& defaultValue) = 0; + const std::string& defaultValue) = 0; virtual bool getConfigBoolean(const std::string& name, bool defaultValue) = 0; virtual void setProperty(std::string& propertyName, void* value) = 0; diff --git a/targets/minecraft/server/Settings.cpp b/targets/minecraft/server/Settings.cpp index 39ac1c996..107746d92 100644 --- a/targets/minecraft/server/Settings.cpp +++ b/targets/minecraft/server/Settings.cpp @@ -10,7 +10,7 @@ void Settings::generateNewProperties() {} void Settings::saveProperties() {} std::string Settings::getString(const std::string& key, - const std::string& defaultValue) { + const std::string& defaultValue) { if (properties.find(key) == properties.end()) { properties[key] = defaultValue; saveProperties(); diff --git a/targets/minecraft/server/Settings.h b/targets/minecraft/server/Settings.h index b74af9621..9a184dbbc 100644 --- a/targets/minecraft/server/Settings.h +++ b/targets/minecraft/server/Settings.h @@ -18,7 +18,7 @@ public: void generateNewProperties(); void saveProperties(); std::string getString(const std::string& key, - const std::string& defaultValue); + const std::string& defaultValue); int getInt(const std::string& key, int defaultValue); bool getBoolean(const std::string& key, bool defaultValue); void setBooleanAndSave(const std::string& key, bool value); diff --git a/targets/minecraft/server/commands/TeleportCommand.h b/targets/minecraft/server/commands/TeleportCommand.h index 7eb654cd6..2d3c7c150 100644 --- a/targets/minecraft/server/commands/TeleportCommand.h +++ b/targets/minecraft/server/commands/TeleportCommand.h @@ -4,10 +4,10 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/packet/GameCommandPacket.h" +#include "platform/PlatformTypes.h" class TeleportCommand : public Command { public: diff --git a/targets/minecraft/server/level/CreativeMode.cpp b/targets/minecraft/server/level/CreativeMode.cpp index 200ddf34b..3d4929eea 100644 --- a/targets/minecraft/server/level/CreativeMode.cpp +++ b/targets/minecraft/server/level/CreativeMode.cpp @@ -4,11 +4,6 @@ #include "minecraft/client/User.h" #include "minecraft/client/player/LocalPlayer.h" - - - - - CreativeMode::CreativeMode(Minecraft* minecraft) : GameMode(minecraft) { destroyDelay = 0; instaBuild = true; diff --git a/targets/minecraft/server/level/DemoMode.cpp b/targets/minecraft/server/level/DemoMode.cpp index 5caa2ed0f..43939df2c 100644 --- a/targets/minecraft/server/level/DemoMode.cpp +++ b/targets/minecraft/server/level/DemoMode.cpp @@ -1,8 +1,6 @@ #include "DemoMode.h" - - DemoMode::DemoMode(Minecraft* minecraft) : SurvivalMode(minecraft) { demoHasEnded = false; demoEndedReminder = 0; diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 0ee2a9d84..4241f547b 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -7,8 +7,6 @@ #include #include -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "TrackedEntity.h" @@ -20,6 +18,7 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/network/network.h" EntityTracker::EntityTracker(ServerLevel* level) { this->level = level; diff --git a/targets/minecraft/server/level/GameMode.cpp b/targets/minecraft/server/level/GameMode.cpp index 23eb4c5d6..18d881a84 100644 --- a/targets/minecraft/server/level/GameMode.cpp +++ b/targets/minecraft/server/level/GameMode.cpp @@ -4,13 +4,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - - - - GameMode::GameMode(Minecraft* minecraft) { instaBuild = false; // 4J - added this->minecraft = minecraft; diff --git a/targets/minecraft/server/level/GameMode.h b/targets/minecraft/server/level/GameMode.h index fe2a1ecde..e3186c3be 100644 --- a/targets/minecraft/server/level/GameMode.h +++ b/targets/minecraft/server/level/GameMode.h @@ -8,7 +8,7 @@ class Player; class ItemInstance; class Entity; -class Tutorial; +class ITutorial; class GameMode { protected: @@ -70,5 +70,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial* getTutorial() { return nullptr; } + virtual ITutorial* getTutorial() { return nullptr; } }; diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index a420c8b25..00240639b 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "PlayerChunkMap.h" #include @@ -10,12 +9,10 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerChunkCache.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" #include "minecraft/network/packet/ChunkTilesUpdatePacket.h" #include "minecraft/network/packet/ChunkVisibilityAreaPacket.h" @@ -25,10 +22,12 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/network/network.h" PlayerChunkMap::PlayerChunk::PlayerChunk(int x, int z, PlayerChunkMap* pcm) : pos(x, z) { @@ -265,7 +264,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); if (player->seenChunks.find(pos) != player->seenChunks.end() && (player->connection->isLocal() || - g_NetworkManager.SystemFlagGet( + NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), flagIndex))) { player->connection->send(packet); sentTo.push_back(player); @@ -299,7 +298,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { // (this flag will be the same for all players on the same system) int flagIndex = ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), flagIndex)) continue; diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 203c58d9b..c1b7e746a 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ServerChunkCache.h" #include @@ -6,12 +5,12 @@ #include #include +#include -#include "minecraft/IGameServices.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/IGameServices.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -21,6 +20,7 @@ #include "minecraft/world/level/chunk/storage/ChunkStorage.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, @@ -165,16 +165,10 @@ LevelChunk* ServerChunkCache::create( } } -#if defined(_WIN64) || defined(__LP64__) - if (InterlockedCompareExchangeRelease64( - (int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) == - (int64_t)lastChunk) -#else - if (InterlockedCompareExchangeRelease( - (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == - (int32_t)lastChunk) -#endif - { + LevelChunk* expected = lastChunk; + if (std::atomic_ref(cache[idx]) + .compare_exchange_strong(expected, chunk, + std::memory_order_release)) { // Successfully updated the cache std::lock_guard lock(m_csLoadCreate); // 4J - added - this will run a recalcHeightmap if source is a @@ -823,7 +817,7 @@ bool ServerChunkCache::shouldSave() { return !level->noSave; } std::string ServerChunkCache::gatherStats() { return "ServerChunkCache: "; // + toWString(loadedChunks.size()) + " - // Drop: " + toWString(toDrop.size()); + // Drop: " + toWString(toDrop.size()); } std::vector* ServerChunkCache::getMobsAt( @@ -831,8 +825,9 @@ std::vector* ServerChunkCache::getMobsAt( return source->getMobsAt(mobCategory, x, y, z); } -TilePos* ServerChunkCache::findNearestMapFeature( - Level* level, const std::string& featureName, int x, int y, int z) { +TilePos* ServerChunkCache::findNearestMapFeature(Level* level, + const std::string& featureName, + int x, int y, int z) { return source->findNearestMapFeature(level, featureName, x, y, z); } diff --git a/targets/minecraft/server/level/ServerChunkCache.h b/targets/minecraft/server/level/ServerChunkCache.h index 86cb3a6eb..00af9cd5f 100644 --- a/targets/minecraft/server/level/ServerChunkCache.h +++ b/targets/minecraft/server/level/ServerChunkCache.h @@ -5,14 +5,12 @@ #include #include -#include "platform/C4JThread.h" #include "java/File.h" #include "java/JavaIntHash.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/levelgen/RandomLevelSource.h" - - +#include "platform/thread/C4JThread.h" class ServerLevel; class ChunkStorage; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index fd310d273..754b4b1e0 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerLevel.h" #include @@ -7,15 +5,7 @@ #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" #include "EntityTracker.h" -#include "platform/ShutdownManager.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "PlayerChunkMap.h" #include "Pos.h" #include "ServerChunkCache.h" @@ -23,8 +13,10 @@ #include "ServerPlayer.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" #include "minecraft/network/packet/EntityEventPacket.h" @@ -36,6 +28,7 @@ #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerScoreboard.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/util/WeighedTreasure.h" @@ -66,6 +59,10 @@ #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/network/network.h" +#include "platform/storage/storage.h" +#include "platform/thread/ShutdownManager.h" #include "strings.h" class ChunkStorage; @@ -736,7 +733,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, } } else { if (!toBeTicked.empty()) { - Log::info("To be ticked size: %d\n", toBeTicked.size()); + Log::info("To be ticked size: %zu\n", toBeTicked.size()); } for (auto it = toBeTicked.begin(); it != toBeTicked.end();) { TickNextTickData td = *it; @@ -851,8 +848,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) { zSpawn = findBiome->z; delete findBiome; } else { - Log::info( - "Level::setInitialSpawn - Unable to find spawn biome\n"); + Log::info("Level::setInitialSpawn - Unable to find spawn biome\n"); } int tries = 0; @@ -989,11 +985,7 @@ void ServerLevel::saveToDisc(ProgressListener* progressListener, // the case for going into the mash-up pack world with a trial version) if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = pDLCTexPack->getDLCInfoParentPack(); - - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, "")) { + if (tPack->needsPurchase()) { return; } } diff --git a/targets/minecraft/server/level/ServerLevel.h b/targets/minecraft/server/level/ServerLevel.h index 8407324b6..6de6131e7 100644 --- a/targets/minecraft/server/level/ServerLevel.h +++ b/targets/minecraft/server/level/ServerLevel.h @@ -12,14 +12,13 @@ #include #include "SharedConstants.h" -#include "platform/C4JThread.h" #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TickNextTickData.h" #include "minecraft/world/level/TileEventData.h" #include "minecraft/world/level/biome/Biome.h" - +#include "platform/thread/C4JThread.h" class ServerChunkCache; class MinecraftServer; diff --git a/targets/minecraft/server/level/ServerLevelListener.cpp b/targets/minecraft/server/level/ServerLevelListener.cpp index 15f7f2ffd..5c342e89f 100644 --- a/targets/minecraft/server/level/ServerLevelListener.cpp +++ b/targets/minecraft/server/level/ServerLevelListener.cpp @@ -1,11 +1,9 @@ -#include "minecraft/util/Log.h" #include "ServerLevelListener.h" #include #include #include "EntityTracker.h" -#include "app/linux/LinuxGame.h" #include "PlayerChunkMap.h" #include "ServerLevel.h" #include "ServerPlayer.h" @@ -16,6 +14,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index d50593678..7c616ac53 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerPlayer.h" #include @@ -10,13 +8,7 @@ #include #include -#include "platform/input/input.h" #include "EntityTracker.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -25,10 +17,13 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/AwardStatPacket.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" @@ -55,6 +50,7 @@ #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -91,6 +87,7 @@ #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/biome/Biome.h" @@ -109,6 +106,8 @@ #include "minecraft/world/scores/Scoreboard.h" #include "minecraft/world/scores/criteria/ObjectiveCriteria.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" +#include "platform/network/network.h" #include "strings.h" class Objective; @@ -443,7 +442,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // connection->getNetworkPlayer()->GetSmallId(), // canSendToPlayer, // connection->countDelayedPackets(), - // g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( + // NetworkService.GetHostPlayer()->GetSendQueueSizeMessages( // nullptr, true ), // connection->done); // } @@ -451,8 +450,8 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { if (dontDelayChunks || (canSendToPlayer && (connection->countDelayedPackets() < 4) && - (g_NetworkManager.GetHostPlayer() - ->GetSendQueueSizeMessages(nullptr, true) < 4) && + (NetworkService.GetHostPlayer()->GetSendQueueSizeMessages( + nullptr, true) < 4) && //(tickCount - lastBrupSendTickCount) > //(connection->getNetworkPlayer()->GetCurrentRtt()>>4) && !connection->done)) { @@ -505,7 +504,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // ever request that chunks be unloaded on the client // and so just gradually build up more and more of the // finite set of chunks as the player moves - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( connection->getNetworkPlayer(), flagIndex)) { // Log::info("Creating // BRUP for %d %d\n",nearest.x, nearest.z); @@ -531,7 +530,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { } // Set flag to say we have send this block already to // this system - g_NetworkManager.SystemFlagSet( + NetworkService.SystemFlagSet( connection->getNetworkPlayer(), flagIndex); chunkDataSent = true; @@ -781,8 +780,7 @@ void ServerPlayer::changeDimension(int i) { true; // We only flag this for the player in the portal connection->send(std::make_shared( GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); - Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + Log::info("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if (thisPlayer != nullptr) { for (auto it = MinecraftServer::getInstance() @@ -803,7 +801,7 @@ void ServerPlayer::changeDimension(int i) { new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()))); Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + thisPlayer->GetUserIndex()); } } } @@ -979,8 +977,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) { if (containerMenu == inventoryMenu) { nextContainerCounter(); connection->send(std::make_shared( - containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, - false)); + containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, false)); containerMenu = new AnvilMenu( inventory, level, x, y, z, std::dynamic_pointer_cast(shared_from_this())); diff --git a/targets/minecraft/server/level/ServerPlayer.h b/targets/minecraft/server/level/ServerPlayer.h index aea142f5d..86948418c 100644 --- a/targets/minecraft/server/level/ServerPlayer.h +++ b/targets/minecraft/server/level/ServerPlayer.h @@ -13,8 +13,6 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/net.minecraft.world.inventory.ContainerListener.h" - - #include "minecraft/world/level/ChunkPos.h" class PlayerConnection; @@ -64,8 +62,8 @@ private: int lastBrupSendTickCount; // 4J Added public: - ServerPlayer(MinecraftServer* server, Level* level, - const std::string& name, ServerPlayerGameMode* gameMode); + ServerPlayer(MinecraftServer* server, Level* level, const std::string& name, + ServerPlayerGameMode* gameMode); ~ServerPlayer(); void flagEntitiesToBeRemoved(unsigned int* flags, bool* removedFound); // 4J added @@ -131,7 +129,7 @@ public: virtual bool openFireworks(int x, int y, int z); // 4J added virtual bool startEnchanting( int x, int y, int z, const std::string& name); // 4J added bool return - virtual bool startRepairing(int x, int y, int z); // 4J added bool return + virtual bool startRepairing(int x, int y, int z); // 4J added bool return virtual bool openContainer( std::shared_ptr container); // 4J added bool return virtual bool openHopper(std::shared_ptr container); diff --git a/targets/minecraft/server/level/ServerPlayerGameMode.cpp b/targets/minecraft/server/level/ServerPlayerGameMode.cpp index 300e3fca4..bad2c2790 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "ServerPlayerGameMode.h" #include -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" @@ -16,6 +15,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/WeaponItem.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" diff --git a/targets/minecraft/server/level/SurvivalMode.cpp b/targets/minecraft/server/level/SurvivalMode.cpp index 9105d2259..0edcd73b4 100644 --- a/targets/minecraft/server/level/SurvivalMode.cpp +++ b/targets/minecraft/server/level/SurvivalMode.cpp @@ -6,10 +6,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - SurvivalMode::SurvivalMode(Minecraft* minecraft) : GameMode(minecraft) { // 4J - added initialisers xDestroyBlock = -1; diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index f7eb9b3b4..ddcb4ee8d 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TrackedEntity.h" #include @@ -9,10 +8,7 @@ #include #include -#include "platform/PlatformTypes.h" #include "EntityTracker.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerPlayer.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" @@ -36,6 +32,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Creature.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/ExperienceOrb.h" @@ -57,12 +54,11 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/PlatformTypes.h" +#include "platform/network/network.h" class AttributeInstance; class MobEffectInstance; -#ifndef __linux__ -#include -#endif // __linux__ TrackedEntity::TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta) { @@ -713,7 +709,7 @@ void TrackedEntity::updatePlayers( std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { Log::info("Fetching addPacket for removed entity - %s\n", - e->getAName().c_str()); + e->getAName().c_str()); } // 4J-PB - replacing with a switch, rather than tons of ifs diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 62c26afd1..9b5a10f5c 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PendingConnection.h" #include @@ -7,18 +5,12 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "platform/IPlatformNetwork.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" #include "java/Random.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -27,6 +19,11 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/storage/storage.h" class Packet; // #if 0 @@ -80,7 +77,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { Log::info("Netcode version is %d not equal to %d\n", - packet->m_netcodeVersion, MINECRAFT_NET_VERSION); + packet->m_netcodeVersion, MINECRAFT_NET_VERSION); if (packet->m_netcodeVersion > MINECRAFT_NET_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { @@ -136,11 +133,11 @@ void PendingConnection::sendPreLoginResponse() { } { - connection->send(std::shared_ptr( - new PreLoginPacket("-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, - server->m_ugcPlayersVersion, szUniqueMapName, - gameServices().getGameHostOption(eGameHostOption_All), - hostIndex, server->m_texturePackId))); + connection->send(std::shared_ptr(new PreLoginPacket( + "-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, + server->m_ugcPlayersVersion, szUniqueMapName, + gameServices().getGameHostOption(eGameHostOption_All), hostIndex, + server->m_texturePackId))); } } @@ -150,8 +147,8 @@ void PendingConnection::handleLogin(std::shared_ptr packet) { // name = packet->userName; if (packet->clientVersion != SharedConstants::NETWORK_PROTOCOL_VERSION) { Log::info("Client version is %d not equal to %d\n", - packet->clientVersion, - SharedConstants::NETWORK_PROTOCOL_VERSION); + packet->clientVersion, + SharedConstants::NETWORK_PROTOCOL_VERSION); if (packet->clientVersion > SharedConstants::NETWORK_PROTOCOL_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 184f4264e..e68f39790 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/util/Log.h" #include "PlayerConnection.h" #include @@ -11,15 +8,6 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "app/linux/LinuxGame.h" -#include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -27,11 +15,18 @@ #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "minecraft/commands/CommandDispatcher.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/ClientCommandPacket.h" @@ -72,6 +67,7 @@ #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/level/ServerPlayerGameMode.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -97,6 +93,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" @@ -104,6 +101,7 @@ #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/network/network.h" class SavedData; @@ -139,8 +137,10 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, m_onlineXUID = INVALID_XUID; m_bHasClientTickedOnce = false; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(gameServices().getGameHostOption(eGameHostOption_Gamertags) != + 0 + ? true + : false); } PlayerConnection::~PlayerConnection() { delete connection; } @@ -384,8 +384,7 @@ void PlayerConnection::handleMovePlayer( #if !defined(_CONTENT_PACKAGE) printf("%s moved wrongly!\n", player->name.c_str()); Log::info("Got position %f, %f, %f\n", xt, yt, zt); - Log::info("Expected %f, %f, %f\n", player->x, player->y, - player->z); + Log::info("Expected %f, %f, %f\n", player->x, player->y, player->z); #endif } player->absMoveTo(xt, yt, zt, yRotT, xRotT); @@ -408,7 +407,7 @@ void PlayerConnection::handleMovePlayer( // kicked for floating too long!"); #if !defined(_CONTENT_PACKAGE) printf("%s was kicked for floating too long!\n", - player->name.c_str()); + player->name.c_str()); #endif disconnect(DisconnectPacket::eDisconnect_NoFlying); return; @@ -810,11 +809,12 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -826,10 +826,10 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } } @@ -843,21 +843,22 @@ void PlayerConnection::handleTextureAndGeometry( // Request for texture and geometry #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(packet->textureName); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwTextureBytes); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(packet->textureName); if (dwTextureBytes != 0) { - if (pDLCSkinFile) { - if (pDLCSkinFile->getAdditionalBoxesCount() != 0) { + if (pSkinAsset) { + if (pSkinAsset->getAdditionalBoxesCount() != 0) { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, pbData, dwTextureBytes, - pDLCSkinFile))); + pSkinAsset))); } else { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, @@ -883,23 +884,23 @@ void PlayerConnection::handleTextureAndGeometry( // Response with texture and geometry data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s and geometry\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // add the geometry to the app list if (packet->dwBoxC != 0) { #if !defined(_CONTENT_PACKAGE) printf("Adding skin boxes for skin id %X, box count %d\n", - packet->dwSkinID, packet->dwBoxC); + packet->dwSkinID, packet->dwBoxC); #endif - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); player->setCustomSkin(packet->dwSkinID); @@ -936,17 +937,18 @@ void PlayerConnection::handleTextureAndGeometryReceived( std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; gameServices().getMemFileDetails(textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(textureName); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(textureName); if (dwTextureBytes != 0) { - if (pDLCSkinFile && - (pDLCSkinFile->getAdditionalBoxesCount() != 0)) { + if (pSkinAsset && (pSkinAsset->getAdditionalBoxesCount() != 0)) { send(std::shared_ptr( - new TextureAndGeometryPacket( - textureName, pbData, dwTextureBytes, pDLCSkinFile))); + new TextureAndGeometryPacket(textureName, pbData, + dwTextureBytes, pSkinAsset))); } else { // get the data from the app - std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(textureName); + std::uint32_t dwSkinID = + gameServices().getSkinIdFromPath(textureName); std::vector* pvSkinBoxes = gameServices().getAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask = @@ -966,11 +968,12 @@ void PlayerConnection::handleTextureChange( std::shared_ptr packet) { switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); + player->setCustomSkin( + gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) printf("Skin for server player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -978,7 +981,7 @@ void PlayerConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for server player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -1014,7 +1017,7 @@ void PlayerConnection::handleTextureAndGeometryChange( "PlayerConnection::handleTextureAndGeometryChange - Skin for server " "player %s has changed to %s (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && @@ -1060,46 +1063,47 @@ void PlayerConnection::handleServerSettingsChanged( gameServices().setGameHostOption( eGameHostOption_FireSpreads, GameHostOptions::get(packet->data, - eGameHostOption_FireSpreads)); + eGameHostOption_FireSpreads)); gameServices().setGameHostOption( eGameHostOption_TNT, GameHostOptions::get(packet->data, eGameHostOption_TNT)); gameServices().setGameHostOption( eGameHostOption_MobGriefing, GameHostOptions::get(packet->data, - eGameHostOption_MobGriefing)); + eGameHostOption_MobGriefing)); gameServices().setGameHostOption( eGameHostOption_KeepInventory, GameHostOptions::get(packet->data, - eGameHostOption_KeepInventory)); + eGameHostOption_KeepInventory)); gameServices().setGameHostOption( eGameHostOption_DoMobSpawning, GameHostOptions::get(packet->data, - eGameHostOption_DoMobSpawning)); + eGameHostOption_DoMobSpawning)); gameServices().setGameHostOption( eGameHostOption_DoMobLoot, GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot)); gameServices().setGameHostOption( eGameHostOption_DoTileDrops, GameHostOptions::get(packet->data, - eGameHostOption_DoTileDrops)); + eGameHostOption_DoTileDrops)); gameServices().setGameHostOption( eGameHostOption_DoDaylightCycle, GameHostOptions::get(packet->data, - eGameHostOption_DoDaylightCycle)); + eGameHostOption_DoDaylightCycle)); gameServices().setGameHostOption( eGameHostOption_NaturalRegeneration, GameHostOptions::get(packet->data, - eGameHostOption_NaturalRegeneration)); + eGameHostOption_NaturalRegeneration)); server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, - gameServices().getGameHostOption(eGameHostOption_All)))); + gameServices().getGameHostOption( + eGameHostOption_All)))); // Update the QoS data - g_NetworkManager.UpdateAndSetGameSessionData(); + NetworkService.UpdateAndSetGameSessionData(); } } } @@ -1408,10 +1412,10 @@ void PlayerConnection::handlePlayerInfo( if (serverPlayer != nullptr) { unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); - bool trustPlayers = - gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0; - bool cheats = - gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0; + bool trustPlayers = gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) != 0; + bool cheats = gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0; if (serverPlayer == player) { GameType* gameType = Player::getPlayerGamePrivilege( @@ -1424,7 +1428,7 @@ void PlayerConnection::handlePlayerInfo( gameType) { #if !defined(_CONTENT_PACKAGE) printf("Setting %s to game mode %d\n", - serverPlayer->name.c_str(), gameType); + serverPlayer->name.c_str(), gameType->getId()); #endif serverPlayer->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_CreativeMode, @@ -1439,7 +1443,7 @@ void PlayerConnection::handlePlayerInfo( } else { #if !defined(_CONTENT_PACKAGE) printf("%s already has game mode %d\n", - serverPlayer->name.c_str(), gameType); + serverPlayer->name.c_str(), gameType->getId()); #endif } if (cheats) { diff --git a/targets/minecraft/server/network/PlayerConnection.h b/targets/minecraft/server/network/PlayerConnection.h index 054b7c0e0..71808f575 100644 --- a/targets/minecraft/server/network/PlayerConnection.h +++ b/targets/minecraft/server/network/PlayerConnection.h @@ -7,11 +7,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaIntHash.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/server/ConsoleInputSource.h" +#include "platform/PlatformTypes.h" class MinecraftServer; class Connection; diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 6648b7a2b..89430951b 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -1,19 +1,18 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerConnection.h" #include -#include "app/linux/LinuxGame.h" #include "PendingConnection.h" #include "PlayerConnection.h" -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "util/StringHelpers.h" ServerConnection::ServerConnection(MinecraftServer* server) { // 4J - added initialiser diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt new file mode 100644 index 000000000..e55538beb --- /dev/null +++ b/targets/minecraft/sources.txt @@ -0,0 +1,1057 @@ +Direction.cpp +Facing.cpp +GameHostOptions.cpp +IGameServices.cpp +Pos.cpp +SharedConstants.cpp +StaticConstructors.cpp +client/BufferedImage.cpp +client/Camera.cpp +client/ClientConstants.cpp +client/DemoUser.cpp +client/GuiMessage.cpp +client/KeyMapping.cpp +client/Lighting.cpp +client/MemoryTracker.cpp +client/Minecraft.cpp +client/Options.cpp +client/ProgressRenderer.cpp +client/Timer.cpp +client/User.cpp +client/gui/Button.cpp +client/gui/ChatScreen.cpp +client/gui/ConfirmScreen.cpp +client/gui/ControlsScreen.cpp +client/gui/CreateWorldScreen.cpp +client/gui/DeathScreen.cpp +client/gui/EditBox.cpp +client/gui/ErrorScreen.cpp +client/gui/Font.cpp +client/gui/Gui.cpp +client/gui/GuiComponent.cpp +client/gui/InBedChatScreen.cpp +client/gui/JoinMultiplayerScreen.cpp +client/gui/MessageScreen.cpp +client/gui/Minimap.cpp +client/gui/NameEntryScreen.cpp +client/gui/OptionsScreen.cpp +client/gui/PauseScreen.cpp +client/gui/RenameWorldScreen.cpp +client/gui/Screen.cpp +client/gui/ScreenSizeCalculator.cpp +client/gui/ScrolledSelectionList.cpp +client/gui/SelectWorldScreen.cpp +client/gui/SlideButton.cpp +client/gui/SmallButton.cpp +client/gui/TradeSwitchButton.cpp +client/gui/VideoSettingsScreen.cpp +client/gui/achievement/AchievementPopup.cpp +client/gui/achievement/AchievementScreen.cpp +client/gui/achievement/StatsScreen.cpp +client/gui/inventory/AbstractBeaconButton.cpp +client/gui/inventory/AbstractContainerScreen.cpp +client/gui/inventory/BeaconCancelButton.cpp +client/gui/inventory/BeaconConfirmButton.cpp +client/gui/inventory/BeaconPowerButton.cpp +client/gui/inventory/BeaconScreen.cpp +client/gui/inventory/BrewingStandScreen.cpp +client/gui/inventory/ContainerScreen.cpp +client/gui/inventory/CraftingScreen.cpp +client/gui/inventory/CreativeInventoryScreen.cpp +client/gui/inventory/EnchantmentScreen.cpp +client/gui/inventory/FurnaceScreen.cpp +client/gui/inventory/HopperScreen.cpp +client/gui/inventory/HorseInventoryScreen.cpp +client/gui/inventory/InventoryScreen.cpp +client/gui/inventory/MerchantScreen.cpp +client/gui/inventory/RepairScreen.cpp +client/gui/inventory/TextEditScreen.cpp +client/gui/inventory/TrapScreen.cpp +client/gui/particle/GuiParticle.cpp +client/gui/particle/GuiParticles.cpp +client/level/DemoLevel.cpp +client/model/BatModel.cpp +client/model/BlazeModel.cpp +client/model/BoatModel.cpp +client/model/BookModel.cpp +client/model/ChestModel.cpp +client/model/ChickenModel.cpp +client/model/CowModel.cpp +client/model/CreeperModel.cpp +client/model/EndermanModel.cpp +client/model/GhastModel.cpp +client/model/HumanoidModel.cpp +client/model/LargeChestModel.cpp +client/model/LavaSlimeModel.cpp +client/model/LeashKnotModel.cpp +client/model/MinecartModel.cpp +client/model/ModelHorse.cpp +client/model/OcelotModel.cpp +client/model/PigModel.cpp +client/model/Polygon.cpp +client/model/QuadrupedModel.cpp +client/model/SheepFurModel.cpp +client/model/SheepModel.cpp +client/model/SignModel.cpp +client/model/SilverfishModel.cpp +client/model/SkeletonHeadModel.cpp +client/model/SkeletonModel.cpp +client/model/SkiModel.cpp +client/model/SlimeModel.cpp +client/model/SnowManModel.cpp +client/model/SpiderModel.cpp +client/model/SquidModel.cpp +client/model/Vertex.cpp +client/model/VillagerGolemModel.cpp +client/model/VillagerModel.cpp +client/model/VillagerZombieModel.cpp +client/model/WitchModel.cpp +client/model/WitherBossModel.cpp +client/model/WolfModel.cpp +client/model/ZombieModel.cpp +client/model/dragon/DragonModel.cpp +client/model/dragon/EnderCrystalModel.cpp +client/model/geom/Cube.cpp +client/model/geom/Model.cpp +client/model/geom/ModelPart.cpp +client/model/geom/TexOffs.cpp +client/multiplayer/ClientConnection.cpp +client/multiplayer/ConnectScreen.cpp +client/multiplayer/DisconnectedScreen.cpp +client/multiplayer/MultiPlayerChunkCache.cpp +client/multiplayer/MultiPlayerGameMode.cpp +client/multiplayer/MultiPlayerLevel.cpp +client/multiplayer/MultiPlayerLocalPlayer.cpp +client/multiplayer/ReceivingLevelScreen.cpp +client/particle/BreakingItemParticle.cpp +client/particle/BubbleParticle.cpp +client/particle/CritParticle.cpp +client/particle/CritParticle2.cpp +client/particle/DragonBreathParticle.cpp +client/particle/DripParticle.cpp +client/particle/EnchantmentTableParticle.cpp +client/particle/EnderParticle.cpp +client/particle/ExplodeParticle.cpp +client/particle/FireworksParticles.cpp +client/particle/FlameParticle.cpp +client/particle/FootstepParticle.cpp +client/particle/HeartParticle.cpp +client/particle/HugeExplosionParticle.cpp +client/particle/HugeExplosionSeedParticle.cpp +client/particle/LavaParticle.cpp +client/particle/NetherPortalParticle.cpp +client/particle/NoteParticle.cpp +client/particle/Particle.cpp +client/particle/ParticleEngine.cpp +client/particle/PlayerCloudParticle.cpp +client/particle/RedDustParticle.cpp +client/particle/SmokeParticle.cpp +client/particle/SnowShovelParticle.cpp +client/particle/SpellParticle.cpp +client/particle/SplashParticle.cpp +client/particle/SuspendedParticle.cpp +client/particle/SuspendedTownParticle.cpp +client/particle/TakeAnimationParticle.cpp +client/particle/TerrainParticle.cpp +client/particle/WaterDropParticle.cpp +client/player/Input.cpp +client/player/LocalPlayer.cpp +client/player/RemotePlayer.cpp +client/renderer/BossMobGuiInfo.cpp +client/renderer/Chunk.cpp +client/renderer/DirtyChunkSorter.cpp +client/renderer/DistanceChunkSorter.cpp +client/renderer/EntityTileRenderer.cpp +client/renderer/GameRenderer.cpp +client/renderer/HttpTexture.cpp +client/renderer/ItemInHandRenderer.cpp +client/renderer/LevelRenderer.cpp +client/renderer/MemTexture.cpp +client/renderer/MobSkinMemTextureProcessor.cpp +client/renderer/MobSkinTextureProcessor.cpp +client/renderer/OffsettedRenderList.cpp +client/renderer/Rect2i.cpp +client/renderer/Tesselator.cpp +client/renderer/Textures.cpp +client/renderer/TileRenderer.cpp +client/renderer/culling/AllowAllCuller.cpp +client/renderer/culling/Frustum.cpp +client/renderer/culling/FrustumCuller.cpp +client/renderer/culling/FrustumData.cpp +client/renderer/culling/ViewportCuller.cpp +client/renderer/entity/ArrowRenderer.cpp +client/renderer/entity/BatRenderer.cpp +client/renderer/entity/BlazeRenderer.cpp +client/renderer/entity/BoatRenderer.cpp +client/renderer/entity/CaveSpiderRenderer.cpp +client/renderer/entity/ChickenRenderer.cpp +client/renderer/entity/CowRenderer.cpp +client/renderer/entity/CreeperRenderer.cpp +client/renderer/entity/DefaultRenderer.cpp +client/renderer/entity/EnderCrystalRenderer.cpp +client/renderer/entity/EnderDragonRenderer.cpp +client/renderer/entity/EndermanRenderer.cpp +client/renderer/entity/EntityRenderDispatcher.cpp +client/renderer/entity/EntityRenderer.cpp +client/renderer/entity/ExperienceOrbRenderer.cpp +client/renderer/entity/FallingTileRenderer.cpp +client/renderer/entity/FireballRenderer.cpp +client/renderer/entity/FishingHookRenderer.cpp +client/renderer/entity/GhastRenderer.cpp +client/renderer/entity/GiantMobRenderer.cpp +client/renderer/entity/HorseRenderer.cpp +client/renderer/entity/HumanoidMobRenderer.cpp +client/renderer/entity/ItemFrameRenderer.cpp +client/renderer/entity/ItemRenderer.cpp +client/renderer/entity/ItemSpriteRenderer.cpp +client/renderer/entity/LavaSlimeRenderer.cpp +client/renderer/entity/LeashKnotRenderer.cpp +client/renderer/entity/LightningBoltRenderer.cpp +client/renderer/entity/LivingEntityRenderer.cpp +client/renderer/entity/MinecartRenderer.cpp +client/renderer/entity/MinecartSpawnerRenderer.cpp +client/renderer/entity/MobRenderer.cpp +client/renderer/entity/MushroomCowRenderer.cpp +client/renderer/entity/OcelotRenderer.cpp +client/renderer/entity/PaintingRenderer.cpp +client/renderer/entity/PigRenderer.cpp +client/renderer/entity/PlayerRenderer.cpp +client/renderer/entity/SheepRenderer.cpp +client/renderer/entity/SilverfishRenderer.cpp +client/renderer/entity/SkeletonRenderer.cpp +client/renderer/entity/SlimeRenderer.cpp +client/renderer/entity/SnowManRenderer.cpp +client/renderer/entity/SpiderRenderer.cpp +client/renderer/entity/SquidRenderer.cpp +client/renderer/entity/TntMinecartRenderer.cpp +client/renderer/entity/TntRenderer.cpp +client/renderer/entity/VillagerGolemRenderer.cpp +client/renderer/entity/VillagerRenderer.cpp +client/renderer/entity/WitchRenderer.cpp +client/renderer/entity/WitherBossRenderer.cpp +client/renderer/entity/WitherSkullRenderer.cpp +client/renderer/entity/WolfRenderer.cpp +client/renderer/entity/ZombieRenderer.cpp +client/renderer/texture/PreStitchedTextureMap.cpp +client/renderer/texture/SimpleIcon.cpp +client/renderer/texture/StitchSlot.cpp +client/renderer/texture/StitchedTexture.cpp +client/renderer/texture/Stitcher.cpp +client/renderer/texture/Texture.cpp +client/renderer/texture/TextureAtlas.cpp +client/renderer/texture/TextureHolder.cpp +client/renderer/texture/TextureManager.cpp +client/renderer/texture/TextureMap.cpp +client/renderer/texture/custom/ClockTexture.cpp +client/renderer/texture/custom/CompassTexture.cpp +client/renderer/tileentity/BeaconRenderer.cpp +client/renderer/tileentity/ChestRenderer.cpp +client/renderer/tileentity/EnchantTableRenderer.cpp +client/renderer/tileentity/EnderChestRenderer.cpp +client/renderer/tileentity/MobSpawnerRenderer.cpp +client/renderer/tileentity/PistonPieceRenderer.cpp +client/renderer/tileentity/SignRenderer.cpp +client/renderer/tileentity/SkullTileRenderer.cpp +client/renderer/tileentity/TheEndPortalRenderer.cpp +client/renderer/tileentity/TileEntityRenderDispatcher.cpp +client/renderer/tileentity/TileEntityRenderer.cpp +client/resources/Colours/ColourTable.cpp +client/skins/AbstractTexturePack.cpp +client/skins/DLCTexturePack.cpp +client/skins/DefaultTexturePack.cpp +client/skins/FileTexturePack.cpp +client/skins/FolderTexturePack.cpp +client/skins/TexturePack.cpp +client/skins/TexturePackRepository.cpp +client/title/TitleScreen.cpp +commands/Command.cpp +commands/CommandDispatcher.cpp +commands/common/DefaultGameModeCommand.cpp +commands/common/EffectCommand.cpp +commands/common/EnchantItemCommand.cpp +commands/common/ExperienceCommand.cpp +commands/common/GameModeCommand.cpp +commands/common/GiveItemCommand.cpp +commands/common/KillCommand.cpp +commands/common/TimeCommand.cpp +commands/common/ToggleDownfallCommand.cpp +core/AbstractProjectileDispenseBehavior.cpp +core/BehaviorRegistry.cpp +core/BlockSourceImpl.cpp +core/DefaultDispenseItemBehavior.cpp +core/DispenseItemBehavior.cpp +core/FacingEnum.cpp +core/ItemDispenseBehaviors.cpp +locale/I18n.cpp +locale/Language.cpp +locale/StringTable.cpp +network/Connection.cpp +network/Socket.cpp +network/packet/AddEntityPacket.cpp +network/packet/AddExperienceOrbPacket.cpp +network/packet/AddGlobalEntityPacket.cpp +network/packet/AddMobPacket.cpp +network/packet/AddPaintingPacket.cpp +network/packet/AddPlayerPacket.cpp +network/packet/AnimatePacket.cpp +network/packet/AwardStatPacket.cpp +network/packet/BlockRegionUpdatePacket.cpp +network/packet/ChatPacket.cpp +network/packet/ChunkTilesUpdatePacket.cpp +network/packet/ChunkVisibilityAreaPacket.cpp +network/packet/ChunkVisibilityPacket.cpp +network/packet/ClientCommandPacket.cpp +network/packet/ComplexItemDataPacket.cpp +network/packet/ContainerAckPacket.cpp +network/packet/ContainerButtonClickPacket.cpp +network/packet/ContainerClickPacket.cpp +network/packet/ContainerClosePacket.cpp +network/packet/ContainerOpenPacket.cpp +network/packet/ContainerSetContentPacket.cpp +network/packet/ContainerSetDataPacket.cpp +network/packet/ContainerSetSlotPacket.cpp +network/packet/CraftItemPacket.cpp +network/packet/CustomPayloadPacket.cpp +network/packet/DebugOptionsPacket.cpp +network/packet/DisconnectPacket.cpp +network/packet/EntityActionAtPositionPacket.cpp +network/packet/EntityEventPacket.cpp +network/packet/ExplodePacket.cpp +network/packet/GameCommandPacket.cpp +network/packet/GameEventPacket.cpp +network/packet/GetInfoPacket.cpp +network/packet/InteractPacket.cpp +network/packet/KeepAlivePacket.cpp +network/packet/KickPlayerPacket.cpp +network/packet/LevelEventPacket.cpp +network/packet/LevelParticlesPacket.cpp +network/packet/LevelSoundPacket.cpp +network/packet/LoginPacket.cpp +network/packet/MoveEntityPacket.cpp +network/packet/MoveEntityPacketSmall.cpp +network/packet/MovePlayerPacket.cpp +network/packet/Packet.cpp +network/packet/PacketListener.cpp +network/packet/PlayerAbilitiesPacket.cpp +network/packet/PlayerActionPacket.cpp +network/packet/PlayerCommandPacket.cpp +network/packet/PlayerInfoPacket.cpp +network/packet/PlayerInputPacket.cpp +network/packet/PreLoginPacket.cpp +network/packet/RemoveEntitiesPacket.cpp +network/packet/RemoveMobEffectPacket.cpp +network/packet/RespawnPacket.cpp +network/packet/RotateHeadPacket.cpp +network/packet/ServerSettingsChangedPacket.cpp +network/packet/SetCarriedItemPacket.cpp +network/packet/SetCreativeModeSlotPacket.cpp +network/packet/SetDisplayObjectivePacket.cpp +network/packet/SetEntityDataPacket.cpp +network/packet/SetEntityLinkPacket.cpp +network/packet/SetEntityMotionPacket.cpp +network/packet/SetEquippedItemPacket.cpp +network/packet/SetExperiencePacket.cpp +network/packet/SetHealthPacket.cpp +network/packet/SetObjectivePacket.cpp +network/packet/SetPlayerTeamPacket.cpp +network/packet/SetScorePacket.cpp +network/packet/SetSpawnPositionPacket.cpp +network/packet/SetTimePacket.cpp +network/packet/SignUpdatePacket.cpp +network/packet/TakeItemEntityPacket.cpp +network/packet/TeleportEntityPacket.cpp +network/packet/TextureAndGeometryChangePacket.cpp +network/packet/TextureAndGeometryPacket.cpp +network/packet/TextureChangePacket.cpp +network/packet/TexturePacket.cpp +network/packet/TileDestructionPacket.cpp +network/packet/TileEditorOpenPacket.cpp +network/packet/TileEntityDataPacket.cpp +network/packet/TileEventPacket.cpp +network/packet/TileUpdatePacket.cpp +network/packet/TradeItemPacket.cpp +network/packet/UpdateAttributesPacket.cpp +network/packet/UpdateGameRuleProgressPacket.cpp +network/packet/UpdateMobEffectPacket.cpp +network/packet/UpdateProgressPacket.cpp +network/packet/UseItemPacket.cpp +network/packet/XZPacket.cpp +server/ConsoleInput.cpp +server/DispenserBootstrap.cpp +server/MinecraftServer.cpp +server/PlayerList.cpp +server/ServerScoreboard.cpp +server/Settings.cpp +server/commands/ServerCommandDispatcher.cpp +server/commands/TeleportCommand.cpp +server/level/DerivedServerLevel.cpp +server/level/EntityTracker.cpp +server/level/PlayerChunkMap.cpp +server/level/ServerChunkCache.cpp +server/level/ServerLevel.cpp +server/level/ServerLevelListener.cpp +server/level/ServerPlayer.cpp +server/level/ServerPlayerGameMode.cpp +server/level/TrackedEntity.cpp +server/network/PendingConnection.cpp +server/network/PlayerConnection.cpp +server/network/ServerConnection.cpp +stats/Achievement.cpp +stats/Achievements.cpp +stats/CommonStats.cpp +stats/GeneralStat.cpp +stats/GenericStats.cpp +stats/ItemStat.cpp +stats/Stat.cpp +stats/Stats.cpp +stats/StatsCounter.cpp +stats/StatsSyncer.cpp +util/Hasher.cpp +util/HtmlString.cpp +util/Mth.cpp +util/SmoothFloat.cpp +util/WeighedRandom.cpp +util/WeighedTreasure.cpp +world/CompoundContainer.cpp +world/FlippedIcon.cpp +world/SimpleContainer.cpp +world/damageSource/CombatEntry.cpp +world/damageSource/CombatTracker.cpp +world/damageSource/DamageSource.cpp +world/damageSource/EntityDamageSource.cpp +world/damageSource/IndirectEntityDamageSource.cpp +world/effect/AbsoptionMobEffect.cpp +world/effect/AttackDamageMobEffect.cpp +world/effect/HealthBoostMobEffect.cpp +world/effect/InstantaneousMobEffect.cpp +world/effect/MobEffect.cpp +world/effect/MobEffectInstance.cpp +world/entity/AgeableMob.cpp +world/entity/Creature.cpp +world/entity/DelayedRelease.cpp +world/entity/Entity.cpp +world/entity/EntityIO.cpp +world/entity/EntityPos.cpp +world/entity/EntitySelector.cpp +world/entity/ExperienceOrb.cpp +world/entity/FlyingMob.cpp +world/entity/HangingEntity.cpp +world/entity/ItemFrame.cpp +world/entity/LeashFenceKnotEntity.cpp +world/entity/LivingEntity.cpp +world/entity/Mob.cpp +world/entity/MobCategory.cpp +world/entity/Painting.cpp +world/entity/PathfinderMob.cpp +world/entity/SyncedEntityData.cpp +world/entity/TamableAnimal.cpp +world/entity/ai/attributes/Attribute.cpp +world/entity/ai/attributes/AttributeModifier.cpp +world/entity/ai/attributes/BaseAttribute.cpp +world/entity/ai/attributes/BaseAttributeMap.cpp +world/entity/ai/attributes/ModifiableAttributeInstance.cpp +world/entity/ai/attributes/RangedAttribute.cpp +world/entity/ai/attributes/ServersideAttributeMap.cpp +world/entity/ai/control/BodyControl.cpp +world/entity/ai/control/JumpControl.cpp +world/entity/ai/control/LookControl.cpp +world/entity/ai/control/MoveControl.cpp +world/entity/ai/goal/AvoidPlayerGoal.cpp +world/entity/ai/goal/BegGoal.cpp +world/entity/ai/goal/BreakDoorGoal.cpp +world/entity/ai/goal/BreedGoal.cpp +world/entity/ai/goal/ControlledByPlayerGoal.cpp +world/entity/ai/goal/DoorInteractGoal.cpp +world/entity/ai/goal/EatTileGoal.cpp +world/entity/ai/goal/FleeSunGoal.cpp +world/entity/ai/goal/FloatGoal.cpp +world/entity/ai/goal/FollowOwnerGoal.cpp +world/entity/ai/goal/FollowParentGoal.cpp +world/entity/ai/goal/Goal.cpp +world/entity/ai/goal/GoalSelector.cpp +world/entity/ai/goal/InteractGoal.cpp +world/entity/ai/goal/LeapAtTargetGoal.cpp +world/entity/ai/goal/LookAtPlayerGoal.cpp +world/entity/ai/goal/LookAtTradingPlayerGoal.cpp +world/entity/ai/goal/MakeLoveGoal.cpp +world/entity/ai/goal/MeleeAttackGoal.cpp +world/entity/ai/goal/MoveIndoorsGoal.cpp +world/entity/ai/goal/MoveThroughVillageGoal.cpp +world/entity/ai/goal/MoveTowardsRestrictionGoal.cpp +world/entity/ai/goal/MoveTowardsTargetGoal.cpp +world/entity/ai/goal/OcelotAttackGoal.cpp +world/entity/ai/goal/OcelotSitOnTileGoal.cpp +world/entity/ai/goal/OfferFlowerGoal.cpp +world/entity/ai/goal/OpenDoorGoal.cpp +world/entity/ai/goal/PanicGoal.cpp +world/entity/ai/goal/PlayGoal.cpp +world/entity/ai/goal/RandomLookAroundGoal.cpp +world/entity/ai/goal/RandomStrollGoal.cpp +world/entity/ai/goal/RangedAttackGoal.cpp +world/entity/ai/goal/RestrictOpenDoorGoal.cpp +world/entity/ai/goal/RestrictSunGoal.cpp +world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp +world/entity/ai/goal/SitGoal.cpp +world/entity/ai/goal/SwellGoal.cpp +world/entity/ai/goal/TakeFlowerGoal.cpp +world/entity/ai/goal/TemptGoal.cpp +world/entity/ai/goal/TradeWithPlayerGoal.cpp +world/entity/ai/goal/target/DefendVillageTargetGoal.cpp +world/entity/ai/goal/target/HurtByTargetGoal.cpp +world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp +world/entity/ai/goal/target/NonTameRandomTargetGoal.cpp +world/entity/ai/goal/target/OwnerHurtByTargetGoal.cpp +world/entity/ai/goal/target/OwnerHurtTargetGoal.cpp +world/entity/ai/goal/target/TargetGoal.cpp +world/entity/ai/navigation/PathNavigation.cpp +world/entity/ai/sensing/Sensing.cpp +world/entity/ai/util/RandomPos.cpp +world/entity/ai/village/DoorInfo.cpp +world/entity/ai/village/Village.cpp +world/entity/ai/village/VillageSiege.cpp +world/entity/ai/village/Villages.cpp +world/entity/ambient/AmbientCreature.cpp +world/entity/ambient/Bat.cpp +world/entity/animal/Animal.cpp +world/entity/animal/Chicken.cpp +world/entity/animal/Cow.cpp +world/entity/animal/EntityHorse.cpp +world/entity/animal/Golem.cpp +world/entity/animal/MushroomCow.cpp +world/entity/animal/Ocelot.cpp +world/entity/animal/Pig.cpp +world/entity/animal/Sheep.cpp +world/entity/animal/SnowMan.cpp +world/entity/animal/Squid.cpp +world/entity/animal/VillagerGolem.cpp +world/entity/animal/WaterAnimal.cpp +world/entity/animal/Wolf.cpp +world/entity/boss/MultiEntityMobPart.cpp +world/entity/boss/enderdragon/EnderCrystal.cpp +world/entity/boss/enderdragon/EnderDragon.cpp +world/entity/boss/wither/WitherBoss.cpp +world/entity/global/GlobalEntity.cpp +world/entity/global/LightningBolt.cpp +world/entity/item/Boat.cpp +world/entity/item/FallingTile.cpp +world/entity/item/ItemEntity.cpp +world/entity/item/Minecart.cpp +world/entity/item/MinecartChest.cpp +world/entity/item/MinecartContainer.cpp +world/entity/item/MinecartFurnace.cpp +world/entity/item/MinecartHopper.cpp +world/entity/item/MinecartRideable.cpp +world/entity/item/MinecartSpawner.cpp +world/entity/item/MinecartTNT.cpp +world/entity/item/PrimedTnt.cpp +world/entity/monster/Blaze.cpp +world/entity/monster/CaveSpider.cpp +world/entity/monster/Creeper.cpp +world/entity/monster/EnderMan.cpp +world/entity/monster/Enemy.cpp +world/entity/monster/Ghast.cpp +world/entity/monster/Giant.cpp +world/entity/monster/LavaSlime.cpp +world/entity/monster/Monster.cpp +world/entity/monster/PigZombie.cpp +world/entity/monster/SharedMonsterAttributes.cpp +world/entity/monster/Silverfish.cpp +world/entity/monster/Skeleton.cpp +world/entity/monster/Slime.cpp +world/entity/monster/Spider.cpp +world/entity/monster/Witch.cpp +world/entity/monster/Zombie.cpp +world/entity/npc/ClientSideMerchant.cpp +world/entity/npc/Npc.cpp +world/entity/npc/Villager.cpp +world/entity/player/Abilities.cpp +world/entity/player/Inventory.cpp +world/entity/player/Player.cpp +world/entity/projectile/Arrow.cpp +world/entity/projectile/DragonFireball.cpp +world/entity/projectile/EyeOfEnderSignal.cpp +world/entity/projectile/Fireball.cpp +world/entity/projectile/FireworksRocketEntity.cpp +world/entity/projectile/FishingHook.cpp +world/entity/projectile/LargeFireball.cpp +world/entity/projectile/SmallFireball.cpp +world/entity/projectile/Snowball.cpp +world/entity/projectile/Throwable.cpp +world/entity/projectile/ThrownEgg.cpp +world/entity/projectile/ThrownEnderpearl.cpp +world/entity/projectile/ThrownExpBottle.cpp +world/entity/projectile/ThrownPotion.cpp +world/entity/projectile/WitherSkull.cpp +world/food/FoodConstants.cpp +world/food/FoodData.cpp +world/inventory/AbstractContainerMenu.cpp +world/inventory/AnimalChest.cpp +world/inventory/AnvilMenu.cpp +world/inventory/ArmorSlot.cpp +world/inventory/BeaconMenu.cpp +world/inventory/BrewingStandMenu.cpp +world/inventory/ContainerMenu.cpp +world/inventory/CraftingContainer.cpp +world/inventory/CraftingMenu.cpp +world/inventory/EnchantmentContainer.cpp +world/inventory/EnchantmentMenu.cpp +world/inventory/FireworksMenu.cpp +world/inventory/FurnaceMenu.cpp +world/inventory/FurnaceResultSlot.cpp +world/inventory/HopperMenu.cpp +world/inventory/HorseInventoryMenu.cpp +world/inventory/InventoryMenu.cpp +world/inventory/MenuBackup.cpp +world/inventory/MerchantContainer.cpp +world/inventory/MerchantMenu.cpp +world/inventory/MerchantResultSlot.cpp +world/inventory/PlayerEnderChestContainer.cpp +world/inventory/RepairContainer.cpp +world/inventory/RepairResultSlot.cpp +world/inventory/ResultContainer.cpp +world/inventory/ResultSlot.cpp +world/inventory/Slot.cpp +world/inventory/TrapMenu.cpp +world/item/AnvilTileItem.cpp +world/item/ArmorItem.cpp +world/item/AuxDataTileItem.cpp +world/item/BedItem.cpp +world/item/BoatItem.cpp +world/item/BookItem.cpp +world/item/BottleItem.cpp +world/item/BowItem.cpp +world/item/BowlFoodItem.cpp +world/item/BucketItem.cpp +world/item/CarrotOnAStickItem.cpp +world/item/ClockItem.cpp +world/item/CoalItem.cpp +world/item/ColoredTileItem.cpp +world/item/CompassItem.cpp +world/item/ComplexItem.cpp +world/item/DiggerItem.cpp +world/item/DoorItem.cpp +world/item/DyePowderItem.cpp +world/item/EggItem.cpp +world/item/EmptyMapItem.cpp +world/item/EnchantedBookItem.cpp +world/item/EnderEyeItem.cpp +world/item/EnderpearlItem.cpp +world/item/ExperienceItem.cpp +world/item/FireChargeItem.cpp +world/item/FireworksChargeItem.cpp +world/item/FireworksItem.cpp +world/item/FishingRodItem.cpp +world/item/FlintAndSteelItem.cpp +world/item/FoodItem.cpp +world/item/GoldenAppleItem.cpp +world/item/HangingEntityItem.cpp +world/item/HatchetItem.cpp +world/item/HoeItem.cpp +world/item/Item.cpp +world/item/ItemInstance.cpp +world/item/LeafTileItem.cpp +world/item/LeashItem.cpp +world/item/MapItem.cpp +world/item/MilkBucketItem.cpp +world/item/MinecartItem.cpp +world/item/MultiTextureTileItem.cpp +world/item/NameTagItem.cpp +world/item/PickaxeItem.cpp +world/item/PistonTileItem.cpp +world/item/PlanterTileItem.cpp +world/item/PotionItem.cpp +world/item/Rarity.cpp +world/item/RecordingItem.cpp +world/item/RedStoneItem.cpp +world/item/SaddleItem.cpp +world/item/SaplingTileItem.cpp +world/item/SeedFoodItem.cpp +world/item/SeedItem.cpp +world/item/ShearsItem.cpp +world/item/ShovelItem.cpp +world/item/SignItem.cpp +world/item/SimpleFoiledItem.cpp +world/item/SkullItem.cpp +world/item/SnowItem.cpp +world/item/SnowballItem.cpp +world/item/SpawnEggItem.cpp +world/item/StoneSlabTileItem.cpp +world/item/TileItem.cpp +world/item/WaterLilyTileItem.cpp +world/item/WeaponItem.cpp +world/item/WoolTileItem.cpp +world/item/alchemy/PotionBrewing.cpp +world/item/crafting/ArmorDyeRecipe.cpp +world/item/crafting/ArmorRecipes.cpp +world/item/crafting/ClothDyeRecipes.cpp +world/item/crafting/FireworksRecipe.cpp +world/item/crafting/FoodRecipes.cpp +world/item/crafting/FurnaceRecipes.cpp +world/item/crafting/OreRecipes.cpp +world/item/crafting/Recipes.cpp +world/item/crafting/ShapedRecipy.cpp +world/item/crafting/ShapelessRecipy.cpp +world/item/crafting/StructureRecipes.cpp +world/item/crafting/ToolRecipes.cpp +world/item/crafting/WeaponRecipes.cpp +world/item/enchantment/ArrowDamageEnchantment.cpp +world/item/enchantment/ArrowFireEnchantment.cpp +world/item/enchantment/ArrowInfiniteEnchantment.cpp +world/item/enchantment/ArrowKnockbackEnchantment.cpp +world/item/enchantment/DamageEnchantment.cpp +world/item/enchantment/DigDurabilityEnchantment.cpp +world/item/enchantment/DiggingEnchantment.cpp +world/item/enchantment/Enchantment.cpp +world/item/enchantment/EnchantmentCategory.cpp +world/item/enchantment/EnchantmentHelper.cpp +world/item/enchantment/EnchantmentInstance.cpp +world/item/enchantment/FireAspectEnchantment.cpp +world/item/enchantment/KnockbackEnchantment.cpp +world/item/enchantment/LootBonusEnchantment.cpp +world/item/enchantment/OxygenEnchantment.cpp +world/item/enchantment/ProtectionEnchantment.cpp +world/item/enchantment/ThornsEnchantment.cpp +world/item/enchantment/UntouchingEnchantment.cpp +world/item/enchantment/WaterWorkerEnchantment.cpp +world/item/trading/MerchantRecipe.cpp +world/item/trading/MerchantRecipeList.cpp +world/level/BaseMobSpawner.cpp +world/level/BlockDestructionProgress.cpp +world/level/Calendar.cpp +world/level/ChunkPos.cpp +world/level/Explosion.cpp +world/level/FoliageColor.cpp +world/level/GameRules.cpp +world/level/GrassColor.cpp +world/level/Level.cpp +world/level/LevelSettings.cpp +world/level/LevelType.cpp +world/level/MobSpawner.cpp +world/level/PortalForcer.cpp +world/level/Region.cpp +world/level/TickNextTickData.cpp +world/level/TileEventData.cpp +world/level/TilePos.cpp +world/level/WaterColor.cpp +world/level/WstringLookup.cpp +world/level/biome/BeachBiome.cpp +world/level/biome/Biome.cpp +world/level/biome/BiomeCache.cpp +world/level/biome/BiomeDecorator.cpp +world/level/biome/BiomeSource.cpp +world/level/biome/DesertBiome.cpp +world/level/biome/ExtremeHillsBiome.cpp +world/level/biome/FixedBiomeSource.cpp +world/level/biome/ForestBiome.cpp +world/level/biome/HellBiome.cpp +world/level/biome/IceBiome.cpp +world/level/biome/JungleBiome.cpp +world/level/biome/MushroomIslandBiome.cpp +world/level/biome/PlainsBiome.cpp +world/level/biome/RainforestBiome.cpp +world/level/biome/SwampBiome.cpp +world/level/biome/TaigaBiome.cpp +world/level/biome/TheEndBiome.cpp +world/level/biome/TheEndBiomeDecorator.cpp +world/level/biome/WaterlilyFeature.cpp +world/level/chunk/BlockReplacements.cpp +world/level/chunk/CompressedTileStorage.cpp +world/level/chunk/DataLayer.cpp +world/level/chunk/EmptyLevelChunk.cpp +world/level/chunk/LevelChunk.cpp +world/level/chunk/ReadOnlyChunkCache.cpp +world/level/chunk/SparseDataStorage.cpp +world/level/chunk/SparseLightStorage.cpp +world/level/chunk/WaterLevelChunk.cpp +world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +world/level/chunk/storage/McRegionChunkStorage.cpp +world/level/chunk/storage/OldChunkStorage.cpp +world/level/chunk/storage/RegionFile.cpp +world/level/chunk/storage/RegionFileCache.cpp +world/level/dimension/Dimension.cpp +world/level/dimension/HellDimension.cpp +world/level/dimension/TheEndDimension.cpp +world/level/levelgen/CanyonFeature.cpp +world/level/levelgen/ConsoleSchematicFile.cpp +world/level/levelgen/CustomLevelSource.cpp +world/level/levelgen/DungeonFeature.cpp +world/level/levelgen/FlatLevelSource.cpp +world/level/levelgen/HellFlatLevelSource.cpp +world/level/levelgen/HellRandomLevelSource.cpp +world/level/levelgen/LargeCaveFeature.cpp +world/level/levelgen/LargeFeature.cpp +world/level/levelgen/LargeHellCaveFeature.cpp +world/level/levelgen/RandomLevelSource.cpp +world/level/levelgen/TheEndLevelRandomLevelSource.cpp +world/level/levelgen/feature/BasicTreeFeature.cpp +world/level/levelgen/feature/BirchFeature.cpp +world/level/levelgen/feature/BonusChestFeature.cpp +world/level/levelgen/feature/CactusFeature.cpp +world/level/levelgen/feature/CaveFeature.cpp +world/level/levelgen/feature/ClayFeature.cpp +world/level/levelgen/feature/DeadBushFeature.cpp +world/level/levelgen/feature/DesertWellFeature.cpp +world/level/levelgen/feature/EndPodiumFeature.cpp +world/level/levelgen/feature/Feature.cpp +world/level/levelgen/feature/FlowerFeature.cpp +world/level/levelgen/feature/GroundBushFeature.cpp +world/level/levelgen/feature/HellFireFeature.cpp +world/level/levelgen/feature/HellPortalFeature.cpp +world/level/levelgen/feature/HellSpringFeature.cpp +world/level/levelgen/feature/HouseFeature.cpp +world/level/levelgen/feature/HugeMushroomFeature.cpp +world/level/levelgen/feature/LakeFeature.cpp +world/level/levelgen/feature/LightGemFeature.cpp +world/level/levelgen/feature/MegaTreeFeature.cpp +world/level/levelgen/feature/MonsterRoomFeature.cpp +world/level/levelgen/feature/NetherSphereFeature.cpp +world/level/levelgen/feature/OreFeature.cpp +world/level/levelgen/feature/PineFeature.cpp +world/level/levelgen/feature/PumpkinFeature.cpp +world/level/levelgen/feature/ReedsFeature.cpp +world/level/levelgen/feature/SandFeature.cpp +world/level/levelgen/feature/SpikeFeature.cpp +world/level/levelgen/feature/SpringFeature.cpp +world/level/levelgen/feature/SpruceFeature.cpp +world/level/levelgen/feature/SwampTreeFeature.cpp +world/level/levelgen/feature/TallGrassFeature.cpp +world/level/levelgen/feature/TreeFeature.cpp +world/level/levelgen/feature/VinesFeature.cpp +world/level/levelgen/flat/FlatGeneratorInfo.cpp +world/level/levelgen/flat/FlatLayerInfo.cpp +world/level/levelgen/structure/BlockGenMethods.cpp +world/level/levelgen/structure/BoundingBox.cpp +world/level/levelgen/structure/MineShaftFeature.cpp +world/level/levelgen/structure/MineShaftPieces.cpp +world/level/levelgen/structure/MineShaftStart.cpp +world/level/levelgen/structure/NetherBridgeFeature.cpp +world/level/levelgen/structure/NetherBridgePieces.cpp +world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +world/level/levelgen/structure/ScatteredFeaturePieces.cpp +world/level/levelgen/structure/StrongholdFeature.cpp +world/level/levelgen/structure/StrongholdPieces.cpp +world/level/levelgen/structure/StructureFeature.cpp +world/level/levelgen/structure/StructureFeatureIO.cpp +world/level/levelgen/structure/StructureFeatureSavedData.cpp +world/level/levelgen/structure/StructurePiece.cpp +world/level/levelgen/structure/StructureStart.cpp +world/level/levelgen/structure/VillageFeature.cpp +world/level/levelgen/structure/VillagePieces.cpp +world/level/levelgen/synth/Distort.cpp +world/level/levelgen/synth/Emboss.cpp +world/level/levelgen/synth/FastNoise.cpp +world/level/levelgen/synth/ImprovedNoise.cpp +world/level/levelgen/synth/PerlinNoise.cpp +world/level/levelgen/synth/PerlinSimplexNoise.cpp +world/level/levelgen/synth/Rotate.cpp +world/level/levelgen/synth/Scale.cpp +world/level/levelgen/synth/SimplexNoise.cpp +world/level/levelgen/synth/Synth.cpp +world/level/material/Material.cpp +world/level/material/MaterialColor.cpp +world/level/newbiome/layer/AddIslandLayer.cpp +world/level/newbiome/layer/AddMushroomIslandLayer.cpp +world/level/newbiome/layer/AddSnowLayer.cpp +world/level/newbiome/layer/BiomeInitLayer.cpp +world/level/newbiome/layer/BiomeOverrideLayer.cpp +world/level/newbiome/layer/DownfallLayer.cpp +world/level/newbiome/layer/DownfallMixerLayer.cpp +world/level/newbiome/layer/FlatLayer.cpp +world/level/newbiome/layer/FuzzyZoomLayer.cpp +world/level/newbiome/layer/GrowMushroomIslandLayer.cpp +world/level/newbiome/layer/IslandLayer.cpp +world/level/newbiome/layer/Layer.cpp +world/level/newbiome/layer/RegionHillsLayer.cpp +world/level/newbiome/layer/RiverInitLayer.cpp +world/level/newbiome/layer/RiverLayer.cpp +world/level/newbiome/layer/RiverMixerLayer.cpp +world/level/newbiome/layer/ShoreLayer.cpp +world/level/newbiome/layer/SmoothLayer.cpp +world/level/newbiome/layer/SmoothZoomLayer.cpp +world/level/newbiome/layer/SwampRiversLayer.cpp +world/level/newbiome/layer/TemperatureLayer.cpp +world/level/newbiome/layer/TemperatureMixerLayer.cpp +world/level/newbiome/layer/VoronoiZoom.cpp +world/level/newbiome/layer/ZoomLayer.cpp +world/level/pathfinder/BinaryHeap.cpp +world/level/pathfinder/Node.cpp +world/level/pathfinder/Path.cpp +world/level/pathfinder/PathFinder.cpp +world/level/redstone/Redstone.cpp +world/level/saveddata/MapItemSavedData.cpp +world/level/saveddata/SavedData.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileInputStream.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOutputStream.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +world/level/storage/ConsoleSaveFileIO/compression.cpp +world/level/storage/DerivedLevelData.cpp +world/level/storage/DirectoryLevelStorage.cpp +world/level/storage/DirectoryLevelStorageSource.cpp +world/level/storage/LevelData.cpp +world/level/storage/LevelStorage.cpp +world/level/storage/LevelStorageProfilerDecorator.cpp +world/level/storage/LevelSummary.cpp +world/level/storage/McRegionLevelStorage.cpp +world/level/storage/McRegionLevelStorageSource.cpp +world/level/storage/MockedLevelStorage.cpp +world/level/storage/SavedDataStorage.cpp +world/level/tile/AirTile.cpp +world/level/tile/AnvilTile.cpp +world/level/tile/BaseEntityTile.cpp +world/level/tile/BasePressurePlateTile.cpp +world/level/tile/BaseRailTile.cpp +world/level/tile/BeaconTile.cpp +world/level/tile/BedTile.cpp +world/level/tile/BookshelfTile.cpp +world/level/tile/BrewingStandTile.cpp +world/level/tile/ButtonTile.cpp +world/level/tile/CactusTile.cpp +world/level/tile/CakeTile.cpp +world/level/tile/CarrotTile.cpp +world/level/tile/CauldronTile.cpp +world/level/tile/ChestTile.cpp +world/level/tile/ClayTile.cpp +world/level/tile/CocoaTile.cpp +world/level/tile/ColoredTile.cpp +world/level/tile/CommandBlock.cpp +world/level/tile/ComparatorTile.cpp +world/level/tile/CoralTile.cpp +world/level/tile/CropTile.cpp +world/level/tile/DaylightDetectorTile.cpp +world/level/tile/DeadBushTile.cpp +world/level/tile/DetectorRailTile.cpp +world/level/tile/DiodeTile.cpp +world/level/tile/DirectionalTile.cpp +world/level/tile/DirtTile.cpp +world/level/tile/DispenserTile.cpp +world/level/tile/DoorTile.cpp +world/level/tile/DropperTile.cpp +world/level/tile/EggTile.cpp +world/level/tile/EnchantmentTableTile.cpp +world/level/tile/EnderChestTile.cpp +world/level/tile/FarmTile.cpp +world/level/tile/FenceGateTile.cpp +world/level/tile/FenceTile.cpp +world/level/tile/FireTile.cpp +world/level/tile/FlowerPotTile.cpp +world/level/tile/FurnaceTile.cpp +world/level/tile/GlassTile.cpp +world/level/tile/GlowstoneTile.cpp +world/level/tile/GrassTile.cpp +world/level/tile/GravelTile.cpp +world/level/tile/HalfSlabTile.cpp +world/level/tile/HalfTransparentTile.cpp +world/level/tile/HayBlockTile.cpp +world/level/tile/HeavyTile.cpp +world/level/tile/HopperTile.cpp +world/level/tile/HugeMushroomTile.cpp +world/level/tile/IceTile.cpp +world/level/tile/JukeboxTile.cpp +world/level/tile/LadderTile.cpp +world/level/tile/LeafTile.cpp +world/level/tile/LeverTile.cpp +world/level/tile/LiquidTile.cpp +world/level/tile/LiquidTileDynamic.cpp +world/level/tile/LiquidTileStatic.cpp +world/level/tile/LockedChestTile.cpp +world/level/tile/MelonTile.cpp +world/level/tile/MetalTile.cpp +world/level/tile/MobSpawnerTile.cpp +world/level/tile/MushroomPlantTile.cpp +world/level/tile/MycelTile.cpp +world/level/tile/NetherWartTile.cpp +world/level/tile/NetherrackTile.cpp +world/level/tile/NotGateTile.cpp +world/level/tile/NoteBlockTile.cpp +world/level/tile/ObsidianTile.cpp +world/level/tile/OreTile.cpp +world/level/tile/PlantTile.cpp +world/level/tile/PortalTile.cpp +world/level/tile/PotatoTile.cpp +world/level/tile/PoweredMetalTile.cpp +world/level/tile/PoweredRailTile.cpp +world/level/tile/PressurePlateTile.cpp +world/level/tile/PumpkinTile.cpp +world/level/tile/QuartzBlockTile.cpp +world/level/tile/RailTile.cpp +world/level/tile/RedStoneDustTile.cpp +world/level/tile/RedStoneOreTile.cpp +world/level/tile/RedlightTile.cpp +world/level/tile/ReedTile.cpp +world/level/tile/RepeaterTile.cpp +world/level/tile/RotatedPillarTile.cpp +world/level/tile/SandStoneTile.cpp +world/level/tile/SaplingPlantTile.cpp +world/level/tile/SignTile.cpp +world/level/tile/SkullTile.cpp +world/level/tile/SmoothStoneBrickTile.cpp +world/level/tile/SnowTile.cpp +world/level/tile/SoulSandTile.cpp +world/level/tile/SpongeTile.cpp +world/level/tile/StainedGlassBlock.cpp +world/level/tile/StainedGlassPaneBlock.cpp +world/level/tile/StairTile.cpp +world/level/tile/StemTile.cpp +world/level/tile/StoneButtonTile.cpp +world/level/tile/StoneMonsterTile.cpp +world/level/tile/StoneSlabTile.cpp +world/level/tile/StoneTile.cpp +world/level/tile/TallGrassPlantTile.cpp +world/level/tile/TheEndPortalFrameTile.cpp +world/level/tile/ThinFenceTile.cpp +world/level/tile/Tile.cpp +world/level/tile/TntTile.cpp +world/level/tile/TopSnowTile.cpp +world/level/tile/TorchTile.cpp +world/level/tile/TransparentTile.cpp +world/level/tile/TrapDoorTile.cpp +world/level/tile/TreeTile.cpp +world/level/tile/TripWireSourceTile.cpp +world/level/tile/TripWireTile.cpp +world/level/tile/VineTile.cpp +world/level/tile/WallTile.cpp +world/level/tile/WaterLilyTile.cpp +world/level/tile/WebTile.cpp +world/level/tile/WeightedPressurePlateTile.cpp +world/level/tile/WoodButtonTile.cpp +world/level/tile/WoodSlabTile.cpp +world/level/tile/WoodTile.cpp +world/level/tile/WoolCarpetTile.cpp +world/level/tile/WorkbenchTile.cpp +world/level/tile/entity/BeaconTileEntity.cpp +world/level/tile/entity/BrewingStandTileEntity.cpp +world/level/tile/entity/ChestTileEntity.cpp +world/level/tile/entity/CommandBlockEntity.cpp +world/level/tile/entity/ComparatorTileEntity.cpp +world/level/tile/entity/DaylightDetectorTileEntity.cpp +world/level/tile/entity/DispenserTileEntity.cpp +world/level/tile/entity/DropperTileEntity.cpp +world/level/tile/entity/EnchantmentTableTileEntity.cpp +world/level/tile/entity/EnderChestTileEntity.cpp +world/level/tile/entity/FurnaceTileEntity.cpp +world/level/tile/entity/HopperTileEntity.cpp +world/level/tile/entity/MobSpawnerTileEntity.cpp +world/level/tile/entity/MusicTileEntity.cpp +world/level/tile/entity/PistonMovingTileEntity.cpp +world/level/tile/entity/PistonPieceTileEntity.cpp +world/level/tile/entity/SignTileEntity.cpp +world/level/tile/entity/SkullTileEntity.cpp +world/level/tile/entity/TheEndPortalTile.cpp +world/level/tile/entity/TheEndPortalTileEntity.cpp +world/level/tile/entity/TileEntity.cpp +world/level/tile/piston/PistonBaseTile.cpp +world/level/tile/piston/PistonExtensionTile.cpp +world/phys/AABB.cpp +world/phys/HitResult.cpp +world/phys/Vec3.cpp +world/scores/Objective.cpp +world/scores/PlayerTeam.cpp +world/scores/Score.cpp +world/scores/Scoreboard.cpp +world/scores/Team.cpp +world/scores/criteria/DummyCriteria.cpp +world/scores/criteria/HealthCriteria.cpp +world/scores/criteria/ObjectiveCriteria.cpp diff --git a/targets/minecraft/stats/Achievement.cpp b/targets/minecraft/stats/Achievement.cpp index 774b02595..3e134bd40 100644 --- a/targets/minecraft/stats/Achievement.cpp +++ b/targets/minecraft/stats/Achievement.cpp @@ -52,8 +52,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Item* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -63,8 +62,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Tile* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -75,8 +73,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(icon), x(x), y(y), diff --git a/targets/minecraft/stats/Achievements.cpp b/targets/minecraft/stats/Achievements.cpp index 767edebbc..839f3d685 100644 --- a/targets/minecraft/stats/Achievements.cpp +++ b/targets/minecraft/stats/Achievements.cpp @@ -5,7 +5,7 @@ #include #include "Achievement.h" -#include "app/common/Console_Awards_enum.h" +#include "minecraft/stats/Console_Awards_enum.h" #include "minecraft/world/item/BowItem.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" @@ -220,8 +220,8 @@ void Achievements::staticCtor() { Tile::treeTrunk, (Achievement*)buildSword)) ->postConstruct(); Achievements::socialPost = - (new Achievement(eAward_socialPost, "socialPost", 0, 0, - Tile::treeTrunk, (Achievement*)buildSword)) + (new Achievement(eAward_socialPost, "socialPost", 0, 0, Tile::treeTrunk, + (Achievement*)buildSword)) ->postConstruct(); // WARNING: NO NEW ACHIEVMENTS CAN BE ADDED HERE @@ -235,8 +235,8 @@ void Achievements::staticCtor() { // 4J Stu - This achievment added in 1.8.2, but does not map to any Xbox // achievements Achievements::snipeSkeleton = - (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, - Item::bow, (Achievement*)killEnemy)) + (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, Item::bow, + (Achievement*)killEnemy)) ->setGolden() ->postConstruct(); @@ -317,13 +317,13 @@ void Achievements::staticCtor() { // 0,0, Tile::bookshelf, (Achievement*) nullptr) // )->postConstruct(); Achievements::theHaggler = - (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::potPlanter = - (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::itsASign = diff --git a/targets/minecraft/stats/CommonStats.h b/targets/minecraft/stats/CommonStats.h index 47eacd2d4..2ce7232ce 100644 --- a/targets/minecraft/stats/CommonStats.h +++ b/targets/minecraft/stats/CommonStats.h @@ -6,8 +6,8 @@ #include #include "GenericStats.h" -#include "app/common/Console_Awards_enum.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class CommonStats : public GenericStats { protected: diff --git a/targets/app/common/Console_Awards_enum.h b/targets/minecraft/stats/Console_Awards_enum.h similarity index 100% rename from targets/app/common/Console_Awards_enum.h rename to targets/minecraft/stats/Console_Awards_enum.h diff --git a/targets/minecraft/stats/GenericStats.h b/targets/minecraft/stats/GenericStats.h index 6d25d356a..374915e5c 100644 --- a/targets/minecraft/stats/GenericStats.h +++ b/targets/minecraft/stats/GenericStats.h @@ -6,10 +6,10 @@ #include #include -#include "app/common/Console_Awards_enum.h" #include "Stat.h" #include "Stats.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class DamageSource; class ItemInstance; @@ -19,7 +19,7 @@ class Stat; // #include "minecraft/world/damageSource/DamageSource.h" -// #include "app/common/Console_Awards_enum.h" +// #include "minecraft/stats/Console_Awards_enum.h" /** 4J-JEV: diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index e7ef7339e..744bd2b2b 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -8,9 +8,8 @@ #include #include "GenericStats.h" -#include "minecraft/IGameServices.h" -#include "app/linux/LinuxGame.h" #include "StatFormatter.h" +#include "minecraft/IGameServices.h" class DecimalFormat; class LocalPlayer; diff --git a/targets/minecraft/stats/Stats.cpp b/targets/minecraft/stats/Stats.cpp index 804d6a6b2..3636bd8f4 100644 --- a/targets/minecraft/stats/Stats.cpp +++ b/targets/minecraft/stats/Stats.cpp @@ -6,7 +6,6 @@ #include "Achievements.h" #include "GeneralStat.h" #include "ItemStat.h" -#include "util/StringHelpers.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/item/FishingRodItem.h" @@ -14,6 +13,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/GrassTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class StatFormatter; @@ -171,8 +171,8 @@ bool Stats::blockStatsLoaded = false; void Stats::buildBlockStats() { blocksMined = std::vector(32000); - ItemStat* newStat = new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", - Tile::dirt->id); + ItemStat* newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", Tile::dirt->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::dirt->id] = newStat; blocksMined[Tile::grass->id] = newStat; @@ -185,8 +185,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::cobblestone->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", - Tile::sand->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", Tile::sand->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::sand->id] = newStat; newStat->postConstruct(); @@ -203,8 +203,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::gravel->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", - Tile::clay->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", Tile::clay->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::clay->id] = newStat; newStat->postConstruct(); @@ -390,9 +390,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::pickAxe_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", - Item::pickAxe_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", + Item::pickAxe_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::pickAxe_diamond->id] = newStat; newStat->postConstruct(); @@ -415,9 +414,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::shovel_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", - Item::shovel_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", + Item::shovel_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::shovel_diamond->id] = newStat; newStat->postConstruct(); @@ -512,8 +510,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::bucket_empty->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, - "craftItem.flintAndSteel", Item::flintAndSteel->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, "craftItem.flintAndSteel", + Item::flintAndSteel->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::flintAndSteel->id] = newStat; newStat->postConstruct(); @@ -536,8 +534,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::compass->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", - Item::map->id); + newStat = + new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", Item::map->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::map->id] = newStat; newStat->postConstruct(); @@ -602,8 +600,8 @@ void Stats::buildAdditionalStats() { // we don't need those record items (and we only need 2). blocksPlaced = std::vector(1000); - itemStat = new ItemStat(offset++, "blockPlaced.flowerPot", - Tile::flowerPot_Id); + itemStat = + new ItemStat(offset++, "blockPlaced.flowerPot", Tile::flowerPot_Id); blocksPlacedStats->push_back(itemStat); blocksPlaced[itemStat->getItemId()] = itemStat; itemStat->postConstruct(); diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 6f3e77bd2..84e291844 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "StatsCounter.h" #include @@ -10,17 +9,18 @@ #include #include -#include "platform/profile/profile.h" #include "app/common/App_structs.h" -#include "app/common/Leaderboards/LeaderboardManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/leaderboard/IPlatformLeaderboard.h" +#include "platform/profile/profile.h" Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, &Stats::fallOneM, &Stats::climbOneM, @@ -29,7 +29,8 @@ Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, std::unordered_map StatsCounter::statBoards; -StatsCounter::StatsCounter() { +StatsCounter::StatsCounter(IPlatformLeaderboard& leaderboard) + : m_leaderboard(leaderboard) { requiresSave = false; saveCounter = 0; modifiedBoards = 0; @@ -69,7 +70,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, statBoards.find(stat); if (leaderboardEntry != statBoards.end()) { Log::info("[StatsCounter] award(): %X\n", - leaderboardEntry->second << difficulty); + leaderboardEntry->second << difficulty); modifiedBoards |= (leaderboardEntry->second << difficulty); if (flushCounter == 0) flushCounter = FLUSH_DELAY; } @@ -186,8 +187,7 @@ void StatsCounter::save(int player, bool force) { (LARGE_STATS_COUNT * 4 * (sizeof(unsigned int) - sizeof(unsigned short))); assert(uiTotalStatsSize <= - (Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS))); + (Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS))); // Retrieve the data pointer from the profile std::uint8_t* pbData = reinterpret_cast( @@ -199,8 +199,7 @@ void StatsCounter::save(int player, bool force) { // Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, - Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS)); + Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS)); // For each stat StatsMap::iterator val; @@ -250,9 +249,9 @@ void StatsCounter::save(int player, bool force) { } void StatsCounter::flushLeaderboards() { - if (LeaderboardManager::Instance()->OpenSession()) { + if (m_leaderboard.OpenSession()) { writeStats(); - LeaderboardManager::Instance()->FlushStats(); + m_leaderboard.FlushStats(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); @@ -266,9 +265,9 @@ void StatsCounter::flushLeaderboards() { } void StatsCounter::saveLeaderboards() { - if (LeaderboardManager::Instance()->OpenSession()) { + if (m_leaderboard.OpenSession()) { writeStats(); - LeaderboardManager::Instance()->CloseSession(); + m_leaderboard.CloseSession(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); @@ -357,8 +356,8 @@ void StatsCounter::dumpStatsToTTY() { for (std::vector::iterator statsIter = Stats::all->begin(); statsIter != statsEnd; ++statsIter) { Log::info("%s\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), - getValue(*statsIter, 0), getValue(*statsIter, 1), - getValue(*statsIter, 2), getValue(*statsIter, 3)); + getValue(*statsIter, 0), getValue(*statsIter, 1), + getValue(*statsIter, 2), getValue(*statsIter, 3)); } } diff --git a/targets/minecraft/stats/StatsCounter.h b/targets/minecraft/stats/StatsCounter.h index c93d4e5fe..6f064e8a7 100644 --- a/targets/minecraft/stats/StatsCounter.h +++ b/targets/minecraft/stats/StatsCounter.h @@ -2,6 +2,7 @@ #include #include +class IPlatformLeaderboard; class Stat; class Achievement; class StatsSyncher; @@ -70,8 +71,13 @@ private: static std::unordered_map statBoards; int flushCounter; + // Borrowed from the composition root - StatsCounter does not own the + // backend. The reference is valid for the lifetime of the StatsCounter + // (the leaderboard outlives all StatsCounter instances). + IPlatformLeaderboard& m_leaderboard; + public: - StatsCounter(); + explicit StatsCounter(IPlatformLeaderboard& leaderboard); void award(Stat* stat, unsigned int difficulty, unsigned int count); bool hasTaken(Achievement* ach); bool canTake(Achievement* ach); diff --git a/targets/minecraft/util/Hasher.cpp b/targets/minecraft/util/Hasher.cpp index feeb01f38..60d8c67f7 100644 --- a/targets/minecraft/util/Hasher.cpp +++ b/targets/minecraft/util/Hasher.cpp @@ -1,17 +1,30 @@ -#if defined(_WIN32) -#include -#else +// #if defined(_WIN32) +// #include +// #else #include #include -#endif // _WIN32 -#include -#include +// #endif // _WIN32 +// #include +// #include #include "Hasher.h" Hasher::Hasher(std::string& salt) { this->salt = salt; } std::string Hasher::getHash(std::string& name) { + // 4jcraft: stubbed for portability reasons. + // + // The OpenSSL meson is broken on windows and expects winsock to + // be statically linked (which is dumb since we only want libcrypto + // for MD5 hashing), and avoiding a dependency on libcrypto here is + // probably a good thing either way for some platforms. + // + // Given that this class isn't used and im lazy, we're just gonna do + // this until it becomes a problem. This class isnt actually used + // anywhere at the moment anyways so it's whatever. + return ""; + +#if 0 #if defined(_WIN32) // 4J Stu - Removed try/catch // try { @@ -46,4 +59,5 @@ std::string Hasher::getHash(std::string& name) { std::string hash_str = ss.str(); return std::string(hash_str.begin(), hash_str.end()); #endif +#endif } diff --git a/targets/minecraft/util/HtmlString.h b/targets/minecraft/util/HtmlString.h index c8c73bbb0..a01d366c9 100644 --- a/targets/minecraft/util/HtmlString.h +++ b/targets/minecraft/util/HtmlString.h @@ -9,7 +9,7 @@ // 4J: Simple std::string wrapper that includes basic formatting information class HtmlString { public: - std::string text; // Text content of std::string + std::string text; // Text content of std::string eMinecraftColour color; // Hex color bool italics; // Show text in italics bool indent; // Indent text diff --git a/targets/minecraft/util/Log.h b/targets/minecraft/util/Log.h index ee70d553b..b353b244d 100644 --- a/targets/minecraft/util/Log.h +++ b/targets/minecraft/util/Log.h @@ -5,11 +5,22 @@ namespace Log { +#if defined(_FINAL_BUILD) +// In shipping builds, info traces compile to nothing - matches the +// historical Game::DebugPrintf behaviour. The varargs path is +// completely elided so format strings and their arguments are not +// even constructed. +inline void info(const char* /*fmt*/, ...) {} +#else +#if defined(__GNUC__) || defined(__clang__) +[[gnu::format(printf, 1, 2)]] +#endif inline void info(const char* fmt, ...) { va_list args; va_start(args, fmt); std::vfprintf(stderr, fmt, args); va_end(args); } +#endif } // namespace Log diff --git a/targets/minecraft/util/WeighedRandom.cpp b/targets/minecraft/util/WeighedRandom.cpp index 07a99f54d..55705a30d 100644 --- a/targets/minecraft/util/WeighedRandom.cpp +++ b/targets/minecraft/util/WeighedRandom.cpp @@ -1,10 +1,9 @@ #include "minecraft/util/WeighedRandom.h" -#include #include +#include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" int WeighedRandom::getTotalWeight(std::vector* items) { diff --git a/targets/minecraft/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index 8672c3384..71d187fe6 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,7 +1,6 @@ -#include "minecraft/IGameServices.h" #include "CompoundContainer.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/world/Container.h" diff --git a/targets/minecraft/world/Container.h b/targets/minecraft/world/Container.h index b86b9de8e..82ec0632c 100644 --- a/targets/minecraft/world/Container.h +++ b/targets/minecraft/world/Container.h @@ -2,6 +2,7 @@ #include #include +#include class ItemInstance; class Player; diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 4d62020c0..9eaafc93a 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -1,9 +1,8 @@ -#include "minecraft/IGameServices.h" #include "SimpleContainer.h" #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/item/ItemInstance.h" #include "net.minecraft.world.ContainerListener.h" diff --git a/targets/minecraft/world/effect/AbsoptionMobEffect.h b/targets/minecraft/world/effect/AbsoptionMobEffect.h index 6796292a3..048ae000d 100644 --- a/targets/minecraft/world/effect/AbsoptionMobEffect.h +++ b/targets/minecraft/world/effect/AbsoptionMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; diff --git a/targets/minecraft/world/effect/AttackDamageMobEffect.h b/targets/minecraft/world/effect/AttackDamageMobEffect.h index fdf709fe0..649b3dbd8 100644 --- a/targets/minecraft/world/effect/AttackDamageMobEffect.h +++ b/targets/minecraft/world/effect/AttackDamageMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class AttributeModifier; diff --git a/targets/minecraft/world/effect/HealthBoostMobEffect.h b/targets/minecraft/world/effect/HealthBoostMobEffect.h index a84c6d0f4..a4be079df 100644 --- a/targets/minecraft/world/effect/HealthBoostMobEffect.h +++ b/targets/minecraft/world/effect/HealthBoostMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; class BaseAttributeMap; diff --git a/targets/minecraft/world/effect/InstantaneousMobEffect.h b/targets/minecraft/world/effect/InstantaneousMobEffect.h index da911bb52..871c355dd 100644 --- a/targets/minecraft/world/effect/InstantaneousMobEffect.h +++ b/targets/minecraft/world/effect/InstantaneousMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class InstantenousMobEffect : public MobEffect { public: diff --git a/targets/minecraft/world/effect/MobEffect.cpp b/targets/minecraft/world/effect/MobEffect.cpp index f282e7fc7..755839987 100644 --- a/targets/minecraft/world/effect/MobEffect.cpp +++ b/targets/minecraft/world/effect/MobEffect.cpp @@ -9,8 +9,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/AbsoptionMobEffect.h" diff --git a/targets/minecraft/world/effect/MobEffectInstance.cpp b/targets/minecraft/world/effect/MobEffectInstance.cpp index 9363619a0..c58290bde 100644 --- a/targets/minecraft/world/effect/MobEffectInstance.cpp +++ b/targets/minecraft/world/effect/MobEffectInstance.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/effect/MobEffectInstance.h" #include @@ -7,7 +5,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "nbt/CompoundTag.h" @@ -50,8 +48,7 @@ MobEffectInstance::MobEffectInstance(MobEffectInstance* copy) { void MobEffectInstance::update(MobEffectInstance* takeOver) { if (id != takeOver->id) { - Log::info( - "This method should only be called for matching effects!"); + Log::info("This method should only be called for matching effects!"); } if (takeOver->amplifier > amplifier) { amplifier = takeOver->amplifier; diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 129aaa98d..a74fe68ca 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Entity.h" #include @@ -17,12 +15,12 @@ #include "EntityIO.h" #include "EntityPos.h" #include "SyncedEntityData.h" -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -30,7 +28,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -686,12 +684,13 @@ void Entity::move(double xa, double ya, double za, bool isPlayerSneaking = onGround && isSneaking() && instanceof(eTYPE_PLAYER); + auto shared = shared_from_this(); + if (isPlayerSneaking) { double d = 0.05; AABB translated_bb = bb.move(xa, -1.0, 0.0); - while (xa != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + while (xa != 0 && level->getCubes(shared, &translated_bb)->empty()) { if (xa < d && xa >= -d) xa = 0; else if (xa > 0) @@ -702,8 +701,7 @@ void Entity::move(double xa, double ya, double za, } translated_bb = bb.move(0, -1.0, za); - while (za != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + while (za != 0 && level->getCubes(shared, &translated_bb)->empty()) { if (za < d && za >= -d) za = 0; else if (za > 0) @@ -715,7 +713,7 @@ void Entity::move(double xa, double ya, double za, translated_bb = bb.move(xa, -1.0, za); while (xa != 0 && za != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + level->getCubes(shared, &translated_bb)->empty()) { if (xa < d && xa >= -d) xa = 0; else if (xa > 0) @@ -735,7 +733,7 @@ void Entity::move(double xa, double ya, double za, AABB expanded = bb.expand(xa, ya, za); std::vector* aABBs = - level->getCubes(shared_from_this(), &expanded, noEntityCubes, true); + level->getCubes(shared, &expanded, noEntityCubes, true); // LAND FIRST, then x and z auto itEndAABB = aABBs->end(); diff --git a/targets/minecraft/world/entity/EntityIO.cpp b/targets/minecraft/world/entity/EntityIO.cpp index d98e58ad2..04be0a7b3 100644 --- a/targets/minecraft/world/entity/EntityIO.cpp +++ b/targets/minecraft/world/entity/EntityIO.cpp @@ -1,13 +1,12 @@ -#include "minecraft/util/Log.h" #include "EntityIO.h" #include #include "Entity.h" -#include "app/linux/LinuxGame.h" #include "Painting.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/ItemFrame.h" #include "minecraft/world/entity/LeashFenceKnotEntity.h" @@ -91,7 +90,7 @@ void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum) { idCreateMap->insert( std::unordered_map::value_type(id, - createFn)); + createFn)); classIdMap->insert( std::unordered_map::value_type(clas, id)); @@ -143,8 +142,8 @@ void EntityIO::staticCtor() { "FireworksRocketEntity", 22); setId(Boat::create, eTYPE_BOAT, "Boat", 41); - setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, - "MinecartRideable", 42); + setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, "MinecartRideable", + 42); setId(MinecartChest::create, eTYPE_MINECART_CHEST, "MinecartChest", 43); setId(MinecartFurnace::create, eTYPE_MINECART_FURNACE, "MinecartFurnace", 44); @@ -331,8 +330,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { entity->load(tag); } else { #ifdef _DEBUG - Log::info("Skipping Entity with id %s\n", - tag->getString("id").c_str()); + Log::info("Skipping Entity with id %s\n", tag->getString("id").c_str()); #endif } return entity; diff --git a/targets/minecraft/world/entity/EntityIO.h b/targets/minecraft/world/entity/EntityIO.h index 8693f099a..b214b6a50 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -5,10 +5,10 @@ #include #include "Entity.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/GameEnums.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; class CompoundTag; @@ -51,9 +51,8 @@ private: static void setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum); static void setId(entityCreateFn createFn, eINSTANCEOF clas, - const std::string& id, int idNum, - eMinecraftColour color1, eMinecraftColour color2, - int nameId); + const std::string& id, int idNum, eMinecraftColour color1, + eMinecraftColour color2, int nameId); public: static void staticCtor(); diff --git a/targets/minecraft/world/entity/ExperienceOrb.cpp b/targets/minecraft/world/entity/ExperienceOrb.cpp index 73de05d64..61eb4012c 100644 --- a/targets/minecraft/world/entity/ExperienceOrb.cpp +++ b/targets/minecraft/world/entity/ExperienceOrb.cpp @@ -5,10 +5,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 3720cb360..eed87daa7 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LivingEntity.h" #include @@ -14,7 +13,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -25,8 +24,8 @@ #include "minecraft/network/packet/TakeItemEntityPacket.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerLevel.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -338,8 +337,7 @@ int LivingEntity::decreaseAirSupply(int currentSupply) { } if (instanceof(eTYPE_PLAYER)) { Log::info("++++++++++ %s: Player decreasing air supply to %d\n", - level->isClientSide ? "CLIENT" : "SERVER", - currentSupply - 1); + level->isClientSide ? "CLIENT" : "SERVER", currentSupply - 1); } return currentSupply - 1; } @@ -423,8 +421,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("Attributes") && level != nullptr && !level->isClientSide) { SharedMonsterAttributes::loadAttributes( - getAttributes(), - (ListTag*)tag->getList("Attributes")); + getAttributes(), (ListTag*)tag->getList("Attributes")); } if (tag->contains("ActiveEffects")) { @@ -727,8 +724,8 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { // 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java // version. if (this->instanceof(eTYPE_PLAYER) && - (source == - DamageSource::lava)) // Only award when in lava (not any fire). + (source == DamageSource::lava)) // Only award when in lava (not + // any fire). { std::shared_ptr plr = std::dynamic_pointer_cast(shared_from_this()); @@ -1247,8 +1244,12 @@ void LivingEntity::jumpFromGround() { } void LivingEntity::travel(float xa, float ya) { - std::shared_ptr thisPlayer = - std::dynamic_pointer_cast(shared_from_this()); + // AP - dynamic_pointer_cast is a non-trivial call, use raw pointer instead + Player* thisPlayer = nullptr; + if (this->instanceof(eTYPE_PLAYER)) { + thisPlayer = (Player*)this; + } + if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying)) { double yo = y; moveRelative(xa, ya, useNewAi() ? 0.04f : 0.02f); @@ -1276,12 +1277,13 @@ void LivingEntity::travel(float xa, float ya) { } } else { float friction = 0.91f; + int frictionTile = 0; if (onGround) { friction = 0.6f * 0.91f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); - if (t > 0) { - friction = Tile::tiles[t]->friction * 0.91f; + frictionTile = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, + Mth::floor(z)); + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; } } @@ -1300,10 +1302,8 @@ void LivingEntity::travel(float xa, float ya) { friction = 0.91f; if (onGround) { friction = 0.6f * 0.91f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); - if (t > 0) { - friction = Tile::tiles[t]->friction * 0.91f; + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; } } if (onLadder()) { @@ -1604,11 +1604,15 @@ void LivingEntity::pushEntities() { AABB grown = bb.grow(0.2, 0, 0.2); std::vector>* entities = level->getEntities(shared_from_this(), &grown); - if (entities != nullptr && !entities->empty()) { - auto itEnd = entities->end(); - for (auto it = entities->begin(); it != itEnd; it++) { - std::shared_ptr e = *it; // entities->at(i); - if (e and !e->removed and e->isPushable()) push(e); + + if (entities == nullptr || entities->empty()) { + return; + } + + std::vector> prev_entities = *entities; + for (const std::shared_ptr& e : prev_entities) { + if (e && !e->removed && e->isPushable()) { + push(e); } } } diff --git a/targets/minecraft/world/entity/Mob.cpp b/targets/minecraft/world/entity/Mob.cpp index 80fda456d..aca62e948 100644 --- a/targets/minecraft/world/entity/Mob.cpp +++ b/targets/minecraft/world/entity/Mob.cpp @@ -9,7 +9,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -50,6 +49,7 @@ #include "nbt/CompoundTag.h" #include "nbt/FloatTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" const float Mob::MAX_WEARING_ARMOR_CHANCE = 0.15f; const float Mob::MAX_PICKUP_LOOT_CHANCE = 0.55f; @@ -763,9 +763,9 @@ bool Mob::interact(std::shared_ptr player) { if (shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) && (tamableAnimal = std::dynamic_pointer_cast( shared_from_this())) - ->isTame()) // 4J-JEV: excuse the assignment operator - // in here, don't want to dyn-cast if it's - // avoidable. + ->isTame()) // 4J-JEV: excuse the assignment + // operator in here, don't want to + // dyn-cast if it's avoidable. { if (player->getUUID().compare( tamableAnimal->getOwnerUUID()) == 0) { @@ -862,8 +862,7 @@ void Mob::restoreLeashFromSave() { } } delete livingEnts; - } else if (leashInfoTag->contains("X") && - leashInfoTag->contains("Y") && + } else if (leashInfoTag->contains("X") && leashInfoTag->contains("Y") && leashInfoTag->contains("Z")) { int x = leashInfoTag->getInt("X"); int y = leashInfoTag->getInt("Y"); diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 7c48a5455..3370caffc 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "Painting.h" #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/HangingEntity.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/minecraft/world/entity/PathfinderMob.cpp b/targets/minecraft/world/entity/PathfinderMob.cpp index bb907cab2..e77fdea41 100644 --- a/targets/minecraft/world/entity/PathfinderMob.cpp +++ b/targets/minecraft/world/entity/PathfinderMob.cpp @@ -26,25 +26,20 @@ AttributeModifier* PathfinderMob::SPEED_MODIFIER_FLEEING = AttributeModifier::OPERATION_MULTIPLY_TOTAL)) ->setSerialize(false); -PathfinderMob::PathfinderMob(Level* level) : Mob(level) { - path = nullptr; - attackTarget = nullptr; - holdGround = false; - fleeTime = 0; - - restrictRadius = -1; - restrictCenter = new Pos(0, 0, 0); - addedLeashRestrictionGoal = false; - leashRestrictionGoal = new MoveTowardsRestrictionGoal(this, 1.0f); -} +PathfinderMob::PathfinderMob(Level* level) + : Mob(level), + path(nullptr), + attackTarget(nullptr), + holdGround(false), + fleeTime(0), + restrictCenter(0, 0, 0), + restrictRadius(-1), + leashRestrictionGoal(this, 1.0f), + addedLeashRestrictionGoal(false) {} bool PathfinderMob::shouldHoldGround() { return false; } -PathfinderMob::~PathfinderMob() { - delete path; - delete restrictCenter; - delete leashRestrictionGoal; -} +PathfinderMob::~PathfinderMob() { delete path; } void PathfinderMob::serverAiStep() { if (fleeTime > 0) { @@ -264,15 +259,15 @@ bool PathfinderMob::isWithinRestriction() { bool PathfinderMob::isWithinRestriction(int x, int y, int z) { if (restrictRadius == -1) return true; - return restrictCenter->distSqr(x, y, z) < restrictRadius * restrictRadius; + return restrictCenter.distSqr(x, y, z) < restrictRadius * restrictRadius; } void PathfinderMob::restrictTo(int x, int y, int z, int radius) { - restrictCenter->set(x, y, z); + restrictCenter.set(x, y, z); restrictRadius = radius; } -Pos* PathfinderMob::getRestrictCenter() { return restrictCenter; } +Pos* PathfinderMob::getRestrictCenter() { return &restrictCenter; } float PathfinderMob::getRestrictRadius() { return restrictRadius; } @@ -304,7 +299,7 @@ void PathfinderMob::tickLeash() { } if (!addedLeashRestrictionGoal) { - goalSelector.addGoal(2, leashRestrictionGoal, false); + goalSelector.addGoal(2, &leashRestrictionGoal, false); getNavigation()->setAvoidWater(false); addedLeashRestrictionGoal = true; } @@ -331,7 +326,7 @@ void PathfinderMob::tickLeash() { } else if (!isLeashed() && addedLeashRestrictionGoal) { addedLeashRestrictionGoal = false; - goalSelector.removeGoal(leashRestrictionGoal); + goalSelector.removeGoal(&leashRestrictionGoal); getNavigation()->setAvoidWater(true); clearRestriction(); } diff --git a/targets/minecraft/world/entity/PathfinderMob.h b/targets/minecraft/world/entity/PathfinderMob.h index 774e9b620..3f09e96f2 100644 --- a/targets/minecraft/world/entity/PathfinderMob.h +++ b/targets/minecraft/world/entity/PathfinderMob.h @@ -3,14 +3,14 @@ #include #include "Mob.h" +#include "minecraft/Pos.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Mob.h" +#include "minecraft/world/entity/ai/goal/MoveTowardsRestrictionGoal.h" class Level; class Path; class AttributeModifier; -class Goal; -class Pos; class PathfinderMob : public Mob { public: @@ -32,9 +32,9 @@ protected: int fleeTime; private: - Pos* restrictCenter; + Pos restrictCenter; float restrictRadius; - Goal* leashRestrictionGoal; + MoveTowardsRestrictionGoal leashRestrictionGoal; bool addedLeashRestrictionGoal; protected: diff --git a/targets/minecraft/world/entity/SyncedEntityData.cpp b/targets/minecraft/world/entity/SyncedEntityData.cpp index ba2034f53..bbcae4ac0 100644 --- a/targets/minecraft/world/entity/SyncedEntityData.cpp +++ b/targets/minecraft/world/entity/SyncedEntityData.cpp @@ -1,14 +1,13 @@ -#include "minecraft/util/Log.h" #include "SyncedEntityData.h" #include #include -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/util/Log.h" class ItemInstance; diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index a01a153d1..763b83372 100644 --- a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp +++ b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "AttributeModifier.h" #include #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" diff --git a/targets/minecraft/world/entity/ambient/Bat.cpp b/targets/minecraft/world/entity/ambient/Bat.cpp index 55b66af55..d25f52646 100644 --- a/targets/minecraft/world/entity/ambient/Bat.cpp +++ b/targets/minecraft/world/entity/ambient/Bat.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Pos.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" diff --git a/targets/minecraft/world/entity/animal/Chicken.cpp b/targets/minecraft/world/entity/animal/Chicken.cpp index fe69ff10e..b35aa70ab 100644 --- a/targets/minecraft/world/entity/animal/Chicken.cpp +++ b/targets/minecraft/world/entity/animal/Chicken.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" #include "minecraft/world/entity/ai/goal/FloatGoal.h" diff --git a/targets/minecraft/world/entity/animal/Cow.cpp b/targets/minecraft/world/entity/animal/Cow.cpp index a12908a9a..b41aadb83 100644 --- a/targets/minecraft/world/entity/animal/Cow.cpp +++ b/targets/minecraft/world/entity/animal/Cow.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index de5831f7e..959475cb6 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityHorse.h" #include @@ -7,12 +6,11 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" @@ -52,6 +50,7 @@ #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class EntitySelector; class Path; @@ -71,8 +70,8 @@ std::string EntityHorse::ARMOR_TEXTURES[EntityHorse::ARMORS] = { int EntityHorse::ARMOR_TEXTURES_ID[EntityHorse::ARMORS] = { -1, TN_MOB_HORSE_ARMOR_IRON, TN_MOB_HORSE_ARMOR_GOLD, TN_MOB_HORSE_ARMOR_DIAMOND}; -std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", - "goo", "dio"}; +std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", "goo", + "dio"}; int EntityHorse::ARMOR_PROTECTION[EntityHorse::ARMORS] = {0, 5, 7, 11}; std::string EntityHorse::VARIANT_TEXTURES[EntityHorse::VARIANTS] = { @@ -841,10 +840,9 @@ bool EntityHorse::mobInteract(std::shared_ptr player) { } doPlayerRide(player); - Log::info( - " Horse speed: %f\n", - (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) - ->getValue())); + Log::info(" Horse speed: %f\n", + (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) + ->getValue())); return true; } else { @@ -1225,11 +1223,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag* tag) { if (inventory->getItem(INV_SLOT_ARMOR) != nullptr) { tag->put("ArmorItem", inventory->getItem(INV_SLOT_ARMOR) - ->save(new CompoundTag("ArmorItem"))); + ->save(new CompoundTag("ArmorItem"))); } if (inventory->getItem(INV_SLOT_SADDLE) != nullptr) { tag->put("SaddleItem", inventory->getItem(INV_SLOT_SADDLE) - ->save(new CompoundTag("SaddleItem"))); + ->save(new CompoundTag("SaddleItem"))); } } diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index df9299bf7..4be10a765 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Ocelot.h" #include @@ -6,14 +5,12 @@ #include #include -#include "platform/input/input.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -50,6 +47,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" +#include "util/StringHelpers.h" const double Ocelot::SNEAK_SPEED_MOD = 0.6; const double Ocelot::WALK_SPEED_MOD = 0.8; diff --git a/targets/minecraft/world/entity/animal/Pig.cpp b/targets/minecraft/world/entity/animal/Pig.cpp index e432cbdaa..697e0d17f 100644 --- a/targets/minecraft/world/entity/animal/Pig.cpp +++ b/targets/minecraft/world/entity/animal/Pig.cpp @@ -5,8 +5,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/SyncedEntityData.h" diff --git a/targets/minecraft/world/entity/animal/Sheep.cpp b/targets/minecraft/world/entity/animal/Sheep.cpp index f33e8e167..c9504bc9c 100644 --- a/targets/minecraft/world/entity/animal/Sheep.cpp +++ b/targets/minecraft/world/entity/animal/Sheep.cpp @@ -6,8 +6,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/AgeableMob.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/animal/SnowMan.cpp b/targets/minecraft/world/entity/animal/SnowMan.cpp index 6753eebb6..43d9b38ca 100644 --- a/targets/minecraft/world/entity/animal/SnowMan.cpp +++ b/targets/minecraft/world/entity/animal/SnowMan.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/entity/animal/VillagerGolem.cpp b/targets/minecraft/world/entity/animal/VillagerGolem.cpp index bc1ee2630..95e5d3420 100644 --- a/targets/minecraft/world/entity/animal/VillagerGolem.cpp +++ b/targets/minecraft/world/entity/animal/VillagerGolem.cpp @@ -2,10 +2,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Pos.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/animal/Wolf.cpp b/targets/minecraft/world/entity/animal/Wolf.cpp index fb0ce2c3c..0ed85be47 100644 --- a/targets/minecraft/world/entity/animal/Wolf.cpp +++ b/targets/minecraft/world/entity/animal/Wolf.cpp @@ -6,11 +6,10 @@ #include #include "Sheep.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -50,6 +49,7 @@ #include "minecraft/world/level/tile/ColoredTile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" Wolf::Wolf(Level* level) : TamableAnimal(level) { // 4J Stu - This function call had to be moved here from the Entity ctor to diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index 046b974e4..d95771a89 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EnderDragon.h" #include @@ -6,10 +5,11 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -1433,7 +1433,7 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, entityData->set(DATA_ID_SYNCHED_ACTION, action); } else { Log::info("EnderDragon: Invalid state transition from %d to %d\n", - getSynchedAction(), action); + getSynchedAction(), action); } return force || validTransition; @@ -1529,10 +1529,9 @@ void EnderDragon::navigateToNextPathNode() { } while (yTarget < (curr.y)); } zTarget = curr.z; - Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, - curr.z); + Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, curr.z); Log::info("Setting new target to (%f,%f,%f)\n", xTarget, yTarget, - zTarget); + zTarget); } } @@ -1576,8 +1575,7 @@ int EnderDragon::findClosestNode() { std::max((level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment); - Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, - nodeZ); + Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, nodeZ); (*m_nodes)[i] = new Node(nodeX, nodeY, nodeZ); @@ -1726,8 +1724,7 @@ Path* EnderDragon::findPath(int startIndex, int endIndex, } if (closest == from) return nullptr; - Log::info("Failed to find path from %d to %d\n", startIndex, - endIndex); + Log::info("Failed to find path from %d to %d\n", startIndex, endIndex); if (finalNode != nullptr) { finalNode->cameFrom = closest; closest = finalNode; diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h index 63b05728a..5331dc29c 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" @@ -207,7 +207,9 @@ public: std::vector& partPos); Vec3 getHeadLookVector(float a); - virtual std::string getAName() { return gameServices().getString(IDS_ENDERDRAGON); }; + virtual std::string getAName() { + return gameServices().getString(IDS_ENDERDRAGON); + }; virtual float getHealth() { return LivingEntity::getHealth(); }; virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); }; }; diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp index 8dce2a1c3..83f12546d 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp @@ -8,9 +8,9 @@ #include #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.h b/targets/minecraft/world/entity/boss/wither/WitherBoss.h index 77031b494..c821f0f8d 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.h +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/EntitySelector.h" #include "minecraft/world/entity/MobType.h" @@ -120,5 +120,7 @@ public: // 4J Stu - These are required for the BossMob interface virtual float getMaxHealth() { return Monster::getMaxHealth(); }; virtual float getHealth() { return Monster::getHealth(); }; - virtual std::string getAName() { return gameServices().getString(IDS_WITHER); }; + virtual std::string getAName() { + return gameServices().getString(IDS_WITHER); + }; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/LightningBolt.cpp b/targets/minecraft/world/entity/global/LightningBolt.cpp index c8df38246..2012f473c 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.cpp +++ b/targets/minecraft/world/entity/global/LightningBolt.cpp @@ -5,10 +5,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/GlobalEntity.h" diff --git a/targets/minecraft/world/entity/global/LightningBolt.h b/targets/minecraft/world/entity/global/LightningBolt.h index b9a24565f..06da70736 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.h +++ b/targets/minecraft/world/entity/global/LightningBolt.h @@ -5,7 +5,6 @@ #include "GlobalEntity.h" #include "java/Class.h" - class Level; // class LightningBolt : public GlobalEntity diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 9c3901bb2..911bd226b 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ItemEntity.h" #include @@ -7,12 +6,12 @@ #include #include -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/item/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 6806f0070..1a2113c35 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "MinecartContainer.h" #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/entity/item/Minecart.h" diff --git a/targets/minecraft/world/entity/item/MinecartTNT.cpp b/targets/minecraft/world/entity/item/MinecartTNT.cpp index 1620f18b4..5ce6305d7 100644 --- a/targets/minecraft/world/entity/item/MinecartTNT.cpp +++ b/targets/minecraft/world/entity/item/MinecartTNT.cpp @@ -5,9 +5,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/entity/monster/Blaze.cpp b/targets/minecraft/world/entity/monster/Blaze.cpp index 29a11762d..76648aee0 100644 --- a/targets/minecraft/world/entity/monster/Blaze.cpp +++ b/targets/minecraft/world/entity/monster/Blaze.cpp @@ -6,10 +6,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Mob.h" diff --git a/targets/minecraft/world/entity/monster/Creeper.cpp b/targets/minecraft/world/entity/monster/Creeper.cpp index a2efbdadf..e898c1097 100644 --- a/targets/minecraft/world/entity/monster/Creeper.cpp +++ b/targets/minecraft/world/entity/monster/Creeper.cpp @@ -5,8 +5,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index 92c7d094c..8d7f39f77 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "EnderMan.h" #include @@ -8,10 +7,10 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Ghast.cpp b/targets/minecraft/world/entity/monster/Ghast.cpp index 50d675a27..4e1f85260 100644 --- a/targets/minecraft/world/entity/monster/Ghast.cpp +++ b/targets/minecraft/world/entity/monster/Ghast.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/network/packet/ChatPacket.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/LavaSlime.cpp b/targets/minecraft/world/entity/monster/LavaSlime.cpp index 5ec06fe10..3fa88d67c 100644 --- a/targets/minecraft/world/entity/monster/LavaSlime.cpp +++ b/targets/minecraft/world/entity/monster/LavaSlime.cpp @@ -3,9 +3,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/monster/SharedMonsterAttributes.h" diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index b2cbfaf04..8926ea2f5 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Monster.h" #include @@ -6,8 +5,8 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 5cf607f37..070bbde47 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" #include "PigZombie.h" #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp index a8c66793c..6f1fcc531 100644 --- a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp +++ b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SharedMonsterAttributes.h" #include @@ -6,7 +5,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/attributes/AttributeModifier.h" @@ -94,8 +93,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap* attributes, if (instance != nullptr) { loadAttribute(instance, tag); } else { - Log::info("Ignoring unknown attribute '%d'", - tag->getInt("ID")); + Log::info("Ignoring unknown attribute '%d'", tag->getInt("ID")); } } } diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index c2ad4f2b1..d7b73dbec 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" #include "Silverfish.h" #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Skeleton.cpp b/targets/minecraft/world/entity/monster/Skeleton.cpp index da25e0d57..34d8a6122 100644 --- a/targets/minecraft/world/entity/monster/Skeleton.cpp +++ b/targets/minecraft/world/entity/monster/Skeleton.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Slime.cpp b/targets/minecraft/world/entity/monster/Slime.cpp index 00d42fd09..ca7de4e7f 100644 --- a/targets/minecraft/world/entity/monster/Slime.cpp +++ b/targets/minecraft/world/entity/monster/Slime.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index 3e2e1f27a..c195c6b7f 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Spider.h" #include @@ -7,9 +6,9 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" diff --git a/targets/minecraft/world/entity/monster/Witch.cpp b/targets/minecraft/world/entity/monster/Witch.cpp index fa3366d77..ac276a336 100644 --- a/targets/minecraft/world/entity/monster/Witch.cpp +++ b/targets/minecraft/world/entity/monster/Witch.cpp @@ -3,10 +3,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/monster/Zombie.cpp b/targets/minecraft/world/entity/monster/Zombie.cpp index 77df90fa1..73a7c7ea1 100644 --- a/targets/minecraft/world/entity/monster/Zombie.cpp +++ b/targets/minecraft/world/entity/monster/Zombie.cpp @@ -8,8 +8,8 @@ #include #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -314,8 +314,7 @@ void Zombie::addAdditonalSaveData(CompoundTag* tag) { if (isBaby()) tag->putBoolean("IsBaby", true); if (isVillager()) tag->putBoolean("IsVillager", true); - tag->putInt("ConversionTime", - isConverting() ? villagerConversionTime : -1); + tag->putInt("ConversionTime", isConverting() ? villagerConversionTime : -1); } void Zombie::readAdditionalSaveData(CompoundTag* tag) { diff --git a/targets/minecraft/world/entity/npc/ClientSideMerchant.h b/targets/minecraft/world/entity/npc/ClientSideMerchant.h index 6a594faa8..c613594d4 100644 --- a/targets/minecraft/world/entity/npc/ClientSideMerchant.h +++ b/targets/minecraft/world/entity/npc/ClientSideMerchant.h @@ -21,8 +21,7 @@ private: std::string m_name; public: - ClientSideMerchant(std::shared_ptr source, - const std::string& name); + ClientSideMerchant(std::shared_ptr source, const std::string& name); ~ClientSideMerchant(); void createContainer(); // 4J Added diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 2b2e26511..96c02961b 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -1,16 +1,15 @@ -#include "minecraft/IGameServices.h" #include "Villager.h" #include #include #include -#include "app/linux/LinuxGame.h" #include "Pos.h" #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index 043f96f45..79c5d9cd3 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Inventory.h" #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -394,15 +393,14 @@ void Inventory::setItem(unsigned int slot, std::shared_ptr item) { if (item != nullptr) { std::string itemstring = item->toString(); Log::info("Inventory::setItem - slot = %d,\t item = %d ", slot, - item->id); + item->id); // OutputDebugStringW(itemstring.c_str()); Log::info("\n"); } #else if (item != nullptr) { - Log::info( - "Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", slot, - item->id, item->getAuxValue()); + Log::info("Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", + slot, item->id, item->getAuxValue()); } #endif // 4J Stu - Changed this a little from Java to be less funn @@ -490,7 +488,9 @@ std::shared_ptr Inventory::getItem(unsigned int slot) { */ } -std::string Inventory::getName() { return gameServices().getString(IDS_INVENTORY); } +std::string Inventory::getName() { + return gameServices().getString(IDS_INVENTORY); +} std::string Inventory::getCustomName() { return ""; } diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index e6477a1c3..26ec1cb79 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -9,8 +9,6 @@ // derives from, and not to find the derived class itself (which should own the // virtual GetType function) -#include "Player.h" - #include #include @@ -22,21 +20,19 @@ #include #include "Inventory.h" -#include "minecraft/GameEnums.h" -#include "app/common/App_structs.h" -#include "app/common/Minecraft_Macros.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "app/linux/LinuxGame.h" +#include "Player.h" +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -75,6 +71,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BedTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -183,8 +180,10 @@ Player::Player(Level* level, const std::string& name) : LivingEntity(level) { m_xuid = INVALID_XUID; m_OnlineXuid = INVALID_XUID; // m_bShownOnMaps = true; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(gameServices().getGameHostOption(eGameHostOption_Gamertags) != + 0 + ? true + : false); m_bIsGuest = false; // 4J: Set UUID to name on none-XB1 consoles, may change in future but for @@ -535,7 +534,8 @@ void Player::ride(std::shared_ptr e) { void Player::setPlayerDefaultSkin(EDefaultSkins skin) { #if !defined(_CONTENT_PACKAGE) - printf("Setting default skin to %d for player %s\n", std::to_underlying(skin), name.c_str()); + printf("Setting default skin to %d for player %s\n", + static_cast(skin), name.c_str()); #endif m_skinIndex = skin; } @@ -543,7 +543,7 @@ void Player::setPlayerDefaultSkin(EDefaultSkins skin) { void Player::setCustomSkin(std::uint32_t skinId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set skin to %08X for player %s\n", skinId, - name.c_str()); + name.c_str()); #endif EDefaultSkins playerSkin = EDefaultSkins::ServerSelected; @@ -574,7 +574,8 @@ void Player::setCustomSkin(std::uint32_t skinId) { this->customTextureUrl = gameServices().getSkinPathFromId(skinId); // set the new player additional boxes - /*vector *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); + /*vector + *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); if(pvModelParts==nullptr) { @@ -582,23 +583,23 @@ void Player::setCustomSkin(std::uint32_t skinId) { Log::info("Couldn't get model parts for skin %X\n",m_dwSkinId); // do we have it from the DLC pack? - DLCSkinFile *pDLCSkinFile = - gameServices().getDLCSkinFile(this->customTextureUrl); + ISkinAssetData *pSkinAsset = + gameServices().getSkinAssetData(this->customTextureUrl); - if(pDLCSkinFile!=nullptr) + if(pSkinAsset!=nullptr) { const int additionalBoxCount = - pDLCSkinFile->getAdditionalBoxesCount(); if(additionalBoxCount != 0) + pSkinAsset->getAdditionalBoxesCount(); if(additionalBoxCount != 0) { Log::info("Got model parts from DLCskin for skin %X\n",m_dwSkinId); - pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); + pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pSkinAsset->getAdditionalBoxes()); this->SetAdditionalModelParts(pvModelParts); } else { this->SetAdditionalModelParts(nullptr); } - gameServices().setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); + gameServices().setAnimOverrideBitmask(pSkinAsset->getSkinID(),pSkinAsset->getAnimOverrideBitmask()); } else { @@ -664,7 +665,7 @@ void Player::setXuid(PlayerUID xuid) { m_xuid = xuid; } void Player::setCustomCape(std::uint32_t capeId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set cape to %08X for player %s\n", capeId, - name.c_str()); + name.c_str()); #endif m_dwCapeId = capeId; @@ -672,7 +673,8 @@ void Player::setCustomCape(std::uint32_t capeId) { if (capeId > 0) { this->customTextureUrl2 = Player::getCapePathFromId(capeId); } else { - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Cape if (pMojangData->wchCape[0] != 0) { @@ -762,7 +764,8 @@ void Player::ChangePlayerSkin() { } void Player::prepareCustomTextures() { - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Skin @@ -1519,8 +1522,8 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, // use the bed in daytime from far away and you'll get the message about // only sleeping at night - if (abs(this->x - x) > 3 || abs(this->y - y) > 2 || - abs(this->z - z) > 3) { + if (std::abs(this->x - x) > 3 || std::abs(this->y - y) > 2 || + std::abs(this->z - z) > 3) { // too far away return TOO_FAR_AWAY; } @@ -2544,7 +2547,8 @@ bool Player::isAllowedToMine() { bool Player::isAllowedToAttackPlayers() { bool allowed = true; if (hasInvisiblePrivilege() || - ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && + ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == + 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackPlayers))) { allowed = false; @@ -2597,7 +2601,8 @@ bool Player::isAllowedToFly() { bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && + if ((gameServices().getGameHostOption( + eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying)) { @@ -2617,7 +2622,8 @@ bool Player::isAllowedToTeleport() { bool Player::hasInvisiblePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) { enabled = true; } @@ -2626,7 +2632,8 @@ bool Player::hasInvisiblePrivilege() { bool Player::hasInvulnerablePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) { enabled = true; @@ -2673,7 +2680,8 @@ std::vector* Player::GetAdditionalModelParts() { customTextureUrl.substr(0, 3).compare("def") == 0; // see if we can find the parts - m_ppAdditionalModelParts = gameServices().getAdditionalModelParts(m_dwSkinId); + m_ppAdditionalModelParts = + gameServices().getAdditionalModelParts(m_dwSkinId); // If it's a default texture (which has no parts), we have the parts, or // we already have the texture (in which case we should have parts if @@ -2694,24 +2702,25 @@ std::vector* Player::GetAdditionalModelParts() { m_dwSkinId); // do we have it from the DLC pack? - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(this->customTextureUrl); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(this->customTextureUrl); - if (pDLCSkinFile != nullptr) { + if (pSkinAsset != nullptr) { const int additionalBoxCount = - pDLCSkinFile->getAdditionalBoxesCount(); + pSkinAsset->getAdditionalBoxesCount(); if (additionalBoxCount != 0) { Log::info( "m_bCheckedForModelParts Got model parts from DLCskin " "for skin %X\n", m_dwSkinId); - m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( - m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); + m_ppAdditionalModelParts = + gameServices().setAdditionalSkinBoxesFromVec( + m_dwSkinId, pSkinAsset->getAdditionalBoxes()); } gameServices().setAnimOverrideBitmask( - pDLCSkinFile->getSkinID(), - pDLCSkinFile->getAnimOverrideBitmask()); + pSkinAsset->getSkinID(), + pSkinAsset->getAnimOverrideBitmask()); m_bCheckedForModelParts = true; } diff --git a/targets/minecraft/world/entity/player/Player.h b/targets/minecraft/world/entity/player/Player.h index a529c1ca6..369b4778f 100644 --- a/targets/minecraft/world/entity/player/Player.h +++ b/targets/minecraft/world/entity/player/Player.h @@ -6,18 +6,18 @@ #include #include -#include "platform/PlatformTypes.h" #include "Abilities.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "java/Class.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/inventory/PlayerEnderChestContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/scores/ScoreHolder.h" +#include "platform/PlatformTypes.h" class AbstractContainerMenu; class Stats; @@ -238,7 +238,7 @@ public: std::shared_ptr container); virtual bool startEnchanting( int x, int y, int z, - const std::string& name); // 4J - added bool return + const std::string& name); // 4J - added bool return virtual bool startRepairing(int x, int y, int z); // 4J - added bool return virtual bool startCrafting(int x, int y, int z); // 4J - added bool return virtual bool openFireworks(int x, int y, int z); // 4J - added @@ -259,7 +259,7 @@ public: virtual bool canHarmPlayer(std::shared_ptr target); virtual bool canHarmPlayer( std::string targetName); // 4J: Added for ServerPlayer when only - // player name is provided + // player name is provided protected: virtual void hurtArmor(float damage); diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index 4775c8443..d5b7719fc 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Arrow.h" #include @@ -9,14 +8,14 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -183,7 +182,7 @@ void Arrow::lerpMotion(double xd, double yd, double zd) { xRotO = xRot = (float)(atan2(yd, sd) * 180 / std::numbers::pi); xRotO = xRot; yRotO = yRot; - Log::info("%f %f : 0x%x\n", xRot, yRot, &yRot); + Log::info("%f %f : %p\n", xRot, yRot, static_cast(&yRot)); moveTo(x, y, z, yRot, xRot); life = 0; } @@ -481,8 +480,7 @@ void Arrow::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("pickup")) { pickup = tag->getByte("pickup"); } else if (tag->contains("player")) { - pickup = - tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; + pickup = tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; } } diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index f89d0ccd0..b94a38b61 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Fireball.h" #include @@ -10,10 +9,10 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp index 052f698ed..40f4e332d 100644 --- a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp +++ b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp @@ -5,10 +5,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/projectile/FishingHook.cpp b/targets/minecraft/world/entity/projectile/FishingHook.cpp index 4e01c1570..f86354118 100644 --- a/targets/minecraft/world/entity/projectile/FishingHook.cpp +++ b/targets/minecraft/world/entity/projectile/FishingHook.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/inventory/AnvilMenu.cpp b/targets/minecraft/world/inventory/AnvilMenu.cpp index 57725a460..3da3a17e6 100644 --- a/targets/minecraft/world/inventory/AnvilMenu.cpp +++ b/targets/minecraft/world/inventory/AnvilMenu.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "AnvilMenu.h" #include @@ -6,8 +5,7 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" @@ -27,6 +25,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" AnvilMenu::AnvilMenu(std::shared_ptr inventory, Level* level, int xt, int yt, int zt, std::shared_ptr player) { @@ -233,9 +232,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info( - "Un-naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Un-naming cost; price is now %d (went up by %d)", + price, namingCost); } result->resetHoverName(); } @@ -246,8 +244,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info("Naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Naming cost; price is now %d (went up by %d)", price, + namingCost); } if (input->hasCustomHoverName()) { @@ -291,9 +289,8 @@ void AnvilMenu::createResult() { tax += count + level * fee; if (DEBUG_COST) { - Log::info( - "Enchantment tax; tax is now %d (went up by %d)", tax, - (count + level * fee)); + Log::info("Enchantment tax; tax is now %d (went up by %d)", tax, + (count + level * fee)); } } @@ -335,11 +332,11 @@ void AnvilMenu::createResult() { if (DEBUG_COST) { if (level->isClientSide) { - Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, price, + tax); } else { - Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, price, + tax); } } } diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 0ef001e3e..f8e1da6b6 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -5,10 +5,9 @@ #include #include -#include "app/common/Colours/ColourTable.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/BehaviorRegistry.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" @@ -30,8 +29,8 @@ class Icon; const int ArmorItem::healthPerSlot[] = {11, 16, 15, 13}; const std::string ArmorItem::LEATHER_OVERLAYS[] = { - "helmetCloth_overlay", "chestplateCloth_overlay", - "leggingsCloth_overlay", "bootsCloth_overlay"}; + "helmetCloth_overlay", "chestplateCloth_overlay", "leggingsCloth_overlay", + "bootsCloth_overlay"}; const std::string ArmorItem::TEXTURE_EMPTY_SLOTS[] = { "slot_empty_helmet", "slot_empty_chestplate", "slot_empty_leggings", diff --git a/targets/minecraft/world/item/BowItem.cpp b/targets/minecraft/world/item/BowItem.cpp index ad63775d4..014d00f91 100644 --- a/targets/minecraft/world/item/BowItem.cpp +++ b/targets/minecraft/world/item/BowItem.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" @@ -18,7 +18,7 @@ class Icon; const std::string BowItem::TEXTURE_PULL[] = {"bow_pull_0", "bow_pull_1", - "bow_pull_2"}; + "bow_pull_2"}; BowItem::BowItem(int id) : Item(id) { maxStackSize = 1; diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index ed17ba6e2..fcf8ae7fd 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "BucketItem.h" #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -12,8 +11,8 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/minecraft/world/item/ClockItem.h b/targets/minecraft/world/item/ClockItem.h index f5628cebb..fba8dab71 100644 --- a/targets/minecraft/world/item/ClockItem.h +++ b/targets/minecraft/world/item/ClockItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/CompassItem.h b/targets/minecraft/world/item/CompassItem.h index c61ae9c57..b151aadc3 100644 --- a/targets/minecraft/world/item/CompassItem.h +++ b/targets/minecraft/world/item/CompassItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/DyePowderItem.cpp b/targets/minecraft/world/item/DyePowderItem.cpp index dd8c87191..5d065d849 100644 --- a/targets/minecraft/world/item/DyePowderItem.cpp +++ b/targets/minecraft/world/item/DyePowderItem.cpp @@ -300,7 +300,7 @@ void DyePowderItem::registerIcons(IconRegister* iconRegister) { icons = new Icon*[DYE_POWDER_ITEM_TEXTURE_COUNT]; for (int i = 0; i < DYE_POWDER_ITEM_TEXTURE_COUNT; i++) { - icons[i] = iconRegister->registerIcon(getIconName() + "_" + - COLOR_TEXTURES[i]); + icons[i] = + iconRegister->registerIcon(getIconName() + "_" + COLOR_TEXTURES[i]); } } \ No newline at end of file diff --git a/targets/minecraft/world/item/EggItem.cpp b/targets/minecraft/world/item/EggItem.cpp index 01e664d77..c19365395 100644 --- a/targets/minecraft/world/item/EggItem.cpp +++ b/targets/minecraft/world/item/EggItem.cpp @@ -3,8 +3,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEgg.h" diff --git a/targets/minecraft/world/item/EnchantedBookItem.cpp b/targets/minecraft/world/item/EnchantedBookItem.cpp index 0d33cd2e9..ecc40e283 100644 --- a/targets/minecraft/world/item/EnchantedBookItem.cpp +++ b/targets/minecraft/world/item/EnchantedBookItem.cpp @@ -58,8 +58,7 @@ void EnchantedBookItem::appendHoverText( if (list != nullptr) { std::string unformatted = ""; for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -104,8 +103,7 @@ void EnchantedBookItem::addEnchantment(std::shared_ptr item, } if (!item->hasTag()) item->setTag(new CompoundTag()); - item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), - enchantments); + item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), enchantments); } std::shared_ptr EnchantedBookItem::createForEnchantment( diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index 66098b4f7..0306b184c 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -1,13 +1,12 @@ -#include "minecraft/util/Log.h" #include "EnderEyeItem.h" #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/EyeOfEnderSignal.h" diff --git a/targets/minecraft/world/item/EnderpearlItem.cpp b/targets/minecraft/world/item/EnderpearlItem.cpp index 851b958c7..91c7557ac 100644 --- a/targets/minecraft/world/item/EnderpearlItem.cpp +++ b/targets/minecraft/world/item/EnderpearlItem.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEnderpearl.h" diff --git a/targets/minecraft/world/item/ExperienceItem.cpp b/targets/minecraft/world/item/ExperienceItem.cpp index 207faa5fb..9b8bc55c2 100644 --- a/targets/minecraft/world/item/ExperienceItem.cpp +++ b/targets/minecraft/world/item/ExperienceItem.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownExpBottle.h" diff --git a/targets/minecraft/world/item/FireChargeItem.cpp b/targets/minecraft/world/item/FireChargeItem.cpp index 5d97f8e12..a33e5d6a4 100644 --- a/targets/minecraft/world/item/FireChargeItem.cpp +++ b/targets/minecraft/world/item/FireChargeItem.cpp @@ -3,8 +3,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 07f5a8c6f..dc6ae7edb 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -1,9 +1,8 @@ -#include "minecraft/IGameServices.h" #include "FireworksChargeItem.h" #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/DyePowderItem.h" @@ -99,10 +98,11 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // shape uint8_t type = expTag->getByte(FireworksItem::TAG_E_TYPE); if (type >= FireworksItem::TYPE_MIN && type <= FireworksItem::TYPE_MAX) { - lines->push_back( - HtmlString(gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); + lines->push_back(HtmlString( + gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); } else { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); } // colors @@ -116,7 +116,7 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -125,7 +125,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -141,14 +142,15 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, expTag->getIntArray(FireworksItem::TAG_E_FADECOLORS); if (fadeList.size() > 0) { bool first = true; - std::string output = - std::string(gameServices().getString(IDS_FIREWORKS_CHARGE_FADE_TO)) + " "; + std::string output = std::string(gameServices().getString( + IDS_FIREWORKS_CHARGE_FADE_TO)) + + " "; for (unsigned int i = 0; i < fadeList.size(); ++i) { int c = fadeList[i]; if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -157,7 +159,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -171,7 +174,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // has trail bool trail = expTag->getBoolean(FireworksItem::TAG_E_TRAIL); if (trail) { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); } // has flicker diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 71e2086bd..c93b3cf3c 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -1,11 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FireworksItem.h" #include #include -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -17,6 +15,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" const std::string FireworksItem::TAG_FIREWORKS = "Fireworks"; const std::string FireworksItem::TAG_EXPLOSION = "Explosion"; @@ -66,8 +65,8 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, } if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( - std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + " " + - toWString((fireTag->getByte(TAG_FLIGHT)))); + std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + + " " + toWString((fireTag->getByte(TAG_FLIGHT)))); } ListTag* explosions = diff --git a/targets/minecraft/world/item/FishingRodItem.cpp b/targets/minecraft/world/item/FishingRodItem.cpp index 247377291..21380eae0 100644 --- a/targets/minecraft/world/item/FishingRodItem.cpp +++ b/targets/minecraft/world/item/FishingRodItem.cpp @@ -3,8 +3,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" diff --git a/targets/minecraft/world/item/FlintAndSteelItem.cpp b/targets/minecraft/world/item/FlintAndSteelItem.cpp index 16d49a8ec..735a58b87 100644 --- a/targets/minecraft/world/item/FlintAndSteelItem.cpp +++ b/targets/minecraft/world/item/FlintAndSteelItem.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/FoodItem.cpp b/targets/minecraft/world/item/FoodItem.cpp index b1a0f0e77..c5bd47495 100644 --- a/targets/minecraft/world/item/FoodItem.cpp +++ b/targets/minecraft/world/item/FoodItem.cpp @@ -1,8 +1,8 @@ #include "FoodItem.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodConstants.h" diff --git a/targets/minecraft/world/item/HangingEntityItem.cpp b/targets/minecraft/world/item/HangingEntityItem.cpp index 0e4fea560..9bd00b20e 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HangingEntityItem.h" #include @@ -10,7 +9,7 @@ #include "Direction.h" #include "Facing.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/HangingEntity.h" diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index fc7b424ff..e7575f12d 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - #include "Item.h" #include @@ -9,10 +6,11 @@ #include "HangingEntityItem.h" #include "MapItem.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" @@ -1714,7 +1712,7 @@ attrAttrModMap* Item::getDefaultAttributeModifiers() { 4J: These are necesary on the PS3. (and 4 and Vita). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int Item::shovel_iron_Id; const int Item::pickAxe_iron_Id; const int Item::hatchet_iron_Id; diff --git a/targets/minecraft/world/item/ItemInstance.cpp b/targets/minecraft/world/item/ItemInstance.cpp index 1bd665d2d..fa3fb9774 100644 --- a/targets/minecraft/world/item/ItemInstance.cpp +++ b/targets/minecraft/world/item/ItemInstance.cpp @@ -11,7 +11,6 @@ #include #include "Item.h" -#include "util/StringHelpers.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/LivingEntity.h" @@ -31,6 +30,7 @@ #include "nbt/CompoundTag.h" #include "nbt/IntTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class Tag; @@ -370,8 +370,8 @@ std::string ItemInstance::toString() { std::ostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed if (Item::items[id] == nullptr) { - oss << std::dec << count << "x" << " Item::items[id] is nullptr " - << "@" << auxValue; + oss << std::dec << count << "x" << " Item::items[id] is nullptr " << "@" + << auxValue; } else { oss << std::dec << count << "x" << Item::items[id]->getDescription(shared_from_this()) << "@" diff --git a/targets/minecraft/world/item/MapItem.cpp b/targets/minecraft/world/item/MapItem.cpp index a1fb0c5c1..35d541dc7 100644 --- a/targets/minecraft/world/item/MapItem.cpp +++ b/targets/minecraft/world/item/MapItem.cpp @@ -7,7 +7,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/network/packet/ComplexItemDataPacket.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class SavedData; diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 4561dba92..71812c91b 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PlanterTileItem.h" #include -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index 16e084eb5..4cc05d4f1 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -1,14 +1,12 @@ -#include "minecraft/IGameServices.h" #include "PotionItem.h" #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/effect/MobEffect.h" @@ -27,6 +25,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" class Icon; @@ -214,8 +213,9 @@ std::string PotionItem::getHoverName( if (isThrowable(itemInstance->getAuxValue())) { // elementName = I18n.get("potion.prefix.grenade").trim() + " " + // elementName; - elementName = replaceAll(elementName, "{*splash*}", - gameServices().getString(IDS_POTION_PREFIX_GRENADE)); + elementName = + replaceAll(elementName, "{*splash*}", + gameServices().getString(IDS_POTION_PREFIX_GRENADE)); } else { elementName = replaceAll(elementName, "{*splash*}", ""); } @@ -228,17 +228,19 @@ std::string PotionItem::getHoverName( // return elementName + " " + I18n.get(postfixString).trim(); elementName = replaceAll(elementName, "{*prefix*}", ""); - elementName = replaceAll( - elementName, "{*postfix*}", - gameServices().getString(effects->at(0)->getPostfixDescriptionId())); + elementName = + replaceAll(elementName, "{*postfix*}", + gameServices().getString( + effects->at(0)->getPostfixDescriptionId())); } else { // String appearanceName = // PotionBrewing.getAppearanceName(itemInstance.getAuxValue()); return // I18n.get(appearanceName).trim() + " " + elementName; - elementName = replaceAll(elementName, "{*prefix*}", - gameServices().getString(PotionBrewing::getAppearanceName( - itemInstance->getAuxValue()))); + elementName = replaceAll( + elementName, "{*prefix*}", + gameServices().getString( + PotionBrewing::getAppearanceName(itemInstance->getAuxValue()))); elementName = replaceAll(elementName, "{*postfix*}", ""); } return elementName; @@ -289,18 +291,22 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, switch (effect->getAmplifier()) { case 1: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_1); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_1); break; case 2: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_2); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_2); break; case 3: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_3); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_3); break; default: - potencyString = gameServices().getString(IDS_POTION_POTENCY_0); + potencyString = + gameServices().getString(IDS_POTION_POTENCY_0); break; } effectString += @@ -308,8 +314,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, // effect.getAmplifier()).trim(); } if (effect->getDuration() > SharedConstants::TICKS_PER_SECOND) { - effectString += - " (" + MobEffect::formatDuration(effect) + ")"; + effectString += " (" + MobEffect::formatDuration(effect) + ")"; } eMinecraftColour color = eMinecraftColour_NOT_SET; @@ -332,8 +337,9 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, if (!modifiers.empty()) { // Add new line lines->push_back(HtmlString("")); - lines->push_back(HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), - eHTMLColor_5)); + lines->push_back( + HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), + eHTMLColor_5)); // Add modifier descriptions for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { diff --git a/targets/minecraft/world/item/SkullItem.cpp b/targets/minecraft/world/item/SkullItem.cpp index cf294fe60..8a711587e 100644 --- a/targets/minecraft/world/item/SkullItem.cpp +++ b/targets/minecraft/world/item/SkullItem.cpp @@ -19,8 +19,8 @@ const unsigned int SkullItem::NAMES[SKULL_COUNT] = { IDS_ITEM_SKULL_SKELETON, IDS_ITEM_SKULL_WITHER, IDS_ITEM_SKULL_ZOMBIE, IDS_ITEM_SKULL_CHARACTER, IDS_ITEM_SKULL_CREEPER}; -std::string SkullItem::ICON_NAMES[SKULL_COUNT] = { - "skeleton", "wither", "zombie", "char", "creeper"}; +std::string SkullItem::ICON_NAMES[SKULL_COUNT] = {"skeleton", "wither", + "zombie", "char", "creeper"}; SkullItem::SkullItem(int id) : Item(id) { // setItemCategory(CreativeModeTab.TAB_DECORATIONS); diff --git a/targets/minecraft/world/item/SnowballItem.cpp b/targets/minecraft/world/item/SnowballItem.cpp index 91498a9b2..f6f1ceef9 100644 --- a/targets/minecraft/world/item/SnowballItem.cpp +++ b/targets/minecraft/world/item/SnowballItem.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Snowball.h" diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index a4261b0d7..240b6561b 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -1,16 +1,14 @@ -#include "minecraft/IGameServices.h" #include "SpawnEggItem.h" #include #include #include "Facing.h" -#include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/IconRegister.h" @@ -26,6 +24,7 @@ #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/phys/HitResult.h" #include "strings.h" +#include "util/StringHelpers.h" SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll @@ -40,8 +39,8 @@ std::string SpawnEggItem::getHoverName( int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) { - elementName = - replaceAll(elementName, "{*CREATURE*}", gameServices().getString(nameId)); + elementName = replaceAll(elementName, "{*CREATURE*}", + gameServices().getString(nameId)); // elementName += " " + I18n.get("entity." + encodeId + ".name"); } else { elementName = replaceAll(elementName, "{*CREATURE*}", ""); diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index 12b042728..791681074 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -1,16 +1,13 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - - #include "TileItem.h" #include -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -157,8 +154,8 @@ bool TileItem::useOn(std::shared_ptr instance, // Log::info("Place Sound - %s, Step Sound - // %s\n",szPlaceSoundName,szStepSoundName); - Log::info("Place Sound - %d, Step Sound - %d\n", - iPlaceSound, iStepSound); + Log::info("Place Sound - %d, Step Sound - %d\n", iPlaceSound, + iStepSound); #endif level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getPlaceSound(), diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp index c98b2924d..915818e8e 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "strings.h" @@ -75,7 +75,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = // with water bottle and gunpowder const std::string PotionBrewing::MOD_GUNPOWDER = "+14"; //&13-13"; // gunpowder makes them throwable! // gunpowder requires - // 13 and sets 14 + // 13 and sets 14 #else const std::string PotionBrewing::MOD_WATER = "-1-3-5-7-9-11-13"; const std::string PotionBrewing::MOD_SUGAR = "+0"; @@ -91,7 +91,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = ""; // glowstone increases amplification const std::string PotionBrewing::MOD_GUNPOWDER = ""; // gunpowder makes them throwable! // gunpowder requires 13 and sets - // 14 + // 14 #endif PotionBrewing::intStringMap PotionBrewing::potionEffectDuration; diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.h b/targets/minecraft/world/item/alchemy/PotionBrewing.h index 546e83747..59dfcec24 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.h +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.h @@ -98,8 +98,8 @@ private: int countCompare, int valuePart, int multiplierPart, int brew); static int countOnes(int brew); - static int parseEffectFormulaValue(const std::string& definition, - int start, int end, int brew); + static int parseEffectFormulaValue(const std::string& definition, int start, + int end, int brew); public: static std::vector* getEffects( diff --git a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp index 7f8fa3ad3..8be5a539c 100644 --- a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp +++ b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp @@ -5,7 +5,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ArmorItem.h" @@ -15,6 +14,7 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/item/crafting/ShapedRecipy.h" #include "minecraft/world/level/tile/ColoredTile.h" +#include "platform/PlatformTypes.h" bool ArmorDyeRecipe::matches(std::shared_ptr craftSlots, Level* level) { diff --git a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp index 25488a652..04e01d33c 100644 --- a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp @@ -12,18 +12,18 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string ArmorRecipes::shapes[][4] = { - {"XXX", // + {"XXX", // "X X", ""}, // - {"X X", // - "XXX", // + {"X X", // + "XXX", // "XXX", ""}, // - {"XXX", // - "X X", // + {"XXX", // + "X X", // "X X", ""}, // - {"X X", // + {"X X", // "X X", ""}, // }; diff --git a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp index 45717de60..e1f81d734 100644 --- a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp @@ -104,7 +104,6 @@ void ClothDyeRecipes::addRecipes(Recipes* r) { for (int i = 0; i < 16; i++) { r->addShapedRecipy(new ItemInstance(Tile::woolCarpet, 3, i), "sczg", - "##", '#', new ItemInstance(Tile::wool, 1, i), - 'D'); + "##", '#', new ItemInstance(Tile::wool, 1, i), 'D'); } } diff --git a/targets/minecraft/world/item/crafting/Recipes.cpp b/targets/minecraft/world/item/crafting/Recipes.cpp index b8d432582..912f29d15 100644 --- a/targets/minecraft/world/item/crafting/Recipes.cpp +++ b/targets/minecraft/world/item/crafting/Recipes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "minecraft/world/item/crafting/Recipes.h" #include @@ -9,7 +8,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/util/Log.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/Item.h" @@ -80,13 +79,12 @@ Recipes::Recipes() { '#', new ItemInstance(Tile::treeTrunk, 1, 0), 'S'); // TU9 - adding coloured wood - addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // - "sczg", - "#", // + addShapedRecipy( + new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // + "sczg", + "#", // - '#', - new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), 'S'); addShapedRecipy( new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // @@ -100,8 +98,7 @@ Recipes::Recipes() { "sczg", "#", // - '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), 'S'); addShapedRecipy(new ItemInstance(Item::stick, 4), // "ssctg", @@ -262,14 +259,14 @@ Recipes::Recipes() { '#', Tile::sandStone, 'S'); - addShapedRecipy( - new ItemInstance(Tile::woodStairsBirch, 4), // - "sssczg", - "# ", // - "## ", // - "###", // + addShapedRecipy(new ItemInstance(Tile::woodStairsBirch, 4), // + "sssczg", + "# ", // + "## ", // + "###", // - '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), 'S'); + '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), + 'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsDark, 4), // "sssczg", @@ -670,8 +667,8 @@ Recipes::Recipes() { "#X#", // "III", // - '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, - 'I', Tile::stone, 'M'); + '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, 'I', + Tile::stone, 'M'); addShapedRecipy(new ItemInstance(Tile::daylightDetector), "sssctcictg", "GGG", "QQQ", "WWW", @@ -768,8 +765,8 @@ Recipes::Recipes() { "###", // "#X#", // "#R#", // - '#', Tile::cobblestone, 'X', Item::bow, 'R', - Item::redStone, 'M'); + '#', Tile::cobblestone, 'X', Item::bow, 'R', Item::redStone, + 'M'); addShapedRecipy(new ItemInstance(Tile::dropper, 1), // "sssctcig", diff --git a/targets/minecraft/world/item/crafting/Recipy.h b/targets/minecraft/world/item/crafting/Recipy.h index 9f0ff125c..a1460182e 100644 --- a/targets/minecraft/world/item/crafting/Recipy.h +++ b/targets/minecraft/world/item/crafting/Recipy.h @@ -5,8 +5,8 @@ #pragma once -#include "platform/PlatformTypes.h" #include "minecraft/world/inventory/CraftingContainer.h" +#include "platform/PlatformTypes.h" #define RECIPE_TYPE_2x2 0 #define RECIPE_TYPE_3x3 1 diff --git a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp index 70380f05b..50ba3af68 100644 --- a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -4,17 +4,15 @@ // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; -#include "ShapedRecipy.h" - #include -#include "platform/PlatformTypes.h" -#include "app/linux/LinuxGame.h" #include "Recipes.h" +#include "ShapedRecipy.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" // 4J-PB - for new crafting - Adding group to define type of item that the // recipe produces diff --git a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp index 5b8ba09ad..d4c304491 100644 --- a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp @@ -12,11 +12,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "Recipes.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "platform/PlatformTypes.h" ShapelessRecipy::ShapelessRecipy(ItemInstance* result, std::vector* ingredients, diff --git a/targets/minecraft/world/item/crafting/StructureRecipes.cpp b/targets/minecraft/world/item/crafting/StructureRecipes.cpp index 6d4a382d7..dc29a4400 100644 --- a/targets/minecraft/world/item/crafting/StructureRecipes.cpp +++ b/targets/minecraft/world/item/crafting/StructureRecipes.cpp @@ -34,8 +34,7 @@ void StructureRecipies::addRecipes(Recipes* r) { "#", // "#", // - '#', - new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), + '#', new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), 'S'); r->addShapedRecipy( diff --git a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp index a3c14af3c..3ac71fa01 100644 --- a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp +++ b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp @@ -10,8 +10,8 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string WeaponRecipies::shapes[][4] = { - {"X", // - "X", // + {"X", // + "X", // "#", ""}, // }; diff --git a/targets/minecraft/world/item/enchantment/Enchantment.cpp b/targets/minecraft/world/item/enchantment/Enchantment.cpp index f4e3afedd..6b0147ed5 100644 --- a/targets/minecraft/world/item/enchantment/Enchantment.cpp +++ b/targets/minecraft/world/item/enchantment/Enchantment.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Enchantment.h" #include @@ -6,6 +5,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/enchantment/ArrowDamageEnchantment.h" #include "minecraft/world/item/enchantment/ArrowFireEnchantment.h" @@ -162,7 +162,8 @@ int Enchantment::getDescriptionId() { return descriptionId; } // 4jcraft: re-added old TU18 overload for java gui std::string Enchantment::getFullname(int level, std::string& unformatted) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); unformatted = formatted; snprintf(formatted, 256, "%s", @@ -172,7 +173,8 @@ std::string Enchantment::getFullname(int level, std::string& unformatted) { HtmlString Enchantment::getFullname(int level) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); @@ -214,5 +216,6 @@ std::string Enchantment::getLevelString(int level) { stringId = IDS_ENCHANTMENT_LEVEL_10; break; }; - return gameServices().getString(stringId); // I18n.get("enchantment.level." + level); + return gameServices().getString( + stringId); // I18n.get("enchantment.level." + level); } \ No newline at end of file diff --git a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp index ec6a96030..b88a730e6 100644 --- a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp +++ b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp @@ -29,8 +29,8 @@ int EnchantmentHelper::getEnchantmentLevel( return 0; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); @@ -51,8 +51,7 @@ std::unordered_map* EnchantmentHelper::getEnchantments( if (list != nullptr) { for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -119,8 +118,8 @@ void EnchantmentHelper::runIterationOnItem( return; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); diff --git a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp index 5122ec57b..39c08c393 100644 --- a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp +++ b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp @@ -1,7 +1,7 @@ #include "ThornsEnchantment.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp index 6a8864d1c..75c2b52b6 100644 --- a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp +++ b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp @@ -135,8 +135,7 @@ MerchantRecipeList* MerchantRecipeList::createFromStream( } void MerchantRecipeList::load(CompoundTag* tag) { - ListTag* list = - (ListTag*)tag->getList("Recipes"); + ListTag* list = (ListTag*)tag->getList("Recipes"); for (int i = 0; i < list->size(); i++) { CompoundTag* recipeTag = list->get(i); diff --git a/targets/minecraft/world/level/ChunkPos.cpp b/targets/minecraft/world/level/ChunkPos.cpp index 7bd788bf9..5e47710ec 100644 --- a/targets/minecraft/world/level/ChunkPos.cpp +++ b/targets/minecraft/world/level/ChunkPos.cpp @@ -4,9 +4,9 @@ #include #include -#include "util/StringHelpers.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/TilePos.h" +#include "util/StringHelpers.h" ChunkPos::ChunkPos(int x, int z) : x(x), z(z) {} diff --git a/targets/app/common/GameRules/ConsoleGameRulesConstants.h b/targets/minecraft/world/level/ConsoleGameRulesConstants.h similarity index 89% rename from targets/app/common/GameRules/ConsoleGameRulesConstants.h rename to targets/minecraft/world/level/ConsoleGameRulesConstants.h index 522b04d66..4cd70be62 100644 --- a/targets/app/common/GameRules/ConsoleGameRulesConstants.h +++ b/targets/minecraft/world/level/ConsoleGameRulesConstants.h @@ -2,6 +2,12 @@ #include "java/InputOutputStream/DataOutputStream.h" +// Filename for the per-save game rules blob written by GameRuleManager +// and consumed by the save / converter / level storage paths. Defined +// here in minecraft/ so save-path consumers don't need to drag in the +// full app-side GameRuleManager header just for this string. +inline constexpr const char* GAME_RULE_SAVENAME = "requiredGameRules.grf"; + class ConsoleGameRules { public: enum EGameRuleType { diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 099c3b33c..172957645 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Explosion.h" #include @@ -7,11 +6,11 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -207,7 +206,7 @@ void Explosion::finalizeExplosion( if (destroyBlocks) { // toBlowArray.addAll(toBlow); // TODO 4J Stu - Reverse iterator - Log::info("Finalizing explosion size %d\n", toBlow.size()); + Log::info("Finalizing explosion size %zu\n", toBlow.size()); static const int MAX_EXPLODE_PARTICLES = 50; // 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; diff --git a/targets/minecraft/world/level/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index c406d365e..77aae202e 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,8 +1,8 @@ #include "FoliageColor.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" // 4J Stu - Don't use this any more // std::vector FoliageColor::pixels; diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index 41943618e..d97eebf7b 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "GameRules.h" #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" // 4J: GameRules isn't in use anymore, just routes any requests to app game host // options, kept things commented out for context @@ -41,21 +40,28 @@ GameRules::~GameRules() { bool GameRules::getBoolean(const int rule) { switch (rule) { case GameRules::RULE_DOFIRETICK: - return gameServices().getGameHostOption(eGameHostOption_FireSpreads); + return gameServices().getGameHostOption( + eGameHostOption_FireSpreads); case GameRules::RULE_MOBGRIEFING: - return gameServices().getGameHostOption(eGameHostOption_MobGriefing); + return gameServices().getGameHostOption( + eGameHostOption_MobGriefing); case GameRules::RULE_KEEPINVENTORY: - return gameServices().getGameHostOption(eGameHostOption_KeepInventory); + return gameServices().getGameHostOption( + eGameHostOption_KeepInventory); case GameRules::RULE_DOMOBSPAWNING: - return gameServices().getGameHostOption(eGameHostOption_DoMobSpawning); + return gameServices().getGameHostOption( + eGameHostOption_DoMobSpawning); case GameRules::RULE_DOMOBLOOT: return gameServices().getGameHostOption(eGameHostOption_DoMobLoot); case GameRules::RULE_DOTILEDROPS: - return gameServices().getGameHostOption(eGameHostOption_DoTileDrops); + return gameServices().getGameHostOption( + eGameHostOption_DoTileDrops); case GameRules::RULE_NATURAL_REGENERATION: - return gameServices().getGameHostOption(eGameHostOption_NaturalRegeneration); + return gameServices().getGameHostOption( + eGameHostOption_NaturalRegeneration); case GameRules::RULE_DAYLIGHT: - return gameServices().getGameHostOption(eGameHostOption_DoDaylightCycle); + return gameServices().getGameHostOption( + eGameHostOption_DoDaylightCycle); default: assert(0); return false; diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.h b/targets/minecraft/world/level/GameRules/GameRule.h similarity index 100% rename from targets/app/common/GameRules/LevelRules/Rules/GameRule.h rename to targets/minecraft/world/level/GameRules/GameRule.h diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h similarity index 90% rename from targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h rename to targets/minecraft/world/level/GameRules/GameRuleDefinition.h index 71a43fa2e..9117995a0 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h +++ b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h @@ -6,9 +6,9 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" class GameRule; class LevelRuleset; @@ -81,7 +81,6 @@ public: GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules, Connection* connection); static std::string generateDescriptionString( - ConsoleGameRules::EGameRuleType defType, - const std::string& description, void* data = nullptr, - int dataLength = 0); + ConsoleGameRules::EGameRuleType defType, const std::string& description, + void* data = nullptr, int dataLength = 0); }; diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h b/targets/minecraft/world/level/GameRules/GameRulesInstance.h similarity index 93% rename from targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h rename to targets/minecraft/world/level/GameRules/GameRulesInstance.h index b3390636c..f278e3225 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h +++ b/targets/minecraft/world/level/GameRules/GameRulesInstance.h @@ -2,7 +2,7 @@ // using namespace std; #include -#include "GameRule.h" +#include "minecraft/world/level/GameRules/GameRule.h" class GameRuleDefinition; diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h similarity index 96% rename from targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h rename to targets/minecraft/world/level/GameRules/LevelGenerationOptions.h index 0c0fdbfa3..c667076ab 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h @@ -8,10 +8,9 @@ #include #include -#include "app/common/DLC/DLCPack.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class ApplySchematicRuleDefinition; @@ -189,7 +188,8 @@ private: bool m_bHaveMinY; int m_minY; std::unordered_map m_schematics; - std::unordered_map + std::unordered_map m_chunkRuleCache; std::vector m_biomeOverrides; std::vector m_features; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 5dfb7be27..72184ddd9 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Level.h" #include @@ -15,25 +13,23 @@ #include #include "Explosion.h" -#include "platform/input/input.h" #include "LevelListener.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/FrameProfiler.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/Entity.h" @@ -73,6 +69,8 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "minecraft/world/scores/Scoreboard.h" +#include "platform/input/input.h" +#include "util/FrameProfiler.h" class CompoundTag; class ItemInstance; @@ -2114,7 +2112,8 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) - if (!(gameServices().debugSettingsOn() && gameServices().debugMobsDontTick() && + if (!(gameServices().debugSettingsOn() && + gameServices().debugMobsDontTick() && e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) #endif { @@ -2572,7 +2571,7 @@ std::string Level::gatherStats() { char buf[64]; { std::lock_guard lock(m_entitiesCS); - snprintf(buf, 64, "All:%d", entities.size()); + snprintf(buf, 64, "All:%zu", entities.size()); } return std::string(buf); } @@ -3832,7 +3831,7 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, // This is quite expensive so only actually do it if we are hosting, // online, and the update will actually change something bool forceUnshare = false; - if (g_NetworkManager.IsHost() && isClientSide) { + if (NetworkService.IsHost() && isClientSide) { forceUnshare = lc->testSetBlocksAndData(data, x0, y0, z0, x1, y1, z1, p); } @@ -3846,7 +3845,7 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, setTilesDirty(xc * 16 + x0, y0, zc * 16 + z0, xc * 16 + x1, y1, zc * 16 + z1); - if (g_NetworkManager.IsHost() && isClientSide) { + if (NetworkService.IsHost() && isClientSide) { lc->startSharingTilesAndData(); } } @@ -3873,8 +3872,8 @@ void Level::setGameTime(int64_t time) { // time passing so ignore (moving dimensions does this) Log::info( "Level::setTime: Massive time difference, ignoring for time " - "passed stat (%lli)\n", - timeDiff); + "passed stat (%lld)\n", + static_cast(timeDiff)); timeDiff = 0; } diff --git a/targets/minecraft/world/level/Level.h b/targets/minecraft/world/level/Level.h index 64ff774f0..3b71af1f6 100644 --- a/targets/minecraft/world/level/Level.h +++ b/targets/minecraft/world/level/Level.h @@ -10,12 +10,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "ChunkPos.h" #include "LevelSource.h" #include "LightLayer.h" #include "TickNextTickData.h" -#include "platform/C4JThread.h" #include "java/Class.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/ChunkPos.h" @@ -24,6 +22,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "minecraft/world/phys/AABB.h" +#include "platform/PlatformTypes.h" +#include "platform/thread/C4JThread.h" class CompoundTag; class ItemInstance; @@ -635,8 +635,8 @@ public: int source); virtual float getDifficulty(double x, double y, double z); virtual float getDifficulty(int x, int y, int z); - TilePos* findNearestMapFeature(const std::string& featureName, int x, - int y, int z); + TilePos* findNearestMapFeature(const std::string& featureName, int x, int y, + int z); // 4J Added int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, diff --git a/targets/minecraft/world/level/PortalForcer.cpp b/targets/minecraft/world/level/PortalForcer.cpp index 6998269d6..8529fd156 100644 --- a/targets/minecraft/world/level/PortalForcer.cpp +++ b/targets/minecraft/world/level/PortalForcer.cpp @@ -1,14 +1,13 @@ -#include "minecraft/util/Log.h" #include "PortalForcer.h" #include -#include "app/linux/LinuxGame.h" #include "Pos.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/SharedConstants.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" diff --git a/targets/app/common/GameRules/WstringLookup.cpp b/targets/minecraft/world/level/WstringLookup.cpp similarity index 95% rename from targets/app/common/GameRules/WstringLookup.cpp rename to targets/minecraft/world/level/WstringLookup.cpp index 41e82b0c1..7df353651 100644 --- a/targets/app/common/GameRules/WstringLookup.cpp +++ b/targets/minecraft/world/level/WstringLookup.cpp @@ -1,5 +1,5 @@ -#include "WstringLookup.h" +#include "minecraft/world/level/WstringLookup.h" #include diff --git a/targets/app/common/GameRules/WstringLookup.h b/targets/minecraft/world/level/WstringLookup.h similarity index 100% rename from targets/app/common/GameRules/WstringLookup.h rename to targets/minecraft/world/level/WstringLookup.h diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index f617b1f30..cdf85d28d 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -6,11 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/biome/BeachBiome.h" #include "minecraft/world/level/biome/BiomeDecorator.h" diff --git a/targets/minecraft/world/level/biome/Biome.h b/targets/minecraft/world/level/biome/Biome.h index 57a1fe990..ad67a09a2 100644 --- a/targets/minecraft/world/level/biome/Biome.h +++ b/targets/minecraft/world/level/biome/Biome.h @@ -6,8 +6,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/biome/BiomeCache.cpp b/targets/minecraft/world/level/biome/BiomeCache.cpp index 79ecc3acf..8912ac2b8 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "BiomeCache.h" #include #include "BiomeSource.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/biome/Biome.h" BiomeCache::Block::Block(int x, int z, BiomeCache* parent) { diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index ac352882c..76a256ba5 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -1,10 +1,7 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/level/biome/BiomeDecorator.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/WaterlilyFeature.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 21eb3d0aa..bfbab599a 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -1,18 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BiomeSource.h" #include #include -#include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" @@ -20,6 +18,7 @@ #include "minecraft/world/level/biome/BiomeCache.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/input/input.h" #include "strings.h" // 4J - removal of separate temperature & downfall layers brought forward @@ -426,8 +425,8 @@ int64_t BiomeSource::findSeed(LevelType* generator) { delete pr; #if defined(DEBUG_SEEDS) - Log::info("%d: %d tries taken, seed used is %lld\n", k, - tryCount, bestSeed); + Log::info("%d: %d tries taken, seed used is %lld\n", k, tryCount, + bestSeed); BiomeSource* biomeSource = new BiomeSource(bestSeed); std::vector biomes = biomeSource->getBiomeBlock( diff --git a/targets/minecraft/world/level/biome/BiomeSource.h b/targets/minecraft/world/level/biome/BiomeSource.h index c6b15c4bc..99796531c 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.h +++ b/targets/minecraft/world/level/biome/BiomeSource.h @@ -10,7 +10,6 @@ #include "BiomeSource.h" #include "minecraft/world/level/biome/BiomeSource.h" - class ChunkPos; class Level; class Layer; diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 7c4e3eef8..0e3285bfc 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -1,19 +1,17 @@ #include "CompressedTileStorage.h" #include -#include #include #include #include +#include #include -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" -#include "util/Definitions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "platform/network/NetTypes.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index 8cf7e6b07..ef39bfa8e 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LevelChunk.h" #include @@ -9,16 +8,16 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "SparseLightStorage.h" #include "java/Class.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -1333,7 +1332,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { if (te != nullptr) { if (level->isClientSide) { Log::info("Removing tile entity of type %d\n", - te->GetType()); + te->GetType()); } te->setRemoved(); } @@ -1833,7 +1832,7 @@ int LevelChunk::setBlocksAndData(std::vector& data, int x0, int y0, // server updated them. This will leave the lighting information out of // sync on the client, so resync for this & surrounding chunks that // might have been affected - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { reSyncLighting(); level->getChunk(x - 1, z - 1)->reSyncLighting(); level->getChunk(x - 0, z - 1)->reSyncLighting(); @@ -2155,7 +2154,7 @@ void LevelChunk::compressBlocks() { // compress the local client copy of the data if the data is unshared, since // we'll be throwing this data away again anyway once we share with the // server again. - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { // Note - only the extraction of the pointers needs to be done in the // lock, since even if the data is unshared whilst we are // processing this data is still valid (for the server) @@ -2255,7 +2254,7 @@ void LevelChunk::compressData() { // compress the local client copy of the data if the data is unshared, since // we'll be throwing this data away again anyway once we share with the // server again. - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { // Note - only the extraction of the pointers needs to be done in the // lock, since even if the data is unshared whilst we are // processing this data is still valid (for the server) diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index 5c7bf9c6c..adbce1b5e 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -4,12 +4,12 @@ #include #include +#include #include -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/network/NetTypes.h" // Note: See header for an overview of this class @@ -422,14 +422,12 @@ void SparseDataStorage::addNewPlane(int y) { newDataAndCount |= ((int64_t)linesUsed) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted queueForDelete(lastDataPointer); @@ -496,14 +494,12 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) { unsigned char* lastDataPointer = (unsigned char*)(lastDataAndCount & 0x0000ffffffffffff); - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full @@ -571,14 +567,12 @@ int SparseDataStorage::compress() { newDataAndCount |= ((int64_t)planesToAlloc) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 != lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (!std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 8d507bc7b..8d32f546a 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -4,12 +4,12 @@ #include #include +#include #include -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/network/NetTypes.h" // Note: See header for an overview of this class @@ -426,14 +426,12 @@ void SparseLightStorage::addNewPlane(int y) { newDataAndCount |= ((int64_t)linesUsed) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted queueForDelete(lastDataPointer); @@ -500,14 +498,12 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) { unsigned char* lastDataPointer = (unsigned char*)(lastDataAndCount & 0x0000ffffffffffff); - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full @@ -582,14 +578,12 @@ int SparseLightStorage::compress() { newDataAndCount |= ((int64_t)planesToAlloc) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); - - if (lastDataAndCount2 != lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (!std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 36f89b42e..2e4230967 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "ChunkStorageProfileDecorator.h" #include -#include "app/linux/LinuxGame.h" #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/ChunkStorage.h" ChunkStorageProfilerDecorator::ChunkStorageProfilerDecorator( @@ -46,30 +45,18 @@ void ChunkStorageProfilerDecorator::tick() { if (counter > 500) { if (loadCount > 0) { #if !defined(_CONTENT_PACKAGE) -#if defined(__linux__) sprintf(buf, "Average load time: %f (%lld)", 0.000001 * (double)timeSpentLoading / (double)loadCount, (long long)loadCount); -#else - sprintf(buf, "Average load time: %f (%I64d)", - 0.000001 * (double)timeSpentLoading / (double)loadCount, - loadCount); -#endif - Log::info(buf); + Log::info("%s", buf); #endif } if (saveCount > 0) { #if !defined(_CONTENT_PACKAGE) -#if defined(__linux__) sprintf(buf, "Average save time: %f (%lld)", 0.000001 * (double)timeSpentSaving / (double)loadCount, (long long)loadCount); -#else - sprintf(buf, "Average save time: %f (%I64d)", - 0.000001 * (double)timeSpentSaving / (double)loadCount, - loadCount); -#endif - Log::info(buf); + Log::info("%s", buf); #endif } counter = 0; diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 784abea6c..2235e889f 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionChunkStorage.h" #include @@ -10,16 +8,14 @@ #include #include -#include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" -#include "platform/C4JThread.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" @@ -29,9 +25,12 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOutputStream.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" +#include "platform/thread/C4JThread.h" class DataInput; @@ -145,7 +144,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); delete chunkData; return nullptr; } @@ -154,7 +153,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); delete chunkData; return nullptr; } @@ -166,7 +165,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { "Chunk file at %d, %d is in the wrong location; " "relocating. Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - Log::info(buf); + Log::info("%s", buf); delete levelChunk; delete chunkData; return nullptr; @@ -207,15 +206,16 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) { DataOutputStream* output = RegionFileCache::getChunkDataOutputStream( m_saveFile, m_prefix, levelChunk->x, levelChunk->z); - if (m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - OldChunkStorage::save(levelChunk, level, output); + if (m_saveFile->getOriginalSaveVersion() >= + SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { + OldChunkStorage::save(levelChunk, level, output); - { - std::lock_guard lock(cs_memory); - s_chunkDataQueue.push_back(output); - } - // 4jcraft: WAKE UP, WAKE THE FUCK.. UP - s_queueCondition.notify_one(); + { + std::lock_guard lock(cs_memory); + s_chunkDataQueue.push_back(output); + } + // 4jcraft: WAKE UP, WAKE THE FUCK.. UP + s_queueCondition.notify_one(); } else { CompoundTag* tag; @@ -350,11 +350,12 @@ int McRegionChunkStorage::runSaveThreadProc(void* lpParam) { while (running) { { std::unique_lock lock(cs_memory); - s_queueCondition.wait(lock, [] { return !s_chunkDataQueue.empty(); }); + s_queueCondition.wait(lock, + [] { return !s_chunkDataQueue.empty(); }); dos = s_chunkDataQueue.front(); s_chunkDataQueue.pop_front(); s_runningThreadCount++; - } // Unlock so the main thread can keep working + } // Unlock so the main thread can keep working if (dos) { dos->close(); @@ -395,12 +396,10 @@ void McRegionChunkStorage::WaitForSaves() { static const int MAX_QUEUE_SIZE = 12; static const int DESIRED_QUEUE_SIZE = 6; - std::unique_lock lock(cs_memory); if (s_chunkDataQueue.size() > MAX_QUEUE_SIZE) { // Pause until the queue drains down to the desired size - s_waitCondition.wait(lock, [] { - return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; - }); + s_waitCondition.wait( + lock, [] { return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; }); } } diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h index 2938d9a37..644379c9b 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h @@ -2,6 +2,7 @@ #include +#include // 4jcraft: im pretty sure there's a better alternative to this. #include #include #include @@ -14,7 +15,6 @@ #include "RegionFileCache.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "nbt/NbtIo.h" -#include // 4jcraft: im pretty sure there's a better alternative to this. class ConsoleSaveFile; class C4JThread; diff --git a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp index 3023cbf3b..8f5237b2d 100644 --- a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp @@ -1,8 +1,5 @@ #include "MemoryChunkStorage.h" - - - LevelChunk* MemoryChunkStorage::load(Level* level, int x, int z) // throws IOException { diff --git a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp index 2e4fb78ee..651032e1b 100644 --- a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp @@ -6,18 +6,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 40cb60a7c..560216ac6 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OldChunkStorage.h" #include @@ -12,15 +10,14 @@ #include #include -#include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" -#include "util/Definitions.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/FileOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/level/Level.h" @@ -33,6 +30,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; @@ -73,22 +71,46 @@ OldChunkStorage::OldChunkStorage(File dir, bool create) { this->create = create; } +// https://cplusplus.com/forum/general/144043/ +void to_base36(int value, char* buf) { + static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + char tmp[64]; + int i = 0; + unsigned int uval = + (value < 0) ? -(unsigned int)value : (unsigned int)value; + + if (uval == 0) { + buf[0] = '0'; + buf[1] = '\0'; + return; + } + + while (uval > 0) { + tmp[i++] = digits[uval % 36]; + uval /= 36; + } + if (value < 0) tmp[i++] = '-'; + + for (int j = 0; j < i; ++j) buf[j] = tmp[i - 1 - j]; + buf[i] = '\0'; +} + File OldChunkStorage::getFile(int x, int z) { + constexpr int MAX_PATH_SIZE = 256; + char name[MAX_PATH_SIZE]; char path1[MAX_PATH_SIZE]; char path2[MAX_PATH_SIZE]; char xRadix36[64]; char zRadix36[64]; -#if defined(__linux__) - assert(0); // need a gcc verison of _itow ? -#else - _itow(x, xRadix36, 36); - _itow(z, zRadix36, 36); + + to_base36(x, xRadix36); + to_base36(z, zRadix36); snprintf(name, MAX_PATH_SIZE, "c.%s.%s.dat", xRadix36, zRadix36); - _itow(x & 63, path1, 36); - _itow(z & 63, path2, 36); -#endif + to_base36(x & 63, path1); + to_base36(z & 63, path2); + // sprintf(file,"%s\\%s",dir,path1); File file(dir, std::string(path1)); if (!file.exists()) { @@ -135,7 +157,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); return nullptr; } if (!tag->getCompound("Level")->contains("Blocks")) { @@ -143,7 +165,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); return nullptr; } LevelChunk* levelChunk = @@ -154,7 +176,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { "Chunk fileat %d, %d is in the wrong location; relocating. " "Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - Log::info(buf); + Log::info("%s", buf); tag->putInt("xPos", x); tag->putInt("zPos", z); levelChunk = @@ -470,10 +492,9 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } @@ -579,10 +600,9 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index 882981e02..ae3a8db5a 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RegionFile.h" #include @@ -7,15 +6,15 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" std::vector RegionFile::emptySector(SECTOR_BYTES); diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.h b/targets/minecraft/world/level/chunk/storage/RegionFile.h index bca5b99d4..1d1475836 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.h @@ -4,9 +4,9 @@ #include #include -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" class FileEntry; class ConsoleSaveFile; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp index 273cf8266..2eda9aacf 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp @@ -2,11 +2,11 @@ #include -#include "util/StringHelpers.h" #include "java/File.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/StringHelpers.h" class DataInputStream; class DataOutputStream; @@ -37,11 +37,11 @@ RegionFile* RegionFileCache::_getRegionFile( // toWString(chunkZ>>5) + ".mcr" ); File file; if (useSplitSaves(saveFile->getSavePlatform())) { - file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + - "." + toWString(chunkZ >> 4) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + "." + + toWString(chunkZ >> 4) + ".mcr"); } else { - file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + - "." + toWString(chunkZ >> 5) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + "." + + toWString(chunkZ >> 5) + ".mcr"); } RegionFile* ref = nullptr; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h index 36dfe0547..e07bc8cba 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h @@ -49,8 +49,7 @@ public: } static void clear() { s_defaultCache._clear(); } static int getSizeDelta(ConsoleSaveFile* saveFile, - const std::string& prefix, int chunkX, - int chunkZ) { + const std::string& prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); } static DataInputStream* getChunkDataInputStream(ConsoleSaveFile* saveFile, @@ -59,9 +58,9 @@ public: return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); } - static DataOutputStream* getChunkDataOutputStream( - ConsoleSaveFile* saveFile, const std::string& prefix, int chunkX, - int chunkZ) { + static DataOutputStream* getChunkDataOutputStream(ConsoleSaveFile* saveFile, + const std::string& prefix, + int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); } diff --git a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp index 7babd8962..43ed2cece 100644 --- a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp @@ -7,18 +7,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } } // namespace diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp index 7dfd1135e..8574cb912 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ZonedChunkStorage.h" #include @@ -7,10 +6,7 @@ #include "ZoneFile.h" #include "java/ByteBuffer.h" #include "java/File.h" - - - - +#include "minecraft/util/Log.h" // 4J Stu - There are changes to this class for 1.8.2, but since we never use it // anyway lets not worry about it @@ -63,14 +59,15 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) { char zRadix36[64]; _itow(x, xRadix36, 36); _itow(z, zRadix36, 36); - File file = File(dir, std::string("zone_") + toString(xRadix36) + - "_" + toString(zRadix36) + ".dat"); + File file = File(dir, std::string("zone_") + toString(xRadix36) + "_" + + toString(zRadix36) + ".dat"); if (!file.exists()) { if (!create) return nullptr; - void* ch = CreateFile(std::filesystem::path(file.getPath()).string().c_str(), - GENERIC_READ | GENERIC_WRITE, 0, nullptr, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + void* ch = CreateFile( + std::filesystem::path(file.getPath()).string().c_str(), + GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); CloseHandle(ch); } diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index dab92411b..838508367 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Dimension.h" #include @@ -6,14 +5,13 @@ #include #include "HellDimension.h" -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "NormalDimension.h" #include "TheEndDimension.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -27,6 +25,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" class Pos; diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index 27e5f97e5..36e78808e 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -1,14 +1,12 @@ -#include "minecraft/IGameServices.h" #include "HellDimension.h" #include -#include "platform/input/input.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -17,6 +15,7 @@ #include "minecraft/world/level/levelgen/HellRandomLevelSource.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" void HellDimension::init() { biomeSource = new FixedBiomeSource(Biome::hell, 1, 0); diff --git a/targets/minecraft/world/level/dimension/TheEndDimension.cpp b/targets/minecraft/world/level/dimension/TheEndDimension.cpp index 10b1ee6ad..3959cd442 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -5,9 +5,9 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/FixedBiomeSource.h" diff --git a/targets/minecraft/world/level/dlc/DLCConstants.h b/targets/minecraft/world/level/dlc/DLCConstants.h new file mode 100644 index 000000000..fdf8a5f56 --- /dev/null +++ b/targets/minecraft/world/level/dlc/DLCConstants.h @@ -0,0 +1,47 @@ +#pragma once + +// DLC type and parameter enums extracted from app/common/DLC/DLCManager +// so minecraft/ consumers can reference them without including the app +// header. DLCManager re-exports these as nested aliases for backward +// compatibility with app-side call sites. + +namespace minecraft::dlc { + +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, + + e_DLCType_Max, + e_DLCType_All, +}; + +enum EDLCParameterType { + e_DLCParamType_Invalid = -1, + + 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, +}; + +} // namespace minecraft::dlc diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index 21f98b440..dec6f2565 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" #include "CanyonFeature.h" #include #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -183,7 +182,7 @@ void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, thickness, yRot, xRot, 0, 0, 3.0); // 4J Add to feature list - gameServices().addTerrainFeaturePosition(eTerrainFeature_Ravine, - (int)(xCave / 16.0), (int)(yCave / 16.0)); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_Ravine, (int)(xCave / 16.0), (int)(yCave / 16.0)); } } \ No newline at end of file diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp similarity index 98% rename from targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp rename to targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp index aee9d428c..33920b03c 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp @@ -1,4 +1,4 @@ -#include "ConsoleSchematicFile.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include #include @@ -8,12 +8,10 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/Class.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/entity/ItemFrame.h" @@ -22,6 +20,7 @@ #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/chunk/LevelChunk.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" @@ -39,7 +38,7 @@ ConsoleSchematicFile::ConsoleSchematicFile() { } ConsoleSchematicFile::~ConsoleSchematicFile() { - app.DebugPrintf("Deleting schematic file\n"); + Log::info("Deleting schematic file\n"); } void ConsoleSchematicFile::save(DataOutputStream* dos) { @@ -112,7 +111,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { m_data.resize(m_dataSize); break; default: - app.DebugPrintf( + Log::info( "Unrecognized compression type for Schematic file " "(%d)\n", (int)compressionType); @@ -139,7 +138,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { if (te == nullptr) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf( + Log::info( "ConsoleSchematicFile has read a nullptr tile " "entity\n"); assert(0); @@ -216,8 +215,8 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); #ifdef _DEBUG - app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, - zStart, xEnd - 1, yEnd - 1, zEnd - 1); + Log::info("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, zStart, + xEnd - 1, yEnd - 1, zEnd - 1); #endif int rowBlocksIncluded = (yEnd - yStart) * (zEnd - zStart); @@ -291,8 +290,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, dataP += (rowBlockCount - rowBlocksIncluded) / 2; } } else { - app.DebugPrintf( - "ERROR: Rotation of block and data not implemented!!\n"); + Log::info("ERROR: Rotation of block and data not implemented!!\n"); } // 4J Stu - Hack for ME pack to replace sand with end stone in schematics @@ -556,8 +554,8 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, e->absMoveTo(targetX, targetY, targetZ, e->yRot, e->xRot); } #ifdef _DEBUG - app.DebugPrintf("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), - e->x, e->y, e->z); + Log::info("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), e->x, + e->y, e->z); #endif e->setLevel(chunk->level); e->resetSmallId(); @@ -617,7 +615,7 @@ void ConsoleSchematicFile::generateSchematicFile( int ySize = yEnd - yStart + 1; int zSize = zEnd - zStart + 1; - app.DebugPrintf( + Log::info( "Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), " "%dx%dx%d\n", xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize); diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.h similarity index 85% rename from targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h rename to targets/minecraft/world/level/levelgen/ConsoleSchematicFile.h index 7e638f17d..ee0e184f9 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.h @@ -13,7 +13,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" @@ -43,26 +42,6 @@ public: void decrementRefCount() { --m_refCount; } bool shouldDelete() { return m_refCount <= 0; } - typedef struct _XboxSchematicInitParam { - char name[64]; - int startX; - int startY; - int startZ; - int endX; - int endY; - int endZ; - bool bSaveMobs; - - Compression::ECompressionTypes compressionType; - - _XboxSchematicInitParam() { - memset(name, 0, 64 * (sizeof(char))); - startX = startY = startZ = endX = endY = endZ = 0; - bSaveMobs = false; - compressionType = Compression::eCompressionType_None; - } - } XboxSchematicInitParam; - private: int m_xSize, m_ySize, m_zSize; std::vector > m_tileEntities; diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 1fe5a7f3f..b0f4e6237 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -1,24 +1,19 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CustomLevelSource.h" #include #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/biome/Biome.h" -#include "minecraft/world/level/chunk/ChunkSource.h" -#if defined(__linux__) -#include "app/linux/Stubs/winapi_stubs.h" -#endif #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/MobCategory.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/MobSpawner.h" +#include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" +#include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/levelgen/CanyonFeature.h" #include "minecraft/world/level/levelgen/LargeCaveFeature.h" @@ -32,6 +27,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/HeavyTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/fs/fs.h" const double CustomLevelSource::SNOW_SCALE = 0.3; const double CustomLevelSource::SNOW_CUTOFF = 0.5; @@ -63,9 +59,9 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, { const char* waterHeightPath = "GameRules/waterheight.bin"; - auto result = PlatformFilesystem.readFile( - waterHeightPath, m_waterheightOverride.data(), - m_waterheightOverride.size()); + auto result = PlatformFilesystem.readFile(waterHeightPath, + m_waterheightOverride.data(), + m_waterheightOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { memset(m_waterheightOverride.data(), level->seaLevel, m_waterheightOverride.size()); @@ -262,7 +258,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* lgo = + gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } diff --git a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp index c5281f80a..199527881 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "FlatLevelSource.h" #include @@ -6,8 +5,8 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index f4d8feb11..1f692fd8c 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellFlatLevelSource.h" #include @@ -7,8 +6,8 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -193,9 +192,7 @@ bool HellFlatLevelSource::tick() { return false; } bool HellFlatLevelSource::shouldSave() { return true; } -std::string HellFlatLevelSource::gatherStats() { - return "HellFlatLevelSource"; -} +std::string HellFlatLevelSource::gatherStats() { return "HellFlatLevelSource"; } std::vector* HellFlatLevelSource::getMobsAt( MobCategory* mobCategory, int x, int y, int z) { diff --git a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index 420d4bf5a..f7e4f435f 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellRandomLevelSource.h" #include @@ -8,8 +7,8 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index d7cba474e..78c68988b 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "RandomLevelSource.h" #include @@ -6,12 +5,11 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" -#include "util/Timer.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/MobCategory.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/MobSpawner.h" #include "minecraft/world/level/biome/Biome.h" @@ -32,6 +30,7 @@ #include "minecraft/world/level/tile/HeavyTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "util/Timer.h" const double RandomLevelSource::SNOW_SCALE = 0.3; const double RandomLevelSource::SNOW_CUTOFF = 0.5; @@ -409,7 +408,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* lgo = + gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } diff --git a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index c13ef9a67..945ba6fee 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "TheEndLevelRandomLevelSource.h" #include @@ -6,8 +5,8 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index 087eefc0a..9337440bf 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BasicTreeFeature.h" #include @@ -7,10 +5,11 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index 9cc463d87..69cb44d15 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BirchFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index f106f7c6c..9869f8c77 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CaveFeature.h" #include @@ -7,10 +5,11 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index cfd5b65e3..7a47479c6 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "FlowerFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index c13c1d68a..044972f15 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LakeFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index a2d426b29..dfb384dcc 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MegaTreeFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index 4068466f4..f813a49b2 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OreFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index 468438eec..f97635dce 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PineFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/LeafTile.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index 9006cc7af..98b5561e5 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ReedsFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index 2e8307244..d1cb2e072 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SandFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp index f24fbc8fd..e19d76c11 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "SpikeFeature.h" #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index 34833deb5..8c4e59c03 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -1,9 +1,8 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpringFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index eeebb62fa..862259be1 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpruceFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 79c962cca..e87779b0c 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SwampTreeFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 5ebcfa2b2..d89f5741f 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TreeFeature.h" #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp index b3e577f17..13e6f694b 100644 --- a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp +++ b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp @@ -1,16 +1,15 @@ #include "FlatGeneratorInfo.h" -#include "util/StringHelpers.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/levelgen/flat/FlatLayerInfo.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" const std::string FlatGeneratorInfo::STRUCTURE_VILLAGE = "village"; const std::string FlatGeneratorInfo::STRUCTURE_BIOME_SPECIFIC = "biome_1"; const std::string FlatGeneratorInfo::STRUCTURE_STRONGHOLD = "stronghold"; const std::string FlatGeneratorInfo::STRUCTURE_MINESHAFT = "mineshaft"; -const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = - "decoration"; +const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = "decoration"; const std::string FlatGeneratorInfo::STRUCTURE_LAKE = "lake"; const std::string FlatGeneratorInfo::STRUCTURE_LAVA_LAKE = "lava_lake"; const std::string FlatGeneratorInfo::STRUCTURE_DUNGEON = "dungeon"; @@ -27,8 +26,7 @@ int FlatGeneratorInfo::getBiome() { return biome; } void FlatGeneratorInfo::setBiome(int biome) { this->biome = biome; } -std::unordered_map >* +std::unordered_map >* FlatGeneratorInfo::getStructures() { return &structures; } diff --git a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp index aa7b4061d..ca634a00e 100644 --- a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp +++ b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp @@ -5,10 +5,10 @@ #include #include -#include "util/StringHelpers.h" #include "java/JavaMath.h" #include "minecraft/Direction.h" #include "nbt/IntArrayTag.h" +#include "util/StringHelpers.h" BoundingBox::BoundingBox() { // 4J added initialisers diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index ab45ebf0a..30bbcb970 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" - #include "minecraft/world/level/levelgen/structure/MineShaftFeature.h" #include @@ -9,11 +7,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" const std::string MineShaftFeature::OPTION_CHANCE = "chance"; @@ -35,7 +33,8 @@ MineShaftFeature::MineShaftFeature( bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Mineshaft); diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index a80b781a2..9a9dc7151 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -1,15 +1,14 @@ -#include "minecraft/IGameServices.h" #include "NetherBridgeFeature.h" #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "NetherBridgePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -60,7 +59,8 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { } bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_NetherBridge); diff --git a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp index 2c2d41041..26f4c590b 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -1,15 +1,14 @@ -#include "minecraft/IGameServices.h" #include "RandomScatteredLargeFeature.h" #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -68,7 +67,8 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Temples); diff --git a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp index 7204abd45..71d300c68 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ScatteredFeaturePieces.h" #include @@ -6,16 +5,16 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/entity/monster/Witch.h" #include "minecraft/world/item/DyePowderItem.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" @@ -61,7 +60,8 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece( orientation = random->nextInt(4); - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { int tempOrientation = 0; if (levelGenOptions->isFeatureChunk(west >> 4, north >> 4, diff --git a/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp index a317fe9e6..be517ba77 100644 --- a/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp +++ b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp @@ -1,10 +1,5 @@ #include "SkyIslandDimension.h" - - - - - void SkyIslandDimension::init() { biomeSource = new FixedBiomeSource(Biome::sky, 0.5f, 0); id = 1; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index ee429ebb7..777392973 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "StrongholdFeature.h" #include @@ -10,15 +8,15 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/biome/Biome.h" @@ -168,8 +166,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { "%d)\n", selectedX, selectedZ, position->x, position->z); // 4J added - gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - selectedX, selectedZ); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_Stronghold, selectedX, selectedZ); // 4J Added hasFoundValidPos = true; @@ -199,8 +197,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { // for #81933 - GAMEPLAY: The Eye of Ender occasionally does not // appear when used to try and locate the End Portal. gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - strongholdPos[0]->x, - strongholdPos[0]->z); + strongholdPos[0]->x, + strongholdPos[0]->z); } isSpotSelected = true; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index d3c1590ef..9e5021c69 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "StrongholdPieces.h" #include @@ -7,12 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/EnchantedBookItem.h" @@ -31,6 +29,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" int StrongholdPieces::totalWeight = 0; std::list StrongholdPieces::currentPieces; @@ -1971,8 +1970,8 @@ bool StrongholdPieces::PortalRoom::postProcess(Level* level, Random* random, // 4J Stu - The mob spawner location is close enough for the map // icon display, and this ensures that we only need to set the // position once - gameServices().addTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal, - x, z); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_StrongholdEndPortal, x, z); level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); level->getLevelData()->setHasStrongholdEndPortal(); diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp index b2da6a4a4..9516fa122 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp @@ -1,11 +1,10 @@ -#include "minecraft/util/Log.h" #include "StructureFeatureIO.h" #include #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/levelgen/structure/MineShaftPieces.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" #include "minecraft/world/level/levelgen/structure/NetherBridgeFeature.h" @@ -97,7 +96,7 @@ StructureStart* StructureFeatureIO::loadStaticStart(CompoundTag* tag, start->load(level, tag); } else { Log::info("Skipping Structure with id %s", - tag->getString("id").c_str()); + tag->getString("id").c_str()); } return start; } @@ -114,8 +113,7 @@ StructurePiece* StructureFeatureIO::loadStaticPiece(CompoundTag* tag, if (piece != nullptr) { piece->load(level, tag); } else { - Log::info("Skipping Piece with id %s", - tag->getString("id").c_str()); + Log::info("Skipping Piece with id %s", tag->getString("id").c_str()); } return piece; } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp index 3efefcfd8..21222c680 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp @@ -2,9 +2,9 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" std::string StructureFeatureSavedData::TAG_FEATURES = "Features"; @@ -35,7 +35,7 @@ void StructureFeatureSavedData::putFeatureTag(CompoundTag* tag, int chunkX, } std::string StructureFeatureSavedData::createFeatureTagId(int chunkX, - int chunkZ) { + int chunkZ) { return "[" + toWString(chunkX) + "," + toWString(chunkZ) + "]"; } diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index b1ba967a9..818b189b1 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -1,17 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "VillageFeature.h" #include #include #include -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "VillagePieces.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -86,7 +85,8 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Village); diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index 784dfccf6..814cac593 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -1,23 +1,20 @@ -#include "minecraft/util/Log.h" #include "BiomeOverrideLayer.h" #include #include "minecraft/IGameServices.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/newbiome/layer/Layer.h" -#if defined(__linux__) -#include "app/linux/Stubs/winapi_stubs.h" -#endif +#include "minecraft/util/Log.h" #include "minecraft/world/level/biome/Biome.h" +#include "minecraft/world/level/newbiome/layer/Layer.h" +#include "platform/fs/fs.h" BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { m_biomeOverride = std::vector(width * height); { const char* path = "GameRules/biomemap.bin"; - auto result = PlatformFilesystem.readFile( - path, m_biomeOverride.data(), m_biomeOverride.size()); + auto result = PlatformFilesystem.readFile(path, m_biomeOverride.data(), + m_biomeOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { Log::info("Biome override not found, using plains as default\n"); memset(m_biomeOverride.data(), Biome::plains->id, diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index c2605e23a..bacde1c54 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include @@ -7,9 +6,8 @@ #include #include "BiomeOverrideLayer.h" -#include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" #include "minecraft/world/level/newbiome/layer/AddMushroomIslandLayer.h" @@ -27,6 +25,7 @@ #include "minecraft/world/level/newbiome/layer/SwampRiversLayer.h" #include "minecraft/world/level/newbiome/layer/VoronoiZoom.h" #include "minecraft/world/level/newbiome/layer/ZoomLayer.h" +#include "platform/input/input.h" std::vector> Layer::getDefaultLayers( int64_t seed, LevelType* levelType) { diff --git a/targets/minecraft/world/level/pathfinder/Node.cpp b/targets/minecraft/world/level/pathfinder/Node.cpp index e5fe4fb07..222df853f 100644 --- a/targets/minecraft/world/level/pathfinder/Node.cpp +++ b/targets/minecraft/world/level/pathfinder/Node.cpp @@ -7,8 +7,8 @@ #include -#include "util/StringHelpers.h" #include "minecraft/util/Mth.h" +#include "util/StringHelpers.h" void Node::_init() { heapIdx = -1; diff --git a/targets/minecraft/world/level/pathfinder/Node.h b/targets/minecraft/world/level/pathfinder/Node.h index e01c7ac27..3db0f3c4f 100644 --- a/targets/minecraft/world/level/pathfinder/Node.h +++ b/targets/minecraft/world/level/pathfinder/Node.h @@ -11,10 +11,10 @@ class Node { friend class EnderDragon; public: - const int x, y, z; + int x, y, z; private: - const int hash; + int hash; protected: int heapIdx; diff --git a/targets/minecraft/world/level/pathfinder/Path.cpp b/targets/minecraft/world/level/pathfinder/Path.cpp index 5307cacd0..f3bfe3e86 100644 --- a/targets/minecraft/world/level/pathfinder/Path.cpp +++ b/targets/minecraft/world/level/pathfinder/Path.cpp @@ -1,31 +1,12 @@ #include "Path.h" -#include - #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/pathfinder/Node.h" #include "minecraft/world/phys/Vec3.h" -Path::~Path() { - for (size_t i = 0; i < nodes.size(); i++) delete nodes[i]; -} - -Path::Path(std::vector& nodes) { - index = 0; - - length = nodes.size(); - // 4J - copying these nodes over from a std::vector (which is an - // array of Node - // * references) to just a straight array of Nodes, so that this Path is no - // longer dependent of Nodes allocated elsewhere and can handle its own - // destruction Note: cameFrom pointer will be useless now but that isn't - // used once this is just a path - this->nodes = std::vector(length); - - for (int i = 0; i < length; i++) { - this->nodes[i] = new Node(); - memcpy(this->nodes[i], nodes[i], sizeof(Node)); - } +Path::Path(std::vector& src) + : nodes(src.size()), index(0), length(static_cast(src.size())) { + for (int i = 0; i < length; i++) nodes[i] = *src[i]; } void Path::next() { index++; } @@ -34,12 +15,12 @@ bool Path::isDone() { return index >= length; } Node* Path::last() { if (length > 0) { - return nodes[length - 1]; + return &nodes[length - 1]; } return nullptr; } -Node* Path::get(int i) { return nodes[i]; } +Node* Path::get(int i) { return &nodes[i]; } int Path::getSize() { return length; } @@ -50,25 +31,24 @@ int Path::getIndex() { return index; } void Path::setIndex(int index) { this->index = index; } Vec3 Path::getPos(std::shared_ptr e, int index) { - double x = nodes[index]->x + (int)(e->bbWidth + 1) * 0.5; - double y = nodes[index]->y; - double z = nodes[index]->z + (int)(e->bbWidth + 1) * 0.5; + double x = nodes[index].x + (int)(e->bbWidth + 1) * 0.5; + double y = nodes[index].y; + double z = nodes[index].z + (int)(e->bbWidth + 1) * 0.5; return Vec3(x, y, z); } Vec3 Path::currentPos(std::shared_ptr e) { return getPos(e, index); } Vec3 Path::currentPos() { - return Vec3(nodes[index]->x, nodes[index]->y, nodes[index]->z); + return Vec3(nodes[index].x, nodes[index].y, nodes[index].z); } bool Path::sameAs(Path* path) { if (path == nullptr) return false; if (path->nodes.size() != nodes.size()) return false; - for (int i = 0; i < nodes.size(); ++i) - if (nodes[i]->x != path->nodes[i]->x || - nodes[i]->y != path->nodes[i]->y || - nodes[i]->z != path->nodes[i]->z) + for (size_t i = 0; i < nodes.size(); ++i) + if (nodes[i].x != path->nodes[i].x || nodes[i].y != path->nodes[i].y || + nodes[i].z != path->nodes[i].z) return false; return true; } diff --git a/targets/minecraft/world/level/pathfinder/Path.h b/targets/minecraft/world/level/pathfinder/Path.h index 9c472824f..082d40468 100644 --- a/targets/minecraft/world/level/pathfinder/Path.h +++ b/targets/minecraft/world/level/pathfinder/Path.h @@ -13,13 +13,16 @@ class Path { friend class PathFinder; private: - std::vector nodes; + // Nodes are stored by value. The vector is sized once in the constructor + // and never resized, so Node* returned by get()/last() remain valid for + // the lifetime of the Path. + std::vector nodes; int index; int length; public: Path(std::vector& nodes); - ~Path(); + ~Path() = default; void next(); bool isDone(); @@ -30,7 +33,6 @@ public: int getIndex(); void setIndex(int index); Vec3 getPos(std::shared_ptr e, int index); - std::vector Getarray(); Vec3 currentPos(std::shared_ptr e); Vec3 currentPos(); bool sameAs(Path* path); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp index dc3b599ae..4eb4cb992 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp @@ -8,11 +8,11 @@ #include #include -#include "app/common/GameRules/GameRuleManager.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/util/ProgressListener.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" @@ -116,7 +116,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, FileEntry* targetFe = targetSave->createFile(targetPlayerDatPath); printf("Processing player dat file %s\n", - playerFiles->at(fileIdx)->data.filename); + playerFiles->at(fileIdx)->data.filename); ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe); targetFe->data.lastModifiedTime = @@ -169,8 +169,8 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, if (dis) { int read = dis->read(); DataOutputStream* dos = - targetCache._getChunkDataOutputStream(targetSave, "", - x, z); + targetCache._getChunkDataOutputStream(targetSave, "", x, + z); BufferedOutputStream bos(dos, 1024 * 1024); while (read != -1) { bos.write(read & 0xff); @@ -303,7 +303,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, } else { #if !defined(_CONTENT_PACKAGE) printf("%s is not a region file, ignoring\n", - fe->data.filename); + fe->data.filename); #endif } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 2e071866e..052bd2851 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include @@ -14,61 +12,41 @@ #include #include -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/storage/storage.h" +#include "platform/PlatformTypes.h" #include "platform/fs/fs.h" - -#define RESERVE_ALLOCATION MEM_RESERVE -#define COMMIT_ALLOCATION MEM_COMMIT - -unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; -void* ConsoleSaveFileOriginal::pvHeap = nullptr; +#include "platform/storage/storage.h" ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( const std::string& fileName, void* pvSaveData /*= nullptr*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, - ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { - // One time initialise of static stuff required for our storage - if (pvHeap == nullptr) { - // Reserve a chunk of 64MB of virtual address space for our saves, using - // 64KB pages. We'll only be committing these as required to grow the - // storage we need, which will the storage to grow without having to use - // realloc. - - // AP - The Vita doesn't have virtual memory so a pretend system has - // been implemented in PSVitaStubs.cpp. All access to the memory must be - // done via the access function as the pointer returned from - // VirtualAlloc can't be used directly. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, - RESERVE_ALLOCATION, PAGE_READWRITE); - } - - pvSaveMem = pvHeap; + ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) + : saveBuffer(MAX_SAVE_SIZE) { m_fileName = fileName; unsigned int fileSize = initialFileSize; // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -80,34 +58,6 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( if (forceCleanSave) fileSize = 0; - unsigned int heapSize = std::max( - fileSize, - 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than - // 2MB so allocate high to start with - - // Initially committ enough room to store headSize bytes (using - // CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one - // save file at a time, and the pages should be decommitted in the dtor, so - // pages committed should always be zero at this point. - if (pagesCommitted != 0) { -#ifndef _CONTENT_PACKAGE - assert(0); -#endif - } - - unsigned int pagesRequired = - (heapSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { -#ifndef _CONTENT_PACKAGE - // Out of physical memory - assert(0); -#endif - } - pagesCommitted = pagesRequired; - if (fileSize > 0) { if (pvSaveData != nullptr) { memcpy(pvSaveMem, pvSaveData, fileSize); @@ -118,7 +68,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } void* pvSourceData = pvSaveMem; @@ -136,6 +86,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // Clear the first 8 bytes that reference the header header.WriteHeader(pvSourceData); } else { + assert(decompSize <= MAX_SAVE_SIZE); unsigned char* buf = new unsigned char[decompSize]; Compression::getCompression()->SetDecompressionType( plat); // if this save is from another platform, set the @@ -147,25 +98,6 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( SAVE_FILE_PLATFORM_LOCAL); // and then set the // decompression back to the // local machine's standard type - - // Only ReAlloc if we need to (we might already have enough) - // and align to 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = decompSize; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = - VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } memcpy(pvSaveMem, buf, decompSize); delete[] buf; } @@ -179,10 +111,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( } } -ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() { - VirtualFree(pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT); - pagesCommitted = 0; -} +ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() = default; // Add the file to our table of internal files if not already there // Open our actual save file ready for reading/writing, and the set the file @@ -425,23 +354,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond( unsigned int buffer1Size = 0; unsigned int buffer2Size = 0; - // Only ReAlloc if we need to (we might already have enough) and align to - // 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } + assert(header.GetFileSize() + nNumberOfBytesToWrite <= MAX_SAVE_SIZE); // This is the start of where we want the space to be, and the start of the // data that we need to move @@ -635,8 +548,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -646,7 +558,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { #ifdef _WINDOWS64 gameServices().getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, - &pbDataSaveImage, &dwDataSizeSaveImage); + &pbDataSaveImage, &dwDataSizeSaveImage); #endif std::uint8_t bTextMetadata[88] = {}; @@ -872,8 +784,7 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index 2d8fcbd27..aac482dea 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -1,8 +1,9 @@ #pragma once +#include #include #include +#include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" @@ -13,18 +14,19 @@ private: std::string m_fileName; - // void* hHeap; - static void* pvHeap; - static unsigned int pagesCommitted; + // Backing store for the in-memory save image. The buffer is sized to + // MAX_SAVE_SIZE up front; on Linux/macOS the kernel only physically backs + // pages that are actually touched, so this gives the same demand-paging + // behaviour the legacy VirtualAlloc reserve/commit pattern relied on, + // without any OS-specific calls. #if defined(_LARGE_WORLDS) - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = - 32 * 1024; // 2GB virtual allocation + static constexpr std::size_t MAX_SAVE_SIZE = + 2u * 1024u * 1024u * 1024u; // 2GB #else - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 1024; + static constexpr std::size_t MAX_SAVE_SIZE = 64u * 1024u * 1024u; // 64MB #endif - void* pvSaveMem; + std::vector saveBuffer; + void* pvSaveMem = saveBuffer.data(); std::recursive_mutex m_lock; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 134178e25..ee31dc710 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #include @@ -15,39 +13,33 @@ #include #include -#include "platform/fs/fs.h" -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class ProgressListener; -#define RESERVE_ALLOCATION MEM_RESERVE -#define COMMIT_ALLOCATION MEM_COMMIT - -unsigned int ConsoleSaveFileSplit::pagesCommitted = 0; -void* ConsoleSaveFileSplit::pvHeap = nullptr; - ConsoleSaveFileSplit::RegionFileReference::RegionFileReference( int index, unsigned int regionIndex, unsigned int length /*=0*/, unsigned char* data /*=nullptr*/) { @@ -364,12 +356,14 @@ FileEntry* ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) { ConsoleSaveFileSplit::ConsoleSaveFileSplit( const std::string& fileName, void* pvSaveData /*= nullptr*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, - ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { + ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) + : saveBuffer(MAX_SAVE_SIZE) { unsigned int fileSize = initialFileSize; // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -390,7 +384,8 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit( ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile* sourceSave, bool alreadySmallRegions, - ProgressListener* progress) { + ProgressListener* progress) + : saveBuffer(MAX_SAVE_SIZE) { _init(sourceSave->getFilename(), nullptr, 0, sourceSave->getSavePlatform()); header.setOriginalSaveVersion(sourceSave->getOriginalSaveVersion()); @@ -423,17 +418,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, unsigned int fileSize, ESavePlatform plat) { m_lastTickTime = 0; - // One time initialise of static stuff required for our storage - if (pvHeap == nullptr) { - // Reserve a chunk of 64MB of virtual address space for our saves, using - // 64KB pages. We'll only be committing these as required to grow the - // storage we need, which will the storage to grow without having to use - // realloc. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, - RESERVE_ALLOCATION, PAGE_READWRITE); - } - - pvSaveMem = pvHeap; m_fileName = fileName; // Get details of region files. From this point on we are responsible for @@ -459,34 +443,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, regionFiles[regionIndex] = regionFileRef; } - unsigned int heapSize = std::max( - fileSize, - 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than - // 2MB so allocate high to start with - - // Initially committ enough room to store headSize bytes (using - // CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one - // save file at a time, and the pages should be decommitted in the dtor, so - // pages committed should always be zero at this point. - if (pagesCommitted != 0) { -#if !defined(_CONTENT_PACKAGE) - assert(0); -#endif - } - - unsigned int pagesRequired = - (heapSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { -#if !defined(_CONTENT_PACKAGE) - // Out of physical memory - assert(0); -#endif - } - pagesCommitted = pagesRequired; - if (fileSize > 0) { if (pvSaveData != nullptr) { memcpy(pvSaveMem, pvSaveData, fileSize); @@ -494,7 +450,7 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } @@ -516,26 +472,7 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, if (Compression::getCompression()->Decompress( buf, &decompSize, (unsigned char*)pvSaveMem + 8, fileSize - 8) == 0) { - // Only ReAlloc if we need to (we might already have enough) - // and align to 512 byte boundaries - unsigned int currentHeapSize = - pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = decompSize; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = - VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } - + assert(decompSize <= MAX_SAVE_SIZE); memcpy(pvSaveMem, buf, decompSize); } else { // Corrupt save, although most of the terrain should @@ -562,8 +499,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, } ConsoleSaveFileSplit::~ConsoleSaveFileSplit() { - VirtualFree(pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT); - pagesCommitted = 0; // Make sure we don't have any thumbnail data still waiting round - we can't // need it now we've destroyed the save file anyway @@ -997,9 +932,8 @@ void ConsoleSaveFileSplit::tick() { #endif if (writeRequired) { - PlatformStorage.SaveSubfiles([this](bool bRes) { - return SaveRegionFilesCallback(this, bRes); - }); + PlatformStorage.SaveSubfiles( + [this](bool bRes) { return SaveRegionFilesCallback(this, bRes); }); } ReleaseSaveAccess(); @@ -1024,23 +958,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry* file, unsigned int buffer1Size = 0; unsigned int buffer2Size = 0; - // Only ReAlloc if we need to (we might already have enough) and align to - // 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } + assert(header.GetFileSize() + nNumberOfBytesToWrite <= MAX_SAVE_SIZE); // This is the start of where we want the space to be, and the start of the // data that we need to move @@ -1232,7 +1150,7 @@ std::string ConsoleSaveFileSplit::GetNameFromNumericIdentifier( signed char regionX = (idIn >> 8) & 255; signed char regionZ = idIn & 255; std::string region = (prefix + std::string("r.") + toWString(regionX) + - "." + toWString(regionZ) + ".mcr"); + "." + toWString(regionZ) + ".mcr"); return region; } @@ -1317,7 +1235,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { fileSize); Log::info("Check buffer size: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -1334,15 +1252,14 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { pvSaveMem, fileSize); Log::info("Compress: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); memset(compData, 0, 8); int saveVer = 0; memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); if (updateThumbnail) { std::uint8_t* pbThumbnailData = nullptr; @@ -1382,9 +1299,8 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // save the data - PlatformStorage.SaveSaveData([this](bool bRes) { - return SaveSaveDataCallback(this, bRes); - }); + PlatformStorage.SaveSaveData( + [this](bool bRes) { return SaveSaveDataCallback(this, bRes); }); #if !defined(_CONTENT_PACKAGE) if (gameServices().debugSettingsOn()) { if (gameServices().getWriteSavesToFolderEnabled()) { @@ -1438,14 +1354,11 @@ void ConsoleSaveFileSplit::DebugFlushToFile( char* fileName = new char[XCONTENT_MAX_FILENAME_LENGTH + 1]; - auto now_tp = std::chrono::system_clock::now(); - std::time_t now_tt = std::chrono::system_clock::to_time_t(now_tp); - std::tm t{}; -#if defined(_WIN32) - gmtime_s(&t, &now_tt); -#else - gmtime_r(&now_tt, &t); -#endif + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + std::chrono::hh_mm_ss hms{ + std::chrono::floor(now - dp)}; // 14 chars for the digits // 11 chars for the separators + suffix @@ -1454,10 +1367,14 @@ void ConsoleSaveFileSplit::DebugFlushToFile( if (m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) { cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); } - snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, - "\\v%04d-%s%02d.%02d.%02d.%02d.%02d.mcs", VER_PRODUCTBUILD, - cutFileName.c_str(), t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, - t.tm_sec); + + auto result = + std::format("\\v{:04d}-{}{:02d}.{:02d}.{:02d}.{:02d}.{:02d}.mcs", + VER_PRODUCTBUILD, cutFileName, (unsigned)ymd.month(), + (unsigned)ymd.day(), (int)hms.hours().count(), + (int)hms.minutes().count(), (int)hms.seconds().count()); + + snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, "%s", result.c_str()); const std::string outputPath = targetFileDir.getPath() + std::string(fileName); @@ -1598,8 +1515,7 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index a1e93f573..cb7e635a6 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -5,7 +5,6 @@ #include #include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" @@ -73,18 +72,19 @@ private: std::string m_fileName; bool m_autosave; - // void* hHeap; - static void* pvHeap; - static unsigned int pagesCommitted; + // Backing store for the in-memory save image. The buffer is sized to + // MAX_SAVE_SIZE up front; on Linux/macOS the kernel only physically backs + // pages that are actually touched, so this gives the same demand-paging + // behaviour the legacy VirtualAlloc reserve/commit pattern relied on, + // without any OS-specific calls. #if defined(_LARGE_WORLDS) - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = - 32 * 1024; // 2GB virtual allocation + static constexpr std::size_t MAX_SAVE_SIZE = + 2u * 1024u * 1024u * 1024u; // 2GB #else - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 1024; + static constexpr std::size_t MAX_SAVE_SIZE = 64u * 1024u * 1024u; // 64MB #endif - void* pvSaveMem; + std::vector saveBuffer; + void* pvSaveMem = saveBuffer.data(); std::recursive_mutex m_lock; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index a3ff514d5..cbac4d7de 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -2,8 +2,6 @@ // #define _DEBUG_FILE_HEADER -#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" - #include #include @@ -12,12 +10,8 @@ #include #include -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/Definitions.h" #include "java/System.h" - -extern LinuxGame app; +#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" FileHeader::FileHeader() { lastFile = nullptr; @@ -115,8 +109,8 @@ void FileHeader::WriteHeader(void* saveMem) { char* headerPosition = (char*)saveMem + headerOffset; #if defined(_DEBUG_FILE_HEADER) - Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif // Write the header @@ -182,8 +176,8 @@ void FileHeader::ReadHeader( Log::info( "Read save file with orignal version: %d, and current version %d\n", m_originalSaveVersion, m_saveVersion); - Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif char* headerPosition = (char*)saveMem + headerOffset; @@ -269,11 +263,10 @@ void FileHeader::ReadHeader( lastFile = entry; fileTable.push_back(entry); #if defined(_DEBUG_FILE_HEADER) - Log::info( - "File: %s, Start = %d, Length = %d, End = %d\n", - entry->data.filename, entry->data.startOffset, - entry->data.length, - entry->data.startOffset + entry->data.length); + Log::info("File: %s, Start = %d, Length = %d, End = %d\n", + entry->data.filename, entry->data.startOffset, + entry->data.length, + entry->data.startOffset + entry->data.length); #endif i += sizeof(FileEntrySaveDataV1); @@ -282,8 +275,7 @@ void FileHeader::ReadHeader( } break; default: #if !defined(_CONTENT_PACKAGE) - Log::info("********** Invalid save version %d\n", - m_saveVersion); + Log::info("********** Invalid save version %d\n", m_saveVersion); assert(0); #endif break; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h index c0955c660..fdc151b46 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h @@ -1,13 +1,12 @@ #pragma once +#include #include #include #include #include #include -#include - #define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ (static_cast(static_cast(ch0)) | \ (static_cast(static_cast(ch1)) << 8) | \ @@ -81,8 +80,8 @@ enum ESavePlatform { struct FileEntrySaveDataV1 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B // This is only valid once the save file has been written/loaded at least // once @@ -93,8 +92,8 @@ public: // updating 4J Stu - As of writing the tutorial level uses a V1 save file struct FileEntrySaveDataV2 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B union { // This is only valid once the save file has been written/loaded at diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp index 0397adb6d..26b8f0156 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp @@ -2,12 +2,11 @@ #include #include +#include #include #include -#include - thread_local Compression::ThreadStorage* Compression::m_tlsCompression = nullptr; Compression::ThreadStorage* Compression::m_tlsCompressionDefault = nullptr; @@ -41,8 +40,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, void* pSource, unsigned int SrcSize) { std::lock_guard lock(rleCompressLock); - if (rleCompressBuf.size() < SrcSize * 2) - rleCompressBuf.resize(SrcSize * 2); + if (rleCompressBuf.size() < SrcSize * 2) rleCompressBuf.resize(SrcSize * 2); unsigned char* pucIn = (unsigned char*)pSource; unsigned char* pucEnd = pucIn + SrcSize; @@ -60,8 +58,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, *pucOut++ = 255; *pucOut++ = count - 1; } else { - for (unsigned int i = 0; i < count; i++) - *pucOut++ = thisOne; + for (unsigned int i = 0; i < count; i++) *pucOut++ = thisOne; } } else { *pucOut++ = 255; @@ -81,8 +78,7 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, std::lock_guard lock(rleDecompressLock); unsigned int rleSize = *pDestSize; - if (rleDecompressBuf.size() < rleSize) - rleDecompressBuf.resize(rleSize); + if (rleDecompressBuf.size() < rleSize) rleDecompressBuf.resize(rleSize); Decompress(rleDecompressBuf.data(), &rleSize, pSource, SrcSize); @@ -96,13 +92,11 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; @@ -172,13 +166,11 @@ int32_t Compression::DecompressRLE(void* pDestination, unsigned int* pDestSize, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; diff --git a/targets/minecraft/world/level/storage/DerivedLevelData.cpp b/targets/minecraft/world/level/storage/DerivedLevelData.cpp index 6a4da8059..a70321548 100644 --- a/targets/minecraft/world/level/storage/DerivedLevelData.cpp +++ b/targets/minecraft/world/level/storage/DerivedLevelData.cpp @@ -38,9 +38,7 @@ CompoundTag* DerivedLevelData::getLoadedPlayerTag() { return wrapped->getLoadedPlayerTag(); } -std::string DerivedLevelData::getLevelName() { - return wrapped->getLevelName(); -} +std::string DerivedLevelData::getLevelName() { return wrapped->getLevelName(); } int DerivedLevelData::getVersion() { return wrapped->getVersion(); } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 44e804b71..99f93312c 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DirectoryLevelStorage.h" #include @@ -12,13 +10,7 @@ #include #include -#include "platform/input/input.h" #include "LevelData.h" -#include "app/common/Console_Debug_enum.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" @@ -26,7 +18,11 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/dimension/HellDimension.h" @@ -42,7 +38,9 @@ #include "nbt/DoubleTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" const std::string DirectoryLevelStorage::sc_szPlayerDir("players/"); @@ -166,8 +164,9 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings( DataOutputStream* dos) { dos->writeInt(m_mappings.size()); for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { - Log::info(" -- %lld (0x%016llx) = %d\n", it->first, it->first, - it->second); + Log::info(" -- %lld (0x%016llx) = %d\n", + static_cast(it->first), + static_cast(it->first), it->second); dos->writeLong(it->first); dos->writeInt(it->second); } @@ -179,7 +178,9 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream* dis) { int64_t index = dis->readLong(); int id = dis->readInt(); m_mappings[index] = id; - Log::info(" -- %lld (0x%016llx) = %d\n", index, index, id); + Log::info(" -- %lld (0x%016llx) = %d\n", + static_cast(index), + static_cast(index), id); } } #endif @@ -279,15 +280,8 @@ LevelData* DirectoryLevelStorage::prepareLevel() { Log::info("Loading %d mappings\n", count); for (unsigned int i = 0; i < count; ++i) { PlayerUID playerUid = dis.readPlayerUID(); -#if defined(_WINDOWS64) || defined(__linux__) - Log::info(" -- %d\n", playerUid); -#else -#if defined(__linux__) - Log::info(" -- %d\n", playerUid); -#else - Log::info(" -- %s\n", playerUid.toWString().c_str()); -#endif -#endif + Log::info(" -- %llu\n", + static_cast(playerUid)); m_playerMappings[playerUid].readMappings(&dis); } dis.readFully(m_usedMappings); @@ -403,9 +397,8 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { delete it->second; } m_cachedSaveData[realFile.getName()] = bos; - Log::info( - "Cached saving of file %s due to saves being disabled\n", - realFile.getName().c_str()); + Log::info("Cached saving of file %s due to saves being disabled\n", + realFile.getName().c_str()); } else { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); @@ -438,7 +431,7 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { CompoundTag* tag = NbtIo::readCompressed(&bis); bis.reset(); Log::info("Loaded player data from cached file %s\n", - realFile.getName().c_str()); + realFile.getName().c_str()); return tag; } else if (m_saveFile->doesFileExist(realFile)) { ConsoleSaveFileInputStream fis = @@ -636,18 +629,11 @@ void DirectoryLevelStorage::saveMapIdLookup() { ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeInt(m_playerMappings.size()); - Log::info("Saving %d mappings\n", m_playerMappings.size()); + Log::info("Saving %zu mappings\n", m_playerMappings.size()); for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); ++it) { -#if defined(_WINDOWS64) || defined(__linux__) - Log::info(" -- %d\n", it->first); -#else -#if defined(__linux__) - Log::info(" -- %d\n", it->first); -#else - Log::info(" -- %s\n", it->first.toWString().c_str()); -#endif -#endif + Log::info(" -- %llu\n", + static_cast(it->first)); dos.writePlayerUID(it->first); it->second.writeMappings(&dos); } @@ -757,8 +743,7 @@ void DirectoryLevelStorage::saveAllCachedData() { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); - Log::info("Actually writing cached file %s\n", - it->first.c_str()); + Log::info("Actually writing cached file %s\n", it->first.c_str()); fos.write(bos->buf, 0, bos->size()); delete bos; } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h index 2c47e9d8a..43372bbfb 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h @@ -31,12 +31,12 @@ #include #include -#include "platform/PlatformTypes.h" #include "LevelStorage.h" #include "PlayerIO.h" #include "java/File.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class ByteArrayOutputStream; diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp index 3b3a90340..826bd1651 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp @@ -47,8 +47,8 @@ LevelData* DirectoryLevelStorageSource::getDataTagFor( return nullptr; } -void DirectoryLevelStorageSource::renameLevel( - const std::string& levelId, const std::string& newLevelName) { +void DirectoryLevelStorageSource::renameLevel(const std::string& levelId, + const std::string& newLevelName) { ConsoleSaveFileOriginal tempSave(levelId); // File dataFile = File(dir, "level.dat"); diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index f92f56ea8..f9c2f368a 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "LevelData.h" #include @@ -6,10 +5,10 @@ #include #include -#include "app/common/App_Defines.h" -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" @@ -86,11 +85,11 @@ LevelData::LevelData(CompoundTag* tag) { newSeaLevel = tag->getBoolean( "newSeaLevel"); // 4J added - only use new sea level for newly created - // maps. This read defaults to false. (sea level - // changes in 1.8.2) + // maps. This read defaults to false. (sea level + // changes in 1.8.2) hasBeenInCreative = tag->getBoolean( "hasBeenInCreative"); // 4J added so we can not award achievements to - // levels modified in creative + // levels modified in creative // 4J added - for stronghold position bStronghold = tag->getBoolean("hasStronghold"); @@ -183,7 +182,8 @@ LevelData::LevelData(CompoundTag* tag) { assert(0); break; } - gameServices().setGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); + gameServices().setGameHostOption(eGameHostOption_WorldSize, + hostOptionworldSize); #endif /* 4J - we don't store this anymore diff --git a/targets/minecraft/world/level/storage/LevelStorage.h b/targets/minecraft/world/level/storage/LevelStorage.h index 84aecf363..ff4e53793 100644 --- a/targets/minecraft/world/level/storage/LevelStorage.h +++ b/targets/minecraft/world/level/storage/LevelStorage.h @@ -4,8 +4,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" +#include "platform/PlatformTypes.h" class PlayerIO; class Dimension; diff --git a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp index a8292a53c..d7345ba6b 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionLevelStorage.h" #include @@ -8,8 +6,9 @@ #include #include "LevelData.h" -#include "app/linux/LinuxGame.h" #include "java/File.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/McRegionChunkStorage.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp index f233a29b9..1361fa7f3 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp @@ -1,9 +1,5 @@ #include "MemoryLevelStorage.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileIO.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.h b/targets/minecraft/world/level/storage/MemoryLevelStorage.h index 5a00c45b6..6bc1d34fb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.h @@ -2,10 +2,6 @@ #include "LevelStorage.h" #include "PlayerIO.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp index 2ff75f643..e2ee62feb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp @@ -3,7 +3,6 @@ #include "LevelSummary.h" #include "MemoryLevelStorage.h" - MemoryLevelStorageSource::MemoryLevelStorageSource() {} std::string MemoryLevelStorageSource::getName() { return "Memory Storage"; } @@ -19,8 +18,7 @@ std::vector* MemoryLevelStorageSource::getLevelList() { void MemoryLevelStorageSource::clearAll() {} -LevelData* MemoryLevelStorageSource::getDataTagFor( - const std::string& levelId) { +LevelData* MemoryLevelStorageSource::getDataTagFor(const std::string& levelId) { return nullptr; } diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.cpp b/targets/minecraft/world/level/storage/SavedDataStorage.cpp index c39f5140b..eee2f488b 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.cpp +++ b/targets/minecraft/world/level/storage/SavedDataStorage.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/entity/ai/village/Villages.h" diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.h b/targets/minecraft/world/level/storage/SavedDataStorage.h index 707e967c6..eaa1df0e4 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.h +++ b/targets/minecraft/world/level/storage/SavedDataStorage.h @@ -6,8 +6,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/saveddata/SavedData.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class LevelStorage; diff --git a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp index b0770e9db..c07809683 100644 --- a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/ButtonTile.cpp b/targets/minecraft/world/level/tile/ButtonTile.cpp index c1b3204b0..a12482146 100644 --- a/targets/minecraft/world/level/tile/ButtonTile.cpp +++ b/targets/minecraft/world/level/tile/ButtonTile.cpp @@ -4,8 +4,8 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/projectile/Arrow.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/CarrotTile.cpp b/targets/minecraft/world/level/tile/CarrotTile.cpp index 1ad45648a..7e362b287 100644 --- a/targets/minecraft/world/level/tile/CarrotTile.cpp +++ b/targets/minecraft/world/level/tile/CarrotTile.cpp @@ -2,10 +2,10 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" CarrotTile::CarrotTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/CocoaTile.cpp b/targets/minecraft/world/level/tile/CocoaTile.cpp index a318de664..034da2453 100644 --- a/targets/minecraft/world/level/tile/CocoaTile.cpp +++ b/targets/minecraft/world/level/tile/CocoaTile.cpp @@ -20,8 +20,7 @@ class Icon; -const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", - "cocoa_2"}; +const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", "cocoa_2"}; CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, false) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/ComparatorTile.cpp b/targets/minecraft/world/level/tile/ComparatorTile.cpp index 8a520eabe..0d8ae7f3d 100644 --- a/targets/minecraft/world/level/tile/ComparatorTile.cpp +++ b/targets/minecraft/world/level/tile/ComparatorTile.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/CropTile.cpp b/targets/minecraft/world/level/tile/CropTile.cpp index 301bdc6d6..39446245f 100644 --- a/targets/minecraft/world/level/tile/CropTile.cpp +++ b/targets/minecraft/world/level/tile/CropTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class Icon; diff --git a/targets/minecraft/world/level/tile/DispenserTile.h b/targets/minecraft/world/level/tile/DispenserTile.h index 03583f27f..9e1fa4c09 100644 --- a/targets/minecraft/world/level/tile/DispenserTile.h +++ b/targets/minecraft/world/level/tile/DispenserTile.h @@ -3,7 +3,6 @@ #include "BaseEntityTile.h" - class Player; class Mob; class ChunkRebuildData; diff --git a/targets/minecraft/world/level/tile/DoorTile.cpp b/targets/minecraft/world/level/tile/DoorTile.cpp index c1d90edb0..3f46a894e 100644 --- a/targets/minecraft/world/level/tile/DoorTile.cpp +++ b/targets/minecraft/world/level/tile/DoorTile.cpp @@ -15,8 +15,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" -const std::string DoorTile::TEXTURES[] = { - "doorWood_lower", "doorWood_upper", "doorIron_lower", "doorIron_upper"}; +const std::string DoorTile::TEXTURES[] = {"doorWood_lower", "doorWood_upper", + "doorIron_lower", "doorIron_upper"}; DoorTile::DoorTile(int id, Material* material) : Tile(id, material, false) { if (material == Material::metal) { diff --git a/targets/minecraft/world/level/tile/DropperTile.cpp b/targets/minecraft/world/level/tile/DropperTile.cpp index 2fba41574..d6d562edd 100644 --- a/targets/minecraft/world/level/tile/DropperTile.cpp +++ b/targets/minecraft/world/level/tile/DropperTile.cpp @@ -25,8 +25,7 @@ DropperTile::DropperTile(int id) : DispenserTile(id) { void DropperTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); iconTop = iconRegister->registerIcon("furnace_top"); - iconFront = - iconRegister->registerIcon(getIconName() + "_front_horizontal"); + iconFront = iconRegister->registerIcon(getIconName() + "_front_horizontal"); iconFrontVertical = iconRegister->registerIcon(getIconName() + "_front_vertical"); } diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index da189ff2a..7e5b387d3 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -1,17 +1,16 @@ -#include "minecraft/IGameServices.h" #include "FireTile.h" #include #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/FurnaceTile.cpp b/targets/minecraft/world/level/tile/FurnaceTile.cpp index 07c8535cc..c5cde70b1 100644 --- a/targets/minecraft/world/level/tile/FurnaceTile.cpp +++ b/targets/minecraft/world/level/tile/FurnaceTile.cpp @@ -72,8 +72,8 @@ Icon* FurnaceTile::getTexture(int face, int data) { void FurnaceTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); - iconFront = iconRegister->registerIcon(lit ? "furnace_front_lit" - : "furnace_front"); + iconFront = + iconRegister->registerIcon(lit ? "furnace_front_lit" : "furnace_front"); iconTop = iconRegister->registerIcon("furnace_top"); } diff --git a/targets/minecraft/world/level/tile/GrassTile.cpp b/targets/minecraft/world/level/tile/GrassTile.cpp index 52c629a32..f59aa04e4 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp index cf9f036ef..b07cc2197 100644 --- a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp +++ b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp @@ -9,8 +9,7 @@ class Material; const std::string HugeMushroomTile::TEXTURE_STEM = "skin_stem"; const std::string HugeMushroomTile::TEXTURE_INSIDE = "inside"; -const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", - "skin_red"}; +const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", "skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material* material, int type) : Tile(id, material) { diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index 3883be2e6..008b68c5b 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/level/tile/LeverTile.cpp b/targets/minecraft/world/level/tile/LeverTile.cpp index bd79e322b..0d5dd81fa 100644 --- a/targets/minecraft/world/level/tile/LeverTile.cpp +++ b/targets/minecraft/world/level/tile/LeverTile.cpp @@ -2,8 +2,8 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/LiquidTile.cpp b/targets/minecraft/world/level/tile/LiquidTile.cpp index 9aa0fdb55..b356250df 100644 --- a/targets/minecraft/world/level/tile/LiquidTile.cpp +++ b/targets/minecraft/world/level/tile/LiquidTile.cpp @@ -6,11 +6,11 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/NetherWartTile.cpp b/targets/minecraft/world/level/tile/NetherWartTile.cpp index 976f203ef..8459091c7 100644 --- a/targets/minecraft/world/level/tile/NetherWartTile.cpp +++ b/targets/minecraft/world/level/tile/NetherWartTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" NetherWartTile::NetherWartTile(int id) : Bush(id) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index f813da13e..e063bed09 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "NotGateTile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/redstone/Redstone.h" @@ -123,9 +122,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); if (isToggledTooFrequently(level, x, y, z, true)) { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, @@ -149,9 +147,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); } else { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); } } } diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index d51fca491..a3bc08cc3 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -1,12 +1,11 @@ -#include "minecraft/util/Log.h" #include "NoteBlockTile.h" #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BaseEntityTile.h" @@ -22,7 +21,7 @@ void NoteBlockTile::neighborChanged(Level* level, int x, int y, int z, std::dynamic_pointer_cast( level->getTileEntity(x, y, z)); Log::info("-------- Signal is %s, tile is currently %s\n", - signal ? "true" : "false", mte->on ? "ON" : "OFF"); + signal ? "true" : "false", mte->on ? "ON" : "OFF"); if (mte != nullptr && mte->on != signal) { if (signal) { mte->playNote(level, x, y, z); @@ -86,8 +85,7 @@ bool NoteBlockTile::triggerEvent(Level* level, int x, int y, int z, int i, iSound = eSoundType_NOTE_HARP; break; } - Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", - pitch); + Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", pitch); level->playSound(x + 0.5, y + 0.5, z + 0.5, iSound, 3, pitch); level->addParticle(eParticleType_note, x + 0.5, y + 1.2, z + 0.5, note / 24.0, 0, 0); diff --git a/targets/minecraft/world/level/tile/PortalTile.cpp b/targets/minecraft/world/level/tile/PortalTile.cpp index b02b12139..011bcb432 100644 --- a/targets/minecraft/world/level/tile/PortalTile.cpp +++ b/targets/minecraft/world/level/tile/PortalTile.cpp @@ -3,10 +3,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/SpawnEggItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/PotatoTile.cpp b/targets/minecraft/world/level/tile/PotatoTile.cpp index 79519081f..f4f39dd2b 100644 --- a/targets/minecraft/world/level/tile/PotatoTile.cpp +++ b/targets/minecraft/world/level/tile/PotatoTile.cpp @@ -3,13 +3,13 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" PotatoTile::PotatoTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/PressurePlateTile.cpp b/targets/minecraft/world/level/tile/PressurePlateTile.cpp index fc1b59016..7ce79210c 100644 --- a/targets/minecraft/world/level/tile/PressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/PressurePlateTile.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -44,7 +43,7 @@ int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) { entities = level->getEntitiesOfClass(typeid(Player), &at_bb); else assert(0); // 4J-JEV: We're going to delete something at a random - // location. + // location. if (entities != nullptr && !entities->empty()) { for (auto it = entities->begin(); it != entities->end(); ++it) { diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index f2cfe9409..3496834f7 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -6,12 +6,12 @@ #include #include "DiodeTile.h" -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp index 6339f1add..bbb966ce7 100644 --- a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp +++ b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp @@ -7,8 +7,8 @@ class Icon; -const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = { - "", "mossy", "cracked", "carved"}; +const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = {"", "mossy", + "cracked", "carved"}; const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES [SMOOTH_STONE_BRICK_NAMES_LENGTH] = {IDS_TILE_STONE_BRICK_SMOOTH, diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index e6bda67c5..e1c08b849 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 63e367005..b3d5cb22f 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "StoneMonsterTile.h" #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/monster/Silverfish.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp index a66f5a3e5..adae70e40 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -31,7 +31,7 @@ const unsigned int }; const std::string TallGrass::TEXTURE_NAMES[] = {"deadbush", "tallgrass", - "fern"}; + "fern"}; TallGrass::TallGrass(int id) : Bush(id, Material::replaceable_plant) { this->updateDefaultShape(); diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 215f17f20..195a3f3cb 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Tile.h" #include @@ -6,13 +5,12 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -153,6 +151,7 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "strings.h" +#include "util/StringHelpers.h" std::string Tile::TILE_DESCRIPTION_PREFIX = "Tile."; @@ -2624,8 +2623,8 @@ Tile* Tile::setIconName(const std::string& iconName) { } std::string Tile::getIconName() { - return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + - "_" + toWString(descriptionId) + return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + "_" + + toWString(descriptionId) : iconName; } @@ -2738,7 +2737,7 @@ int Tile::SoundType::getPlaceSound() const { return iPlaceSound; } 4J: These are necessary on the PS3. (and 4 and Vita). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int Tile::stone_Id; const int Tile::grass_Id; const int Tile::dirt_Id; diff --git a/targets/minecraft/world/level/tile/Tile.h b/targets/minecraft/world/level/tile/Tile.h index ebd3b42d7..188181309 100644 --- a/targets/minecraft/world/level/tile/Tile.h +++ b/targets/minecraft/world/level/tile/Tile.h @@ -5,7 +5,7 @@ #include #include -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 4b007ebb0..641839c59 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -1,14 +1,13 @@ -#include "minecraft/IGameServices.h" #include "TntTile.h" #include -#include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/level/tile/TreeTile.cpp b/targets/minecraft/world/level/tile/TreeTile.cpp index 97c6acd97..7eeed779f 100644 --- a/targets/minecraft/world/level/tile/TreeTile.cpp +++ b/targets/minecraft/world/level/tile/TreeTile.cpp @@ -19,7 +19,7 @@ const std::string TreeTile::TREE_STRING_NAMES[TreeTile::TREE_NAMES_LENGTH] = { "oak", "spruce", "birch", "jungle"}; const std::string TreeTile::TREE_TEXTURES[] = {"tree_side", "tree_spruce", - "tree_birch", "tree_jungle"}; + "tree_birch", "tree_jungle"}; TreeTile::TreeTile(int id) : RotatedPillarTile(id, Material::wood) {} diff --git a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp index fc910c128..2ca2b02a9 100644 --- a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp +++ b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp @@ -1,9 +1,9 @@ #include "TripWireSourceTile.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index ec4dda5da..94a56f6a2 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -3,10 +3,10 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/WoodTile.cpp b/targets/minecraft/world/level/tile/WoodTile.cpp index 68743203a..0a71cf229 100644 --- a/targets/minecraft/world/level/tile/WoodTile.cpp +++ b/targets/minecraft/world/level/tile/WoodTile.cpp @@ -15,7 +15,7 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { }; const std::string WoodTile::TEXTURE_NAMES[] = {"oak", "spruce", "birch", - "jungle"}; + "jungle"}; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index 7f6776c20..7c1726a50 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "BeaconTileEntity.h" #include #include -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/TileEntityDataPacket.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -282,7 +281,8 @@ void BeaconTileEntity::setItem(unsigned int slot, } std::string BeaconTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_BEACON); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_BEACON); } std::string BeaconTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 69e07f88e..bed079723 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "BrewingStandTileEntity.h" #include @@ -7,7 +6,7 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" @@ -41,7 +40,8 @@ BrewingStandTileEntity::BrewingStandTileEntity() { BrewingStandTileEntity::~BrewingStandTileEntity() {} std::string BrewingStandTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_BREWINGSTAND); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_BREWINGSTAND); } std::string BrewingStandTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index f9f03704e..02b57d53f 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ChestTileEntity.h" #include @@ -6,12 +5,12 @@ #include #include "Direction.h" -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" #include "TileEntity.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/CompoundContainer.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp index 654309fa7..6ce14da25 100644 --- a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp @@ -34,9 +34,7 @@ int CommandBlockEntity::performCommand(Level* level) { std::string CommandBlockEntity::getName() { return name; } -void CommandBlockEntity::setName(const std::string& name) { - this->name = name; -} +void CommandBlockEntity::setName(const std::string& name) { this->name = name; } void CommandBlockEntity::sendMessage(const std::string& message, ChatPacket::EChatPacketMessage type, diff --git a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp index ac6bc5d44..e62efb43a 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "DispenserTileEntity.h" #include -#include "app/linux/LinuxGame.h" #include "TileEntity.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" @@ -125,7 +124,8 @@ int DispenserTileEntity::addItem(std::shared_ptr item) { } std::string DispenserTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_DISPENSER); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_DISPENSER); } std::string DispenserTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp index 8fda024dd..9c9df6cf5 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -1,15 +1,15 @@ -#include "minecraft/IGameServices.h" #include "DropperTileEntity.h" #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "strings.h" std::string DropperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_DROPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_DROPPER); } // 4J Added diff --git a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 7667fa6c6..b59b521b0 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,12 +1,11 @@ -#include "minecraft/IGameServices.h" #include "EnchantmentTableTileEntity.h" #include #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" diff --git a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp index 819f34f0c..08172d448 100644 --- a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp @@ -1,7 +1,7 @@ #include "EnderChestTileEntity.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/ChestTile.h" diff --git a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp index 3b4bb3836..6fa2f5c61 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FurnaceTileEntity.h" #include #include "Facing.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/CoalItem.h" diff --git a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp index fc64a992a..3f28f6666 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HopperTileEntity.h" #include @@ -7,8 +6,8 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/WorldlyContainer.h" #include "minecraft/world/entity/EntitySelector.h" @@ -110,7 +109,8 @@ void HopperTileEntity::setItem(unsigned int slot, } std::string HopperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_HOPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_HOPPER); } std::string HopperTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index e25505c30..a57bf4a5a 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -2,14 +2,13 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" -#include "PlatformTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class Player; @@ -33,7 +32,8 @@ SignTileEntity::SignTileEntity() : TileEntity() { SignTileEntity::~SignTileEntity() { // TODO ORBIS_STUBBED; // 4J-PB - we don't need to verify strings anymore - - // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); }); + // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) + // { return handleStringVerify(r); }); } void SignTileEntity::save(CompoundTag* tag) { @@ -45,8 +45,7 @@ void SignTileEntity::save(CompoundTag* tag) { #if !defined(_CONTENT_PACKAGE) fprintf(stderr, "### - Saving a sign with text - \n"); for (int i = 0; i < 4; i++) { - fprintf(stderr, m_wsmessages[i].c_str()); - fprintf(stderr, "\n"); + fprintf(stderr, "%s\n", m_wsmessages[i].c_str()); } #endif } @@ -64,8 +63,7 @@ void SignTileEntity::load(CompoundTag* tag) { #if !defined(_CONTENT_PACKAGE) fprintf(stderr, "### - Loaded a sign with text - \n"); for (int i = 0; i < 4; i++) { - fprintf(stderr, m_wsmessages[i].c_str()); - fprintf(stderr, "\n"); + fprintf(stderr, "%s\n", m_wsmessages[i].c_str()); } #endif @@ -108,7 +106,7 @@ void SignTileEntity::setChanged() { // 4J-PB - For TU14 we are allowed to not verify strings anymore ! m_bVerified = true; /* - if(!g_NetworkManager.IsLocalGame() && !m_bVerified) + if(!NetworkService.IsLocalGame() && !m_bVerified) //if (pMinecraft->level->isClientSide) { char *wcMessages[MAX_SIGN_LINES]; @@ -124,7 +122,8 @@ sizeof(char)*(MAX_LINE_LENGTH+1)); if(m_wsmessages[i].length()>0) // at this point, we can ask the online string verifier if our sign text is ok #if 0 m_bVerified=true; #else - if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); })) + if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* +r) { return handleStringVerify(r); })) { // Nothing to verify m_bVerified=true; @@ -153,7 +152,7 @@ int SignTileEntity::handleStringVerify(STRING_VERIFY_RESPONSE* pResults) { m_bVerified = true; m_bCensored = false; for (int i = 0; i < pResults->wNumStrings; i++) { - if (pResults->pStringResult[i] != ERROR_SUCCESS) { + if (pResults->pStringResult[i] != 0) { m_bCensored = true; } } diff --git a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp index 183cd131d..3228d298f 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/IGameServices.h" #include "TheEndPortalTileEntity.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/level/tile/entity/TileEntity.cpp b/targets/minecraft/world/level/tile/entity/TileEntity.cpp index 89de391e5..47dcaa866 100644 --- a/targets/minecraft/world/level/tile/entity/TileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/TileEntity.cpp @@ -1,10 +1,9 @@ -#include "minecraft/util/Log.h" #include "TileEntity.h" #include -#include "app/linux/LinuxGame.h" #include "PistonPieceTileEntity.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/JukeboxTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -138,7 +137,7 @@ std::shared_ptr TileEntity::loadStatic(CompoundTag* tag) { } else { #ifdef _DEBUG Log::info("Skipping TileEntity with id %s.\n", - tag->getString("id").c_str()); + tag->getString("id").c_str()); #endif } diff --git a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp index 336585def..4a8212e2d 100644 --- a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp +++ b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp @@ -3,11 +3,11 @@ #include #include "PistonExtensionTile.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/scores/PlayerTeam.cpp b/targets/minecraft/world/scores/PlayerTeam.cpp index c23229712..4270cb479 100644 --- a/targets/minecraft/world/scores/PlayerTeam.cpp +++ b/targets/minecraft/world/scores/PlayerTeam.cpp @@ -55,8 +55,7 @@ std::string PlayerTeam::formatNameForTeam(PlayerTeam* team) { return formatNameForTeam(team, team->getDisplayName()); } -std::string PlayerTeam::formatNameForTeam(Team* team, - const std::string& name) { +std::string PlayerTeam::formatNameForTeam(Team* team, const std::string& name) { if (team == nullptr) return name; return team->getFormattedName(name); } diff --git a/targets/minecraft/world/scores/Team.h b/targets/minecraft/world/scores/Team.h index e29ac65c4..7d92bf2bf 100644 --- a/targets/minecraft/world/scores/Team.h +++ b/targets/minecraft/world/scores/Team.h @@ -7,8 +7,7 @@ public: virtual bool isAlliedTo(Team* other); virtual std::string getName() = 0; - virtual std::string getFormattedName( - const std::string& teamMemberName) = 0; + virtual std::string getFormattedName(const std::string& teamMemberName) = 0; virtual bool canSeeFriendlyInvisibles() = 0; virtual bool isAllowFriendlyFire() = 0; }; \ No newline at end of file diff --git a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h index 828fbc243..651524d63 100644 --- a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h +++ b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h @@ -9,8 +9,7 @@ class Player; class ObjectiveCriteria { public: - static std::unordered_map - CRITERIA_BY_NAME; + static std::unordered_map CRITERIA_BY_NAME; static ObjectiveCriteria* DUMMY; static ObjectiveCriteria* DEATH_COUNT; diff --git a/targets/minecraft/world/tutorial/ITutorial.h b/targets/minecraft/world/tutorial/ITutorial.h new file mode 100644 index 000000000..ed3982fb2 --- /dev/null +++ b/targets/minecraft/world/tutorial/ITutorial.h @@ -0,0 +1,54 @@ +#pragma once + +#include +#include + +#include "minecraft/world/tutorial/TutorialEnum.h" + +class Entity; +class ItemInstance; +class MobEffect; + +// Domain interface for the player tutorial. +// +// minecraft/ consumers (Player, GameMode, ClientConnection, the player +// list) need to forward gameplay events into the tutorial system but +// they should not depend on the heavyweight Tutorial implementation +// in app/common/Tutorial/. The concrete Tutorial in app/ inherits +// from this interface; minecraft/ only sees ITutorial*. +// +// Tutorial state and hint enums (eTutorial_State, eTutorial_Hint) +// remain in minecraft/world/tutorial/TutorialEnum.h, which is itself a +// content-only header that minecraft/ can safely include. +class ITutorial { +public: + virtual ~ITutorial() = default; + + // One-time process-wide initialisation. The concrete tutorial + // implementation in app/common/Tutorial/Tutorial.cpp provides the + // body. Called once from Minecraft::staticCtor. + static void staticInit(); + + [[nodiscard]] virtual bool isStateCompleted(eTutorial_State state) = 0; + virtual void changeTutorialState(eTutorial_State newState) = 0; + + virtual bool setMessage(const std::string& message, int icon, + int auxValue) = 0; + + virtual void showTutorialPopup(bool show) = 0; + + virtual void onCrafted(std::shared_ptr item) = 0; + virtual void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) = 0; + virtual void onSelectedItemChanged(std::shared_ptr item) = 0; + virtual void onLookAt(int id, int iData = 0) = 0; + virtual void onLookAtEntity(std::shared_ptr entity) = 0; + virtual void onRideEntity(std::shared_ptr entity) = 0; + virtual void completeUsingItem(std::shared_ptr item) = 0; + virtual void onEffectChanged(MobEffect* effect, bool bRemoved = false) = 0; + + [[nodiscard]] virtual bool canMoveToPosition(double xo, double yo, + double zo, double xt, + double yt, double zt) = 0; +}; diff --git a/targets/app/common/Tutorial/TutorialEnum.h b/targets/minecraft/world/tutorial/TutorialEnum.h similarity index 97% rename from targets/app/common/Tutorial/TutorialEnum.h rename to targets/minecraft/world/tutorial/TutorialEnum.h index c5cadb0a7..7d9e569eb 100644 --- a/targets/app/common/Tutorial/TutorialEnum.h +++ b/targets/minecraft/world/tutorial/TutorialEnum.h @@ -17,11 +17,9 @@ typedef struct { #define TUTORIAL_NO_TEXT -1 #define TUTORIAL_NO_ICON -1 -// If you want to make these bigger, be aware that that will affect what is -// stored after the tutorial data in the profile data See Xbox_App.h for the -// struct -#define TUTORIAL_PROFILE_STORAGE_BITS 512 -#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS / 8) +// TUTORIAL_PROFILE_STORAGE_BITS / TUTORIAL_PROFILE_STORAGE_BYTES moved to +// platform/profile/ProfileConstants.h since they describe profile data +// layout. Anything that needs them should include that header directly. // 4J Stu - The total number of eTutorial_State and eTutorial_Hint must be less // than 512, as we only have 512 bits of profile data to flag whether or not the diff --git a/targets/nbt/include/nbt/ByteArrayTag.h b/targets/nbt/include/nbt/ByteArrayTag.h index d5409c018..58adda56f 100644 --- a/targets/nbt/include/nbt/ByteArrayTag.h +++ b/targets/nbt/include/nbt/ByteArrayTag.h @@ -32,7 +32,7 @@ public: std::string toString() { static char buf[32]; - snprintf(buf, 32, "[%d bytes]", data.size()); + snprintf(buf, 32, "[%zu bytes]", data.size()); return std::string(buf); } diff --git a/targets/nbt/include/nbt/CompoundTag.h b/targets/nbt/include/nbt/CompoundTag.h index 8169a5cbe..789366680 100644 --- a/targets/nbt/include/nbt/CompoundTag.h +++ b/targets/nbt/include/nbt/CompoundTag.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include "ByteArrayTag.h" @@ -16,14 +16,14 @@ class CompoundTag : public Tag { private: - std::flat_map> tags; + std::unordered_map> tags; public: CompoundTag() : Tag("") {} CompoundTag(const std::string& name) : Tag(name) {} void write(DataOutput* dos) { - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { Tag::writeNamedTag(value.get(), dos); } dos->writeByte(Tag::TAG_End); @@ -49,7 +49,7 @@ public: std::vector getAllTags() { std::vector ret; ret.reserve(tags.size()); - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { ret.push_back(value.get()); } return ret; @@ -228,7 +228,7 @@ public: Tag* copy() { CompoundTag* tag = new CompoundTag(getName()); - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { tag->put(key, value->copy()); } return tag; @@ -239,7 +239,7 @@ public: CompoundTag* o = (CompoundTag*)obj; if (tags.size() == o->tags.size()) { - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { auto itFind = o->tags.find(key); if (itFind == o->tags.end() || !value->equals(itFind->second.get())) { diff --git a/targets/nbt/include/nbt/IntArrayTag.h b/targets/nbt/include/nbt/IntArrayTag.h index 7c2525b7e..fd9f940f9 100644 --- a/targets/nbt/include/nbt/IntArrayTag.h +++ b/targets/nbt/include/nbt/IntArrayTag.h @@ -36,7 +36,7 @@ public: std::string toString() { static char buf[32]; - snprintf(buf, 32, "[%d bytes]", data.size()); + snprintf(buf, 32, "[%zu bytes]", data.size()); return std::string(buf); } diff --git a/targets/nbt/include/nbt/IntTag.h b/targets/nbt/include/nbt/IntTag.h index e7aaa2610..5e48fb44e 100644 --- a/targets/nbt/include/nbt/IntTag.h +++ b/targets/nbt/include/nbt/IntTag.h @@ -5,9 +5,7 @@ class IntTag : public Tag { public: int data; IntTag(const std::string& name) : Tag(name) {} - IntTag(const std::string& name, int data) : Tag(name) { - this->data = data; - } + IntTag(const std::string& name, int data) : Tag(name) { this->data = data; } void write(DataOutput* dos) { dos->writeInt(data); } void load(DataInput* dis, int tagDepth) { data = dis->readInt(); } diff --git a/targets/nbt/include/nbt/LongTag.h b/targets/nbt/include/nbt/LongTag.h index 9af3b75d0..755e845e8 100644 --- a/targets/nbt/include/nbt/LongTag.h +++ b/targets/nbt/include/nbt/LongTag.h @@ -15,7 +15,7 @@ public: uint8_t getId() { return TAG_Long; } std::string toString() { static char buf[32]; - snprintf(buf, 32, "%I64d", data); + snprintf(buf, 32, "%lld", static_cast(data)); return std::string(buf); } diff --git a/targets/platform/IPlatformSound.h b/targets/platform/IPlatformSound.h deleted file mode 100644 index cb22aff11..000000000 --- a/targets/platform/IPlatformSound.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include - -class File; -class Mob; -class Options; - -class IPlatformSound { -public: - virtual ~IPlatformSound() = default; - - virtual void init(Options*) = 0; - virtual void destroy() = 0; - virtual void tick(std::shared_ptr* players, float a) = 0; - - // SFX - virtual void play(int iSound, float x, float y, float z, float volume, - float pitch) = 0; - virtual void playUI(int iSound, float volume, float pitch) = 0; - - // Streaming / music - virtual void playStreaming(const std::string& name, float x, float y, - float z, float volume, float pitch, - bool bMusicDelay = true) = 0; - virtual void playMusicTick() = 0; - virtual void updateMusicVolume(float fVal) = 0; - virtual void updateSystemMusicPlaying(bool isPlaying) = 0; - virtual void updateSoundEffectVolume(float fVal) = 0; - - // Asset registration - virtual void add(const std::string& name, File* file) = 0; - virtual void addMusic(const std::string& name, File* file) = 0; - virtual void addStreaming(const std::string& name, File* file) = 0; - virtual char* ConvertSoundPathToName(const std::string& name, - bool bConvertSpaces = false) = 0; -}; diff --git a/targets/platform/IPlatformUIController.h b/targets/platform/IPlatformUIController.h deleted file mode 100644 index 2223546c0..000000000 --- a/targets/platform/IPlatformUIController.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once - -#include - -#include "IPlatformStorage.h" - -// Forward declarations for game types used by the UI interface. -// Full definitions live in the Client module. -enum EUIScene : int; -enum EUILayer : int; -enum EUIGroup : int; -enum ESoundEffect : int; -struct TutorialPopupInfo; - -class IPlatformUIController { -public: - virtual ~IPlatformUIController() = default; - - virtual void tick() = 0; - virtual void render() = 0; - - // Skin - virtual void StartReloadSkinThread() = 0; - virtual bool IsReloadingSkin() = 0; - virtual void CleanUpSkinReload() = 0; - - // Navigation - virtual bool NavigateToScene(int iPad, EUIScene scene, - void* initData = nullptr, - EUILayer layer = static_cast(0), - EUIGroup group = static_cast(0)) = 0; - virtual bool NavigateBack(int iPad, bool forceUsePad = false, - EUIScene eScene = static_cast(-1), - EUILayer eLayer = static_cast(-1)) = 0; - virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; - virtual void CloseAllPlayersScenes() = 0; - - // Menu state - virtual bool IsPauseMenuDisplayed(int iPad) = 0; - virtual bool IsContainerMenuDisplayed(int iPad) = 0; - virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad) = 0; - virtual bool IsIgnoreAutosaveMenuDisplayed(int iPad) = 0; - virtual void SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) = 0; - virtual bool IsSceneInStack(int iPad, EUIScene eScene) = 0; - virtual bool GetMenuDisplayed(int iPad) = 0; - virtual void CheckMenuDisplayed() = 0; - - // Tooltips - virtual void SetTooltipText(unsigned int iPad, unsigned int tooltip, - int iTextID) = 0; - virtual void SetEnableTooltips(unsigned int iPad, bool bVal) = 0; - virtual void ShowTooltip(unsigned int iPad, unsigned int tooltip, - bool show) = 0; - virtual void SetTooltips(unsigned int iPad, int iA, int iB = -1, - int iX = -1, int iY = -1, int iLT = -1, - int iRT = -1, int iLB = -1, int iRB = -1, - int iLS = -1, int iRS = -1, int iBack = -1, - bool forceUpdate = false) = 0; - virtual void EnableTooltip(unsigned int iPad, unsigned int tooltip, - bool enable) = 0; - virtual void RefreshTooltips(unsigned int iPad) = 0; - - // Sound - virtual void PlayUISFX(ESoundEffect eSound) = 0; - - // Debug - virtual void ShowUIDebugConsole(bool show) {} - virtual void ShowUIDebugMarketingGuide(bool show) {} - - // HUD - virtual void DisplayGamertag(unsigned int iPad, bool show) = 0; - virtual void SetSelectedItem(unsigned int iPad, - const std::string& name) = 0; - virtual void UpdateSelectedItemPos(unsigned int iPad) = 0; - - // Events - virtual void HandleDLCMountingComplete() = 0; - virtual void HandleDLCInstalled(int iPad) = 0; - virtual void HandleTMSDLCFileRetrieved(int iPad) = 0; - virtual void HandleTMSBanFileRetrieved(int iPad) = 0; - virtual void HandleInventoryUpdated(int iPad) = 0; - virtual void HandleGameTick() = 0; - - // Tutorial - virtual void SetTutorialDescription(int iPad, TutorialPopupInfo* info) = 0; - virtual void SetTutorialVisible(int iPad, bool visible) = 0; - virtual bool IsTutorialVisible(int iPad) = 0; - - // Layout - virtual void UpdatePlayerBasePositions() = 0; - virtual void SetEmptyQuadrantLogo(int iSection) = 0; - virtual void HideAllGameUIElements() = 0; - virtual void ShowOtherPlayersBaseScene(unsigned int iPad, bool show) = 0; - - // Autosave - virtual void ShowAutosaveCountdownTimer(bool show) = 0; - virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; - virtual void ShowSavingMessage(unsigned int iPad, - IPlatformStorage::ESavingMessage eVal) = 0; - - // Start screen - virtual bool PressStartPlaying(unsigned int iPad) = 0; - virtual void ShowPressStart(unsigned int iPad) = 0; - - virtual void SetWinUserIndex(unsigned int iPad) = 0; -}; diff --git a/targets/platform/NetTypes.h b/targets/platform/NetTypes.h deleted file mode 100644 index 8c31bcaa7..000000000 --- a/targets/platform/NetTypes.h +++ /dev/null @@ -1,155 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "platform/PlatformTypes.h" - -inline constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; - -static_assert( - MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), - "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); - -using SessionID = uint64_t; -using GameSessionUID = PlayerUID; -class INVITE_INFO; - -inline constexpr int QNET_SENDDATA_LOW_PRIORITY = 0; -inline constexpr int QNET_SENDDATA_SECONDARY = 0; -inline constexpr int QNET_SENDDATA_RELIABLE = 0; -inline constexpr int QNET_SENDDATA_SEQUENTIAL = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_MESSAGES = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_BYTES = 0; - -#define QNET_E_SESSION_FULL 0 -#define QNET_USER_MASK_USER0 1 -#define QNET_USER_MASK_USER1 2 -#define QNET_USER_MASK_USER2 4 -#define QNET_USER_MASK_USER3 8 - -struct XRNM_SEND_BUFFER { - uint32_t dwDataSize; - uint8_t* pbyData; -}; - -template -class XLockFreeStack { - std::vector intStack; - std::mutex m_cs; - -public: - XLockFreeStack() = default; - ~XLockFreeStack() = default; - void Initialize() {} - void Push(T* data) { - std::lock_guard lock(m_cs); - intStack.push_back(data); - } - T* Pop() { - std::lock_guard lock(m_cs); - if (intStack.size()) { - T* ret = intStack.back(); - intStack.pop_back(); - return ret; - } - return nullptr; - } -}; - -class IQNetPlayer { -public: - uint8_t GetSmallId(); - void SendData(IQNetPlayer* player, const void* pvData, uint32_t dwDataSize, - uint32_t dwFlags); - bool IsSameSystem(IQNetPlayer* player); - uint32_t GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags); - uint32_t GetCurrentRtt(); - bool IsHost(); - bool IsGuest(); - bool IsLocal(); - PlayerUID GetXuid(); - const char* GetGamertag(); - int GetSessionIndex(); - bool IsTalking(); - bool IsMutedByLocalUser(uint32_t dwUserIndex); - bool HasVoice(); - bool HasCamera(); - int GetUserIndex(); - void SetCustomDataValue(uintptr_t ulpCustomDataValue); - uintptr_t GetCustomDataValue(); - -private: - uintptr_t m_customData; -}; - -enum QNET_STATE { - QNET_STATE_IDLE, - QNET_STATE_SESSION_HOSTING, - QNET_STATE_SESSION_JOINING, - QNET_STATE_GAME_LOBBY, - QNET_STATE_SESSION_REGISTERING, - QNET_STATE_SESSION_STARTING, - QNET_STATE_GAME_PLAY, - QNET_STATE_SESSION_ENDING, - QNET_STATE_SESSION_LEAVING, - QNET_STATE_SESSION_DELETING -}; - -class IQNet { -public: - int32_t AddLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetHostPlayer(); - IQNetPlayer* GetLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetPlayerByIndex(uint32_t dwPlayerIndex); - IQNetPlayer* GetPlayerBySmallId(uint8_t SmallId); - IQNetPlayer* GetPlayerByXuid(PlayerUID xuid); - uint32_t GetPlayerCount(); - QNET_STATE GetState(); - bool IsHost(); - int32_t JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, - const INVITE_INFO* pInviteInfo); - void HostGame(); - void EndGame(); - - static IQNetPlayer m_player[4]; -}; - -class IQNetCallbacks {}; -class IQNetGameSearch {}; - -struct XNQOSINFO { - uint8_t bFlags; - uint8_t bReserved; - uint16_t cProbesXmit; - uint16_t cProbesRecv; - uint16_t cbData; - uint8_t* pbData; - uint16_t wRttMinInMsecs; - uint16_t wRttMedInMsecs; - uint32_t dwUpBitsPerSec; - uint32_t dwDnBitsPerSec; -}; - -struct XNQOS { - uint32_t cxnqos; - uint32_t cxnqosPending; - XNQOSINFO axnqosinfo[1]; -}; - -struct XOVERLAPPED {}; - -struct XSESSION_SEARCHRESULT {}; - -struct XUSER_CONTEXT { - uint32_t dwContextId; - uint32_t dwValue; -}; - -struct XSESSION_SEARCHRESULT_HEADER { - uint32_t dwSearchResults; - XSESSION_SEARCHRESULT* pResults; -}; diff --git a/targets/platform/Platform.h b/targets/platform/Platform.h deleted file mode 100644 index d5e66025a..000000000 --- a/targets/platform/Platform.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "IPlatformFilesystem.h" -#include "platform/input/input.h" -#include "IPlatformLeaderboard.h" -#include "IPlatformNetwork.h" -#include "IPlatformProfile.h" -#include "platform/renderer/renderer.h" -#include "IPlatformSound.h" -#include "IPlatformStorage.h" -#include "IPlatformUIController.h" -#include "PlatformTypes.h" diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index ee942a9b5..9eda7366a 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -1,25 +1,41 @@ #pragma once +#include #include -#include +#include // Shared value types used by platform interfaces. These are NOT interfaces // themselves — they are data carriers that cross the platform boundary. struct ImageFileBuffer { enum EImageType { e_typePNG, e_typeJPG }; - EImageType m_type; - void* m_pBuffer = nullptr; - int m_bufferSize = 0; - [[nodiscard]] int GetType() const { return m_type; } - [[nodiscard]] void* GetBufferPointer() const { return m_pBuffer; } - [[nodiscard]] int GetBufferSize() const { return m_bufferSize; } + ImageFileBuffer() = default; + ImageFileBuffer(EImageType type, std::size_t size) + : m_type(type), + m_pBuffer(size > 0 ? std::make_unique(size) : nullptr), + m_bufferSize(size) {} + + // move-only + ImageFileBuffer(ImageFileBuffer&&) noexcept = default; + ImageFileBuffer& operator=(ImageFileBuffer&&) noexcept = default; + ImageFileBuffer(const ImageFileBuffer&) = delete; + ImageFileBuffer& operator=(const ImageFileBuffer&) = delete; + + [[nodiscard]] EImageType GetType() const { return m_type; } + [[nodiscard]] std::byte* GetBufferPointer() const { + return m_pBuffer.get(); + } + [[nodiscard]] std::size_t GetBufferSize() const { return m_bufferSize; } [[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; } void Release() { - std::free(m_pBuffer); - m_pBuffer = nullptr; + m_pBuffer.reset(); + m_bufferSize = 0; } + + EImageType m_type{e_typePNG}; + std::unique_ptr m_pBuffer; + std::size_t m_bufferSize = 0; }; struct D3DXIMAGE_INFO { @@ -60,6 +76,11 @@ inline constexpr int XUSER_MAX_COUNT = 4; inline constexpr int XUSER_NAME_SIZE = 32; inline constexpr int XUSER_INDEX_FOCUS = 254; +// Maximum local (split-screen) players. Same as XUSER_MAX_COUNT; kept as a +// separate name because gameplay code talks about "local players" rather +// than Xbox user slots. +#define MAX_LOCAL_PLAYERS 4 + using PlayerUID = unsigned long long; using PPlayerUID = PlayerUID*; inline constexpr PlayerUID INVALID_XUID = 0; @@ -106,11 +127,15 @@ struct XMARKETPLACE_CONTENTOFFER_INFO { using PXMARKETPLACE_CONTENTOFFER_INFO = XMARKETPLACE_CONTENTOFFER_INFO*; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = 0x00000040; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = + 0x00000020; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = + 0x00000040; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_THEME = 0x00000080; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_TILE = 0x00000800; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_ARCADE = 0x00002000; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_VIDEO = 0x00004000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = 0x00010000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = 0x00100000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = + 0x00010000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = + 0x00100000; diff --git a/targets/platform/fs/IPlatformFilesystem.h b/targets/platform/fs/IPlatformFilesystem.h index 0e0ca3b7d..493af1bc0 100644 --- a/targets/platform/fs/IPlatformFilesystem.h +++ b/targets/platform/fs/IPlatformFilesystem.h @@ -24,9 +24,9 @@ public: virtual ~IPlatformFilesystem() = default; // Read an entire file into a caller-provided buffer. - [[nodiscard]] virtual ReadResult readFile( - const std::filesystem::path& path, void* buffer, - std::size_t capacity) = 0; + [[nodiscard]] virtual ReadResult readFile(const std::filesystem::path& path, + void* buffer, + std::size_t capacity) = 0; // Read a segment of a file. [[nodiscard]] virtual ReadResult readFileSegment( diff --git a/targets/platform/fs/fs.h b/targets/platform/fs/fs.h index 4b17768b9..65de540ee 100644 --- a/targets/platform/fs/fs.h +++ b/targets/platform/fs/fs.h @@ -1,3 +1,18 @@ +#pragma once + #include "IPlatformFilesystem.h" -extern IPlatformFilesystem& PlatformFilesystem; \ No newline at end of file +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading +// PlatformFilesystem during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing +// `PlatformFilesystem.foo()` without each call site having to add the `()`. The +// expansion is just a call to a function returning a reference, so codegen is +// unchanged once inlined. +namespace platform_internal { +IPlatformFilesystem& PlatformFilesystem_get(); +} + +#define PlatformFilesystem (::platform_internal::PlatformFilesystem_get()) diff --git a/targets/platform/fs/meson.build b/targets/platform/fs/meson.build new file mode 100644 index 000000000..1b3593f54 --- /dev/null +++ b/targets/platform/fs/meson.build @@ -0,0 +1,9 @@ +lib_platform_fs_std = static_library('platform_fs_std', + files('std/StdFilesystem.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_fs_std_dep = declare_dependency( + link_with: lib_platform_fs_std, +) \ No newline at end of file diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp index 3f605392c..945d4b14f 100644 --- a/targets/platform/fs/std/StdFilesystem.cpp +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -6,11 +6,21 @@ #include #endif -StdFilesystem std_filesystem_instance; -IPlatformFilesystem& PlatformFilesystem = std_filesystem_instance; +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif -IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path, - void* buffer, std::size_t capacity) { +namespace platform_internal { +IPlatformFilesystem& PlatformFilesystem_get() { + static StdFilesystem instance; + return instance; +} +} // namespace platform_internal + +IPlatformFilesystem::ReadResult StdFilesystem::readFile( + const std::filesystem::path& path, void* buffer, std::size_t capacity) { std::error_code ec; auto size = std::filesystem::file_size(path, ec); if (ec) return {ReadStatus::NotFound, 0, 0}; @@ -25,9 +35,9 @@ IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::p static_cast(size)}; } -IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment(const std::filesystem::path& path, - std::size_t offset, void* buffer, - std::size_t bytesToRead) { +IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment( + const std::filesystem::path& path, std::size_t offset, void* buffer, + std::size_t bytesToRead) { std::error_code ec; auto size = std::filesystem::file_size(path, ec); if (ec) return {ReadStatus::NotFound, 0, 0}; @@ -78,15 +88,23 @@ std::size_t StdFilesystem::fileSize(const std::filesystem::path& path) { } std::filesystem::path StdFilesystem::getBasePath() { -#if defined(__linux__) - char buf[4096]; - ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); +#if defined(_WIN32) + wchar_t buf[4096]; + DWORD len = GetModuleFileNameW(nullptr, buf, sizeof(buf) / sizeof(wchar_t)); if (len > 0) { - buf[len] = '\0'; return std::filesystem::path(buf).parent_path(); } -#endif +#elif defined(__APPLE__) + char buf[4096]; + uint32_t size = sizeof(buf); + if (_NSGetExecutablePath(buf, &size) == 0) { + return std::filesystem::path(buf).parent_path(); + } +#elif defined(__linux__) + return std::filesystem::read_symlink("/proc/self/exe").parent_path(); +#else return std::filesystem::current_path(); +#endif } std::filesystem::path StdFilesystem::getUserDataPath() { return getBasePath(); } \ No newline at end of file diff --git a/targets/platform/fs/std/StdFilesystem.h b/targets/platform/fs/std/StdFilesystem.h index 6e494e5e1..bb56ecb20 100644 --- a/targets/platform/fs/std/StdFilesystem.h +++ b/targets/platform/fs/std/StdFilesystem.h @@ -1,10 +1,10 @@ #pragma once -#include "../IPlatformFilesystem.h" - +#include #include #include -#include + +#include "../IPlatformFilesystem.h" // Standard filesystem implementation for desktop platforms. class StdFilesystem : public IPlatformFilesystem { diff --git a/targets/app/common/IPlatformGame.h b/targets/platform/game/IPlatformGame.h similarity index 89% rename from targets/app/common/IPlatformGame.h rename to targets/platform/game/IPlatformGame.h index 033c3c26e..5ded22b07 100644 --- a/targets/app/common/IPlatformGame.h +++ b/targets/platform/game/IPlatformGame.h @@ -21,8 +21,7 @@ public: bool bCallback = false) = 0; virtual int LoadLocalTMSFile(char* wchTMSFile) = 0; - virtual int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) = 0; + virtual int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) = 0; virtual void FreeLocalTMSFiles(eTMSFileType eType) = 0; virtual int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, diff --git a/targets/platform/game/game.h b/targets/platform/game/game.h new file mode 100644 index 000000000..0be9983d6 --- /dev/null +++ b/targets/platform/game/game.h @@ -0,0 +1,11 @@ +#pragma once + +#include "IPlatformGame.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h. +namespace platform_internal { +IPlatformGame& PlatformGame_get(); +} + +#define PlatformGame (::platform_internal::PlatformGame_get()) diff --git a/targets/platform/game/meson.build b/targets/platform/game/meson.build new file mode 100644 index 000000000..8d3aa3b8d --- /dev/null +++ b/targets/platform/game/meson.build @@ -0,0 +1,9 @@ +lib_platform_game_stub = static_library('platform_game_stub', + files('stub/StubPlatformGame.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_game_stub_dep = declare_dependency( + link_with: lib_platform_game_stub, +) \ No newline at end of file diff --git a/targets/platform/game/stub/StubPlatformGame.cpp b/targets/platform/game/stub/StubPlatformGame.cpp new file mode 100644 index 000000000..608a71d62 --- /dev/null +++ b/targets/platform/game/stub/StubPlatformGame.cpp @@ -0,0 +1,10 @@ +#include "StubPlatformGame.h" + +#include "platform/game/game.h" + +namespace platform_internal { +IPlatformGame& PlatformGame_get() { + static StubPlatformGame instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/game/stub/StubPlatformGame.h b/targets/platform/game/stub/StubPlatformGame.h new file mode 100644 index 000000000..5aabbc682 --- /dev/null +++ b/targets/platform/game/stub/StubPlatformGame.h @@ -0,0 +1,42 @@ +#pragma once + +#include "platform/game/IPlatformGame.h" + +// True no-op platform game-services backend. Same role as +// LinuxGame's overrides today: every method is a no-op so the platform +// abstraction is satisfied without any host integration. The composition +// root can substitute a real backend (Xbox Live, Steam, GOG, etc.) at +// link time. + +class StubPlatformGame : public IPlatformGame { +public: + void SetRichPresenceContext(int /*iPad*/, int /*contextId*/) override {} + + void CaptureSaveThumbnail() override {} + void GetSaveThumbnail(std::uint8_t** thumbnailData, + unsigned int* thumbnailSize) override { + if (thumbnailData) *thumbnailData = nullptr; + if (thumbnailSize) *thumbnailSize = 0; + } + void ReleaseSaveThumbnail() override {} + void GetScreenshot(int /*iPad*/, std::uint8_t** screenshotData, + unsigned int* screenshotSize) override { + if (screenshotData) *screenshotData = nullptr; + if (screenshotSize) *screenshotSize = 0; + } + + void ReadBannedList(int /*iPad*/, eTMSAction /*action*/, + bool /*bCallback*/) override {} + + int LoadLocalTMSFile(char* /*wchTMSFile*/) override { return -1; } + int LoadLocalTMSFile(char* /*wchTMSFile*/, + eFileExtensionType /*eExt*/) override { + return -1; + } + void FreeLocalTMSFiles(eTMSFileType /*eType*/) override {} + int GetLocalTMSFileIndex(char* /*wchTMSFile*/, + bool /*bFilenameIncludesExtension*/, + eFileExtensionType /*eEXT*/) override { + return -1; + } +}; diff --git a/targets/platform/input/IPlatformInput.h b/targets/platform/input/IPlatformInput.h index 506839170..7d0c13167 100644 --- a/targets/platform/input/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -2,8 +2,7 @@ #include -#include "PlatformTypes.h" -#include "InputConstants.h" +#include "platform/PlatformTypes.h" class IPlatformInput { public: @@ -80,9 +79,8 @@ public: [[nodiscard]] virtual int GetScrollDelta() = 0; // Keyboard - virtual EKeyboardResult RequestKeyboard(const char* Title, - const char* Text, int iPad, - unsigned int uiMaxChars, + virtual EKeyboardResult RequestKeyboard(const char* Title, const char* Text, + int iPad, unsigned int uiMaxChars, std::function callback, EKeyboardMode eMode) = 0; [[nodiscard]] virtual const char* GetText() = 0; diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h index 436916435..19369689f 100644 --- a/targets/platform/input/input.h +++ b/targets/platform/input/input.h @@ -1,3 +1,19 @@ -#include "IPlatformInput.h" +#pragma once -extern IPlatformInput& PlatformInput; +#include "IPlatformInput.h" +#include "InputConstants.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformInput& PlatformInput;` form had: anything reading +// PlatformInput during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformInput.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformInput& PlatformInput_get(); +} + +#define PlatformInput (::platform_internal::PlatformInput_get()) diff --git a/targets/platform/input/meson.build b/targets/platform/input/meson.build new file mode 100644 index 000000000..5ff09a76e --- /dev/null +++ b/targets/platform/input/meson.build @@ -0,0 +1,10 @@ +lib_platform_input_sdl2 = static_library('platform_input_sdl2', + files('sdl2/SDL2Input.cpp'), + dependencies: dependency('sdl2'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_input_sdl2_dep = declare_dependency( + link_with: lib_platform_input_sdl2, +) diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 29348e951..d80ae45b6 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -1,15 +1,5 @@ #include "SDL2Input.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -17,11 +7,25 @@ #include #include -#include "../InputConstants.h" #include "../../PlatformTypes.h" +#include "../InputConstants.h" +#include "SDL.h" +#include "SDL_events.h" +#include "SDL_gamecontroller.h" +#include "SDL_joystick.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_scancode.h" +#include "SDL_stdinc.h" +#include "SDL_video.h" +#include "begin_code.h" -SDL2Input sdl2_input_instance; -IPlatformInput& PlatformInput = sdl2_input_instance; +namespace platform_internal { +IPlatformInput& PlatformInput_get() { + static SDL2Input instance; + return instance; +} +} // namespace platform_internal static const int KEY_COUNT = SDL_NUM_SCANCODES; static const int BTN_COUNT = SDL_CONTROLLER_BUTTON_MAX; diff --git a/targets/platform/input/sdl2/SDL2Input.h b/targets/platform/input/sdl2/SDL2Input.h index e2be82f51..dc8079c95 100644 --- a/targets/platform/input/sdl2/SDL2Input.h +++ b/targets/platform/input/sdl2/SDL2Input.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "../IPlatformInput.h" class SDL2Input : public IPlatformInput { diff --git a/targets/platform/IPlatformLeaderboard.h b/targets/platform/leaderboard/IPlatformLeaderboard.h similarity index 97% rename from targets/platform/IPlatformLeaderboard.h rename to targets/platform/leaderboard/IPlatformLeaderboard.h index f0f164ba9..3d2137ae4 100644 --- a/targets/platform/IPlatformLeaderboard.h +++ b/targets/platform/leaderboard/IPlatformLeaderboard.h @@ -3,7 +3,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class LeaderboardReadListener; @@ -166,8 +166,7 @@ public: unsigned int readCount) = 0; virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int readCount) = 0; + PlayerUID myUID, unsigned int readCount) = 0; virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, EStatsType type, unsigned int startIndex, diff --git a/targets/platform/leaderboard/leaderboard.h b/targets/platform/leaderboard/leaderboard.h new file mode 100644 index 000000000..661b0e492 --- /dev/null +++ b/targets/platform/leaderboard/leaderboard.h @@ -0,0 +1,13 @@ +#pragma once + +#include "IPlatformLeaderboard.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h: avoids the static-init-order +// fiasco and lets call sites use the existing `PlatformLeaderboard.foo()` +// shape via the macro expansion. +namespace platform_internal { +IPlatformLeaderboard& PlatformLeaderboard_get(); +} + +#define PlatformLeaderboard (::platform_internal::PlatformLeaderboard_get()) diff --git a/targets/platform/leaderboard/meson.build b/targets/platform/leaderboard/meson.build new file mode 100644 index 000000000..597a5c41b --- /dev/null +++ b/targets/platform/leaderboard/meson.build @@ -0,0 +1,9 @@ +lib_platform_leaderboard_stub = static_library('platform_leaderboard_stub', + files('stub/StubLeaderboard.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_leaderboard_stub_dep = declare_dependency( + link_with: lib_platform_leaderboard_stub, +) diff --git a/targets/platform/leaderboard/stub/StubLeaderboard.cpp b/targets/platform/leaderboard/stub/StubLeaderboard.cpp new file mode 100644 index 000000000..03e7585d1 --- /dev/null +++ b/targets/platform/leaderboard/stub/StubLeaderboard.cpp @@ -0,0 +1,10 @@ +#include "StubLeaderboard.h" + +#include "platform/leaderboard/leaderboard.h" + +namespace platform_internal { +IPlatformLeaderboard& PlatformLeaderboard_get() { + static StubLeaderboard instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/leaderboard/stub/StubLeaderboard.h b/targets/platform/leaderboard/stub/StubLeaderboard.h new file mode 100644 index 000000000..f6784fd57 --- /dev/null +++ b/targets/platform/leaderboard/stub/StubLeaderboard.h @@ -0,0 +1,45 @@ +#pragma once + +#include "platform/leaderboard/IPlatformLeaderboard.h" + +// No-op leaderboard backend. Returns success for session lifecycle and +// `false` for every read/write so consumers can short-circuit cleanly. +// This is the platform default; a real backend (Steam, EOS, Xbox Live, +// custom HTTP) would replace this at link time. + +class StubLeaderboard : public IPlatformLeaderboard { +public: + void Tick() override {} + + [[nodiscard]] bool OpenSession() override { return true; } + void CloseSession() override {} + void DeleteSession() override {} + + [[nodiscard]] bool WriteStats(unsigned int /*viewCount*/, + ViewIn /*views*/) override { + return false; + } + + bool ReadStats_Friends(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + PlayerUID /*myUID*/, unsigned int /*startIndex*/, + unsigned int /*readCount*/) override { + return false; + } + bool ReadStats_MyScore(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + PlayerUID /*myUID*/, + unsigned int /*readCount*/) override { + return false; + } + bool ReadStats_TopRank(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + unsigned int /*startIndex*/, + unsigned int /*readCount*/) override { + return false; + } + + void FlushStats() override {} + void CancelOperation() override {} + [[nodiscard]] bool isIdle() override { return true; } +}; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 7aed1816f..6abdd4cb6 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -1,52 +1,10 @@ -platform_inc = include_directories('.') -_threads = dependency('threads') - -lib_platform_core = static_library('platform_core', - files('C4JThread.cpp', 'ShutdownManager.cpp'), - include_directories: [platform_inc, include_directories('..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -platform_dep = declare_dependency( - link_with: lib_platform_core, - include_directories: platform_inc, -) - -# SDL2-based platform implementations (formerly 4J.* modules) -_sdl2 = dependency('sdl2') -_defs = [] - -if get_option('renderer') == 'gles' - _gl = dependency('glesv2', required: true) - _defs += ['-DGLES'] -else - _gl = dependency('gl', required: true) -endif - -sdl2_sources = files( - 'input/sdl2/SDL2Input.cpp', - 'profile/stub/StubProfile.cpp', - 'storage/stub/StubStorage.cpp', - 'renderer/gl/GLRenderer.cpp', - 'renderer/gl/render_stubs.cpp', - 'fs/std/StdFilesystem.cpp', -) - -lib_platform_sdl2 = static_library('platform_sdl2', - sdl2_sources, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep], - cpp_args: _defs + global_cpp_args + global_cpp_defs, -) - -# Combined dependency: interfaces + SDL2 implementations -# Replaces the old render_dep, input_dep, profile_dep, storage_dep -render_dep = declare_dependency( - link_with: lib_platform_sdl2, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep], -) -input_dep = render_dep -profile_dep = render_dep -storage_dep = render_dep +subdir('fs') +subdir('game') +subdir('input') +subdir('leaderboard') +subdir('network') +subdir('profile') +subdir('renderer') +subdir('sound') +subdir('storage') +subdir('thread') diff --git a/targets/app/common/Network/NetworkPlayerInterface.h b/targets/platform/network/INetworkPlayer.h similarity index 100% rename from targets/app/common/Network/NetworkPlayerInterface.h rename to targets/platform/network/INetworkPlayer.h diff --git a/targets/platform/IPlatformNetwork.h b/targets/platform/network/IPlatformNetwork.h similarity index 92% rename from targets/platform/IPlatformNetwork.h rename to targets/platform/network/IPlatformNetwork.h index 742a8d383..9c240d0ad 100644 --- a/targets/platform/IPlatformNetwork.h +++ b/targets/platform/network/IPlatformNetwork.h @@ -5,8 +5,8 @@ #include #include -#include "PlatformTypes.h" -#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" #ifndef VER_NETWORK #define VER_NETWORK 560 @@ -51,8 +51,7 @@ public: virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex( int userIndex) = 0; - [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex( - int playerIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId( unsigned char smallId) = 0; @@ -89,9 +88,8 @@ public: // Callbacks virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; + int iPad, std::function + callback) = 0; virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; virtual void HandleSignInChange() = 0; @@ -112,7 +110,7 @@ public: // System flags virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; [[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) = 0; + int index) = 0; // Stats [[nodiscard]] virtual std::string GatherStats() = 0; @@ -128,8 +126,7 @@ public: int iPad, int localPlayers, bool partyOnly) = 0; [[nodiscard]] virtual bool GetGameSessionInfo( int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; + virtual void SetSessionsUpdatedCallback(std::function callback) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) = 0; diff --git a/targets/platform/network/NetTypes.h b/targets/platform/network/NetTypes.h new file mode 100644 index 000000000..839cbe5be --- /dev/null +++ b/targets/platform/network/NetTypes.h @@ -0,0 +1,80 @@ +#pragma once + +#include +#include +#include +#include + +#include "platform/PlatformTypes.h" + +inline constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; + +static_assert( + MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); + +using SessionID = uint64_t; +using GameSessionUID = PlayerUID; +class INVITE_INFO; + +struct XRNM_SEND_BUFFER { + uint32_t dwDataSize; + uint8_t* pbyData; +}; + +template +class XLockFreeStack { + std::vector intStack; + std::mutex m_cs; + +public: + XLockFreeStack() = default; + ~XLockFreeStack() = default; + void Initialize() {} + void Push(T* data) { + std::lock_guard lock(m_cs); + intStack.push_back(data); + } + T* Pop() { + std::lock_guard lock(m_cs); + if (intStack.size()) { + T* ret = intStack.back(); + intStack.pop_back(); + return ret; + } + return nullptr; + } +}; + +struct XNQOSINFO { + uint8_t bFlags; + uint8_t bReserved; + uint16_t cProbesXmit; + uint16_t cProbesRecv; + uint16_t cbData; + uint8_t* pbData; + uint16_t wRttMinInMsecs; + uint16_t wRttMedInMsecs; + uint32_t dwUpBitsPerSec; + uint32_t dwDnBitsPerSec; +}; + +struct XNQOS { + uint32_t cxnqos; + uint32_t cxnqosPending; + XNQOSINFO axnqosinfo[1]; +}; + +struct XOVERLAPPED {}; + +struct XSESSION_SEARCHRESULT {}; + +struct XUSER_CONTEXT { + uint32_t dwContextId; + uint32_t dwValue; +}; + +struct XSESSION_SEARCHRESULT_HEADER { + uint32_t dwSearchResults; + XSESSION_SEARCHRESULT* pResults; +}; diff --git a/targets/app/common/Network/SessionInfo.h b/targets/platform/network/SessionInfo.h similarity index 96% rename from targets/app/common/Network/SessionInfo.h rename to targets/platform/network/SessionInfo.h index 51c02e051..898aac270 100644 --- a/targets/app/common/Network/SessionInfo.h +++ b/targets/platform/network/SessionInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" // A struct that we store in the QoS data when we are hosting the session. Max // size 1020 bytes. diff --git a/targets/platform/network/meson.build b/targets/platform/network/meson.build new file mode 100644 index 000000000..34a557dac --- /dev/null +++ b/targets/platform/network/meson.build @@ -0,0 +1,10 @@ +lib_platform_network_stub = static_library('platform_network_stub', + files('stub/StubNetworkPlayer.cpp', 'stub/StubPlatformNetwork.cpp'), + include_directories: include_directories('../../'), + dependencies: java_dep, + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_network_stub_dep = declare_dependency( + link_with: lib_platform_network_stub, +) \ No newline at end of file diff --git a/targets/platform/network/network.h b/targets/platform/network/network.h new file mode 100644 index 000000000..e953b9093 --- /dev/null +++ b/targets/platform/network/network.h @@ -0,0 +1,15 @@ +#pragma once + +#include "INetworkPlayer.h" +#include "IPlatformNetwork.h" +#include "SessionInfo.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h: avoids the static-init-order +// fiasco. Call sites use the existing `PlatformNetwork.foo()` form via +// the macro. +namespace platform_internal { +IPlatformNetwork& PlatformNetwork_get(); +} + +#define PlatformNetwork (::platform_internal::PlatformNetwork_get()) diff --git a/targets/platform/network/stub/StubNetworkPlayer.cpp b/targets/platform/network/stub/StubNetworkPlayer.cpp new file mode 100644 index 000000000..295c32d6f --- /dev/null +++ b/targets/platform/network/stub/StubNetworkPlayer.cpp @@ -0,0 +1,53 @@ +#include "StubNetworkPlayer.h" + +#include "StubPlatformNetwork.h" +#include "java/System.h" +#include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" + +StubNetworkPlayer::StubNetworkPlayer() { m_pSocket = nullptr; } + +uint8_t StubNetworkPlayer::GetSmallId() { return 0; } +void StubNetworkPlayer::SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority, bool ack) {} +bool StubNetworkPlayer::IsSameSystem(INetworkPlayer* player) { return true; } +int StubNetworkPlayer::GetOutstandingAckCount() { return 0; } +int StubNetworkPlayer::GetSendQueueSizeBytes(INetworkPlayer* player, + bool lowPriority) { + return 0; +} +int StubNetworkPlayer::GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority) { + return 0; +} +int StubNetworkPlayer::GetCurrentRtt() { return 0; } +bool StubNetworkPlayer::IsHost() { + return this == &StubPlatformNetwork::m_players[0]; +} +bool StubNetworkPlayer::IsGuest() { return false; } +bool StubNetworkPlayer::IsLocal() { return true; } +int StubNetworkPlayer::GetSessionIndex() { return 0; } +bool StubNetworkPlayer::IsTalking() { return false; } +bool StubNetworkPlayer::IsMutedByLocalUser(int dwUserIndex) { return false; } +bool StubNetworkPlayer::HasVoice() { return false; } +bool StubNetworkPlayer::HasCamera() { return false; } +void StubNetworkPlayer::SetSocket(Socket* pSocket) { m_pSocket = pSocket; } +Socket* StubNetworkPlayer::GetSocket() { return m_pSocket; } +PlayerUID StubNetworkPlayer::GetUID() { return INVALID_XUID; } +const char* StubNetworkPlayer::GetOnlineName() { return "stub"; } +std::string StubNetworkPlayer::GetDisplayName() { return "stub"; } +int StubNetworkPlayer::GetUserIndex() { + return this - &StubPlatformNetwork::m_players[0]; +} +void StubNetworkPlayer::SentChunkPacket() { + m_lastChunkPacketTime = System::currentTimeMillis(); +} +int StubNetworkPlayer::GetTimeSinceLastChunkPacket_ms() { + // If we haven't ever sent a packet, return maximum + if (m_lastChunkPacketTime == 0) { + return INT_MAX; + } + + const int64_t currentTime = System::currentTimeMillis(); + return static_cast(currentTime - m_lastChunkPacketTime); +} diff --git a/targets/platform/network/stub/StubNetworkPlayer.h b/targets/platform/network/stub/StubNetworkPlayer.h new file mode 100644 index 000000000..90dced43e --- /dev/null +++ b/targets/platform/network/stub/StubNetworkPlayer.h @@ -0,0 +1,51 @@ +#pragma once + +#include + +#include + +#include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" + +class Socket; + +// This is an implementation of the INetworkPlayer interface for the supported +// QNet-backed path. It +// effectively wraps the StubNetworkPlayer class in a non-platform-specific way. +// It is managed by PlatformNetworkManagerStub. + +class StubNetworkPlayer : public INetworkPlayer { +public: + StubNetworkPlayer(); + + // Common player interface + unsigned char GetSmallId(); + void SendData(INetworkPlayer* player, const void* pvData, int dataSize, + bool lowPriority, bool ack); + bool IsSameSystem(INetworkPlayer* player); + int GetOutstandingAckCount(); + int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); + int GetSendQueueSizeMessages(INetworkPlayer* player, bool lowPriority); + int GetCurrentRtt(); + bool IsHost(); + bool IsGuest(); + bool IsLocal(); + int GetSessionIndex(); + bool IsTalking(); + bool IsMutedByLocalUser(int userIndex); + bool HasVoice(); + bool HasCamera(); + int GetUserIndex(); + void SetSocket(Socket* pSocket); + Socket* GetSocket(); + const char* GetOnlineName(); + std::string GetDisplayName(); + PlayerUID GetUID(); + void SentChunkPacket(); + int GetTimeSinceLastChunkPacket_ms(); + +private: + int64_t m_lastChunkPacketTime; + Socket* m_pSocket; +}; \ No newline at end of file diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp similarity index 51% rename from targets/app/common/Network/PlatformNetworkManagerStub.cpp rename to targets/platform/network/stub/StubPlatformNetwork.cpp index 62bd9c69e..1a0909ef9 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -1,22 +1,28 @@ -#include "PlatformNetworkManagerStub.h" +#include "StubPlatformNetwork.h" #include #include #include +#include "StubNetworkPlayer.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "platform/NetTypes.h" -#include "NetworkPlayerQNet.h" -#include "Socket.h" -#include "platform/C4JThread.h" +#include "minecraft/network/Socket.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/thread/C4JThread.h" -IPlatformNetworkStub* g_pPlatformNetworkManager; +namespace platform_internal { +IPlatformNetwork& PlatformNetwork_get() { + static StubPlatformNetwork instance; + return instance; +} +} // namespace platform_internal -void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { +static bool s_gameRunning = false; +StubNetworkPlayer StubPlatformNetwork::m_players[4]; + +void StubPlatformNetwork::NotifyPlayerJoined(INetworkPlayer* pQNetPlayer) { const char* pszDescription; // 4J Stu - We create a fake socket for every where that we need an INBOUND @@ -26,8 +32,8 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerQNet* networkPlayer = - (NetworkPlayerQNet*)addNetworkPlayer(pQNetPlayer); + INetworkPlayer* networkPlayer = + (INetworkPlayer*)addNetworkPlayer(pQNetPlayer); if (pQNetPlayer->IsLocal()) { localPlayer = true; @@ -52,17 +58,17 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { // If we are the host, then create a fake socket for every remote // player - if (m_pIQNet->IsHost()) { + if (IsHost()) { createFakeSocket = true; } } - if (m_pIQNet->IsHost() && !m_bHostChanged) { + if (IsHost() && !m_bHostChanged) { // Do we already have a primary player for this system? bool systemHasPrimaryPlayer = false; for (auto it = m_machineQNetPrimaryPlayers.begin(); it < m_machineQNetPrimaryPlayers.end(); ++it) { - IQNetPlayer* pQNetPrimaryPlayer = *it; + INetworkPlayer* pQNetPrimaryPlayer = *it; if (pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer)) { systemHasPrimaryPlayer = true; break; @@ -78,12 +84,11 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { g_NetworkManager.CreateSocket(networkPlayer, localPlayer); } - app.DebugPrintf("Player 0x%p \"%s\" joined; %s; voice %i; camera %i.\n", - pQNetPlayer, pQNetPlayer->GetGamertag(), pszDescription, - (int)pQNetPlayer->HasVoice(), - (int)pQNetPlayer->HasCamera()); + fprintf(stderr, "Player 0x%p \"%s\" joined; %s; voice %i; camera %i.\n", + pQNetPlayer, pQNetPlayer->GetOnlineName(), pszDescription, + (int)pQNetPlayer->HasVoice(), (int)pQNetPlayer->HasCamera()); - if (m_pIQNet->IsHost()) { + if (IsHost()) { // 4J-PB - only the host should do this // g_NetworkManager.UpdateAndSetGameSessionData(); SystemFlagAddPlayer(networkPlayer); @@ -94,27 +99,19 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { playerChangedCallback[idx](networkPlayer, false); } - if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) { + if (s_gameRunning) { int localPlayerCount = 0; for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr) - ++localPlayerCount; + if (GetLocalPlayerByUserIndex(idx) != nullptr) ++localPlayerCount; } - - float appTime = app.getAppTime(); - - // Only record stats for the primary player here - m_lastPlayerEventTimeStart = appTime; } } -bool IPlatformNetworkStub::Initialise( - CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { +bool StubPlatformNetwork::Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize) { m_pGameNetworkManager = pGameNetworkManager; m_flagIndexSize = flagIndexSize; - g_pPlatformNetworkManager = this; - // 4jcraft added this, as it was never called - m_pIQNet = new IQNet(); + for (int i = 0; i < XUSER_MAX_COUNT; i++) { playerChangedCallback[i] = nullptr; } @@ -123,99 +120,77 @@ bool IPlatformNetworkStub::Initialise( m_bLeaveGameOnTick = false; m_bHostChanged = false; - m_bSearchResultsReady = false; - m_bSearchPending = false; - m_bIsOfflineGame = false; m_SessionsUpdatedCallback = nullptr; - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - - // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; - m_currentSearchResultsCount[i] = 0; - } - // Success! return true; } -void IPlatformNetworkStub::Terminate() { +void StubPlatformNetwork::Terminate() { // TODO: 4jcraft, no release of ressources } -int IPlatformNetworkStub::GetJoiningReadyPercentage() { return 100; } +int StubPlatformNetwork::GetJoiningReadyPercentage() { return 100; } -int IPlatformNetworkStub::CorrectErrorIDS(int IDS) { return IDS; } +int StubPlatformNetwork::CorrectErrorIDS(int IDS) { return IDS; } -bool IPlatformNetworkStub::isSystemPrimaryPlayer( - IQNetPlayer* pQNetPlayer) { +bool StubPlatformNetwork::isSystemPrimaryPlayer(INetworkPlayer* pQNetPlayer) { return true; } // We call this twice a frame, either side of the render call so is a good place // to "tick" things -void IPlatformNetworkStub::DoWork() {} +void StubPlatformNetwork::DoWork() {} -int IPlatformNetworkStub::GetPlayerCount() { - return m_pIQNet->GetPlayerCount(); -} +int StubPlatformNetwork::GetPlayerCount() { return 1; } -bool IPlatformNetworkStub::ShouldMessageForFullSession() { - return false; -} +bool StubPlatformNetwork::ShouldMessageForFullSession() { return false; } -int IPlatformNetworkStub::GetOnlinePlayerCount() { return 1; } +int StubPlatformNetwork::GetOnlinePlayerCount() { return 1; } -int IPlatformNetworkStub::GetLocalPlayerMask(int playerIndex) { +int StubPlatformNetwork::GetLocalPlayerMask(int playerIndex) { return 1 << playerIndex; } -bool IPlatformNetworkStub::AddLocalPlayerByUserIndex(int userIndex) { - NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); - return (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == 0); -} - -bool IPlatformNetworkStub::RemoveLocalPlayerByUserIndex(int userIndex) { +bool StubPlatformNetwork::AddLocalPlayerByUserIndex(int userIndex) { + NotifyPlayerJoined(GetLocalPlayerByUserIndex(userIndex)); return true; } -bool IPlatformNetworkStub::IsInStatsEnabledSession() { return true; } - -bool IPlatformNetworkStub::SessionHasSpace( - unsigned int spaceRequired /*= 1*/) { +bool StubPlatformNetwork::RemoveLocalPlayerByUserIndex(int userIndex) { return true; } -void IPlatformNetworkStub::SendInviteGUI(int quadrant) {} +bool StubPlatformNetwork::IsInStatsEnabledSession() { return true; } -bool IPlatformNetworkStub::IsAddingPlayer() { return false; } +bool StubPlatformNetwork::SessionHasSpace(unsigned int spaceRequired /*= 1*/) { + return true; +} -bool IPlatformNetworkStub::LeaveGame(bool bMigrateHost) { +void StubPlatformNetwork::SendInviteGUI(int quadrant) {} + +bool StubPlatformNetwork::IsAddingPlayer() { return false; } + +bool StubPlatformNetwork::LeaveGame(bool bMigrateHost) { if (m_bLeavingGame) return true; m_bLeavingGame = true; // If we are the host wait for the game server to end - if (m_pIQNet->IsHost() && g_NetworkManager.ServerStoppedValid()) { - m_pIQNet->EndGame(); + if (IsHost() && g_NetworkManager.ServerStoppedValid()) { + s_gameRunning = false; g_NetworkManager.ServerStoppedWait(); g_NetworkManager.ServerStoppedDestroy(); } return true; } -bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, - bool bLeaveRoom) { +bool StubPlatformNetwork::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) { return true; } -void IPlatformNetworkStub::HostGame( +void StubPlatformNetwork::HostGame( int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) { @@ -229,53 +204,51 @@ void IPlatformNetworkStub::HostGame( localUsersMask |= GetLocalPlayerMask(g_NetworkManager.GetPrimaryPad()); m_bLeavingGame = false; - - m_pIQNet->HostGame(); + s_gameRunning = true; _HostGame(localUsersMask, publicSlots, privateSlots); // #endif } -void IPlatformNetworkStub::_HostGame( +void StubPlatformNetwork::_HostGame( int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) {} -bool IPlatformNetworkStub::_StartGame() { return true; } +bool StubPlatformNetwork::_StartGame() { return true; } -int IPlatformNetworkStub::JoinGame(FriendSessionInfo* searchResult, - int localUsersMask, - int primaryUserIndex) { +int StubPlatformNetwork::JoinGame(FriendSessionInfo* searchResult, + int localUsersMask, int primaryUserIndex) { return CGameNetworkManager::JOINGAME_SUCCESS; } -bool IPlatformNetworkStub::SetLocalGame(bool isLocal) { +bool StubPlatformNetwork::SetLocalGame(bool isLocal) { m_bIsOfflineGame = isLocal; return true; } -void IPlatformNetworkStub::SetPrivateGame(bool isPrivate) { - app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no"); +void StubPlatformNetwork::SetPrivateGame(bool isPrivate) { + fprintf(stderr, "Setting as private game: %s\n", isPrivate ? "yes" : "no"); m_bIsPrivateGame = isPrivate; } -void IPlatformNetworkStub::RegisterPlayerChangedCallback( +void StubPlatformNetwork::RegisterPlayerChangedCallback( int iPad, std::function callback) { playerChangedCallback[iPad] = std::move(callback); } -void IPlatformNetworkStub::UnRegisterPlayerChangedCallback(int iPad) { +void StubPlatformNetwork::UnRegisterPlayerChangedCallback(int iPad) { playerChangedCallback[iPad] = nullptr; } -void IPlatformNetworkStub::HandleSignInChange() { return; } +void StubPlatformNetwork::HandleSignInChange() { return; } -bool IPlatformNetworkStub::_RunNetworkGame() { return true; } +bool StubPlatformNetwork::_RunNetworkGame() { return true; } -void IPlatformNetworkStub::UpdateAndSetGameSessionData( +void StubPlatformNetwork::UpdateAndSetGameSessionData( INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) { - // uint32_t playerCount = m_pIQNet->GetPlayerCount(); + // uint32_t playerCount = m_player->GetPlayerCount(); // // if( this->m_bLeavingGame ) // return; @@ -320,32 +293,12 @@ void IPlatformNetworkStub::UpdateAndSetGameSessionData( // app.GetGameHostOption(eGameHostOption_All); } -int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc( - void* lpParam) { - INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; - - Socket* socket = pNetworkPlayer->GetSocket(); - - if (socket != nullptr) { - // printf("Waiting for socket closed event\n"); - socket->m_socketClosedEvent->waitForSignal(C4JThread::kInfiniteTimeout); - - // printf("Socket closed event has fired\n"); - // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket(nullptr); - delete socket; - } - - return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); -} - -bool IPlatformNetworkStub::RemoveLocalPlayer( - INetworkPlayer* pNetworkPlayer) { +bool StubPlatformNetwork::RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) { return true; } -IPlatformNetworkStub::PlayerFlags::PlayerFlags( - INetworkPlayer* pNetworkPlayer, unsigned int count) { +StubPlatformNetwork::PlayerFlags::PlayerFlags(INetworkPlayer* pNetworkPlayer, + unsigned int count) { // 4J Stu - Don't assert, just make it a multiple of 8! This count is // calculated from a load of separate values, and makes tweaking // world/render sizes a pain if we hit an assert here @@ -356,12 +309,11 @@ IPlatformNetworkStub::PlayerFlags::PlayerFlags( memset(this->flags, 0, count / 8); this->count = count; } -IPlatformNetworkStub::PlayerFlags::~PlayerFlags() { delete[] flags; } +StubPlatformNetwork::PlayerFlags::~PlayerFlags() { delete[] flags; } // Add a player to the per system flag storage - if we've already got a player // from that system, copy its flags over -void IPlatformNetworkStub::SystemFlagAddPlayer( - INetworkPlayer* pNetworkPlayer) { +void StubPlatformNetwork::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { PlayerFlags* newPlayerFlags = new PlayerFlags(pNetworkPlayer, m_flagIndexSize); // If any of our existing players are on the same system, then copy over @@ -376,21 +328,7 @@ void IPlatformNetworkStub::SystemFlagAddPlayer( m_playerFlags.push_back(newPlayerFlags); } -// Remove a player from the per system flag storage - just maintains the -// m_playerFlags vector without any gaps in it -void IPlatformNetworkStub::SystemFlagRemovePlayer( - INetworkPlayer* pNetworkPlayer) { - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { - delete m_playerFlags[i]; - m_playerFlags[i] = m_playerFlags.back(); - m_playerFlags.pop_back(); - return; - } - } -} - -void IPlatformNetworkStub::SystemFlagReset() { +void StubPlatformNetwork::SystemFlagReset() { for (unsigned int i = 0; i < m_playerFlags.size(); i++) { delete m_playerFlags[i]; } @@ -399,8 +337,8 @@ void IPlatformNetworkStub::SystemFlagReset() { // Set a per system flag - this is done by setting the flag on every player that // shares that system -void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, - int index) { +void StubPlatformNetwork::SystemFlagSet(INetworkPlayer* pNetworkPlayer, + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return; if (pNetworkPlayer == nullptr) return; @@ -414,8 +352,8 @@ void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, // Get value of a per system flag - can be read from the flags of the passed in // player as anything else sent to that system should also have been duplicated // here -bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) { +bool StubPlatformNetwork::SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return false; if (pNetworkPlayer == nullptr) { return false; @@ -430,16 +368,15 @@ bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, return false; } -std::string IPlatformNetworkStub::GatherStats() { return ""; } +std::string StubPlatformNetwork::GatherStats() { return ""; } -std::string IPlatformNetworkStub::GatherRTTStats() { +std::string StubPlatformNetwork::GatherRTTStats() { std::string stats("Rtt: "); char stat[32]; for (unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer* pQNetPlayer = - ((NetworkPlayerQNet*)GetPlayerByIndex(i))->GetQNetPlayer(); + INetworkPlayer* pQNetPlayer = GetPlayerByIndex(i); if (!pQNetPlayer->IsLocal()) { memset(stat, 0, 32 * sizeof(char)); @@ -450,20 +387,13 @@ std::string IPlatformNetworkStub::GatherRTTStats() { return stats; } -void IPlatformNetworkStub::TickSearch() {} +void StubPlatformNetwork::TickSearch() {} -void IPlatformNetworkStub::SearchForGames() {} +void StubPlatformNetwork::SearchForGames() {} -int IPlatformNetworkStub::SearchForGamesThreadProc(void* lpParameter) { - return 0; -} +void StubPlatformNetwork::SetSearchResultsReady(int resultCount) {} -void IPlatformNetworkStub::SetSearchResultsReady(int resultCount) { - m_bSearchResultsReady = true; - m_searchResultsCount[m_lastSearchPad] = resultCount; -} - -std::vector* IPlatformNetworkStub::GetSessionList( +std::vector* StubPlatformNetwork::GetSessionList( int iPad, int localPlayers, bool partyOnly) { std::vector* filteredList = new std::vector(); @@ -471,43 +401,34 @@ std::vector* IPlatformNetworkStub::GetSessionList( return filteredList; } -bool IPlatformNetworkStub::GetGameSessionInfo( +bool StubPlatformNetwork::GetGameSessionInfo( int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) { return false; } -void IPlatformNetworkStub::SetSessionsUpdatedCallback( +void StubPlatformNetwork::SetSessionsUpdatedCallback( std::function callback) { m_SessionsUpdatedCallback = std::move(callback); } -void IPlatformNetworkStub::GetFullFriendSessionInfo( +void StubPlatformNetwork::GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) { callback(true); } -void IPlatformNetworkStub::ForceFriendsSessionRefresh() { - app.DebugPrintf("Resetting friends session search data\n"); - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; - } +void StubPlatformNetwork::ForceFriendsSessionRefresh() { + fprintf(stderr, "Resetting friends session search data\n"); } -INetworkPlayer* IPlatformNetworkStub::addNetworkPlayer( - IQNetPlayer* pQNetPlayer) { - NetworkPlayerQNet* pNetworkPlayer = new NetworkPlayerQNet(pQNetPlayer); - pQNetPlayer->SetCustomDataValue((uintptr_t)pNetworkPlayer); +INetworkPlayer* StubPlatformNetwork::addNetworkPlayer( + INetworkPlayer* pQNetPlayer) { + StubNetworkPlayer* pNetworkPlayer = new StubNetworkPlayer(); currentNetworkPlayers.push_back(pNetworkPlayer); return pNetworkPlayer; } -void IPlatformNetworkStub::removeNetworkPlayer( - IQNetPlayer* pQNetPlayer) { +void StubPlatformNetwork::removeNetworkPlayer(INetworkPlayer* pQNetPlayer) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++) { @@ -518,60 +439,49 @@ void IPlatformNetworkStub::removeNetworkPlayer( } } -INetworkPlayer* IPlatformNetworkStub::getNetworkPlayer( - IQNetPlayer* pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue()) - : nullptr; +INetworkPlayer* StubPlatformNetwork::getNetworkPlayer( + INetworkPlayer* pQNetPlayer) { + return pQNetPlayer; } -INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex( - int userIndex) { - return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); +INetworkPlayer* StubPlatformNetwork::GetLocalPlayerByUserIndex(int userIndex) { + if (userIndex != 0) return nullptr; // 4jcraft: hack + return getNetworkPlayer(&m_players[userIndex]); } -INetworkPlayer* IPlatformNetworkStub::GetPlayerByIndex(int playerIndex) { - return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex)); +INetworkPlayer* StubPlatformNetwork::GetPlayerByIndex(int playerIndex) { + return getNetworkPlayer(&m_players[0]); } -INetworkPlayer* IPlatformNetworkStub::GetPlayerByXuid(PlayerUID xuid) { - return getNetworkPlayer(m_pIQNet->GetPlayerByXuid(xuid)); +INetworkPlayer* StubPlatformNetwork::GetPlayerByXuid(PlayerUID xuid) { + return getNetworkPlayer(&m_players[0]); } -INetworkPlayer* IPlatformNetworkStub::GetPlayerBySmallId( - unsigned char smallId) { - return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId)); +INetworkPlayer* StubPlatformNetwork::GetPlayerBySmallId(unsigned char smallId) { + return getNetworkPlayer(&m_players[0]); } -INetworkPlayer* IPlatformNetworkStub::GetHostPlayer() { - return getNetworkPlayer(m_pIQNet->GetHostPlayer()); +INetworkPlayer* StubPlatformNetwork::GetHostPlayer() { + return getNetworkPlayer(&m_players[0]); } -bool IPlatformNetworkStub::IsHost() { - return m_pIQNet->IsHost() && !m_bHostChanged; -} +bool StubPlatformNetwork::IsHost() { return !m_bHostChanged; } -bool IPlatformNetworkStub::JoinGameFromInviteInfo( +bool StubPlatformNetwork::JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { - return (m_pIQNet->JoinGameFromInviteInfo(userIndex, userMask, - pInviteInfo) == 0); + return 0; } -void IPlatformNetworkStub::SetSessionTexturePackParentId(int id) { +void StubPlatformNetwork::SetSessionTexturePackParentId(int id) { m_hostGameSessionData.texturePackParentId = id; } -void IPlatformNetworkStub::SetSessionSubTexturePackId(int id) { +void StubPlatformNetwork::SetSessionSubTexturePackId(int id) { m_hostGameSessionData.subTexturePackId = id; } -void IPlatformNetworkStub::Notify(int ID, uintptr_t Param) {} +void StubPlatformNetwork::Notify(int ID, uintptr_t Param) {} -bool IPlatformNetworkStub::IsInSession() { - return m_pIQNet->GetState() != QNET_STATE_IDLE; -} - -bool IPlatformNetworkStub::IsInGameplay() { - return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY; -} - -bool IPlatformNetworkStub::IsReadyToPlayOrIdle() { return true; } +bool StubPlatformNetwork::IsInSession() { return s_gameRunning; } +bool StubPlatformNetwork::IsInGameplay() { return s_gameRunning; } +bool StubPlatformNetwork::IsReadyToPlayOrIdle() { return true; } \ No newline at end of file diff --git a/targets/platform/network/stub/StubPlatformNetwork.h b/targets/platform/network/stub/StubPlatformNetwork.h new file mode 100644 index 000000000..9826eda2e --- /dev/null +++ b/targets/platform/network/stub/StubPlatformNetwork.h @@ -0,0 +1,167 @@ +#pragma once +#include +// using namespace std; +#include +#include + +#include "StubNetworkPlayer.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/network/IPlatformNetwork.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" + +class CGameNetworkManager; +class INetworkPlayer; + +class StubPlatformNetwork : public IPlatformNetwork { +public: + static StubNetworkPlayer m_players[4]; + + bool Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize); + void Terminate(); + int GetJoiningReadyPercentage(); + int CorrectErrorIDS(int IDS); + + void DoWork(); + int GetPlayerCount(); + int GetOnlinePlayerCount(); + int GetLocalPlayerMask(int playerIndex); + bool AddLocalPlayerByUserIndex(int userIndex); + bool RemoveLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetPlayerByIndex(int playerIndex); + INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); + INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); + bool ShouldMessageForFullSession(); + + INetworkPlayer* GetHostPlayer(); + bool IsHost(); + bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo); + bool LeaveGame(bool bMigrateHost); + + bool IsInSession(); + bool IsInGameplay(); + bool IsReadyToPlayOrIdle(); + bool IsInStatsEnabledSession(); + bool SessionHasSpace(unsigned int spaceRequired = 1); + void SendInviteGUI(int quadrant); + bool IsAddingPlayer(); + + void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, + int primaryUserIndex); + bool SetLocalGame(bool isLocal); + bool IsLocalGame() { return m_bIsOfflineGame; } + void SetPrivateGame(bool isPrivate); + bool IsPrivateGame() { return m_bIsPrivateGame; } + bool IsLeavingGame() { return m_bLeavingGame; } + void ResetLeavingGame() { m_bLeavingGame = false; } + + void RegisterPlayerChangedCallback( + int iPad, + std::function callback); + void UnRegisterPlayerChangedCallback(int iPad); + + void HandleSignInChange(); + + bool _RunNetworkGame(); + +private: + bool isSystemPrimaryPlayer(INetworkPlayer* pQNetPlayer); + bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); + void _HostGame(int dwUsersMask, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + bool _StartGame(); + + void* m_notificationListener; + + std::vector + m_machineQNetPrimaryPlayers; // collection of players that we deem to + // be the main one for that system + + bool m_bLeavingGame; + bool m_bLeaveGameOnTick; + bool m_migrateHostOnLeave; + bool m_bHostChanged; + + bool m_bIsOfflineGame; + bool m_bIsPrivateGame; + int m_flagIndexSize; + + // This is only maintained by the host, and is not valid on client machines + GameSessionData m_hostGameSessionData; + CGameNetworkManager* m_pGameNetworkManager; + +public: + void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = nullptr); + +private: + std::function + playerChangedCallback[XUSER_MAX_COUNT]; + + bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); + + // Things for handling per-system flags + class PlayerFlags { + public: + INetworkPlayer* m_pNetworkPlayer; + unsigned char* flags; + unsigned int count; + PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); + ~PlayerFlags(); + }; + std::vector m_playerFlags; + void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagReset(); + +public: + void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); + bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); + +public: + std::string GatherStats(); + std::string GatherRTTStats(); + +private: + std::vector friendsSessions[XUSER_MAX_COUNT]; + int m_searchResultsCount[XUSER_MAX_COUNT]; + int m_lastSearchStartTime[XUSER_MAX_COUNT]; + + std::function m_SessionsUpdatedCallback; + + void TickSearch(); + void SearchForGames(); + + void SetSearchResultsReady(int resultCount = 0); + + std::vector currentNetworkPlayers; + INetworkPlayer* addNetworkPlayer(INetworkPlayer* pQNetPlayer); + void removeNetworkPlayer(INetworkPlayer* pQNetPlayer); + static INetworkPlayer* getNetworkPlayer(INetworkPlayer* pQNetPlayer); + + void SetSessionTexturePackParentId(int id); + void SetSessionSubTexturePackId(int id); + void Notify(int ID, uintptr_t Param); + +public: + std::vector* GetSessionList(int iPad, int localPlayers, + bool partyOnly); + bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession); + void SetSessionsUpdatedCallback(std::function callback); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + std::function callback); + void ForceFriendsSessionRefresh(); + +private: + void NotifyPlayerJoined(INetworkPlayer* pQNetPlayer); +}; \ No newline at end of file diff --git a/targets/platform/profile/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h index 64ab8591c..38bdbca97 100644 --- a/targets/platform/profile/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -4,7 +4,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class CXuiStringTable; @@ -35,11 +35,11 @@ public: [[nodiscard]] virtual bool IsSignedIn(int iQuadrant) = 0; [[nodiscard]] virtual bool IsSignedInLive(int iProf) = 0; [[nodiscard]] virtual bool IsGuest(int iQuadrant) = 0; - virtual unsigned int RequestSignInUI( - bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, - bool bMultiplayerSignIn, bool bAddUser, - std::function callback, - int iQuadrant = XUSER_INDEX_ANY) = 0; + virtual unsigned int RequestSignInUI(bool bFromInvite, bool bLocalGame, + bool bNoGuestsAllowed, + bool bMultiplayerSignIn, bool bAddUser, + std::function callback, + int iQuadrant = XUSER_INDEX_ANY) = 0; virtual unsigned int DisplayOfflineProfile( std::function callback, int iQuadrant = XUSER_INDEX_ANY) = 0; @@ -96,8 +96,7 @@ public: unsigned int xuidCount) = 0; virtual void ShowProfileCard(int iPad, PlayerUID targetUid) = 0; [[nodiscard]] virtual bool GetProfileAvatar( - int iPad, - std::function callback) = 0; + int iPad, std::function callback) = 0; virtual void CancelProfileAvatarRequest() = 0; // Achievements diff --git a/targets/platform/profile/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h index 6ae5cec98..db1ab2dbf 100644 --- a/targets/platform/profile/ProfileConstants.h +++ b/targets/platform/profile/ProfileConstants.h @@ -1,7 +1,70 @@ #pragma once +// Profile data storage layout, schema versioning, and game settings stored +// in profile data. Owned by the platform/profile layer because the profile +// data structure is what defines these. + #define TITLEID_MINECRAFT 0x584111F7 +// Tutorial completion bits stored in profile data. The exact byte count is +// load-bearing for ProfileGameSettings layout in StubProfile.cpp. +#define TUTORIAL_PROFILE_STORAGE_BITS 512 +#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS / 8) + +// Profile data schema versions +#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 + +// Maximum favourite skins stored in profile data; keep small. +#define MAX_FAVORITE_SKINS 10 + +// Bitmask values for ProfileGameSettings::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 + +// Profile-stored language IDs (ucLanguage). Match the Xbox XC_LANGUAGE_* +// values defined in XboxStubs.h. +#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 + #define CONTEXT_GAME_STATE 0 #define CONTEXT_GAME_STATE_BLANK 0 #define CONTEXT_GAME_STATE_RIDING_PIG 1 diff --git a/targets/platform/profile/meson.build b/targets/platform/profile/meson.build new file mode 100644 index 000000000..c8efb5b7c --- /dev/null +++ b/targets/platform/profile/meson.build @@ -0,0 +1,11 @@ +platform_profile_stub_sources = files('stub/StubProfile.cpp') + +lib_platform_profile_stub = static_library('platform_profile_stub', + files('stub/StubProfile.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_profile_stub_dep = declare_dependency( + link_with: lib_platform_profile_stub, +) \ No newline at end of file diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h index 7b23288c8..4097e056b 100644 --- a/targets/platform/profile/profile.h +++ b/targets/platform/profile/profile.h @@ -1,4 +1,18 @@ -#include "IPlatformProfile.h" -#include "ProfileConstants.h" +#pragma once -extern IPlatformProfile& PlatformProfile; +#include "IPlatformProfile.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformProfile& PlatformProfile;` form had: anything reading +// PlatformProfile during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformProfile.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformProfile& PlatformProfile_get(); +} + +#define PlatformProfile (::platform_internal::PlatformProfile_get()) diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index 9b019e519..dcd23a9e5 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -5,12 +5,14 @@ #include #include "../ProfileConstants.h" -#include "input/input.h" -#include "../../../app/common/Tutorial/TutorialEnum.h" // 4jcraft TODO -#include "../../../app/common/App_Defines.h" // 4jcraft TODO +#include "platform/input/input.h" -StubProfile stub_profile_instance; -IPlatformProfile& PlatformProfile = stub_profile_instance; +namespace platform_internal { +IPlatformProfile& PlatformProfile_get() { + static StubProfile instance; + return instance; +} +} // namespace platform_internal namespace { constexpr PlayerUID kFakeXuidBase = 0xe000d45248242f2eULL; @@ -192,9 +194,5 @@ bool StubProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, // GetPrimaryPad/SetPrimaryPad — delegates to PlatformPlatft. // Kept here temporarily for call sites that still use PlatformPlatfore. // These forward to the canonical copies in SDL2Input. -int StubProfile::GetPrimaryPad() { - return PlatformInput.GetPrimaryPad(); -} -void StubProfile::SetPrimaryPad(int iPad) { - PlatformInput.SetPrimaryPad(iPad); -} +int StubProfile::GetPrimaryPad() { return PlatformInput.GetPrimaryPad(); } +void StubProfile::SetPrimaryPad(int iPad) { PlatformInput.SetPrimaryPad(iPad); } diff --git a/targets/platform/profile/stub/StubProfile.h b/targets/platform/profile/stub/StubProfile.h index ba04e8a5f..3ee620ff0 100644 --- a/targets/platform/profile/stub/StubProfile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -4,9 +4,8 @@ #include #include -#include "PlatformTypes.h" - #include "../IPlatformProfile.h" +#include "platform/PlatformTypes.h" class StubProfile : public IPlatformProfile { public: @@ -61,7 +60,8 @@ public: } void SetPrimaryPlayerChanged(bool) {} void ShowProfileCard(int, PlayerUID) {} - bool GetProfileAvatar(int, std::function) { + bool GetProfileAvatar(int, + std::function) { return false; } void CancelProfileAvatarRequest() {} diff --git a/targets/platform/renderer/IPlatformRenderer.h b/targets/platform/renderer/IPlatformRenderer.h index 186843472..32ab3793f 100644 --- a/targets/platform/renderer/IPlatformRenderer.h +++ b/targets/platform/renderer/IPlatformRenderer.h @@ -2,7 +2,7 @@ #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class IPlatformRenderer { public: diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index a8e87049d..c4c0555be 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,15 +1,15 @@ #include "GLRenderer.h" -#include "PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" #include "SDL_stdinc.h" #include "SDL_video.h" - #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" #include "java/IntBuffer.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" // undefine macros from header to avoid argument mismatch #undef glGenTextures @@ -24,8 +24,6 @@ #undef glNormalPointer #undef glColorPointer #undef glVertexPointer -#undef glGenQueriesARB -#undef glGetQueryObjectuARB #undef glEnable #undef glDisable #undef glBlendFunc @@ -41,21 +39,27 @@ #include "stb_image.h" #define GLM_FORCE_RADIANS -#include -#include #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include -GLRenderer gl_renderer_instance; -IPlatformRenderer& PlatformRenderer = gl_renderer_instance; +#include "glm/glm.hpp" +#include "glm/gtc/matrix_transform.hpp" +#include "glm/gtc/type_ptr.hpp" + +namespace platform_internal { +IPlatformRenderer& PlatformRenderer_get() { + static GLRenderer instance; + return instance; +} +} // namespace platform_internal // MARK: Shaders @@ -94,17 +98,18 @@ static int s_reqWidth = 1920; static int s_reqHeight = 1080; static bool s_fullscreen = false; -static pthread_key_t s_glCtxKey; -static pthread_once_t s_glCtxKeyOnce = PTHREAD_ONCE_INIT; -static void makeGLCtxKey() { pthread_key_create(&s_glCtxKey, nullptr); } +static thread_local SDL_GLContext s_glCtx = nullptr; + +static std::once_flag s_glCtxKeyOnce; + static const int MAX_SHARED_CTXS = 6; static SDL_Window* s_sharedWins[MAX_SHARED_CTXS] = {}; static SDL_GLContext s_sharedCtxs[MAX_SHARED_CTXS] = {}; static int s_sharedCtxCount = 0; static int s_nextSharedCtx = 0; -static pthread_mutex_t s_sharedMtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_glCallMtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_t s_mainThread; +static std::mutex s_sharedMtx; +static std::mutex s_glCallMtx; +static std::thread::id s_mainThreadId; static bool s_mainThreadSet = false; static thread_local unsigned int s_rs_dirty_mask = 0xFFFFFFFF; @@ -384,8 +389,8 @@ static void glShadowSetDepthTest(bool e) { } static void glShadowSetBlendFunc(GLint s, GLint d) { - if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || - s_gl_state.blendSrc != s || s_gl_state.blendDst != d) { + if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || s_gl_state.blendSrc != s || + s_gl_state.blendDst != d) { ::glBlendFunc(s, d); s_gl_state.blendSrc = s; s_gl_state.blendDst = d; @@ -394,8 +399,7 @@ static void glShadowSetBlendFunc(GLint s, GLint d) { } static void glShadowSetDepthMask(GLboolean e) { - if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || - s_gl_state.depthMask != e) { + if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || s_gl_state.depthMask != e) { ::glDepthMask(e); s_gl_state.depthMask = e; s_gl_shadow_mask |= SHADOW_DEPTH_MASK; @@ -506,8 +510,7 @@ static void pushRenderState() { glUniform1f(s_shader.uFogStart, s_rs.fogStart); glUniform1f(s_shader.uFogEnd, s_rs.fogEnd); glUniform1f(s_shader.uFogDensity, s_rs.fogDensity); - glUniform4fv(s_shader.uFogColor, 1, - glm::value_ptr(s_rs.fogColor)); + glUniform4fv(s_shader.uFogColor, 1, glm::value_ptr(s_rs.fogColor)); glUniform1i(s_shader.uFogEnable, s_rs.fogEnable ? 1 : 0); } if (s_rs_dirty_mask & DIRTY_TEXTURE) { @@ -519,11 +522,9 @@ static void pushRenderState() { if (s_rs_dirty_mask & DIRTY_GAMMA) glUniform1f(s_shader.uInvGamma, 1.0f / s_rs.gamma); if (s_rs_dirty_mask & DIRTY_LMT) - glUniform4fv(s_shader.uLMTransform, 1, - glm::value_ptr(s_rs.lmt)); + glUniform4fv(s_shader.uLMTransform, 1, glm::value_ptr(s_rs.lmt)); if (s_rs_dirty_mask & DIRTY_GLOBAL_LM) - glUniform2fv(s_shader.uGlobalLM, 1, - glm::value_ptr(s_rs.globalLM)); + glUniform2fv(s_shader.uGlobalLM, 1, glm::value_ptr(s_rs.globalLM)); s_rs_dirty_mask = 0; } flushMatrices(); @@ -686,10 +687,11 @@ void GLRenderer::Initialise() { glViewport(0, 0, s_windowWidth, s_windowHeight); s_shader.build(VERT_SRC, FRAG_SRC); initStreamingVAOs(); - pthread_once(&s_glCtxKeyOnce, makeGLCtxKey); - s_mainThread = pthread_self(); + + s_mainThreadId = std::this_thread::get_id(); s_mainThreadSet = true; - pthread_setspecific(s_glCtxKey, (void*)s_window); + s_glCtx = s_glContext; + SDL_GL_MakeCurrent(s_window, s_glContext); for (int i = 0; i < MAX_SHARED_CTXS; i++) { SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); @@ -718,32 +720,36 @@ void GLRenderer::Initialise() { void GLRenderer::InitialiseContext() { if (!s_window) return; - pthread_once(&s_glCtxKeyOnce, makeGLCtxKey); - if (s_mainThreadSet && pthread_equal(pthread_self(), s_mainThread)) { + + if (s_mainThreadSet && std::this_thread::get_id() == s_mainThreadId) { SDL_GL_MakeCurrent(s_window, s_glContext); - pthread_setspecific(s_glCtxKey, (void*)s_window); + s_glCtx = s_glContext; return; } - void* cp = pthread_getspecific(s_glCtxKey); - if (cp) { - SDL_GLContext ctx = (SDL_GLContext)cp; - for (int i = 0; i < s_sharedCtxCount; i++) - if (s_sharedCtxs[i] == ctx) { - SDL_GL_MakeCurrent(s_sharedWins[i], ctx); + + if (s_glCtx) { + for (int i = 0; i < s_sharedCtxCount; i++) { + if (s_sharedCtxs[i] == s_glCtx) { + SDL_GL_MakeCurrent(s_sharedWins[i], s_glCtx); return; } + } return; } - pthread_mutex_lock(&s_sharedMtx); - SDL_GLContext shared = (s_nextSharedCtx < s_sharedCtxCount) - ? s_sharedCtxs[s_nextSharedCtx++] - : nullptr; - pthread_mutex_unlock(&s_sharedMtx); + + SDL_GLContext shared = nullptr; + { + std::lock_guard lk(s_sharedMtx); + if (s_nextSharedCtx < s_sharedCtxCount) + shared = s_sharedCtxs[s_nextSharedCtx++]; + } if (!shared) return; - for (int i = 0; i < s_sharedCtxCount; i++) + + for (int i = 0; i < s_sharedCtxCount; i++) { if (s_sharedCtxs[i] == shared) SDL_GL_MakeCurrent(s_sharedWins[i], shared); - pthread_setspecific(s_glCtxKey, (void*)shared); + } + s_glCtx = shared; } void GLRenderer::StartFrame() { @@ -789,10 +795,11 @@ void GLRenderer::GetFramebufferSize(int& w, int& h) { void GLRenderer::Close() { s_window = nullptr; } void GLRenderer::Shutdown() { - pthread_mutex_lock(&s_glCallMtx); - for (auto& kv : s_chunkPool) kv.second.destroy(); - s_chunkPool.clear(); - pthread_mutex_unlock(&s_glCallMtx); + { + std::lock_guard lk(s_glCallMtx); + for (auto& kv : s_chunkPool) kv.second.destroy(); + s_chunkPool.clear(); + } glDeleteVertexArrays(1, &s_sVAO_std); glDeleteBuffers(1, &s_sVBO_std); if (s_shader.prog) glDeleteProgram(s_shader.prog); @@ -812,7 +819,7 @@ void GLRenderer::Shutdown() { } void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, - eVertexType vType, ePixelShaderType) { + eVertexType vType, ePixelShaderType) { if (count <= 0 || !dataIn) return; bool wasQuad = isQuadPrim((int)ptype); @@ -901,7 +908,7 @@ void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, return; } - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); pushRenderState(); glBindVertexArray(s_sVAO_std); @@ -916,26 +923,23 @@ void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::ReadPixels(int x, int y, int w, int h, void* buf) { if (!buf) return; - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); - pthread_mutex_unlock(&s_glCallMtx); } int GLRenderer::CBuffCreate(int count) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); int b = s_nextListBase; s_nextListBase += count; - pthread_mutex_unlock(&s_glCallMtx); return b; } void GLRenderer::CBuffDelete(int first, int count) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); for (int i = first; i < first + count; i++) { auto it = s_chunkPool.find(i); if (it != s_chunkPool.end()) { @@ -943,17 +947,15 @@ void GLRenderer::CBuffDelete(int first, int count) { s_chunkPool.erase(it); } } - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::CBuffDeleteAll() { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); for (auto& kv : s_chunkPool) { kv.second.destroy(); } s_chunkPool.clear(); s_nextListBase = 1; - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::CBuffStart(int index, bool) { @@ -964,12 +966,11 @@ void GLRenderer::CBuffStart(int index, bool) { void GLRenderer::CBuffEnd() { if (s_recListId < 0) return; - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); ChunkBuffer& cb = s_chunkPool[s_recListId]; cb.destroy(); if (s_recVerts.empty()) { s_chunkPool.erase(s_recListId); - pthread_mutex_unlock(&s_glCallMtx); s_recListId = -1; return; } @@ -977,31 +978,27 @@ void GLRenderer::CBuffEnd() { cb.draws = std::move(s_recDraws); cb.valid = true; cb.vboReady = false; - pthread_mutex_unlock(&s_glCallMtx); s_recListId = -1; } void GLRenderer::CBuffClear(int index) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); auto it = s_chunkPool.find(index); if (it != s_chunkPool.end()) { it->second.destroy(); s_chunkPool.erase(it); } - pthread_mutex_unlock(&s_glCallMtx); } bool GLRenderer::CBuffCall(int index, bool) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); auto it = s_chunkPool.find(index); if (it == s_chunkPool.end() || !it->second.valid) { - pthread_mutex_unlock(&s_glCallMtx); return false; } ChunkBuffer& cb = it->second; if (!cb.vboReady) { if (cb.rawVerts.empty()) { - pthread_mutex_unlock(&s_glCallMtx); return false; } @@ -1026,7 +1023,6 @@ bool GLRenderer::CBuffCall(int index, bool) { for (const auto& dc : cb.draws) glDrawArrays(dc.prim, dc.first, dc.count); glBindVertexArray(0); - pthread_mutex_unlock(&s_glCallMtx); return true; } @@ -1076,7 +1072,7 @@ void GLRenderer::MatrixPerspective(float fovy, float asp, float zn, float zf) { markMatrixDirty(); } void GLRenderer::MatrixOrthogonal(float l, float r, float b, float t, float zn, - float zf) { + float zf) { s_proj.cur() = glm::ortho(l, r, b, t, zn, zf); markMatrixDirty(); } @@ -1099,7 +1095,7 @@ void GLRenderer::Set_matrixDirty() { s_boundProgram = 0; s_rs_dirty_mask = 0xFFFFFFFF; s_gl_shadow_mask = 0; - s_normalMatDirty = true; // normal matrix dirt after iggy reset + s_normalMatDirty = true; // normal matrix dirt after iggy reset s_matDirty = true; s_chunkOffsetValid = false; if (s_shader.prog) { @@ -1136,9 +1132,7 @@ void GLRenderer::StateSetDepthMask(bool e) { glShadowSetDepthMask(e ? GL_TRUE : GL_FALSE); } void GLRenderer::StateSetBlendEnable(bool e) { glShadowSetBlend(e); } -void GLRenderer::StateSetBlendFunc(int s, int d) { - glShadowSetBlendFunc(s, d); -} +void GLRenderer::StateSetBlendFunc(int s, int d) { glShadowSetBlendFunc(s, d); } void GLRenderer::StateSetDepthFunc(int f) { ::glDepthFunc(f); } void GLRenderer::StateSetFaceCull(bool e) { glShadowSetCull(e); } void GLRenderer::StateSetFaceCullCW(bool e) { @@ -1185,7 +1179,10 @@ void GLRenderer::StateSetFogEnable(bool e) { } } void GLRenderer::StateSetFogMode(int mode) { - int v = (mode == GL_LINEAR) ? 1 : (mode == GL_EXP) ? 2 : (mode == 0x0801) ? 3 : 0; + int v = (mode == GL_LINEAR) ? 1 + : (mode == GL_EXP) ? 2 + : (mode == 0x0801) ? 3 + : 0; if (s_rs.fogMode != v) { s_rs.fogMode = v; markDirty(DIRTY_FOG); @@ -1261,7 +1258,7 @@ void GLRenderer::StateSetVertexTextureUV(float u, float v) { } } void GLRenderer::StateSetStencil(int fn, uint8_t ref, uint8_t fmask, - uint8_t wmask) { + uint8_t wmask) { glShadowSetStencil(fn, ref, fmask, wmask); } void GLRenderer::StateSetTextureEnable(bool e) { @@ -1307,9 +1304,9 @@ void GLRenderer::TextureBindVertex(int idx, bool scaleLight) { s_rs.useLightmap = true; markDirty(DIRTY_TEXTURE); } - glm::vec4 newLmt = - scaleLight ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} - : glm::vec4{1.f, 1.f, 0.f, 0.f}; + glm::vec4 newLmt = scaleLight + ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} + : glm::vec4{1.f, 1.f, 0.f, 0.f}; if (s_rs.lmt != newLmt) { s_rs.lmt = newLmt; markDirty(DIRTY_LMT); @@ -1336,7 +1333,7 @@ void GLRenderer::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { } } void GLRenderer::TextureDataUpdate(int xo, int yo, int w, int h, void* d, - int lvl) { + int lvl) { glTexSubImage2D(GL_TEXTURE_2D, lvl, xo, yo, w, h, GL_RGBA, GL_UNSIGNED_BYTE, d); } @@ -1368,7 +1365,7 @@ int GLRenderer::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { return hr; } int GLRenderer::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, - int** o) { + int** o) { int w, h, c; unsigned char* d = stbi_load_from_memory(pb, (int)nb, &w, &h, &c, 4); if (!d) return -1; // Failure @@ -1404,78 +1401,6 @@ void glDeleteTextures_4J(int n, const unsigned int* textures) { ::glDeleteTextures(n, textures); } -void glBeginQuery_4J_Helper(unsigned int target, unsigned int id) { - typedef void (*PFNGLBEGINQUERYPROC)(unsigned int, unsigned int); - static PFNGLBEGINQUERYPROC fn = - (PFNGLBEGINQUERYPROC)dlsym(RTLD_DEFAULT, "glBeginQuery"); - if (fn) fn(target, id); -} - -void glEndQuery_4J_Helper(unsigned int target) { - typedef void (*PFNGLENDQUERYPROC)(unsigned int); - static PFNGLENDQUERYPROC fn = - (PFNGLENDQUERYPROC)dlsym(RTLD_DEFAULT, "glEndQuery"); - if (fn) fn(target); -} - -void glGenQueries_4J_Helper(unsigned int* id) { -#ifdef GLES - glGenQueries(1, id); -#else - typedef void (*PFNGLGENQUERIESPROC)(int, unsigned int*); - static PFNGLGENQUERIESPROC fn = - (PFNGLGENQUERIESPROC)dlsym(RTLD_DEFAULT, "glGenQueries"); - if (fn) fn(1, id); -#endif -} - -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val) { -#ifdef GLES - glGetQueryObjectuiv(id, pname, val); -#else - typedef void (*PFNGLGETQUERYOBJECTUIVPROC)(unsigned int, unsigned int, - unsigned int*); - static PFNGLGETQUERYOBJECTUIVPROC fn = - (PFNGLGETQUERYOBJECTUIVPROC)dlsym(RTLD_DEFAULT, "glGetQueryObjectuiv"); - if (fn) fn(id, pname, val); -#endif -} - -// c hooks -#undef glFogfv -#undef glLightfv -#undef glLightModelfv -#undef glShadeModel -#undef glColorMaterial -#undef glNormal3f - -extern "C" { -void glFogfv(GLenum pname, const GLfloat* params) { - if (pname == 0x0B66) - PlatformRenderer.StateSetFogColour(params[0], params[1], params[2]); -} -void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { - if (pname == 0x1203) - PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); - else if (pname == 0x1200) - PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); - else if (pname == 0x1201) - PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); -} -void glLightModelfv(GLenum pname, const GLfloat* params) { - if (pname == 0x0B53) - PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); -} -void glShadeModel(GLenum) {} -void glColorMaterial(GLenum, GLenum) {} -void glNormal3f(GLfloat, GLfloat, GLfloat) {} -} - // MARK: LinuxStubs #ifdef GLES @@ -1523,7 +1448,7 @@ void glTexImage2D_4J(int target, int level, int internalformat, int width, (void)format; (void)type; PlatformRenderer.TextureData(width, height, getBytePtr(pixels), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } void glLight_4J(int light, int pname, FloatBuffer* params) { @@ -1558,7 +1483,8 @@ void glCallLists_4J(IntBuffer* lists) { if (!lists) return; int count = lists->limit() - lists->position(); int* ids = getIntPtr(lists); - for (int i = 0; i < count; i++) PlatformRenderer.CBuffCall(ids[i], false); + for (int i = 0; i < count; i++) + (void)PlatformRenderer.CBuffCall(ids[i], false); } void glReadPixels_4J(int x, int y, int w, int h, int f, int t, ByteBuffer* p) { @@ -1575,54 +1501,9 @@ void glVertexPointer_4J(int, int, FloatBuffer*) {} void glEndList_4J(int) {} void glTexGen_4J(int, int, FloatBuffer*) {} -#include #include #include -static PFNGLGENQUERIESARBPROC _glGenQueriesARB = nullptr; -static PFNGLBEGINQUERYARBPROC _glBeginQueryARB = nullptr; -static PFNGLENDQUERYARBPROC _glEndQueryARB = nullptr; -static PFNGLGETQUERYOBJECTUIVARBPROC _glGetQueryObjectuivARB = nullptr; -static bool _queriesInitialized = false; - -static void initQueryFuncs() { - if (_queriesInitialized) return; - _queriesInitialized = true; - _glGenQueriesARB = - (PFNGLGENQUERIESARBPROC)dlsym(RTLD_DEFAULT, "glGenQueriesARB"); - _glBeginQueryARB = - (PFNGLBEGINQUERYARBPROC)dlsym(RTLD_DEFAULT, "glBeginQueryARB"); - _glEndQueryARB = (PFNGLENDQUERYARBPROC)dlsym(RTLD_DEFAULT, "glEndQueryARB"); - _glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)dlsym( - RTLD_DEFAULT, "glGetQueryObjectuivARB"); -} - -void glGenQueriesARB_4J(IntBuffer* buf) { - initQueryFuncs(); - if (_glGenQueriesARB && buf) { - int n = buf->limit() - buf->position(); - if (n > 0) _glGenQueriesARB(n, (GLuint*)getIntPtr(buf)); - } -} - -void glBeginQueryARB_4J(int target, int id) { - initQueryFuncs(); - if (_glBeginQueryARB) _glBeginQueryARB((GLenum)target, (GLuint)id); -} - -void glEndQueryARB_4J(int target) { - initQueryFuncs(); - if (_glEndQueryARB) _glEndQueryARB((GLenum)target); -} - -void glGetQueryObjectuARB_4J(int id, int pname, IntBuffer* params) { - initQueryFuncs(); - if (_glGetQueryObjectuivARB && params) - // LWJGL does not change limits/positions during these calls, it - // reads/writes exactly at pointer!! - _glGetQueryObjectuivARB((GLuint)id, (GLenum)pname, - (GLuint*)getIntPtr(params)); -} void glGetFloat(int pname, FloatBuffer* params) { glGetFloat_4J(pname, params); -} +} \ No newline at end of file diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index 7ca98ad15..d5084c24b 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -2,13 +2,10 @@ #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two -#include -#include #include -#include -#include "renderer/IPlatformRenderer.h" +#include "platform/renderer/IPlatformRenderer.h" extern IPlatformRenderer& PlatformRenderer; @@ -152,572 +149,3 @@ public: void Close(); void Shutdown(); }; - -// OpenGL Interception Macros -#ifndef GL_MODELVIEW_MATRIX -#define GL_MODELVIEW_MATRIX 0x0BA6 -#endif -#ifndef GL_PROJECTION_MATRIX -#define GL_PROJECTION_MATRIX 0x0BA7 -#endif -#ifndef GL_MODELVIEW -#define GL_MODELVIEW 0x1700 -#endif -#ifndef GL_PROJECTION -#define GL_PROJECTION 0x1701 -#endif -#ifndef GL_TEXTURE -#define GL_TEXTURE 0x1702 -#endif - -#ifndef GL_S -#define GL_S 0x2000 -#endif -#ifndef GL_T -#define GL_T 0x2001 -#endif -#ifndef GL_R -#define GL_R 0x2002 -#endif -#ifndef GL_Q -#define GL_Q 0x2003 -#endif - -#ifndef GL_TEXTURE_GEN_S -#define GL_TEXTURE_GEN_S 0x0C60 -#endif -#ifndef GL_TEXTURE_GEN_T -#define GL_TEXTURE_GEN_T 0x0C61 -#endif -#ifndef GL_TEXTURE_GEN_Q -#define GL_TEXTURE_GEN_Q 0x0C63 -#endif -#ifndef GL_TEXTURE_GEN_R -#define GL_TEXTURE_GEN_R 0x0C62 -#endif - -#ifndef GL_TEXTURE_GEN_MODE -#define GL_TEXTURE_GEN_MODE 0x2500 -#endif -#ifndef GL_OBJECT_LINEAR -#define GL_OBJECT_LINEAR 0x2401 -#endif -#ifndef GL_EYE_LINEAR -#define GL_EYE_LINEAR 0x2400 -#endif -#ifndef GL_OBJECT_PLANE -#define GL_OBJECT_PLANE 0x2501 -#endif -#ifndef GL_EYE_PLANE -#define GL_EYE_PLANE 0x2502 -#endif - -#ifndef GL_TEXTURE_2D -#define GL_TEXTURE_2D 0x0DE1 -#endif -#ifndef GL_BLEND -#define GL_BLEND 0x0BE2 -#endif -#ifndef GL_CULL_FACE -#define GL_CULL_FACE 0x0B44 -#endif -#ifndef GL_ALPHA_TEST -#define GL_ALPHA_TEST 0x0BC0 -#endif -#ifndef GL_DEPTH_TEST -#define GL_DEPTH_TEST 0x0B71 -#endif -#ifndef GL_FOG -#define GL_FOG 0x0B60 -#endif -#ifndef GL_LIGHTING -#define GL_LIGHTING 0x0B50 -#endif -#ifndef GL_LIGHT0 -#define GL_LIGHT0 0x4000 -#endif -#ifndef GL_LIGHT1 -#define GL_LIGHT1 0x4001 -#endif - -#ifndef CLEAR_DEPTH_FLAG -#define CLEAR_DEPTH_FLAG 0x00000100 -#endif -#ifndef CLEAR_COLOUR_FLAG -#define CLEAR_COLOUR_FLAG 0x00004000 -#endif - -#ifndef GL_DEPTH_BUFFER_BIT -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#endif -#ifndef GL_COLOR_BUFFER_BIT -#define GL_COLOR_BUFFER_BIT 0x00004000 -#endif - -#ifndef GL_SRC_ALPHA -#define GL_SRC_ALPHA 0x0302 -#endif -#ifndef GL_ONE_MINUS_SRC_ALPHA -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#endif -#ifndef GL_ONE -#define GL_ONE 1 -#endif -#ifndef GL_ZERO -#define GL_ZERO 0 -#endif -#ifndef GL_DST_ALPHA -#define GL_DST_ALPHA 0x0304 -#endif -#ifndef GL_SRC_COLOR -#define GL_SRC_COLOR 0x0300 -#endif -#ifndef GL_DST_COLOR -#define GL_DST_COLOR 0x0306 -#endif -#ifndef GL_ONE_MINUS_DST_COLOR -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#endif -#ifndef GL_ONE_MINUS_SRC_COLOR -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#endif -#ifndef GL_CONSTANT_ALPHA -#define GL_CONSTANT_ALPHA 0x8003 -#endif -#ifndef GL_ONE_MINUS_CONSTANT_ALPHA -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#endif - -#ifndef GL_GREATER -#define GL_GREATER 0x0204 -#endif -#ifndef GL_EQUAL -#define GL_EQUAL 0x0202 -#endif -#ifndef GL_LEQUAL -#define GL_LEQUAL 0x0203 -#endif -#ifndef GL_GEQUAL -#define GL_GEQUAL 0x0206 -#endif -#ifndef GL_ALWAYS -#define GL_ALWAYS 0x0207 -#endif - -#ifndef GL_TEXTURE_MIN_FILTER -#define GL_TEXTURE_MIN_FILTER 0x2801 -#endif -#ifndef GL_TEXTURE_MAG_FILTER -#define GL_TEXTURE_MAG_FILTER 0x2800 -#endif -#ifndef GL_TEXTURE_WRAP_S -#define GL_TEXTURE_WRAP_S 0x2802 -#endif -#ifndef GL_TEXTURE_WRAP_T -#define GL_TEXTURE_WRAP_T 0x2803 -#endif - -#ifndef GL_NEAREST -#define GL_NEAREST 0x2600 -#endif -#ifndef GL_LINEAR -#define GL_LINEAR 0x2601 -#endif -#ifndef GL_EXP -#define GL_EXP 0x0800 -#endif -#ifndef GL_NEAREST_MIPMAP_LINEAR -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#endif - -#ifndef GL_CLAMP -#define GL_CLAMP 0x2900 -#endif -#ifndef GL_REPEAT -#define GL_REPEAT 0x2901 -#endif - -#ifndef GL_FOG_START -#define GL_FOG_START 0x0B63 -#endif -#ifndef GL_FOG_END -#define GL_FOG_END 0x0B64 -#endif -#ifndef GL_FOG_MODE -#define GL_FOG_MODE 0x0B65 -#endif -#ifndef GL_FOG_DENSITY -#define GL_FOG_DENSITY 0x0B62 -#endif -#ifndef GL_FOG_COLOR -#define GL_FOG_COLOR 0x0B66 -#endif - -#ifndef GL_POSITION -#define GL_POSITION 0x1203 -#endif -#ifndef GL_AMBIENT -#define GL_AMBIENT 0x1200 -#endif -#ifndef GL_DIFFUSE -#define GL_DIFFUSE 0x1201 -#endif -#ifndef GL_SPECULAR -#define GL_SPECULAR 0x1202 -#endif - -#ifndef GL_LIGHT_MODEL_AMBIENT -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#endif - -#ifndef GL_LINES -#define GL_LINES 0x0001 -#endif -#ifndef GL_LINE_STRIP -#define GL_LINE_STRIP 0x0003 -#endif -#ifndef GL_QUADS -#define GL_QUADS 0x0007 -#endif -#ifndef GL_TRIANGLE_FAN -#define GL_TRIANGLE_FAN 0x0006 -#endif -#ifndef GL_TRIANGLE_STRIP -#define GL_TRIANGLE_STRIP 0x0005 -#endif - -// glCallList / display list macros -#undef glNewList -#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) -#undef glEndList -#define glEndList() PlatformRenderer.CBuffEnd() -#undef glCallList -#define glCallList(_list) PlatformRenderer.CBuffCall(_list) - -// glGenLists / glDeleteLists, lists are not supported in core!!!!! -#undef glGenLists -#define glGenLists(range) PlatformRenderer.CBuffCreate(range) -#undef glDeleteLists -#define glDeleteLists(list, range) PlatformRenderer.CBuffDelete(list, range) - -#ifndef GL_SHADEMODEL_IS_FUNCTION -#undef glShadeModel -#define glShadeModel(mode) \ - do { \ - } while (0) -#endif - -#undef glTranslatef -#define glTranslatef(x, y, z) \ - do { \ - PlatformRenderer.MatrixTranslate(x, y, z); \ - } while (0) - -#undef glRotatef -#define glRotatef(a, x, y, z) \ - do { \ - PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ - z); \ - } while (0) - -#undef glScalef -#define glScalef(x, y, z) \ - do { \ - PlatformRenderer.MatrixScale(x, y, z); \ - } while (0) - -#undef glScaled -#define glScaled(x, y, z) \ - do { \ - PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ - } while (0) - -#undef glPushMatrix -#define glPushMatrix() \ - do { \ - PlatformRenderer.MatrixPush(); \ - } while (0) - -#undef glPopMatrix -#define glPopMatrix() \ - do { \ - PlatformRenderer.MatrixPop(); \ - } while (0) - -#undef glLoadIdentity -#define glLoadIdentity() \ - do { \ - PlatformRenderer.MatrixSetIdentity(); \ - } while (0) - -#undef glMatrixMode -#define glMatrixMode(mode) \ - do { \ - PlatformRenderer.MatrixMode(mode); \ - } while (0) - -#undef glMultMatrixf -#define glMultMatrixf(m) \ - do { \ - PlatformRenderer.MatrixMult(m); \ - } while (0) - -#undef glColor4f -#define glColor4f(r, g, b, a) \ - do { \ - PlatformRenderer.StateSetColour(r, g, b, a); \ - } while (0) - -#undef glColor3f -#define glColor3f(r, g, b) \ - do { \ - PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ - } while (0) - -#undef glAlphaFunc -#define glAlphaFunc(func, ref) \ - do { \ - PlatformRenderer.StateSetAlphaFunc(func, ref); \ - } while (0) - -#undef glEnable -#define glEnable(cap) \ - do { \ - if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(true); \ - else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(true); \ - else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(true); \ - else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(true); \ - else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(true); \ - else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(true); \ - else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(true); \ - else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, true); \ - else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, true); \ - else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ - || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ - || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ - || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ - || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ - || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ - || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ - } else \ - ::glEnable(cap); \ - } while (0) - -#undef glDisable -#define glDisable(cap) \ - do { \ - if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(false); \ - else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(false); \ - else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(false); \ - else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(false); \ - else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(false); \ - else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(false); \ - else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(false); \ - else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, false); \ - else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, false); \ - else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ - || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ - || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ - || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ - || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ - || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ - || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ - } else \ - ::glDisable(cap); \ - } while (0) - -#undef glFogi -#define glFogi(pname, param) \ - do { \ - if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ - PlatformRenderer.StateSetFogMode(param); \ - } while (0) - -#undef glFogf -#define glFogf(pname, param) \ - do { \ - if ((pname) == 0x0B63 /*GL_FOG_START*/) \ - PlatformRenderer.StateSetFogNearDistance(param); \ - else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ - PlatformRenderer.StateSetFogFarDistance(param); \ - else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ - PlatformRenderer.StateSetFogDensity(param); \ - } while (0) - -#undef glOrtho -#define glOrtho(left, right, bottom, top, zNear, zFar) \ - do { \ - PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ - } while (0) - -#undef glMultiTexCoord2f -#define glMultiTexCoord2f(tex, u, v) \ - do { \ - if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ - PlatformRenderer.StateSetVertexTextureUV(u, v); \ - } while (0) - -#undef glActiveTexture -#define glActiveTexture(tex) \ - do { \ - PlatformRenderer.StateSetActiveTexture(tex); \ - ::glActiveTexture(tex); \ - } while (0) - -#undef glClientActiveTexture -#define glClientActiveTexture(tex) \ - do { \ - PlatformRenderer.StateSetActiveTexture(tex); \ - } while (0) - -// declarations -int glGenTextures_4J(); -void glGenTextures_4J(int n, unsigned int* textures); -void glDeleteTextures_4J(int id); -void glDeleteTextures_4J(int n, const unsigned int* textures); -void glTexImage2D_4J(int target, int level, int internalformat, int width, - int height, int border, int format, int type, - void* pixels); - -// helprs -void glGenQueries_4J_Helper(unsigned int* id); -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val); - -template -inline void glGenTextures_4J(T* buf) { - unsigned int id = 0; - ::glGenTextures(1, &id); - buf->put((int)id); - buf->flip(); -} -template -inline void glDeleteTextures_4J(T* buf) { - if (buf->limit() > 0) { - unsigned int id = (unsigned int)buf->get(0); - ::glDeleteTextures(1, &id); - } -} -template -inline void glTexCoordPointer_4J(int size, int type, T* pointer) {} -template -inline void glNormalPointer_4J(int type, T* pointer) {} -template -inline void glColorPointer_4J(int size, bool normalized, int stride, - T* pointer) {} -template -inline void glVertexPointer_4J(int size, int type, T* pointer) {} -template -inline void glTexImage2D_4J(int target, int level, int internalformat, - int width, int height, int border, int format, - int type, T* pixels) { - void* data = pixels ? pixels->getBuffer() : nullptr; - ::glTexImage2D((unsigned int)target, level, internalformat, width, height, - border, (unsigned int)format, (unsigned int)type, data); -} -template -inline void glCallLists_4J(T* lists) { - int base = lists->position(); - int count = lists->limit() - base; - for (int i = 0; i < count; i++) { - PlatformRenderer.CBuffCall(lists->get(base + i)); - } -} -template -inline void glGenQueries_4J(T* buf) { - unsigned int id = 0; - glGenQueries_4J_Helper(&id); - buf->put((int)id); - buf->flip(); -} -template -inline void glGetQueryObjectu_4J(int id, int pname, T* params) { - unsigned int val = 0; - glGetQueryObjectu_4J_Helper((unsigned int)id, (unsigned int)pname, &val); - params->put((int)val); - params->flip(); -} -template -inline void glFog_4J(int pname, T* params) { - float* p = params->_getDataPointer(); - if (pname == 0x0B66 /* GL_FOG_COLOR */) - PlatformRenderer.StateSetFogColour(p[0], p[1], p[2]); -} -template -inline void glLight_4J(int light, int pname, T* params) { - float* p = params->_getDataPointer(); - if (pname == 0x1203 /* GL_POSITION */) - PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], - p[1], p[2]); - else if (pname == 0x1200 /* GL_AMBIENT */) - PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); - else if (pname == 0x1201 /* GL_DIFFUSE */) - PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], p[1], - p[2]); -} -template -inline void glLightModel_4J(int pname, T* params) { - float* p = params->_getDataPointer(); - if (pname == 0x0B53 /* GL_LIGHT_MODEL_AMBIENT */) - PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); -} -template -inline void glTexGen_4J(int coord, int pname, T* params) {} -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, void* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, pixels); -} -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, unsigned char* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, (void*)pixels); -} -// T -> .getBuffer() -template -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, T* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, pixels->getBuffer()); -} -void glBeginQuery_4J_Helper(unsigned int target, unsigned int id); -void glEndQuery_4J_Helper(unsigned int target); -void glGenQueries_4J_Helper(unsigned int* id); -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val); - -// redirect the functions to my own implementation, no more 2.1 funcs -#define glGenTextures(...) glGenTextures_4J(__VA_ARGS__) -#define glDeleteTextures(...) glDeleteTextures_4J(__VA_ARGS__) -#define glTexCoordPointer(a, b, c) glTexCoordPointer_4J(a, b, c) -#define glNormalPointer(a, b) glNormalPointer_4J(a, b) -#define glColorPointer(a, b, c, d) glColorPointer_4J(a, b, c, d) -#define glVertexPointer(a, b, c) glVertexPointer_4J(a, b, c) -#define glTexImage2D(a, b, c, d, e, f, g, h, i) \ - glTexImage2D_4J(a, b, c, d, e, f, g, h, i) -#define glCallLists(x) glCallLists_4J(x) -#define glGenQueriesARB(x) glGenQueries_4J(x) -#define glGetQueryObjectuARB(a, b, c) glGetQueryObjectu_4J(a, b, c) -#define glReadPixels(a, b, c, d, e, f, g) glReadPixels_4J(a, b, c, d, e, f, g) -#define glFog(a, b) glFog_4J(a, b) -#define glLight(a, b, c) glLight_4J(a, b, c) -#define glLightModel(a, b) glLightModel_4J(a, b) -#define glTexGen(a, b, c) glTexGen_4J(a, b, c) diff --git a/targets/platform/renderer/gl/gl3_loader.h b/targets/platform/renderer/gl/gl3_loader.h index 6416a1152..0fcc9d096 100644 --- a/targets/platform/renderer/gl/gl3_loader.h +++ b/targets/platform/renderer/gl/gl3_loader.h @@ -1,12 +1,17 @@ #pragma once -#ifndef GL_GLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES 1 + +// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, +// which can only be found in the Windows API +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include #endif -#include -#include -#include + +#include #include + #ifndef GL_ARRAY_BUFFER #define GL_ARRAY_BUFFER 0x8892 #endif @@ -25,24 +30,21 @@ #ifndef GL_QUADS #define GL_QUADS 0x0007 #endif + static inline bool gl3_load() { - const char* ver = (const char*)glGetString(GL_VERSION); - if (!ver) { - fprintf(stderr, "[gl3_loader] ERROR: No active GL context found.\n"); + GLenum err = glewInit(); + if (err != GLEW_OK) { + fprintf(stderr, "[gl_loader] ERROR: glewInit failed: %s\n", + glewGetErrorString(err)); return false; } - int major = 0, minor = 0; - if (sscanf(ver, "%d.%d", &major, &minor) >= 2) { - if (major < 3 || (major == 3 && minor < 3)) { - fprintf(stderr, - "[gl3_loader] ERROR: Need GL 3.3, but system provides %s\n", - ver); - return false; - } + + if (!GLEW_VERSION_3_3) { + fprintf(stderr, "[gl_loader] ERROR: Need GL 3.3, not supported.\n"); + return false; } - fprintf( - stderr, - "[gl3_loader] GL Version: %s, it's all okay!! until android support.\n", - ver); + + fprintf(stderr, "[gl_loader] GL %s loaded successfully.\n", + (const char*)glewGetString(GLEW_VERSION)); return true; } \ No newline at end of file diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h new file mode 100644 index 000000000..752151538 --- /dev/null +++ b/targets/platform/renderer/gl/gl_compat.h @@ -0,0 +1,586 @@ +#pragma once + +// Legacy gl* compatibility shim for code that still issues fixed-function +// OpenGL calls. Provides: +// - GL_* constant defines for use with legacy gl* call sites +// - Macros that route legacy glPushMatrix / glColor4f / etc. through +// PlatformRenderer +// - Template implementations of glLight_4J / glFog_4J / glTexGen_4J +// etc., used by the legacy producers +// - #define glLight glLight_4J style consumer-facing macros +// +// New rendering code should call IPlatformRenderer methods directly via +// the PlatformRenderer extern. This shim exists to keep the legacy +// rendering files compiling without dragging the concrete GLRenderer +// class into every minecraft TU. + +// #include "gl3_loader.h" +// NOTE: gl3_loader.h must be included before these two +#include + +#include +#include + +#include "platform/renderer/IPlatformRenderer.h" +#include "platform/renderer/renderer.h" + +// OpenGL Interception Macros +#ifndef GL_MODELVIEW_MATRIX +#define GL_MODELVIEW_MATRIX 0x0BA6 +#endif +#ifndef GL_PROJECTION_MATRIX +#define GL_PROJECTION_MATRIX 0x0BA7 +#endif +#ifndef GL_MODELVIEW +#define GL_MODELVIEW 0x1700 +#endif +#ifndef GL_PROJECTION +#define GL_PROJECTION 0x1701 +#endif +#ifndef GL_TEXTURE +#define GL_TEXTURE 0x1702 +#endif + +#ifndef GL_S +#define GL_S 0x2000 +#endif +#ifndef GL_T +#define GL_T 0x2001 +#endif +#ifndef GL_R +#define GL_R 0x2002 +#endif +#ifndef GL_Q +#define GL_Q 0x2003 +#endif + +#ifndef GL_TEXTURE_GEN_S +#define GL_TEXTURE_GEN_S 0x0C60 +#endif +#ifndef GL_TEXTURE_GEN_T +#define GL_TEXTURE_GEN_T 0x0C61 +#endif +#ifndef GL_TEXTURE_GEN_Q +#define GL_TEXTURE_GEN_Q 0x0C63 +#endif +#ifndef GL_TEXTURE_GEN_R +#define GL_TEXTURE_GEN_R 0x0C62 +#endif + +#ifndef GL_TEXTURE_GEN_MODE +#define GL_TEXTURE_GEN_MODE 0x2500 +#endif +#ifndef GL_OBJECT_LINEAR +#define GL_OBJECT_LINEAR 0x2401 +#endif +#ifndef GL_EYE_LINEAR +#define GL_EYE_LINEAR 0x2400 +#endif +#ifndef GL_OBJECT_PLANE +#define GL_OBJECT_PLANE 0x2501 +#endif +#ifndef GL_EYE_PLANE +#define GL_EYE_PLANE 0x2502 +#endif + +#ifndef GL_TEXTURE_2D +#define GL_TEXTURE_2D 0x0DE1 +#endif +#ifndef GL_BLEND +#define GL_BLEND 0x0BE2 +#endif +#ifndef GL_CULL_FACE +#define GL_CULL_FACE 0x0B44 +#endif +#ifndef GL_ALPHA_TEST +#define GL_ALPHA_TEST 0x0BC0 +#endif +#ifndef GL_DEPTH_TEST +#define GL_DEPTH_TEST 0x0B71 +#endif +#ifndef GL_FOG +#define GL_FOG 0x0B60 +#endif +#ifndef GL_LIGHTING +#define GL_LIGHTING 0x0B50 +#endif +#ifndef GL_LIGHT0 +#define GL_LIGHT0 0x4000 +#endif +#ifndef GL_LIGHT1 +#define GL_LIGHT1 0x4001 +#endif + +#ifndef CLEAR_DEPTH_FLAG +#define CLEAR_DEPTH_FLAG 0x00000100 +#endif +#ifndef CLEAR_COLOUR_FLAG +#define CLEAR_COLOUR_FLAG 0x00004000 +#endif + +#ifndef GL_DEPTH_BUFFER_BIT +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#endif +#ifndef GL_COLOR_BUFFER_BIT +#define GL_COLOR_BUFFER_BIT 0x00004000 +#endif + +#ifndef GL_SRC_ALPHA +#define GL_SRC_ALPHA 0x0302 +#endif +#ifndef GL_ONE_MINUS_SRC_ALPHA +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#endif +#ifndef GL_ONE +#define GL_ONE 1 +#endif +#ifndef GL_ZERO +#define GL_ZERO 0 +#endif +#ifndef GL_DST_ALPHA +#define GL_DST_ALPHA 0x0304 +#endif +#ifndef GL_SRC_COLOR +#define GL_SRC_COLOR 0x0300 +#endif +#ifndef GL_DST_COLOR +#define GL_DST_COLOR 0x0306 +#endif +#ifndef GL_ONE_MINUS_DST_COLOR +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#endif +#ifndef GL_ONE_MINUS_SRC_COLOR +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif + +#ifndef GL_GREATER +#define GL_GREATER 0x0204 +#endif +#ifndef GL_EQUAL +#define GL_EQUAL 0x0202 +#endif +#ifndef GL_LEQUAL +#define GL_LEQUAL 0x0203 +#endif +#ifndef GL_GEQUAL +#define GL_GEQUAL 0x0206 +#endif +#ifndef GL_ALWAYS +#define GL_ALWAYS 0x0207 +#endif + +#ifndef GL_TEXTURE_MIN_FILTER +#define GL_TEXTURE_MIN_FILTER 0x2801 +#endif +#ifndef GL_TEXTURE_MAG_FILTER +#define GL_TEXTURE_MAG_FILTER 0x2800 +#endif +#ifndef GL_TEXTURE_WRAP_S +#define GL_TEXTURE_WRAP_S 0x2802 +#endif +#ifndef GL_TEXTURE_WRAP_T +#define GL_TEXTURE_WRAP_T 0x2803 +#endif + +#ifndef GL_NEAREST +#define GL_NEAREST 0x2600 +#endif +#ifndef GL_LINEAR +#define GL_LINEAR 0x2601 +#endif +#ifndef GL_EXP +#define GL_EXP 0x0800 +#endif +#ifndef GL_NEAREST_MIPMAP_LINEAR +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#endif + +#ifndef GL_CLAMP +#define GL_CLAMP 0x2900 +#endif +#ifndef GL_REPEAT +#define GL_REPEAT 0x2901 +#endif + +#ifndef GL_FOG_START +#define GL_FOG_START 0x0B63 +#endif +#ifndef GL_FOG_END +#define GL_FOG_END 0x0B64 +#endif +#ifndef GL_FOG_MODE +#define GL_FOG_MODE 0x0B65 +#endif +#ifndef GL_FOG_DENSITY +#define GL_FOG_DENSITY 0x0B62 +#endif +#ifndef GL_FOG_COLOR +#define GL_FOG_COLOR 0x0B66 +#endif + +#ifndef GL_POSITION +#define GL_POSITION 0x1203 +#endif +#ifndef GL_AMBIENT +#define GL_AMBIENT 0x1200 +#endif +#ifndef GL_DIFFUSE +#define GL_DIFFUSE 0x1201 +#endif +#ifndef GL_SPECULAR +#define GL_SPECULAR 0x1202 +#endif + +#ifndef GL_LIGHT_MODEL_AMBIENT +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#endif + +#ifndef GL_LINES +#define GL_LINES 0x0001 +#endif +#ifndef GL_LINE_STRIP +#define GL_LINE_STRIP 0x0003 +#endif +#ifndef GL_QUADS +#define GL_QUADS 0x0007 +#endif +#ifndef GL_TRIANGLE_FAN +#define GL_TRIANGLE_FAN 0x0006 +#endif +#ifndef GL_TRIANGLE_STRIP +#define GL_TRIANGLE_STRIP 0x0005 +#endif + +#ifndef GL_RESCALE_NORMAL +#define GL_RESCALE_NORMAL 0x803A +#endif + +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_RGBA +#define GL_RGBA 0x1908 +#endif + +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif + +// glCallList / display list macros +#undef glNewList +#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) +#undef glEndList +#define glEndList() PlatformRenderer.CBuffEnd() +#undef glCallList +// CBuffCall is [[nodiscard]] because it can fail (chunk not ready), but +// legacy display list call sites treat it as fire-and-forget rendering - +// a missed call just means nothing draws this frame, which is what the +// old GL display list semantics already gave them. +#define glCallList(_list) ((void)PlatformRenderer.CBuffCall(_list)) + +// glGenLists / glDeleteLists, lists are not supported in core!!!!! +#undef glGenLists +#define glGenLists(range) PlatformRenderer.CBuffCreate(range) +#undef glDeleteLists +#define glDeleteLists(list, range) PlatformRenderer.CBuffDelete(list, range) + +#ifndef GL_SHADEMODEL_IS_FUNCTION +#undef glShadeModel +#define glShadeModel(mode) \ + do { \ + } while (0) +#endif + +#undef glTranslatef +#define glTranslatef(x, y, z) \ + do { \ + PlatformRenderer.MatrixTranslate(x, y, z); \ + } while (0) + +#undef glRotatef +#define glRotatef(a, x, y, z) \ + do { \ + PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ + z); \ + } while (0) + +#undef glScalef +#define glScalef(x, y, z) \ + do { \ + PlatformRenderer.MatrixScale(x, y, z); \ + } while (0) + +#undef glScaled +#define glScaled(x, y, z) \ + do { \ + PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ + } while (0) + +#undef glPushMatrix +#define glPushMatrix() \ + do { \ + PlatformRenderer.MatrixPush(); \ + } while (0) + +#undef glPopMatrix +#define glPopMatrix() \ + do { \ + PlatformRenderer.MatrixPop(); \ + } while (0) + +#undef glLoadIdentity +#define glLoadIdentity() \ + do { \ + PlatformRenderer.MatrixSetIdentity(); \ + } while (0) + +#undef glMatrixMode +#define glMatrixMode(mode) \ + do { \ + PlatformRenderer.MatrixMode(mode); \ + } while (0) + +#undef glMultMatrixf +#define glMultMatrixf(m) \ + do { \ + PlatformRenderer.MatrixMult(m); \ + } while (0) + +#undef glColor4f +#define glColor4f(r, g, b, a) \ + do { \ + PlatformRenderer.StateSetColour(r, g, b, a); \ + } while (0) + +#undef glColor3f +#define glColor3f(r, g, b) \ + do { \ + PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ + } while (0) + +#undef glAlphaFunc +#define glAlphaFunc(func, ref) \ + do { \ + PlatformRenderer.StateSetAlphaFunc(func, ref); \ + } while (0) + +#undef glEnable +#define glEnable(cap) \ + do { \ + if ((cap) == 0x0B60 /*GL_FOG*/) \ + PlatformRenderer.StateSetFogEnable(true); \ + else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ + PlatformRenderer.StateSetLightingEnable(true); \ + else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ + PlatformRenderer.StateSetAlphaTestEnable(true); \ + else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ + PlatformRenderer.StateSetTextureEnable(true); \ + else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ + PlatformRenderer.StateSetBlendEnable(true); \ + else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ + PlatformRenderer.StateSetFaceCull(true); \ + else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ + PlatformRenderer.StateSetDepthTestEnable(true); \ + else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ + PlatformRenderer.StateSetLightEnable(0, true); \ + else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ + PlatformRenderer.StateSetLightEnable(1, true); \ + else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ + || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ + || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ + || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ + || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ + || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ + || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ + } else \ + ::glEnable(cap); \ + } while (0) + +#undef glDisable +#define glDisable(cap) \ + do { \ + if ((cap) == 0x0B60 /*GL_FOG*/) \ + PlatformRenderer.StateSetFogEnable(false); \ + else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ + PlatformRenderer.StateSetLightingEnable(false); \ + else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ + PlatformRenderer.StateSetAlphaTestEnable(false); \ + else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ + PlatformRenderer.StateSetTextureEnable(false); \ + else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ + PlatformRenderer.StateSetBlendEnable(false); \ + else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ + PlatformRenderer.StateSetFaceCull(false); \ + else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ + PlatformRenderer.StateSetDepthTestEnable(false); \ + else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ + PlatformRenderer.StateSetLightEnable(0, false); \ + else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ + PlatformRenderer.StateSetLightEnable(1, false); \ + else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ + || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ + || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ + || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ + || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ + || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ + || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ + } else \ + ::glDisable(cap); \ + } while (0) + +#undef glFogi +#define glFogi(pname, param) \ + do { \ + if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ + PlatformRenderer.StateSetFogMode(param); \ + } while (0) + +#undef glFogf +#define glFogf(pname, param) \ + do { \ + if ((pname) == 0x0B63 /*GL_FOG_START*/) \ + PlatformRenderer.StateSetFogNearDistance(param); \ + else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ + PlatformRenderer.StateSetFogFarDistance(param); \ + else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ + PlatformRenderer.StateSetFogDensity(param); \ + } while (0) + +#undef glOrtho +#define glOrtho(left, right, bottom, top, zNear, zFar) \ + do { \ + PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, \ + zFar); \ + } while (0) + +#undef glMultiTexCoord2f +#define glMultiTexCoord2f(tex, u, v) \ + do { \ + if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ + PlatformRenderer.StateSetVertexTextureUV(u, v); \ + } while (0) + +#undef glActiveTexture +#define glActiveTexture(tex) \ + do { \ + PlatformRenderer.StateSetActiveTexture(tex); \ + } while (0) + +#undef glClientActiveTexture +#define glClientActiveTexture(tex) \ + do { \ + PlatformRenderer.StateSetActiveTexture(tex); \ + } while (0) + +// declarations +int glGenTextures_4J(); +void glGenTextures_4J(int n, unsigned int* textures); +void glDeleteTextures_4J(int id); +void glDeleteTextures_4J(int n, const unsigned int* textures); +void glTexImage2D_4J(int target, int level, int internalformat, int width, + int height, int border, int format, int type, + void* pixels); + +template +inline void glGenTextures_4J(T* buf) { + unsigned int id = 0; + ::glGenTextures(1, &id); + buf->put((int)id); + buf->flip(); +} +template +inline void glDeleteTextures_4J(T* buf) { + if (buf->limit() > 0) { + unsigned int id = (unsigned int)buf->get(0); + ::glDeleteTextures(1, &id); + } +} +template +inline void glTexCoordPointer_4J(int size, int type, T* pointer) {} +template +inline void glNormalPointer_4J(int type, T* pointer) {} +template +inline void glColorPointer_4J(int size, bool normalized, int stride, + T* pointer) {} +template +inline void glVertexPointer_4J(int size, int type, T* pointer) {} +template +inline void glTexImage2D_4J(int target, int level, int internalformat, + int width, int height, int border, int format, + int type, T* pixels) { + void* data = pixels ? pixels->getBuffer() : nullptr; + ::glTexImage2D((unsigned int)target, level, internalformat, width, height, + border, (unsigned int)format, (unsigned int)type, data); +} +template +inline void glCallLists_4J(T* lists) { + int base = lists->position(); + int count = lists->limit() - base; + for (int i = 0; i < count; i++) { + PlatformRenderer.CBuffCall(lists->get(base + i)); + } +} +template +inline void glFog_4J(int pname, T* params) { + float* p = params->_getDataPointer(); + if (pname == 0x0B66 /* GL_FOG_COLOR */) + PlatformRenderer.StateSetFogColour(p[0], p[1], p[2]); +} +template +inline void glLight_4J(int light, int pname, T* params) { + float* p = params->_getDataPointer(); + if (pname == 0x1203 /* GL_POSITION */) + PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], + p[1], p[2]); + else if (pname == 0x1200 /* GL_AMBIENT */) + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); + else if (pname == 0x1201 /* GL_DIFFUSE */) + PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], + p[1], p[2]); +} +template +inline void glLightModel_4J(int pname, T* params) { + float* p = params->_getDataPointer(); + if (pname == 0x0B53 /* GL_LIGHT_MODEL_AMBIENT */) + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); +} +template +inline void glTexGen_4J(int coord, int pname, T* params) {} +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, void* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, pixels); +} +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, unsigned char* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, (void*)pixels); +} +// T -> .getBuffer() +template +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, T* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, pixels->getBuffer()); +} +// redirect the functions to my own implementation, no more 2.1 funcs +#define glGenTextures(...) glGenTextures_4J(__VA_ARGS__) +#define glDeleteTextures(...) glDeleteTextures_4J(__VA_ARGS__) +#define glTexCoordPointer(a, b, c) glTexCoordPointer_4J(a, b, c) +#define glNormalPointer(a, b) glNormalPointer_4J(a, b) +#define glColorPointer(a, b, c, d) glColorPointer_4J(a, b, c, d) +#define glVertexPointer(a, b, c) glVertexPointer_4J(a, b, c) +#define glTexImage2D(a, b, c, d, e, f, g, h, i) \ + glTexImage2D_4J(a, b, c, d, e, f, g, h, i) +#define glCallLists(x) glCallLists_4J(x) +#define glReadPixels(a, b, c, d, e, f, g) glReadPixels_4J(a, b, c, d, e, f, g) +#define glFog(a, b) glFog_4J(a, b) +#define glLight(a, b, c) glLight_4J(a, b, c) +#define glLightModel(a, b) glLightModel_4J(a, b) +#define glTexGen(a, b, c) glTexGen_4J(a, b, c) diff --git a/targets/platform/renderer/gl/render_stubs.cpp b/targets/platform/renderer/gl/render_stubs.cpp index b4dc08d4b..531ee9f05 100644 --- a/targets/platform/renderer/gl/render_stubs.cpp +++ b/targets/platform/renderer/gl/render_stubs.cpp @@ -19,7 +19,9 @@ void GLRenderer::TextureDynamicUpdateEnd() {} void GLRenderer::TextureGetStats() {} void* GLRenderer::TextureGetTexture(int) { return nullptr; } -int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { return 0; } +int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { + return 0; +} int GLRenderer::SaveTextureDataToMemory(void*, int, int*, int, int, int*) { return 0; } diff --git a/targets/platform/renderer/meson.build b/targets/platform/renderer/meson.build new file mode 100644 index 000000000..5622bd7b9 --- /dev/null +++ b/targets/platform/renderer/meson.build @@ -0,0 +1,26 @@ +platform_renderer_gl_dependencies = [ + dependency('sdl2'), + dependency('glm'), + dependency('stb'), + java_dep, +] +platform_renderer_gl_defs = [] + +if get_option('renderer') == 'gles' + platform_renderer_gl_dependencies += dependency('glesv2') + platform_renderer_gl_defs = ['-DGLES'] +else + platform_renderer_gl_dependencies += [dependency('gl'), dependency('glew')] + platform_renderer_gl_defs = [] +endif + +lib_platform_renderer_gl = static_library('platform_renderer_gl', + files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp'), + include_directories: include_directories('../../'), + dependencies: platform_renderer_gl_dependencies, + cpp_args: platform_renderer_gl_defs + global_cpp_args + global_cpp_defs, +) + +platform_renderer_gl_dep = declare_dependency( + link_with: lib_platform_renderer_gl, +) diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index 873b2a352..d6588cfdb 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -1,4 +1,18 @@ -#include "IPlatformRenderer.h" -#include "./gl/GLRenderer.h" // 4jcraft TODO: find a way to handle OpenGL stubs through a facade +#pragma once -extern IPlatformRenderer& PlatformRenderer; +#include "IPlatformRenderer.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading +// PlatformRenderer during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformRenderer.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformRenderer& PlatformRenderer_get(); +} + +#define PlatformRenderer (::platform_internal::PlatformRenderer_get()) diff --git a/targets/platform/sound/IPlatformSound.h b/targets/platform/sound/IPlatformSound.h new file mode 100644 index 000000000..5fb3ad171 --- /dev/null +++ b/targets/platform/sound/IPlatformSound.h @@ -0,0 +1,101 @@ +#pragma once + +#include +#include + +#include "platform/sound/SoundHandles.h" + +// Platform sound interface. The backend (currently miniaudio) implements +// this; consumers in app/common/Audio/SoundEngine talk to the interface +// rather than to miniaudio directly. +// +// The interface is intent-level: load a sample from disk, play it, +// stop it, set listener position. State (volume, pitch, looping) is +// passed at play time as a struct rather than via global setters. +// +// Concrete handles (SoundHandle, MusicHandle) are tagged structs so the +// type system catches sample-vs-music confusion at compile time. + +namespace platform::sound { + +struct PlaySoundParams { + float x = 0.0f; + float y = 0.0f; + float z = 0.0f; + float volume = 1.0f; + float pitch = 1.0f; + bool spatial = true; // 3D sound positioned in the world + bool looping = false; + float minDistance = 1.0f; // distance below which the sound is full-volume + float maxDistance = 16.0f; // distance above which the sound is silent +}; + +struct PlayMusicParams { + float volume = 1.0f; + float pitch = 1.0f; + bool looping = false; +}; + +class IPlatformSound { +public: + virtual ~IPlatformSound() = default; + + // Lifecycle. init() takes the maximum number of simultaneous local + // listeners (splitscreen player count). Idempotent: a second init() + // call with the same parameters is a no-op. + virtual void init(int listenerCount) = 0; + virtual void shutdown() = 0; + + // Per-frame tick. Drives streaming reads, voice cleanup, etc. + virtual void tick() = 0; + + // Master volume scaling. 0.0 to 1.0. Applies to all subsequent + // sound and music playback. + virtual void setMasterVolume(float volume) = 0; + + // -- Spatial / one-shot sound effects -- + + // Load and start playing a sound. The backend allocates a voice and + // returns a handle that can be used to query / stop the sound. If + // the load fails or the mixer is at capacity, returns an invalid + // handle (the caller should treat that as "sound was dropped" - not + // an error). + [[nodiscard]] virtual SoundHandle playSoundFromFile( + const std::string& path, const PlaySoundParams& params) = 0; + + virtual void stopSound(SoundHandle handle) = 0; + [[nodiscard]] virtual bool isSoundPlaying(SoundHandle handle) const = 0; + + virtual void setSoundVolume(SoundHandle handle, float volume) = 0; + virtual void setSoundPosition(SoundHandle handle, float x, float y, + float z) = 0; + virtual void setSoundPitch(SoundHandle handle, float pitch) = 0; + + // Release the voice. Idempotent on invalid handles. + virtual void releaseSound(SoundHandle handle) = 0; + + // -- Streaming music -- + + // Load and start a streaming music track. Streaming means the + // backend reads the file incrementally rather than decoding it all + // upfront. Use for music tracks; sound effects should use the + // playSound* methods above. + [[nodiscard]] virtual MusicHandle playMusicFromFile( + const std::string& path, const PlayMusicParams& params) = 0; + + virtual void stopMusic(MusicHandle handle) = 0; + [[nodiscard]] virtual bool isMusicPlaying(MusicHandle handle) const = 0; + virtual void setMusicVolume(MusicHandle handle, float volume) = 0; + virtual void setMusicPitch(MusicHandle handle, float pitch) = 0; + virtual void releaseMusic(MusicHandle handle) = 0; + + // -- Listener (one per local splitscreen player) -- + + virtual void setListenerPosition(int listenerIndex, float x, float y, + float z) = 0; + virtual void setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, + float upX, float upY, float upZ) = 0; +}; + +} // namespace platform::sound diff --git a/targets/platform/sound/SoundHandles.h b/targets/platform/sound/SoundHandles.h new file mode 100644 index 000000000..16a856df1 --- /dev/null +++ b/targets/platform/sound/SoundHandles.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +// Type-safe handles for the platform sound subsystem. Each handle is a +// tagged 32-bit integer; the tag struct prevents accidental conversion +// between handle types at compile time. +// +// Handle 0 is reserved for "invalid". Backends should never return 0 +// from a successful create call. + +namespace platform::sound { + +template +struct Handle { + std::uint32_t id = 0; + + [[nodiscard]] constexpr bool valid() const noexcept { return id != 0; } + constexpr explicit operator bool() const noexcept { return valid(); } + + friend constexpr bool operator==(Handle, Handle) = default; +}; + +struct SoundTag {}; +struct MusicTag {}; + +using SoundHandle = Handle; +using MusicHandle = Handle; + +} // namespace platform::sound diff --git a/targets/platform/sound/meson.build b/targets/platform/sound/meson.build new file mode 100644 index 000000000..e694b9a4f --- /dev/null +++ b/targets/platform/sound/meson.build @@ -0,0 +1,10 @@ +lib_platform_sound_miniaudio = static_library('platform_sound_miniaudio', + files('miniaudio/MiniaudioSound.cpp'), + dependencies: dependency('miniaudio'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_sound_miniaudio_dep = declare_dependency( + link_with: lib_platform_sound_miniaudio, +) \ No newline at end of file diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.cpp b/targets/platform/sound/miniaudio/MiniaudioSound.cpp new file mode 100644 index 000000000..dd9c6ba41 --- /dev/null +++ b/targets/platform/sound/miniaudio/MiniaudioSound.cpp @@ -0,0 +1,255 @@ +#include "MiniaudioSound.h" + +#include +#include + +#include "miniaudio.h" +#include "platform/sound/sound.h" + +namespace platform::sound::miniaudio { + +namespace { + +// Each loaded sound voice. Owned by the State's map; the SoundHandle +// the caller holds is the integer key. +struct Voice { + ma_sound sound{}; + bool inUse = false; +}; + +} // namespace + +struct State { + ma_engine engine{}; + ma_engine_config engineConfig{}; + bool engineReady = false; + + // Voice pool. Sound handles are keys; the backend allocates a fresh + // id for every play call. Caller releases via releaseSound() (or + // we'll auto-release when the sound finishes - tick() handles that). + std::unordered_map> sounds; + std::unordered_map> music; + std::atomic nextHandleId{1}; +}; + +MiniaudioSound::MiniaudioSound() : m_state(std::make_unique()) {} +MiniaudioSound::~MiniaudioSound() { + if (m_state && m_state->engineReady) { + shutdown(); + } +} +MiniaudioSound::MiniaudioSound(MiniaudioSound&&) noexcept = default; +MiniaudioSound& MiniaudioSound::operator=(MiniaudioSound&&) noexcept = default; + +void MiniaudioSound::init(int listenerCount) { + if (m_state->engineReady) return; + m_state->engineConfig = ma_engine_config_init(); + m_state->engineConfig.listenerCount = + listenerCount > 0 ? static_cast(listenerCount) : 1; + if (ma_engine_init(&m_state->engineConfig, &m_state->engine) != + MA_SUCCESS) { + return; + } + ma_engine_set_volume(&m_state->engine, 1.0f); + m_state->engineReady = true; +} + +void MiniaudioSound::shutdown() { + if (!m_state->engineReady) return; + // Tear down all live voices first. + for (auto& [id, voice] : m_state->sounds) { + if (voice && voice->inUse) { + ma_sound_uninit(&voice->sound); + } + } + m_state->sounds.clear(); + for (auto& [id, voice] : m_state->music) { + if (voice && voice->inUse) { + ma_sound_uninit(&voice->sound); + } + } + m_state->music.clear(); + ma_engine_uninit(&m_state->engine); + m_state->engineReady = false; +} + +void MiniaudioSound::tick() { + if (!m_state->engineReady) return; + // Reap finished one-shot sounds (non-looping, not currently playing). + // We don't auto-reap music here; music is explicitly stopped by the + // game's music system. + for (auto it = m_state->sounds.begin(); it != m_state->sounds.end();) { + auto& voice = it->second; + if (voice && voice->inUse && !ma_sound_is_playing(&voice->sound) && + !ma_sound_is_looping(&voice->sound)) { + ma_sound_uninit(&voice->sound); + voice->inUse = false; + it = m_state->sounds.erase(it); + } else { + ++it; + } + } +} + +void MiniaudioSound::setMasterVolume(float volume) { + if (!m_state->engineReady) return; + ma_engine_set_volume(&m_state->engine, volume); +} + +SoundHandle MiniaudioSound::playSoundFromFile(const std::string& path, + const PlaySoundParams& params) { + if (!m_state->engineReady) return {}; + auto voice = std::make_unique(); + if (ma_sound_init_from_file(&m_state->engine, path.c_str(), + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &voice->sound) != MA_SUCCESS) { + return {}; + } + ma_sound_set_spatialization_enabled(&voice->sound, + params.spatial ? MA_TRUE : MA_FALSE); + ma_sound_set_min_distance(&voice->sound, params.minDistance); + ma_sound_set_max_distance(&voice->sound, params.maxDistance); + ma_sound_set_volume(&voice->sound, params.volume); + ma_sound_set_pitch(&voice->sound, params.pitch); + ma_sound_set_position(&voice->sound, params.x, params.y, params.z); + ma_sound_set_looping(&voice->sound, params.looping ? MA_TRUE : MA_FALSE); + ma_sound_start(&voice->sound); + voice->inUse = true; + + SoundHandle handle{m_state->nextHandleId.fetch_add(1)}; + m_state->sounds.emplace(handle.id, std::move(voice)); + return handle; +} + +void MiniaudioSound::stopSound(SoundHandle handle) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second) return; + if (it->second->inUse) { + ma_sound_stop(&it->second->sound); + } +} + +bool MiniaudioSound::isSoundPlaying(SoundHandle handle) const { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) { + return false; + } + return ma_sound_is_playing(&it->second->sound) != MA_FALSE; +} + +void MiniaudioSound::setSoundVolume(SoundHandle handle, float volume) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_volume(&it->second->sound, volume); +} + +void MiniaudioSound::setSoundPosition(SoundHandle handle, float x, float y, + float z) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_position(&it->second->sound, x, y, z); +} + +void MiniaudioSound::setSoundPitch(SoundHandle handle, float pitch) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_pitch(&it->second->sound, pitch); +} + +void MiniaudioSound::releaseSound(SoundHandle handle) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end()) return; + if (it->second && it->second->inUse) { + ma_sound_uninit(&it->second->sound); + it->second->inUse = false; + } + m_state->sounds.erase(it); +} + +MusicHandle MiniaudioSound::playMusicFromFile(const std::string& path, + const PlayMusicParams& params) { + if (!m_state->engineReady) return {}; + auto voice = std::make_unique(); + if (ma_sound_init_from_file(&m_state->engine, path.c_str(), + MA_SOUND_FLAG_STREAM, nullptr, nullptr, + &voice->sound) != MA_SUCCESS) { + return {}; + } + ma_sound_set_spatialization_enabled(&voice->sound, MA_FALSE); + ma_sound_set_volume(&voice->sound, params.volume); + ma_sound_set_pitch(&voice->sound, params.pitch); + ma_sound_set_looping(&voice->sound, params.looping ? MA_TRUE : MA_FALSE); + ma_sound_start(&voice->sound); + voice->inUse = true; + + MusicHandle handle{m_state->nextHandleId.fetch_add(1)}; + m_state->music.emplace(handle.id, std::move(voice)); + return handle; +} + +void MiniaudioSound::stopMusic(MusicHandle handle) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second) return; + if (it->second->inUse) { + ma_sound_stop(&it->second->sound); + } +} + +bool MiniaudioSound::isMusicPlaying(MusicHandle handle) const { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) + return false; + return ma_sound_is_playing(&it->second->sound) != MA_FALSE; +} + +void MiniaudioSound::setMusicVolume(MusicHandle handle, float volume) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; + ma_sound_set_volume(&it->second->sound, volume); +} + +void MiniaudioSound::setMusicPitch(MusicHandle handle, float pitch) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; + ma_sound_set_pitch(&it->second->sound, pitch); +} + +void MiniaudioSound::releaseMusic(MusicHandle handle) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end()) return; + if (it->second && it->second->inUse) { + ma_sound_uninit(&it->second->sound); + it->second->inUse = false; + } + m_state->music.erase(it); +} + +void MiniaudioSound::setListenerPosition(int listenerIndex, float x, float y, + float z) { + if (!m_state->engineReady) return; + ma_engine_listener_set_position( + &m_state->engine, static_cast(listenerIndex), x, y, z); +} + +void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, + float upX, float upY, float upZ) { + if (!m_state->engineReady) return; + ma_engine_listener_set_direction(&m_state->engine, + static_cast(listenerIndex), + forwardX, forwardY, forwardZ); + ma_engine_listener_set_world_up( + &m_state->engine, static_cast(listenerIndex), upX, upY, upZ); +} + +} // namespace platform::sound::miniaudio + +namespace platform_internal { +::platform::sound::IPlatformSound& PlatformSound_get() { + static ::platform::sound::miniaudio::MiniaudioSound instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.h b/targets/platform/sound/miniaudio/MiniaudioSound.h new file mode 100644 index 000000000..44a7845e5 --- /dev/null +++ b/targets/platform/sound/miniaudio/MiniaudioSound.h @@ -0,0 +1,61 @@ +#pragma once + +#include + +#include "platform/sound/IPlatformSound.h" + +// Forward-declare the miniaudio state struct so this header doesn't +// need to include miniaudio.h - keeps the include footprint small for +// any consumer of the backend header. +namespace platform::sound::miniaudio { + +struct State; + +class MiniaudioSound : public IPlatformSound { +public: + MiniaudioSound(); + ~MiniaudioSound() override; + + // Move-only - the engine owns hardware state. + MiniaudioSound(MiniaudioSound&&) noexcept; + MiniaudioSound& operator=(MiniaudioSound&&) noexcept; + MiniaudioSound(const MiniaudioSound&) = delete; + MiniaudioSound& operator=(const MiniaudioSound&) = delete; + + // -- IPlatformSound -- + + void init(int listenerCount) override; + void shutdown() override; + void tick() override; + + void setMasterVolume(float volume) override; + + [[nodiscard]] SoundHandle playSoundFromFile( + const std::string& path, const PlaySoundParams& params) override; + void stopSound(SoundHandle handle) override; + [[nodiscard]] bool isSoundPlaying(SoundHandle handle) const override; + void setSoundVolume(SoundHandle handle, float volume) override; + void setSoundPosition(SoundHandle handle, float x, float y, + float z) override; + void setSoundPitch(SoundHandle handle, float pitch) override; + void releaseSound(SoundHandle handle) override; + + [[nodiscard]] MusicHandle playMusicFromFile( + const std::string& path, const PlayMusicParams& params) override; + void stopMusic(MusicHandle handle) override; + [[nodiscard]] bool isMusicPlaying(MusicHandle handle) const override; + void setMusicVolume(MusicHandle handle, float volume) override; + void setMusicPitch(MusicHandle handle, float pitch) override; + void releaseMusic(MusicHandle handle) override; + + void setListenerPosition(int listenerIndex, float x, float y, + float z) override; + void setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, float upX, + float upY, float upZ) override; + +private: + std::unique_ptr m_state; +}; + +} // namespace platform::sound::miniaudio diff --git a/targets/platform/sound/sound.h b/targets/platform/sound/sound.h new file mode 100644 index 000000000..41dba077f --- /dev/null +++ b/targets/platform/sound/sound.h @@ -0,0 +1,16 @@ +#pragma once + +#include "platform/sound/IPlatformSound.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same pattern as input/renderer/profile/storage/fs - SIOF-safe. +// +// The macro lets call sites keep using `PlatformSound.foo()` syntax; +// the expansion is just a function call returning a reference, which +// LTO inlines. + +namespace platform_internal { +::platform::sound::IPlatformSound& PlatformSound_get(); +} + +#define PlatformSound (::platform_internal::PlatformSound_get()) diff --git a/targets/platform/storage/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h index e65b86211..1bbf3aedd 100644 --- a/targets/platform/storage/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -6,7 +6,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 #define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 @@ -36,8 +36,6 @@ using PSAVE_DETAILS = SAVE_DETAILS*; class C4JStringTable; - - class IPlatformStorage { public: // Enums live here so both the interface consumer and the concrete @@ -198,9 +196,10 @@ public: unsigned int textDataBytes) = 0; virtual ESaveGameState SaveSaveData( std::function callback) = 0; - virtual void CopySaveDataToNewSave( - std::uint8_t* pbThumbnail, unsigned int cbThumbnail, - char* wchNewName, std::function callback) = 0; + virtual void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) = 0; virtual ESaveGameState DoesSaveExist(bool* pbExists) = 0; virtual bool EnoughSpaceForAMinSaveGame() = 0; virtual void SetSaveMessageVPosition(float fY) = 0; @@ -211,10 +210,9 @@ public: virtual PSAVE_DETAILS ReturnSavesInfo() = 0; virtual void ClearSavesInfo() = 0; virtual ESaveGameState LoadSaveDataThumbnail( - PSAVE_INFO pSaveInfo, - std::function - callback) = 0; + PSAVE_INFO pSaveInfo, std::function + callback) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, @@ -224,16 +222,14 @@ public: PSAVE_INFO pSaveInfo, std::function callback) = 0; virtual ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) = 0; + PSAVE_INFO pSaveInfo, std::function callback) = 0; // DLC virtual void RegisterMarketplaceCountsCallback( std::function callback) = 0; virtual void SetDLCPackageRoot(char* pszDLCRoot) = 0; virtual EDLCStatus GetDLCOffers( - int iPad, - std::function callback, + int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT) = 0; virtual unsigned int CancelGetDLCOffers() = 0; @@ -260,8 +256,7 @@ public: // Title storage virtual ETMSStatus ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, eTMS_FileType eFileType, - char* pwchFilename, std::uint8_t** ppBuffer, - unsigned int* pBufferSize, + char* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback = nullptr, int iAction = 0) = 0; virtual bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, diff --git a/targets/platform/storage/meson.build b/targets/platform/storage/meson.build new file mode 100644 index 000000000..7fa48cb3d --- /dev/null +++ b/targets/platform/storage/meson.build @@ -0,0 +1,9 @@ +lib_platform_storage_stub = static_library('platform_storage_stub', + files('stub/StubStorage.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_storage_stub_dep = declare_dependency( + link_with: lib_platform_storage_stub, +) diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h index 0a6d962e7..624af2ddb 100644 --- a/targets/platform/storage/storage.h +++ b/targets/platform/storage/storage.h @@ -1,3 +1,18 @@ +#pragma once + #include "IPlatformStorage.h" -extern IPlatformStorage& PlatformStorage; +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformStorage& PlatformStorage;` form had: anything reading +// PlatformStorage during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformStorage.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformStorage& PlatformStorage_get(); +} + +#define PlatformStorage (::platform_internal::PlatformStorage_get()) diff --git a/targets/platform/storage/stub/StubStorage.cpp b/targets/platform/storage/stub/StubStorage.cpp index cd4ff1300..8d6518e5c 100644 --- a/targets/platform/storage/stub/StubStorage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -6,8 +6,12 @@ #include #include -StubStorage stub_storage_instance; -IPlatformStorage& PlatformStorage = stub_storage_instance; +namespace platform_internal { +IPlatformStorage& PlatformStorage_get() { + static StubStorage instance; + return instance; +} +} // namespace platform_internal static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; @@ -30,15 +34,15 @@ StubStorage::EMessageResult StubStorage::GetMessageBoxResult() { } bool StubStorage::SetSaveDevice(std::function callback, - bool bForceResetOfSaveDevice) { + bool bForceResetOfSaveDevice) { return true; } void StubStorage::Init(unsigned int uiSaveVersion, - const char* pwchDefaultSaveName, char* pszSavePackName, - int iMinimumSaveSize, - std::function callback, - const char* szGroupID) {} + const char* pwchDefaultSaveName, char* pszSavePackName, + int iMinimumSaveSize, + std::function callback, + const char* szGroupID) {} void StubStorage::ResetSaveData() {} void StubStorage::SetDefaultSaveNameForKeyboardDisplay( const char* pwchDefaultSaveName) {} @@ -53,7 +57,7 @@ bool StubStorage::GetSaveUniqueFilename(char* pszName) { } void StubStorage::SetSaveUniqueFilename(char* szFilename) {} void StubStorage::SetState(ESaveGameControlState eControlState, - std::function callback) {} + std::function callback) {} void StubStorage::SetSaveDisabled(bool bDisable) {} bool StubStorage::GetSaveDisabled(void) { return false; } unsigned int StubStorage::GetSaveSize() { return 0; } @@ -64,18 +68,18 @@ void* StubStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } void StubStorage::SetSaveImages(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes, - std::uint8_t* pbImage, unsigned int imageBytes, - std::uint8_t* pbTextData, - unsigned int textDataBytes) {} + unsigned int thumbnailBytes, + std::uint8_t* pbImage, unsigned int imageBytes, + std::uint8_t* pbTextData, + unsigned int textDataBytes) {} StubStorage::ESaveGameState StubStorage::SaveSaveData( std::function callback) { return ESaveGame_Idle; } void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, - unsigned int cbThumbnail, - char* wchNewName, - std::function callback) {} + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) {} void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } StubStorage::ESaveGameState StubStorage::DoesSaveExist(bool* pbExists) { @@ -94,29 +98,26 @@ PSAVE_DETAILS StubStorage::ReturnSavesInfo() { return nullptr; } void StubStorage::ClearSavesInfo() {} StubStorage::ESaveGameState StubStorage::LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, - std::function + std::function callback) { return ESaveGame_Idle; } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - XCONTENT_DATA& xContentData) { + XCONTENT_DATA& xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - std::uint8_t** ppbImageData, - unsigned int* pImageBytes) { + std::uint8_t** ppbImageData, + unsigned int* pImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pImageBytes) *pImageBytes = 0; } StubStorage::ESaveGameState StubStorage::LoadSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } StubStorage::ESaveGameState StubStorage::DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } void StubStorage::RegisterMarketplaceCountsCallback( @@ -133,9 +134,10 @@ XMARKETPLACE_CONTENTOFFER_INFO& StubStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } int StubStorage::GetOfferCount() { return 0; } -unsigned int StubStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, - std::function callback, - bool bTrial) { +unsigned int StubStorage::InstallOffer(int iOfferIDC, + std::uint64_t* ullOfferIDA, + std::function callback, + bool bTrial) { return 0; } unsigned int StubStorage::GetAvailableDLCCount(int iPad) { return 0; } @@ -159,7 +161,7 @@ unsigned int StubStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } void StubStorage::GetMountedDLCFileList(const char* szMountDrive, - std::vector& fileList) { + std::vector& fileList) { fileList.clear(); } std::string StubStorage::GetMountedPath(std::string szMount) { return ""; } @@ -171,12 +173,12 @@ StubStorage::ETMSStatus StubStorage::ReadTMSFile( return ETMSStatus_Fail; } bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename, std::uint8_t* pBuffer, - unsigned int bufferSize) { + char* pwchFilename, std::uint8_t* pBuffer, + unsigned int bufferSize) { return false; } bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename) { + char* pwchFilename) { return false; } void StubStorage::StoreTMSPathName(char* pwchName) {} @@ -204,7 +206,7 @@ int StubStorage::AddSubfile(int regionIndex) { } unsigned int StubStorage::GetSubfileCount() { return 0; } void StubStorage::GetSubfileDetails(unsigned int i, int* regionIndex, - void** data, unsigned int* size) { + void** data, unsigned int* size) { (void)i; if (regionIndex) *regionIndex = 0; if (data) *data = 0; @@ -219,5 +221,7 @@ void StubStorage::UpdateSubfile(int index, void* data, unsigned int size) { void StubStorage::SaveSubfiles(std::function callback) { if (callback) callback(true); } -StubStorage::ESaveGameState StubStorage::GetSaveState() { return ESaveGame_Idle; } +StubStorage::ESaveGameState StubStorage::GetSaveState() { + return ESaveGame_Idle; +} void StubStorage::ContinueIncompleteOperation() {} diff --git a/targets/platform/storage/stub/StubStorage.h b/targets/platform/storage/stub/StubStorage.h index ce0d57440..9ccfc51a0 100644 --- a/targets/platform/storage/stub/StubStorage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -7,8 +7,8 @@ #include // #include -#include "PlatformTypes.h" #include "../IPlatformStorage.h" +#include "platform/PlatformTypes.h" class C4JStringTable; @@ -87,8 +87,7 @@ public: const char* szGroupID); void ResetSaveData(); // Call before a new save to clear out stored save // file name - void SetDefaultSaveNameForKeyboardDisplay( - const char* pwchDefaultSaveName); + void SetDefaultSaveNameForKeyboardDisplay(const char* pwchDefaultSaveName); void SetSaveTitle(const char* pwchDefaultSaveName); bool GetSaveUniqueNumber(int* piVal); bool GetSaveUniqueFilename(char* pszName); @@ -145,8 +144,7 @@ public: PSAVE_INFO pSaveInfo, std::function callback); StubStorage::ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback); + PSAVE_INFO pSaveInfo, std::function callback); // DLC void RegisterMarketplaceCountsCallback( @@ -194,8 +192,9 @@ public: #ifdef _XBOX StubStorage::ETMSStatus WriteTMSFile( int iPad, StubStorage::eGlobalStorage eStorageFacility, - StubStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, - unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam); + StubStorage::eTMS_FileType eFileType, char* pchFilePath, + char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func, + void* lpParam); int GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, void* lpParam); #endif diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 5c2f47b4a..a84615d90 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -1,10 +1,17 @@ #pragma once -#include +// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, +// which can only be found in the Windows API +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif -#ifdef __linux__ -#include -#include +#include + +#include "java/File.h" +#include "renderer/gl/gl_compat.h" #undef GL_SMOOTH #undef GL_FLAT @@ -34,130 +41,6 @@ void glEndList_4J(int vertexCount = 0); void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*); void glCallLists(IntBuffer*); -void glGenQueriesARB(IntBuffer*); -void glBeginQueryARB(int, int); -void glEndQueryARB(int); -void glGetQueryObjectuARB(int, int, IntBuffer*); -void glReadPixels(int, int, int, int, int, int, ByteBuffer*); - -#else - -const int GL_BYTE = 0; -const int GL_FLOAT = 0; -const int GL_UNSIGNED_BYTE = 0; - -const int GL_COLOR_ARRAY = 0; -const int GL_VERTEX_ARRAY = 0; -const int GL_NORMAL_ARRAY = 0; -const int GL_TEXTURE_COORD_ARRAY = 0; - -const int GL_COMPILE = 0x1300; - -const int GL_NORMALIZE = 0; - -const int GL_RESCALE_NORMAL = 0; - -const int GL_SMOOTH = 0; -const int GL_FLAT = 0; - -const int GL_RGBA = 0; -const int GL_BGRA = 1; -const int GL_BGR = 0; - -const int GL_SAMPLES_PASSED_ARB = 0; -const int GL_QUERY_RESULT_AVAILABLE_ARB = 0; -const int GL_QUERY_RESULT_ARB = 0; - -const int GL_POLYGON_OFFSET_FILL = 0; - -const int GL_FRONT = 0; -const int GL_BACK = 1; -const int GL_FRONT_AND_BACK = 2; - -const int GL_COLOR_MATERIAL = 0; - -const int GL_AMBIENT_AND_DIFFUSE = 0; - -const int GL_TEXTURE1 = 0; -const int GL_TEXTURE0 = 1; - -void glFlush(); -void glTexGeni(int, int, int); -void glTexGen(int, int, FloatBuffer*); -void glReadPixels(int, int, int, int, int, int, ByteBuffer*); -void glClearDepth(double); -void glCullFace(int); -void glDeleteLists(int, int); -void glGenTextures(IntBuffer*); -int glGenTextures(); -int glGenLists(int); -void glLight(int, int, FloatBuffer*); -void glLightModel(int, FloatBuffer*); -void glGetFloat(int a, FloatBuffer* b); -void glTexCoordPointer(int, int, int, int); -void glTexCoordPointer(int, int, FloatBuffer*); -void glNormalPointer(int, int, int); -void glNormalPointer(int, ByteBuffer*); -void glEnableClientState(int); -void glDisableClientState(int); -void glColorPointer(int, bool, int, ByteBuffer*); -void glColorPointer(int, int, int, int); -void glVertexPointer(int, int, int, int); -void glVertexPointer(int, int, FloatBuffer*); -void glDrawArrays(int, int, int); -void glTranslatef(float, float, float); -void glRotatef(float, float, float, float); -void glNewList(int, int); -void glEndList(int vertexCount = 0); -void glCallList(int); -void glPopMatrix(); -void glPushMatrix(); -void glColor3f(float, float, float); -void glScalef(float, float, float); -void glMultMatrixf(float*); -void glColor4f(float, float, float, float); -void glDisable(int); -void glEnable(int); -void glBlendFunc(int, int); -void glDepthMask(bool); -void glNormal3f(float, float, float); -void glDepthFunc(int); -void glMatrixMode(int); -void glLoadIdentity(); -void glBindTexture(int, int); -void glTexParameteri(int, int, int); -void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*); -void glDeleteTextures(IntBuffer*); -void glDeleteTextures(int); -void glCallLists(IntBuffer*); -void glGenQueriesARB(IntBuffer*); -void glColorMask(bool, bool, bool, bool); -void glBeginQueryARB(int, int); -void glEndQueryARB(int); -void glGetQueryObjectuARB(int, int, IntBuffer*); -void glShadeModel(int); -void glPolygonOffset(float, float); -void glLineWidth(float); -void glScaled(double, double, double); -void gluPerspective(float, float, float, float); -void glClear(int); -void glViewport(int, int, int, int); -void glAlphaFunc(int, float); -void glOrtho(float, float, float, float, float, float); -void glClearColor(float, float, float, float); -void glFogi(int, int); -void glFogf(int, float); -void glFog(int, FloatBuffer*); -void glColorMaterial(int, int); -void glMultiTexCoord2f(int, float, float); - -void glClientActiveTexture(int); -void glActiveTexture(int); - -#endif - -#ifdef __linux__ -#include "java/File.h" class GL11 { public: @@ -177,23 +60,6 @@ public: static void glBufferDataARB(int, ByteBuffer*, int) {} static void glGenBuffersARB(IntBuffer*) {} }; -#else -class GL11 { -public: - static const int GL_SMOOTH = 0; - static const int GL_FLAT = 0; - static void glShadeModel(int) {}; -}; - -class ARBVertexBufferObject { -public: - static const int GL_ARRAY_BUFFER_ARB = 0; - static const int GL_STREAM_DRAW_ARB = 0; - static void glBindBufferARB(int, int) {} - static void glBufferDataARB(int, ByteBuffer*, int) {} - static void glGenBuffersARB(IntBuffer*) {} -}; -#endif class Level; class Player; diff --git a/targets/platform/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp similarity index 73% rename from targets/platform/C4JThread.cpp rename to targets/platform/thread/C4JThread.cpp index fc793bc93..36067b5d1 100644 --- a/targets/platform/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -15,7 +15,9 @@ #include #if defined(_WIN32) -#include +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include #endif #if defined(__linux__) @@ -26,8 +28,8 @@ #include #endif -#include "platform/ShutdownManager.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" +#include "platform/thread/ShutdownManager.h" class Level; @@ -82,46 +84,46 @@ std::int64_t getNativeThreadId() { void setThreadNamePlatform([[maybe_unused]] std::uint32_t threadId, [[maybe_unused]] const char* name) { -#if defined(_WIN32) - // Try modern API first (Windows 10 1607+). - if (threadId == static_cast(-1) || - threadId == ::GetCurrentThreadId()) { - using SetThreadDescriptionFn = int32_t(WINAPI*)(void*, PCWSTR); - const HMODULE kernel = ::GetModuleHandleW("Kernel32.dll"); - if (kernel) { - const auto fn = reinterpret_cast( - ::GetProcAddress(kernel, "SetThreadDescription")); - if (fn) { - char wide[64]; - const auto n = std::strncpy( - wide, name, (sizeof(wide) / sizeof(wide[0])) - 1); - if (n != static_cast(-1)) { - wide[n] = '\0'; - (void)fn(::GetCurrentThread(), wide); - return; - } - } - } - } +// #if defined(_WIN32) +// // Try modern API first (Windows 10 1607+). +// if (threadId == static_cast(-1) || +// threadId == ::GetCurrentThreadId()) { +// using SetThreadDescriptionFn = int32_t(WINAPI*)(void*, PCWSTR); +// const HMODULE kernel = ::GetModuleHandleA("Kernel32.dll"); +// if (kernel) { +// const auto fn = reinterpret_cast( +// ::GetProcAddress(kernel, "SetThreadDescription")); +// if (fn) { +// char wide[64]; +// const auto n = std::strncpy( +// wide, name, (sizeof(wide) / sizeof(wide[0])) - 1); +// if (n != static_cast(-1)) { +// wide[n] = '\0'; +// (void)fn(::GetCurrentThread(), wide); +// return; +// } +// } +// } +// } - // Legacy fallback: raise exception 0x406D1388 for older MSVC debuggers. -#pragma pack(push, 8) - struct THREADNAME_INFO { - std::uint32_t dwType; - const char* szName; - std::uint32_t dwThreadID; - std::uint32_t dwFlags; - }; -#pragma pack(pop) +// // Legacy fallback: raise exception 0x406D1388 for older MSVC debuggers. +// #pragma pack(push, 8) +// struct THREADNAME_INFO { +// std::uint32_t dwType; +// const char* szName; +// std::uint32_t dwThreadID; +// std::uint32_t dwFlags; +// }; +// #pragma pack(pop) - THREADNAME_INFO info{0x1000, name, threadId, 0}; - __try { - ::RaiseException(0x406D1388, 0, sizeof(info) / sizeof(uintptr_t), - reinterpret_cast(&info)); - } __except (EXCEPTION_EXECUTE_HANDLER) { - } +// THREADNAME_INFO info{0x1000, name, threadId, 0}; +// __try { +// ::RaiseException(0x406D1388, 0, sizeof(info) / sizeof(uintptr_t), +// reinterpret_cast(&info)); +// } __except (EXCEPTION_EXECUTE_HANDLER) { +// } -#elif defined(__linux__) +#if defined(__linux__) // pthread_setname_np limit: 16 chars including null terminator. char truncated[16]; std::snprintf(truncated, sizeof(truncated), "%s", name); @@ -140,7 +142,7 @@ void setPriorityPlatform(std::thread& threadHandle, bool isSelf, handle = ::GetCurrentThread(); else return; - (void)::SetThreadPriority(handle, std::to_underlying(priority)); + (void)::SetThreadPriority(handle, static_cast(priority)); #elif defined(__linux__) std::int64_t tid = 0; @@ -376,77 +378,121 @@ std::uint32_t C4JThread::Event::waitForSignal(int timeoutMs) { } C4JThread::EventArray::EventArray(int size, Mode mode) - : m_size(size), m_mode(mode), m_mutex(), m_condition(), m_signaledMask(0U) { + : m_size(size), m_mode(mode), m_signaledMask(0U) { assert(m_size > 0 && m_size <= 32); } void C4JThread::EventArray::set(int index) { assert(index >= 0 && index < m_size); - { - std::lock_guard lock(m_mutex); - m_signaledMask |= (1U << static_cast(index)); - } - m_condition.notify_all(); + const std::uint32_t bit = 1U << static_cast(index); + m_signaledMask.fetch_or(bit, std::memory_order_release); + m_signaledMask.notify_all(); } void C4JThread::EventArray::clear(int index) { assert(index >= 0 && index < m_size); - std::lock_guard lock(m_mutex); - m_signaledMask &= ~(1U << static_cast(index)); + const std::uint32_t bit = 1U << static_cast(index); + m_signaledMask.fetch_and(~bit, std::memory_order_relaxed); } void C4JThread::EventArray::setAll() { - { - std::lock_guard lock(m_mutex); - m_signaledMask |= buildMaskForSize(m_size); - } - m_condition.notify_all(); + const std::uint32_t mask = buildMaskForSize(m_size); + m_signaledMask.fetch_or(mask, std::memory_order_release); + m_signaledMask.notify_all(); } void C4JThread::EventArray::clearAll() { - std::lock_guard lock(m_mutex); - m_signaledMask = 0U; + m_signaledMask.store(0U, std::memory_order_relaxed); } +namespace { + +// Polling fallback for finite-timeout waits; std::atomic::wait has no timed +// overload until C++26. +template +bool waitForMaskTimed(std::atomic& mask, int timeoutMs, + Predicate&& predicate) { + using clock = std::chrono::steady_clock; + const auto deadline = clock::now() + std::chrono::milliseconds(timeoutMs); + auto interval = std::chrono::microseconds(100); + constexpr auto maxInterval = std::chrono::milliseconds(2); + while (clock::now() < deadline) { + if (predicate(mask.load(std::memory_order_acquire))) return true; + std::this_thread::sleep_for(interval); + if (interval < maxInterval) interval *= 2; + } + return predicate(mask.load(std::memory_order_acquire)); +} + +} // namespace + std::uint32_t C4JThread::EventArray::waitForSingle(int index, int timeoutMs) { assert(index >= 0 && index < m_size); const std::uint32_t bitMask = 1U << static_cast(index); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) != 0U; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - if (m_mode == Mode::AutoClear) m_signaledMask &= ~bitMask; + + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~bitMask, std::memory_order_release); + } return WaitResult::Signaled; } std::uint32_t C4JThread::EventArray::waitForAll(int timeoutMs) { const std::uint32_t bitMask = buildMaskForSize(m_size); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) == bitMask; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) == bitMask; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - if (m_mode == Mode::AutoClear) m_signaledMask &= ~bitMask; + + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~bitMask, std::memory_order_release); + } return WaitResult::Signaled; } std::uint32_t C4JThread::EventArray::waitForAny(int timeoutMs) { const std::uint32_t bitMask = buildMaskForSize(m_size); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) != 0U; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - const std::uint32_t readyIndex = firstSetBitIndex(m_signaledMask & bitMask); - if (m_mode == Mode::AutoClear) m_signaledMask &= ~(1U << readyIndex); + const std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + const std::uint32_t readyIndex = firstSetBitIndex(cur & bitMask); + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~(1U << readyIndex), + std::memory_order_release); + } return WaitResult::Signaled + readyIndex; } @@ -563,4 +609,3 @@ void C4JThread::EventQueue::threadPoll() { ShutdownManager::HasFinished(ShutdownManager::eEventQueueThreads); } - diff --git a/targets/platform/C4JThread.h b/targets/platform/thread/C4JThread.h similarity index 97% rename from targets/platform/C4JThread.h rename to targets/platform/thread/C4JThread.h index 54e08f0f2..52eb157ed 100644 --- a/targets/platform/C4JThread.h +++ b/targets/platform/thread/C4JThread.h @@ -51,6 +51,8 @@ public: bool m_signaled; }; + // Lock-free bitmask of up to 32 events; waiters block via + // std::atomic::wait. class EventArray { public: enum class Mode { AutoClear, ManualClear }; @@ -68,9 +70,7 @@ public: private: int m_size; Mode m_mode; - std::mutex m_mutex; - std::condition_variable m_condition; - std::uint32_t m_signaledMask; + std::atomic m_signaledMask; }; class EventQueue { diff --git a/targets/platform/ShutdownManager.cpp b/targets/platform/thread/ShutdownManager.cpp similarity index 88% rename from targets/platform/ShutdownManager.cpp rename to targets/platform/thread/ShutdownManager.cpp index cd3b82678..d2361dfef 100644 --- a/targets/platform/ShutdownManager.cpp +++ b/targets/platform/thread/ShutdownManager.cpp @@ -1,7 +1,8 @@ // Linux stub implementations for ShutdownManager // The PS3/PSVita versions have full implementations; on Linux these are no-ops. -#include "platform/ShutdownManager.h" -#include "platform/C4JThread.h" +#include "platform/thread/ShutdownManager.h" + +#include "platform/thread/C4JThread.h" void ShutdownManager::Initialise() {} void ShutdownManager::StartShutdown() {} diff --git a/targets/platform/ShutdownManager.h b/targets/platform/thread/ShutdownManager.h similarity index 96% rename from targets/platform/ShutdownManager.h rename to targets/platform/thread/ShutdownManager.h index 33f1019be..551039576 100644 --- a/targets/platform/ShutdownManager.h +++ b/targets/platform/thread/ShutdownManager.h @@ -6,7 +6,7 @@ #include #include -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class ShutdownManager { public: diff --git a/targets/platform/thread/meson.build b/targets/platform/thread/meson.build new file mode 100644 index 000000000..fc616cda0 --- /dev/null +++ b/targets/platform/thread/meson.build @@ -0,0 +1,10 @@ +lib_platform_thread = static_library('platform_thread', + files('C4JThread.cpp', 'ShutdownManager.cpp'), + dependencies: [dependency('threads')], + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_thread_dep = declare_dependency( + link_with: lib_platform_thread, +) \ No newline at end of file diff --git a/targets/resources/meson.build b/targets/resources/meson.build index 23af3e495..847217fd7 100644 --- a/targets/resources/meson.build +++ b/targets/resources/meson.build @@ -478,7 +478,7 @@ archive_sources_psvita = [ ] media_archive = custom_target('Minecraft.Media_Archive', - output : 'MediaLinux.arc', + output : 'MediaWindows64.arc', input : archive_sources + archive_sources_movies1080 + archive_sources_movies720 + archive_sources_linux, command : [ python, meson.project_source_root() / 'scripts/pack_arc.py', diff --git a/targets/util/Definitions.h b/targets/util/Definitions.h deleted file mode 100644 index b02596765..000000000 --- a/targets/util/Definitions.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -inline constexpr int MAX_PATH_SIZE = 256; diff --git a/targets/util/FrameProfiler.h b/targets/util/FrameProfiler.h index 71fa01937..b39edbc6a 100644 --- a/targets/util/FrameProfiler.h +++ b/targets/util/FrameProfiler.h @@ -40,7 +40,7 @@ public: [[nodiscard]] static constexpr std::size_t BucketIndex( Bucket bucket) noexcept { - return static_cast(std::to_underlying(bucket)); + return static_cast(bucket); } [[nodiscard]] static constexpr std::size_t BucketCount() noexcept { diff --git a/targets/util/StringHelpers.cpp b/targets/util/StringHelpers.cpp index e1cc331ca..7d5023d5d 100644 --- a/targets/util/StringHelpers.cpp +++ b/targets/util/StringHelpers.cpp @@ -156,24 +156,6 @@ std::u16string string_to_u16string(const std::string& converting) { return result; } -std::string wstringtofilename(const std::wstring& name) { - std::string result; - result.reserve(name.size()); - for (wchar_t c : name) { -#if defined(__linux__) - if (c == L'\\') c = L'/'; -#else - if (c == L'/') c = L'\\'; -#endif - result += static_cast(c); - } - return result; -} - -std::wstring filenametowstring(const char* name) { - return convStringToWstring(name); -} - std::vector& stringSplit(const std::string& s, char delim, std::vector& elems) { std::stringstream ss(s); diff --git a/targets/util/StringHelpers.h b/targets/util/StringHelpers.h index d7de053ab..99484685c 100644 --- a/targets/util/StringHelpers.h +++ b/targets/util/StringHelpers.h @@ -7,7 +7,7 @@ std::string toLower(const std::string& a); std::string trimString(const std::string& a); std::string replaceAll(const std::string& in, const std::string& replace, - const std::string& with); + const std::string& with); bool equalsIgnoreCase(const std::string& a, const std::string& b); @@ -37,11 +37,9 @@ std::wstring u16string_to_wstring(const std::u16string& converting); std::u16string wstring_to_u16string(const std::wstring& converting); std::u16string string_to_u16string(const std::string& converting); std::u8string wstring_to_u8string(const std::wstring& converting); -std::string wstringtofilename(const std::wstring& name); -std::wstring filenametowstring(const char* name); std::vector& stringSplit(const std::string& s, char delim, - std::vector& elems); + std::vector& elems); std::vector stringSplit(const std::string& s, char delim); void stripWhitespaceForHtml(std::string& string, bool bRemoveNewline = true); diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 71ca5e398..915ae4768 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -13,7 +12,10 @@ using clock = std::chrono::steady_clock; using time_point = clock::time_point; template -concept Duration = requires { typename T::rep; typename T::period; }; +concept Duration = requires { + typename T::rep; + typename T::period; +}; namespace detail { @@ -62,16 +64,13 @@ public: line_(where.line()) {} template - ScopedTimer( - std::string_view name, - D min_duration_to_log, - std::source_location where = std::source_location::current()) + ScopedTimer(std::string_view name, D min_duration_to_log, + std::source_location where = std::source_location::current()) : name_(name), file_(detail::base_name(where.file_name())), line_(where.line()), - min_duration_to_log_( - std::chrono::duration_cast(min_duration_to_log)) { - } + min_duration_to_log_(std::chrono::duration_cast( + min_duration_to_log)) {} ~ScopedTimer() noexcept { const auto elapsed = timer_.elapsed(); @@ -81,11 +80,12 @@ public: std::chrono::duration(elapsed).count(); try { - name_.empty() - ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", - ms, file_, line_) - : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", - name_, ms, file_, line_); + const auto log = + name_.empty() ? std::format("[TIMER] {:.3f} ms ({}:{})\n", ms, + file_, line_) + : std::format("[TIMER] {} - {:.3f} ms ({}:{})\n", + name_, ms, file_, line_); + std::fputs(log.c_str(), stderr); } catch (...) { std::fprintf(stderr, "[TIMER] %.3f ms\n", ms); } diff --git a/targets/util/meson.build b/targets/util/meson.build index 35789f396..4c4439263 100644 --- a/targets/util/meson.build +++ b/targets/util/meson.build @@ -1,6 +1,6 @@ lib_util = static_library('util', files('StringHelpers.cpp', 'FrameProfiler.cpp'), - dependencies: [simdutf_dep], + dependencies: [dependency('simdutf')], include_directories : include_directories('.', '..'), cpp_args : global_cpp_args + global_cpp_defs, )