104 Commits

Author SHA1 Message Date
Tropical 397ab0a6e5 fix: more working directory logic bugs 2026-04-11 10:11:37 -07:00
Tropical f7e555ea6b fix: UB with LivingEntities::pushEntities 2026-04-11 09:56:20 -07:00
Tropical 76788f1708 fix: UB when getenv("HOME") returns nullptr 2026-04-11 09:44:28 -07:00
Tropical 2396e6bb96 fix: pulled a 4J 2026-04-11 00:17:49 -05:00
Tropical d7cc42d40e fix: implement StdFilesystem::getBasePath for windows, macos, linux 2026-04-10 20:58:48 -07:00
Tropical b7ad828882 fix: Windows archive file discovery 2026-04-10 20:37:08 -07:00
Tropical 93215033e4 fix: restore debugoptimized default flag 2026-04-10 19:13:44 -07:00
Tropical c432e83d18 fix: make it build on windows 2026-04-10 19:12:57 -07:00
Tropical c58c1bd9d2 fix: MSVC build fixes 2026-04-10 17:09:25 -07:00
Tropical a399023cca refactor: switch to glew for OpenGL loading 2026-04-10 16:27:00 -07:00
Tropical b0fac9fbc6 refactor: downgrade to C++20 2026-04-10 17:12:35 -05:00
Tropical ff7baaac3b nuke non-portable Windows file operations 2026-04-10 17:04:46 -05:00
Tropical 05adecade7 refactor: replace pthreads in GLRenderer with std::thread 2026-04-10 17:02:24 -05:00
Tropical 69b749a844 windows stuff 2026-04-10 14:42:45 -07:00
Tropical 5c248704ac stub Hasher and remove OpenSSL dependency, add zlib wrap 2026-04-10 14:10:53 -07:00
Tropical 027f87f653 feat(build): add openssl wrap 2026-04-10 13:56:41 -07:00
Tropical 6e0b3f163a feat(build): add glm wrap 2026-04-10 13:50:22 -07:00
Tropical 0160419756 refactor(gdraw): temporarily revert OpenGL extension loading via dlsym 2026-04-10 15:47:28 -05:00
Tropical 1628e08748 refactor: nuke gl query functions to remove libdl dependence in the renderer 2026-04-10 15:40:21 -05:00
Tropical 41437bb999 nuke glu dependency, setup sdl2 wrap 2026-04-10 15:22:41 -05:00
Tropical 64a44b5385 format it all 2026-04-10 11:46:33 -05:00
Tropical 2fc0095b86 fix non-unity build 2026-04-10 11:22:58 -05:00
Tropical 85a4e09e17 disable LTO for now, entity micro-optimizations 2026-04-10 09:55:57 -05:00
Tropical abeead819e rework build system dependencies 2026-04-10 02:49:30 -05:00
Tropical 347265c362 chore: format repo, add format script 2026-04-10 00:22:58 -05:00
Tropical 50f6bf8e68 fix iggy includes 2026-04-09 23:52:00 -05:00
Tropical b7d200a5b1 move C4JThread and ShutdownManager to platform/thread 2026-04-09 23:46:02 -05:00
Tropical 69c418213e nuke util/Definitions.h 2026-04-09 23:39:33 -05:00
Tropical 8c6effdabf remove Windows64 app 2026-04-09 23:36:49 -05:00
Tropical daf56bc296 nuke old Miles SoundEngine, more ifdef removal 2026-04-09 23:30:51 -05:00
Tropical 8f04e231bd remove most other linux ifdefs 2026-04-09 23:23:53 -05:00
Tropical d181ed62f6 refactor: remove disconnect packet hack 2026-04-09 23:07:54 -05:00
Tropical cf94e7d162 remove linux-specific networking paths 2026-04-09 23:06:13 -05:00
Tropical e7dca2570a fix: remove platform ifdefs in DLCController 2026-04-09 23:03:16 -05:00
Tropical d862d05616 refactor: restore OldChunkStorage file names using custom base36 conversion 2026-04-09 22:59:19 -05:00
Tropical c4bbf6cf1f remove a bunch of linux ifdefs 2026-04-09 22:57:31 -05:00
Tropical 9e74005af7 switch back to MediaWindows64 for media assets 2026-04-09 22:47:00 -05:00
Tropical 5d28fc9fd5 remove unused StringHelpers 2026-04-09 22:45:58 -05:00
Tropical fbac609df2 rename Linux_Minecraft.cpp to main.cpp 2026-04-09 22:45:51 -05:00
Tropical 224fd9dacc remove remaining Linux implementations for common ones 2026-04-09 22:42:17 -05:00
Tropical 19f73c2754 remove LinuxGame for just Game 2026-04-09 22:32:22 -05:00
Tropical bc494aa979 clean up NetTypes and move to platform/network 2026-04-09 22:18:11 -05:00
Tropical b20b8cb311 properly implement network interface stub 2026-04-09 22:07:16 -05:00
Tropical 8552634614 move SoundEngine back to app 2026-04-09 11:27:33 -05:00
Tropical d87dd6ae72 remove QNet stubs 2026-04-09 11:18:14 -05:00
Tropical a71b1036c7 remove LeaderboardInterface, LeaderboardManager, LinuxLeaderboardManager, for StubLeaderboard 2026-04-09 11:11:52 -05:00
Tropical d3a9de8b2a start work on swapping PlatformNetworkManagerStub for PlatformNetwork 2026-04-09 10:05:35 -05:00
Tropical 9c1c1695a7 remove outdated docs, move socket implementation to minecraft/ 2026-04-09 09:54:29 -05:00
MatthewBeshay 7513c37f52 refactor: extend ITutorial to cover MultiPlayerLocalPlayer event hooks 2026-04-09 22:38:11 +10:00
MatthewBeshay 650c81db3d refactor: relocate ConsoleSchematicFile into minecraft/world/level/levelgen 2026-04-09 22:35:33 +10:00
MatthewBeshay 684b55c260 refactor: relocate Socket header into minecraft/network 2026-04-09 22:31:09 +10:00
MatthewBeshay 41d139ce32 refactor: replace Tutorial::staticCtor with ITutorial::staticInit in Minecraft.cpp 2026-04-09 22:27:26 +10:00
MatthewBeshay 514c75bf01 chore: drop redundant Socket.h include from Connection.cpp 2026-04-09 22:21:49 +10:00
MatthewBeshay 557dd7430b refactor: extract ITutorial interface and move TutorialEnum to minecraft 2026-04-09 22:20:30 +10:00
MatthewBeshay 6fd9148e17 chore: drop redundant Socket.h includes from PlayerList and PlayerConnection 2026-04-09 22:06:25 +10:00
MatthewBeshay a1b9329ad8 refactor: move GAME_RULE_SAVENAME to ConsoleGameRulesConstants.h 2026-04-09 22:03:05 +10:00
MatthewBeshay 9b729ed19e refactor: drop GameNetworkManager.h transitive include from Socket.h 2026-04-09 21:57:30 +10:00
MatthewBeshay 0a5cf82d80 chore: drop unused extern LinuxGame app from FileHeader.cpp 2026-04-09 21:48:47 +10:00
MatthewBeshay e174fabcb6 chore: drop stale app/common/App_structs.h includes from minecraft consumers 2026-04-09 21:45:21 +10:00
MatthewBeshay 62186f8afb refactor: relocate ConsoleSoundEngine base into minecraft/sounds/ 2026-04-09 21:41:06 +10:00
MatthewBeshay 4d9db3ed3b refactor: hide DLC pack lookups behind TexturePack::needsPurchase and BufferedImage helper 2026-04-09 21:22:07 +10:00
MatthewBeshay 8b202ba5f1 refactor: extract ISkinAssetData so minecraft/ stops including DLCSkinFile.h 2026-04-09 21:11:41 +10:00
MatthewBeshay 80019158da fix: harden Log::info, switch StringTable to span, consolidate getLocale 2026-04-09 20:59:00 +10:00
MatthewBeshay 84140ae6d4 refactor: move StringTable impl into minecraft/locale and inject locales 2026-04-09 20:35:53 +10:00
MatthewBeshay aa250ff560 refactor: inject IPlatformLeaderboard into Minecraft and StatsCounter via constructor 2026-04-09 20:19:50 +10:00
MatthewBeshay 08d8e341b9 refactor: stop inheriting Game from IPlatformGame and delete the override stubs 2026-04-09 19:35:47 +10:00
MatthewBeshay 9c502ce8fc refactor: route IPlatformGame and Leaderboard call sites through platform/ 2026-04-09 19:28:57 +10:00
MatthewBeshay fbfccdeac6 chore: drop a few more dead app/ includes from minecraft 2026-04-09 15:49:31 +10:00
MatthewBeshay 5d86773134 refactor: relocate IPlatformNetwork/Leaderboard/Game interfaces to platform/ 2026-04-09 15:42:23 +10:00
MatthewBeshay e051527607 refactor: replace XuiActionPayload polling with server-owned typed action queue 2026-04-09 15:24:13 +10:00
MatthewBeshay 45c85fcf79 perf: stop heap-allocating mob restriction state and Path nodes
Inlines restrictCenter and leashRestrictionGoal as value members and
stores Path nodes by value, removing per-mob and per-path malloc churn.
2026-04-09 15:24:13 +10:00
MatthewBeshay fe77d9c2a0 build: optional mimalloc replacement for system malloc
Toggle with -Denable_mimalloc=enabled/disabled/auto.
2026-04-09 15:24:13 +10:00
MatthewBeshay b7792622a9 perf: replace EventArray mutex+cv with atomic mask
set() is now lock-free; waiters block via std::atomic::wait.
2026-04-09 15:24:13 +10:00
MatthewBeshay cd4b39cf88 style: clang-format the entire project 2026-04-09 15:24:13 +10:00
MatthewBeshay 81c2eb82f0 fix: clear all build warnings and clean up review nits 2026-04-09 15:24:13 +10:00
MatthewBeshay aa515c5f3d refactor: replace winapi_stubs with std::vector, std::atomic_ref and std::chrono 2026-04-09 15:24:13 +10:00
MatthewBeshay 1b9d27f4a0 refactor: hide miniaudio behind PIMPL in SoundEngine 2026-04-09 15:24:13 +10:00
MatthewBeshay 0ef3b2de31 refactor: pull DLC enums out into their own header 2026-04-09 15:24:13 +10:00
MatthewBeshay b3d6e7151b refactor: extract a network service interface for minecraft to depend on 2026-04-09 15:24:13 +10:00
MatthewBeshay 03618ed156 refactor: move leaderboard/network interfaces back into app 2026-04-09 15:24:13 +10:00
MatthewBeshay 33fe5fec3a chore: drop a few more dead LinuxGame.h includes 2026-04-09 15:24:13 +10:00
MatthewBeshay 61a0d9690b chore: drop a few more dead winapi_stubs.h includes 2026-04-09 15:24:13 +10:00
MatthewBeshay 09a6ba4a12 refactor: move Minecraft_Macros.h into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay e14825c302 refactor: move GameRule chain headers into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay efe4c91538 refactor: move BuildVer.h into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay a3b8adeb5a refactor: move Console_Debug_enum.h into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 58de5bb40b refactor: move ConsoleGameRulesConstants.h into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 1ddf12beb9 refactor: move WstringLookup into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay e5cdd2c370 refactor: move NetworkPlayerInterface and SessionInfo into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 9b830f1bfc refactor: carve out a proper sound interface with miniaudio behind it 2026-04-09 15:24:13 +10:00
MatthewBeshay b032e2a3a0 refactor: use function-local statics for platform accessors to dodge SIOF 2026-04-09 15:24:13 +10:00
MatthewBeshay 60410f59bf refactor: split GLRenderer so the class is not tangled with GL macros 2026-04-09 15:24:13 +10:00
MatthewBeshay 9834a95f0e build: break platform_sdl2 up into per-subsystem libraries 2026-04-09 15:24:13 +10:00
MatthewBeshay 7b28bcbcb6 refactor: move ColourTable into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 016b2d91b4 refactor: move StringTable.h into minecraft (impl stays for now) 2026-04-09 15:24:13 +10:00
MatthewBeshay 5f7e4ab703 refactor: move Console_Awards_enum.h into minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 95efdb54dd chore: drop dead winapi_stubs.h includes across minecraft 2026-04-09 15:24:13 +10:00
MatthewBeshay 6e1964adb3 chore: drop dead LinuxGame.h includes across minecraft 2026-04-09 15:24:12 +10:00
MatthewBeshay 52b4ccaea2 refactor: type the IGameServices payload as a variant instead of void* 2026-04-09 15:24:12 +10:00
MatthewBeshay 8084ec7857 chore: delete unused IPlatformUIController and Platform aggregator 2026-04-09 15:24:12 +10:00
MatthewBeshay 6b3b0134cf build: list sources explicitly in meson.build instead of shelling out 2026-04-09 15:24:12 +10:00
MatthewBeshay d7eca58551 refactor: split App_Defines.h up by concern and drop the umbrella 2026-04-09 15:24:12 +10:00
MatthewBeshay 875039a6dd refactor: use unique_ptr<byte[]> in ImageFileBuffer instead of malloc/free 2026-04-09 15:24:12 +10:00
MatthewBeshay 7cceb05d83 build: turn on LTO and tidy up release build flags 2026-04-09 15:24:12 +10:00
1052 changed files with 10269 additions and 26072 deletions
+66 -50
View File
@@ -1,16 +1,21 @@
# MARK: build configuration
project( project(
'4jcraft', '4jcraft',
['cpp', 'c'], ['cpp', 'c'],
version: '0.1.0', version: '0.1.0',
meson_version: '>= 1.3', meson_version: '>= 1.3',
default_options: [ default_options: [
'cpp_std=c++23', 'cpp_std=c++20',
'warning_level=0', 'warning_level=0',
'buildtype=debugoptimized', # for now 'unity=on', # merge source files per target
'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this
'unity_size=8', # TODO: mess around with this 'buildtype=debug',
'b_pch=true', # precompiled headers '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') pymod = import('python')
@@ -18,31 +23,33 @@ python = pymod.find_installation('python3', required: true)
cc = meson.get_compiler('cpp') cc = meson.get_compiler('cpp')
global_cpp_args = []
global_cpp_defs = [ global_cpp_defs = [
'-DSPLIT_SAVES', '-DSPLIT_SAVES',
'-D_LARGE_WORLDS', '-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS', '-D_EXTENDED_ACHIEVEMENTS',
'-D_DEBUG_MENUS_ENABLED', '-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h)
'-D_DEBUG',
'-D_FORTIFY_SOURCE=2',
'-DDEBUG',
] ]
if host_machine.system() == 'linux' # Debug-only defines: keep for debug + debugoptimized so iteration is unchanged.
global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__'] # --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 endif
if get_option('renderer') == 'gles' if get_option('buildtype') == 'debugoptimized'
global_cpp_defs += ['-DGLES'] global_cpp_defs += ['-D_FORTIFY_SOURCE=2']
gl_dep = dependency('glesv2', required: true)
glu_dep = dependency('', required: false)
else
gl_dep = dependency('gl', required: true)
glu_dep = dependency('glu', required: true)
endif endif
# MARK: meson options
if get_option('enable_vsync') if get_option('enable_vsync')
global_cpp_defs += ['-DENABLE_VSYNC'] global_cpp_defs += ['-DENABLE_VSYNC']
endif endif
if get_option('classic_panorama') if get_option('classic_panorama')
@@ -50,43 +57,52 @@ if get_option('classic_panorama')
endif endif
if get_option('enable_frame_profiler') if get_option('enable_frame_profiler')
global_cpp_defs += ['-DENABLE_FRAME_PROFILER'] global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
endif endif
if get_option('ui_backend') == 'shiggy' if get_option('ui_backend') == 'shiggy'
global_cpp_defs += ['-D_ENABLEIGGY'] global_cpp_defs += ['-D_ENABLEIGGY']
endif endif
if get_option('ui_backend') == 'java' 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 endif
add_project_arguments(global_cpp_defs, language: ['cpp', 'c']) add_project_arguments(global_cpp_defs, language: ['cpp', 'c'])
global_cpp_args = [
'-Wshift-count-overflow',
'-pipe',
]
add_project_arguments(global_cpp_args, language: 'cpp') 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/util')
subdir('targets/java') subdir('targets/java')
subdir('targets/nbt') subdir('targets/nbt')
subdir('targets/platform') 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/resources')
subdir('targets/minecraft') subdir('targets/minecraft')
subdir('targets/app') subdir('targets/app')
+7
View File
@@ -40,3 +40,10 @@ option(
value: 'frustum', 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.', description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
) )
option(
'enable_mimalloc',
type: 'feature',
value: 'auto',
description: 'Link mimalloc as the malloc implementation. Requires libmimalloc-dev.',
)
+183
View File
@@ -0,0 +1,183 @@
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
DEFAULT_EXTENSIONS = {
".c",
".cc",
".cpp",
".cxx",
".h",
".hh",
".hpp",
".hxx",
".inl",
".ipp",
}
DEFAULT_JOBS = os.cpu_count() or 4
DEFAULT_TIMEOUT = 10
# ansi escapes
RESET = "\033[0m" if sys.stdout.isatty() else ""
GREEN = "\033[32m" if sys.stdout.isatty() else ""
YELLOW = "\033[33m" if sys.stdout.isatty() else ""
RED = "\033[31m" if sys.stdout.isatty() else ""
BOLD = "\033[1m" if sys.stdout.isatty() else ""
def format_file(path, clang_format, extra_args, timeout):
cmd = [clang_format, "-i"]
cmd += extra_args
cmd.append(str(path))
try:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
timeout=timeout,
)
if result.returncode != 0:
msg = (result.stderr or result.stdout or "non-zero exit code").strip()
return ("error", str(path), msg)
return ("ok", str(path), None)
except subprocess.TimeoutExpired:
return ("timeout", str(path), f"exceeded {timeout}s timeout")
except FileNotFoundError:
return ("error", str(path), f"'{clang_format}' not found — is it installed?")
except Exception as exc:
return ("error", str(path), str(exc))
def find_files(root, extensions, exclude_dirs):
found = []
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = [d for d in dirnames if d not in exclude_dirs]
for fname in filenames:
if Path(fname).suffix.lower() in extensions:
found.append(Path(dirpath) / fname)
return sorted(found)
def main():
p = argparse.ArgumentParser(
description="Recursively runs clang-format on C/C++ files.",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
p.add_argument("directory", nargs="?", default=".", type=Path)
p.add_argument(
"--clang-format",
default="clang-format",
metavar="BIN",
help="Path to the clang-format executable. (default: clang-format)",
)
p.add_argument(
"-j",
"--jobs",
type=int,
default=DEFAULT_JOBS,
metavar="N",
help=f"Number of parallel workers. (default: {DEFAULT_JOBS})",
)
p.add_argument(
"--timeout",
type=int,
default=DEFAULT_TIMEOUT,
metavar="SECS",
help=f"Per-file timeout in seconds. (default: {DEFAULT_TIMEOUT})",
)
p.add_argument(
"--extensions",
nargs="+",
metavar="EXT",
help="File extensions to process (including the dot)."
f"(default: {' '.join(sorted(DEFAULT_EXTENSIONS))})",
)
p.add_argument(
"--exclude",
nargs="*",
default=[],
metavar="DIR",
help="Directory names to skip during traversal (e.g. build third_party).",
)
p.add_argument(
"--clang-format-args",
nargs=argparse.REMAINDER,
default=[],
metavar="...",
)
args = p.parse_args()
root = args.directory.resolve()
if not root.is_dir():
print(f"{RED}Error:{RESET} '{root}' is not a directory.", file=sys.stderr)
return 1
extensions = (
{e if e.startswith(".") else f".{e}" for e in args.extensions}
if args.extensions
else DEFAULT_EXTENSIONS
)
exclude_dirs = set(args.exclude)
files = find_files(root, extensions, exclude_dirs)
if not files:
print(f"{YELLOW}No source files found.{RESET}")
return 0
total = len(files)
print(f"Found {BOLD}{total}{RESET} file(s).")
counters = {"ok": 0, "timeout": 0, "error": 0}
completed = 0
with ThreadPoolExecutor(max_workers=args.jobs) as pool:
futures = {
pool.submit(
format_file,
f,
args.clang_format,
args.clang_format_args,
args.timeout,
): f
for f in files
}
for future in as_completed(futures):
status, path_str, error = future.result()
counters[status] += 1
completed += 1
rel = os.path.relpath(path_str, root)
if status == "ok":
tag = f"{GREEN}[ OK ]{RESET}"
elif status == "timeout":
tag = f"{YELLOW}[ TIMEOUT ]{RESET}"
else:
tag = f"{RED}[ ERROR ]{RESET}"
progress = f"[{completed:>{len(str(total))}}/{total}]"
line = f"{progress} {tag} {rel}"
if error:
line += f"\n {RED}{error}{RESET}"
print(line)
print()
print(f"{BOLD}Summary{RESET}")
print(f"Total: {total}")
print(f"{GREEN}OK: {counters['ok']}{RESET}")
if counters["timeout"]:
print(f"{YELLOW}Timeout: {counters['timeout']}{RESET}")
if counters["error"]:
print(f"{RED}Error: {counters['error']}{RESET}")
return 1 if (counters["timeout"] or counters["error"]) else 0
if __name__ == "__main__":
sys.exit(main())
+97
View File
@@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""Enumerate C/C++ source files for a meson target.
Replaces the run_command('sh', '-c', 'find ...') hack in
targets/{minecraft,app}/meson.build. Run this whenever source files are
added or removed and commit the regenerated *_sources.txt files.
Usage:
python3 scripts/list_sources.py
Each module's sources.txt is generated relative to its meson source dir.
"""
import os
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
# Module configuration: (output_path, scan_root, [exclude_basenames]).
# Paths in the output file are relative to the directory containing the
# meson.build that reads it.
MODULES = [
{
"name": "minecraft",
"output": REPO_ROOT / "targets" / "minecraft" / "sources.txt",
"scan_root": REPO_ROOT / "targets" / "minecraft",
"rel_to": REPO_ROOT / "targets" / "minecraft",
"exclude": {
"DurangoStats.cpp", # Durango-specific
# Incomplete / unused
"SkyIslandDimension.cpp",
"MemoryChunkStorage.cpp",
"MemoryLevelStorage.cpp",
"MemoryLevelStorageSource.cpp",
"NbtSlotFile.cpp",
"ZonedChunkStorage.cpp",
"ZoneFile.cpp",
"ZoneIo.cpp",
"LevelConflictException.cpp",
"SurvivalMode.cpp",
"CreativeMode.cpp",
"GameMode.cpp",
"DemoMode.cpp",
},
},
{
"name": "app_common",
"output": REPO_ROOT / "targets" / "app" / "common_sources.txt",
"scan_root": REPO_ROOT / "targets" / "app" / "common",
"rel_to": REPO_ROOT / "targets" / "app",
"exclude": {
"UIScene_InGameSaveManagementMenu.cpp",
},
},
{
"name": "app_linux",
"output": REPO_ROOT / "targets" / "app" / "linux_sources.txt",
"scan_root": REPO_ROOT / "targets" / "app" / "linux",
"rel_to": REPO_ROOT / "targets" / "app",
"exclude": set(),
},
]
EXTENSIONS = (".cpp", ".c")
def collect(scan_root: Path, rel_to: Path, exclude: set[str]) -> list[str]:
out: list[str] = []
for dirpath, _dirnames, filenames in os.walk(scan_root):
for name in filenames:
if not name.endswith(EXTENSIONS):
continue
if name in exclude:
continue
full = Path(dirpath) / name
out.append(str(full.relative_to(rel_to)))
out.sort()
return out
def main() -> int:
for mod in MODULES:
sources = collect(mod["scan_root"], mod["rel_to"], mod["exclude"])
body = "\n".join(sources) + "\n"
out_path: Path = mod["output"]
previous = out_path.read_text() if out_path.exists() else ""
if previous == body:
print(f"{mod['name']}: {len(sources)} files (unchanged)")
else:
out_path.write_text(body)
print(f"{mod['name']}: {len(sources)} files (regenerated {out_path.relative_to(REPO_ROOT)})")
return 0
if __name__ == "__main__":
sys.exit(main())
-4
View File
@@ -3,7 +3,3 @@ c = 'clang'
cpp = 'clang++' cpp = 'clang++'
c_ld = 'lld' c_ld = 'lld'
cpp_ld = 'lld' cpp_ld = 'lld'
[built-in options]
cpp_args = ['-stdlib=libc++']
cpp_link_args = ['-stdlib=libc++']
+12
View File
@@ -0,0 +1,12 @@
[wrap-file]
directory = glew-2.2.0
source_url = http://downloads.sourceforge.net/glew/glew-2.2.0.tgz
source_filename = glew-2.2.0.tgz
source_hash = d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1
patch_filename = glew_2.2.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/glew_2.2.0-2/get_patch
patch_hash = df7bc80456da53f83e93e89ca5035d04cdff19a836c956887a684b2bee16eb9b
wrapdb_version = 2.2.0-2
[provide]
glew = glew_dep
+13
View File
@@ -0,0 +1,13 @@
[wrap-file]
directory = glm-1.0.1
source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz
source_filename = glm-1.0.1.tar.gz
source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c
patch_filename = glm_1.0.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch
patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz
wrapdb_version = 1.0.1-1
[provide]
glm = glm_dep
+1 -1
View File
@@ -1,6 +1,6 @@
project('simdutf', project('simdutf',
'cpp', 'cpp',
default_options: ['cpp_std=c++23'], default_options: ['cpp_std=c++20'],
version: '8.2.0', version: '8.2.0',
meson_version: '>= 1.1', meson_version: '>= 1.1',
license: ['MIT'], license: ['MIT'],
+5 -1
View File
@@ -1,3 +1,7 @@
project('stb', 'c') project('stb', 'c')
stb_inc = include_directories('.') stb_dep = declare_dependency(
include_directories: include_directories('.'),
)
meson.override_dependency('stb', stb_dep)
+15
View File
@@ -0,0 +1,15 @@
[wrap-file]
directory = SDL2-2.32.8
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-2.32.8.tar.gz
source_filename = SDL2-2.32.8.tar.gz
source_hash = 0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e
patch_filename = sdl2_2.32.8-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.32.8-1/get_patch
patch_hash = 5df17ea39ca418826db20e96bd821fa52b5718dac64b6225119fb6588c2744f0
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.32.8-1/SDL2-2.32.8.tar.gz
wrapdb_version = 2.32.8-1
[provide]
sdl2 = sdl2_dep
sdl2main = sdl2main_dep
sdl2_test = sdl2_test_dep
+1 -1
View File
@@ -1,7 +1,7 @@
[wrap-git] [wrap-git]
url = https://github.com/simdutf/simdutf.git url = https://github.com/simdutf/simdutf.git
depth = 1 depth = 1
revision = v8.2.0 revision = fd476229424b40ae71a58dd5a205795c3d76b5f1
patch_directory = simdutf patch_directory = simdutf
[provide] [provide]
+14
View File
@@ -0,0 +1,14 @@
[wrap-file]
directory = zlib-1.3.2
source_url = https://zlib.net/zlib-1.3.2.tar.xz
source_fallback_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_source/zlib-1.3.2.tar.xz
source_filename = zlib-1.3.2.tar.xz
source_hash = d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3
patch_filename = zlib_1.3.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_patch
patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.2-1/zlib_1.3.2-1_patch.zip
patch_hash = 5ae7a2e92f823df118cfb8c1b23d94e3117864392b3446581d669049b2fba6dd
wrapdb_version = 1.3.2-1
[provide]
dependency_names = zlib
@@ -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`
-27
View File
@@ -1,27 +0,0 @@
========================================================================
Xbox 360 APPLICATION : Minecraft.Client Project Overview
========================================================================
AppWizard has created this Minecraft.Client application for you.
This file contains a summary of what you will find in each of the files that
make up your Minecraft.Client application.
Minecraft.Client.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
Minecraft.Client.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
+47 -72
View File
@@ -1,26 +1,22 @@
#include "app/common/AppGameServices.h" #include "app/common/AppGameServices.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h" #include "app/common/Game.h"
#include "java/Class.h" // eINSTANCEOF #include "java/Class.h" // eINSTANCEOF
#include "platform/game/game.h"
AppGameServices::AppGameServices(Game& game, IMenuService& menus) AppGameServices::AppGameServices(Game& game, IMenuService& menus)
: game_(game), menus_(menus) {} : game_(game), menus_(menus) {}
// -- Strings -- // -- Strings --
const char* AppGameServices::getString(int id) { const char* AppGameServices::getString(int id) { return Game::GetString(id); }
return Game::GetString(id);
}
// -- Debug settings -- // -- Debug settings --
bool AppGameServices::debugSettingsOn() { bool AppGameServices::debugSettingsOn() { return game_.DebugSettingsOn(); }
return game_.DebugSettingsOn();
}
bool AppGameServices::debugArtToolsOn() { bool AppGameServices::debugArtToolsOn() { return game_.DebugArtToolsOn(); }
return game_.DebugArtToolsOn();
}
unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) { unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) {
return game_.GetGameSettingsDebugMask(iPad, overridePlayer); return game_.GetGameSettingsDebugMask(iPad, overridePlayer);
@@ -34,9 +30,7 @@ bool AppGameServices::debugMobsDontTick() {
return game_.GetMobsDontTickEnabled(); return game_.GetMobsDontTickEnabled();
} }
bool AppGameServices::debugFreezePlayers() { bool AppGameServices::debugFreezePlayers() { return game_.GetFreezePlayers(); }
return game_.GetFreezePlayers();
}
// -- Game host options -- // -- Game host options --
@@ -93,9 +87,7 @@ unsigned char AppGameServices::getGameSettings(int setting) {
// -- App time -- // -- App time --
float AppGameServices::getAppTime() { float AppGameServices::getAppTime() { return game_.getAppTime(); }
return game_.getAppTime();
}
// -- Game state -- // -- Game state --
@@ -104,10 +96,14 @@ void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); }
bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); } bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); }
void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); } void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); }
bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); } bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); }
int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); } int AppGameServices::getLocalPlayerCount() {
return game_.GetLocalPlayerCount();
}
bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); } bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); }
void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); } void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); }
int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); } int64_t AppGameServices::secondsToAutosave() {
return game_.SecondsToAutosave();
}
void AppGameServices::setDisconnectReason( void AppGameServices::setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) { DisconnectPacket::eDisconnectReason reason) {
@@ -115,9 +111,13 @@ void AppGameServices::setDisconnectReason(
} }
void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); } void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); }
void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); } void AppGameServices::unlockSaveNotification() {
game_.unlockSaveNotification();
}
bool AppGameServices::getResetNether() { return game_.GetResetNether(); } bool AppGameServices::getResetNether() { return game_.GetResetNether(); }
bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); } bool AppGameServices::getUseDPadForDebug() {
return game_.GetUseDPadForDebug();
}
bool AppGameServices::getWriteSavesToFolderEnabled() { bool AppGameServices::getWriteSavesToFolderEnabled() {
return game_.GetWriteSavesToFolderEnabled(); return game_.GetWriteSavesToFolderEnabled();
@@ -127,9 +127,7 @@ bool AppGameServices::isLocalMultiplayerAvailable() {
return game_.IsLocalMultiplayerAvailable(); return game_.IsLocalMultiplayerAvailable();
} }
bool AppGameServices::dlcInstallPending() { bool AppGameServices::dlcInstallPending() { return game_.DLCInstallPending(); }
return game_.DLCInstallPending();
}
bool AppGameServices::dlcInstallProcessCompleted() { bool AppGameServices::dlcInstallProcessCompleted() {
return game_.DLCInstallProcessCompleted(); return game_.DLCInstallProcessCompleted();
@@ -177,30 +175,15 @@ void AppGameServices::setAction(int iPad, eXuiAction action, void* param) {
game_.SetAction(iPad, action, 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) { eXuiAction AppGameServices::getXuiAction(int iPad) {
return game_.GetXuiAction(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) { void AppGameServices::setGlobalXuiAction(eXuiAction action) {
game_.SetGlobalXuiAction(action); game_.SetGlobalXuiAction(action);
} }
void AppGameServices::handleButtonPresses() { void AppGameServices::handleButtonPresses() { game_.HandleButtonPresses(); }
game_.HandleButtonPresses();
}
void AppGameServices::setTMSAction(int iPad, eTMSAction action) { void AppGameServices::setTMSAction(int iPad, eTMSAction action) {
game_.SetTMSAction(iPad, action); game_.SetTMSAction(iPad, action);
@@ -254,8 +237,7 @@ void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID,
game_.SetAnimOverrideBitmask(dwSkinID, bitmask); game_.SetAnimOverrideBitmask(dwSkinID, bitmask);
} }
unsigned int AppGameServices::getAnimOverrideBitmask( unsigned int AppGameServices::getAnimOverrideBitmask(std::uint32_t dwSkinID) {
std::uint32_t dwSkinID) {
return game_.GetAnimOverrideBitmask(dwSkinID); return game_.GetAnimOverrideBitmask(dwSkinID);
} }
@@ -267,9 +249,7 @@ std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) {
return Game::getSkinPathFromId(skinId); return Game::getSkinPathFromId(skinId);
} }
bool AppGameServices::defaultCapeExists() { bool AppGameServices::defaultCapeExists() { return game_.DefaultCapeExists(); }
return game_.DefaultCapeExists();
}
bool AppGameServices::isXuidNotch(PlayerUID xuid) { bool AppGameServices::isXuidNotch(PlayerUID xuid) {
return game_.isXuidNotch(xuid); return game_.isXuidNotch(xuid);
@@ -284,19 +264,21 @@ bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) {
void AppGameServices::fatalLoadError() { game_.FatalLoadError(); } void AppGameServices::fatalLoadError() { game_.FatalLoadError(); }
void AppGameServices::setRichPresenceContext(int iPad, int contextId) { 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, void AppGameServices::getSaveThumbnail(std::uint8_t** data,
unsigned int* size) { unsigned int* size) {
game_.GetSaveThumbnail(data, size); PlatformGame.GetSaveThumbnail(data, size);
} }
void AppGameServices::readBannedList(int iPad, eTMSAction action, void AppGameServices::readBannedList(int iPad, eTMSAction action,
bool bCallback) { bool bCallback) {
game_.ReadBannedList(iPad, action, bCallback); PlatformGame.ReadBannedList(iPad, action, bCallback);
} }
void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId, void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
@@ -305,8 +287,7 @@ void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges); game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
} }
unsigned int AppGameServices::getPlayerPrivileges( unsigned int AppGameServices::getPlayerPrivileges(std::uint8_t networkSmallId) {
std::uint8_t networkSmallId) {
return game_.GetPlayerPrivileges(networkSmallId); return game_.GetPlayerPrivileges(networkSmallId);
} }
@@ -334,9 +315,7 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type,
return game_.GetTerrainFeaturePosition(type, pX, pZ); return game_.GetTerrainFeaturePosition(type, pX, pZ);
} }
void AppGameServices::loadDefaultGameRules() { void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); }
game_.loadDefaultGameRules();
}
// -- Archive / resources -- // -- Archive / resources --
@@ -363,24 +342,21 @@ const char* AppGameServices::getGameRulesString(const std::string& key) {
return game_.GetGameRulesString(key); return game_.GetGameRulesString(key);
} }
unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata, unsigned int AppGameServices::createImageTextData(
int64_t seed, bool hasSeed, std::uint8_t* textMetadata, int64_t seed, bool hasSeed,
unsigned int uiHostOptions, unsigned int uiHostOptions, unsigned int uiTexturePackId) {
unsigned int uiTexturePackId) { return game_.CreateImageTextData(textMetadata, seed, hasSeed, uiHostOptions,
return game_.CreateImageTextData(textMetadata, seed, hasSeed, uiTexturePackId);
uiHostOptions, uiTexturePackId);
} }
std::string AppGameServices::getFilePath(std::uint32_t packId, std::string AppGameServices::getFilePath(std::uint32_t packId,
std::string filename, std::string filename,
bool bAddDataFolder, bool bAddDataFolder,
std::string mountPoint) { std::string mountPoint) {
return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint); return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint);
} }
char* AppGameServices::getUniqueMapName() { char* AppGameServices::getUniqueMapName() { return game_.GetUniqueMapName(); }
return game_.GetUniqueMapName();
}
void AppGameServices::setUniqueMapName(char* name) { void AppGameServices::setUniqueMapName(char* name) {
game_.SetUniqueMapName(name); game_.SetUniqueMapName(name);
@@ -390,9 +366,7 @@ unsigned int AppGameServices::getOpacityTimer(int iPad) {
return game_.GetOpacityTimer(iPad); return game_.GetOpacityTimer(iPad);
} }
void AppGameServices::setOpacityTimer(int iPad) { void AppGameServices::setOpacityTimer(int iPad) { game_.SetOpacityTimer(iPad); }
game_.SetOpacityTimer(iPad);
}
void AppGameServices::tickOpacityTimer(int iPad) { void AppGameServices::tickOpacityTimer(int iPad) {
game_.TickOpacityTimer(iPad); game_.TickOpacityTimer(iPad);
@@ -413,7 +387,7 @@ void AppGameServices::debugPrintf(const char* msg) {
// -- DLC -- // -- DLC --
DLCSkinFile* AppGameServices::getDLCSkinFile(const std::string& name) { ISkinAssetData* AppGameServices::getSkinAssetData(const std::string& name) {
return game_.m_dlcManager.getSkinFile(name); return game_.m_dlcManager.getSkinFile(name);
} }
bool AppGameServices::dlcNeedsCorruptCheck() { bool AppGameServices::dlcNeedsCorruptCheck() {
@@ -423,8 +397,8 @@ unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) {
return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage); return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage);
} }
bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed, bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed,
const std::string& path, const std::string& path, DLCPack* pack,
DLCPack* pack, bool fromArchive) { bool fromArchive) {
return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack, return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack,
fromArchive); fromArchive);
} }
@@ -435,7 +409,7 @@ void AppGameServices::dlcRemovePack(DLCPack* pack) {
// -- Game rules -- // -- Game rules --
LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data, LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data,
unsigned int size) { unsigned int size) {
return game_.m_gameRules.loadGameRules(data, size); return game_.m_gameRules.loadGameRules(data, size);
} }
void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* 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() { void AppGameServices::unloadCurrentGameRules() {
game_.m_gameRules.unloadCurrentGameRules(); game_.m_gameRules.unloadCurrentGameRules();
} }
void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { void AppGameServices::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
game_.m_gameRules.setLevelGenerationOptions(levelGen); game_.m_gameRules.setLevelGenerationOptions(levelGen);
} }
+11 -18
View File
@@ -4,6 +4,7 @@
class Game; class Game;
class IMenuService; class IMenuService;
class ISkinAssetData;
class AppGameServices : public IGameServices { class AppGameServices : public IGameServices {
public: public:
@@ -22,8 +23,7 @@ public:
// -- Game host options -- // -- Game host options --
unsigned int getGameHostOption(eGameHostOption option) override; unsigned int getGameHostOption(eGameHostOption option) override;
void setGameHostOption(eGameHostOption option, void setGameHostOption(eGameHostOption option, unsigned int value) override;
unsigned int value) override;
// -- Level generation -- // -- Level generation --
LevelGenerationOptions* getLevelGenerationOptions() override; LevelGenerationOptions* getLevelGenerationOptions() override;
@@ -76,11 +76,7 @@ public:
// -- UI dispatch -- // -- UI dispatch --
void setAction(int iPad, eXuiAction action, void* param) override; void setAction(int iPad, eXuiAction action, void* param) override;
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param) override;
eXuiAction getXuiAction(int iPad) override; eXuiAction getXuiAction(int iPad) override;
eXuiServerAction getXuiServerAction(int iPad) override;
void* getXuiServerActionParam(int iPad) override;
void setGlobalXuiAction(eXuiAction action) override; void setGlobalXuiAction(eXuiAction action) override;
void handleButtonPresses() override; void handleButtonPresses() override;
void setTMSAction(int iPad, eTMSAction action) override; void setTMSAction(int iPad, eTMSAction action) override;
@@ -113,8 +109,7 @@ public:
void setRichPresenceContext(int iPad, int contextId) override; void setRichPresenceContext(int iPad, int contextId) override;
void captureSaveThumbnail() override; void captureSaveThumbnail() override;
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override; void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override;
void readBannedList(int iPad, eTMSAction action, void readBannedList(int iPad, eTMSAction action, bool bCallback) override;
bool bCallback) override;
void updatePlayerInfo(std::uint8_t networkSmallId, void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex, int16_t playerColourIndex,
unsigned int playerPrivileges) override; unsigned int playerPrivileges) override;
@@ -139,13 +134,12 @@ public:
int getHTMLColour(eMinecraftColour colour) override; int getHTMLColour(eMinecraftColour colour) override;
std::string getEntityName(EntityTypeId type) override; std::string getEntityName(EntityTypeId type) override;
const char* getGameRulesString(const std::string& key) override; const char* getGameRulesString(const std::string& key) override;
unsigned int createImageTextData(std::uint8_t* textMetadata, unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed,
int64_t seed, bool hasSeed, bool hasSeed, unsigned int uiHostOptions,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) override; unsigned int uiTexturePackId) override;
std::string getFilePath(std::uint32_t packId, std::string filename, std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder, bool bAddDataFolder,
std::string mountPoint) override; std::string mountPoint) override;
char* getUniqueMapName() override; char* getUniqueMapName() override;
void setUniqueMapName(char* name) override; void setUniqueMapName(char* name) override;
unsigned int getOpacityTimer(int iPad) override; unsigned int getOpacityTimer(int iPad) override;
@@ -157,17 +151,16 @@ public:
void debugPrintf(const char* msg) override; void debugPrintf(const char* msg) override;
// -- DLC -- // -- DLC --
DLCSkinFile* getDLCSkinFile(const std::string& name) override; ISkinAssetData* getSkinAssetData(const std::string& name) override;
bool dlcNeedsCorruptCheck() override; bool dlcNeedsCorruptCheck() override;
unsigned int dlcCheckForCorrupt(bool showMessage) override; unsigned int dlcCheckForCorrupt(bool showMessage) override;
bool dlcReadDataFile(unsigned int& filesProcessed, bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path,
const std::string& path, DLCPack* pack, DLCPack* pack, bool fromArchive) override;
bool fromArchive) override;
void dlcRemovePack(DLCPack* pack) override; void dlcRemovePack(DLCPack* pack) override;
// -- Game rules -- // -- Game rules --
LevelGenerationOptions* loadGameRules(std::uint8_t* data, 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 saveGameRules(std::uint8_t** data, unsigned int* size) override;
void unloadCurrentGameRules() override; void unloadCurrentGameRules() override;
void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override; void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override;
-135
View File
@@ -1,135 +0,0 @@
#pragma once
// 4J Stu - For non-splitscreen menus, default to this screen
#define DEFAULT_XUI_MENU_USER 0
#define MULTITHREAD_ENABLE
#define MAX_CAPENAME_SIZE 32
#define MAX_BANNERNAME_SIZE 32
#define MAX_TMSFILENAME_SIZE 40
#define MAX_TYPE_SIZE 32
#define MAX_EXTENSION_TYPES 3
#define MAX_LOCAL_PLAYERS 4
// 4J Stu - Required for sentient reporting of whether the volume level has been
// changed or not
#define DEFAULT_VOLUME_LEVEL 100
#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3
#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004
#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008
#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030
#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040
#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080
#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100
#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200
#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400
#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800
#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000
#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000
#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000
#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000
#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000
#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000
#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000
#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE \
0x00700000 // 3 bits, 5 values (unset(0), classic(1), small(2), medium(3),
// large(4))
#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000
#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000
#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000
#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000
#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000
#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000
#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000
#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20
enum EGameHostOptionWorldSize {
e_worldSize_Unknown = 0,
e_worldSize_Classic,
e_worldSize_Small,
e_worldSize_Medium,
e_worldSize_Large
};
#define PROFILE_VERSION_8 10
#define PROFILE_VERSION_9 11
#define PROFILE_VERSION_10 12
// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms.
#define PROFILE_VERSION_11 13
// Java 1.6.4
#define PROFILE_VERSION_12 14
#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12
#define MAX_FAVORITE_SKINS \
10 // these are stored in the profile data so keep it small
// defines for game settings - uiBitmaskValues
#define GAMESETTING_CLOUDS 0x00000001
#define GAMESETTING_ONLINE 0x00000002
#define GAMESETTING_INVITEONLY 0x00000004
#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008
#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030
#define GAMESETTING_BEDROCKFOG 0x00000040
#define GAMESETTING_DISPLAYHUD 0x00000080
#define GAMESETTING_DISPLAYHAND 0x00000100
#define GAMESETTING_CUSTOMSKINANIM 0x00000200
#define GAMESETTING_DEATHMESSAGES 0x00000400
#define GAMESETTING_UISIZE 0x00001800
#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000
#define GAMESETTING_ANIMATEDCHARACTER 0x00008000
#define GAMESETTING_PS3EULAREAD 0x00010000
#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000
// defines for languages
#define MINECRAFT_LANGUAGE_DEFAULT 0x00
#define MINECRAFT_LANGUAGE_ENGLISH 0x01
#define MINECRAFT_LANGUAGE_JAPANESE 0x02
#define MINECRAFT_LANGUAGE_GERMAN 0x03
#define MINECRAFT_LANGUAGE_FRENCH 0x04
#define MINECRAFT_LANGUAGE_SPANISH 0x05
#define MINECRAFT_LANGUAGE_ITALIAN 0x06
#define MINECRAFT_LANGUAGE_KOREAN 0x07
#define MINECRAFT_LANGUAGE_TCHINESE 0x08
#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09
#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A
#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B
#define MINECRAFT_LANGUAGE_DUTCH 0x0C
#define MINECRAFT_LANGUAGE_FINISH 0x0D
#define MINECRAFT_LANGUAGE_SWEDISH 0x0E
#define MINECRAFT_LANGUAGE_DANISH 0x0F
#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10
#define MINECRAFT_LANGUAGE_POLISH 0x11
#define MINECRAFT_LANGUAGE_TURKISH 0x12
#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13
#define MINECRAFT_LANGUAGE_GREEK 0x14
/* Match these
const int XC_LANGUAGE_ENGLISH =1; const int XC_LANGUAGE_JAPANESE
=2; const int XC_LANGUAGE_GERMAN
=3; const int XC_LANGUAGE_FRENCH
=4; const int XC_LANGUAGE_SPANISH
=5; const int XC_LANGUAGE_ITALIAN
=6; const int XC_LANGUAGE_KOREAN
=7; const int XC_LANGUAGE_TCHINESE
=8; const int XC_LANGUAGE_PORTUGUESE =9; const int XC_LANGUAGE_BRAZILIAN
=10; const int XC_LANGUAGE_RUSSIAN
=11; const int XC_LANGUAGE_DUTCH
=12; const int XC_LANGUAGE_FINISH
=13; const int XC_LANGUAGE_SWEDISH
=14; const int XC_LANGUAGE_DANISH
=15; const int XC_LANGUAGE_NORWEGIAN =16; const int XC_LANGUAGE_POLISH
=17; const int XC_LANGUAGE_TURKISH
=18; const int XC_LANGUAGE_LATINAMERICANSPANISH =19;
const int XC_LANGUAGE_GREEK =20;
*/
+5 -5
View File
@@ -2,15 +2,15 @@
#include <cstdint> #include <cstdint>
#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h" #include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.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/client/model/SkinBox.h"
#include "minecraft/world/tutorial/TutorialEnum.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/network/NetTypes.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/storage/storage.h"
typedef struct { typedef struct {
char* wchFilename; char* wchFilename;
+2 -10
View File
@@ -3,14 +3,14 @@
#include <mutex> #include <mutex>
#include <string> #include <string>
#include "app/common/Game.h"
#include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/linux/LinuxGame.h"
#include "java/File.h" #include "java/File.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/fs/fs.h"
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/fs/fs.h"
ArchiveManager::ArchiveManager() ArchiveManager::ArchiveManager()
: m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {} : m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {}
@@ -18,14 +18,9 @@ ArchiveManager::ArchiveManager()
void ArchiveManager::loadMediaArchive() { void ArchiveManager::loadMediaArchive() {
std::string mediapath = ""; std::string mediapath = "";
#if _WINDOWS64
mediapath = "Common\\Media\\MediaWindows64.arc"; mediapath = "Common\\Media\\MediaWindows64.arc";
#elif __linux__
mediapath = "app/common/Media/MediaLinux.arc";
#endif
if (!mediapath.empty()) { if (!mediapath.empty()) {
#if defined(__linux__)
std::string exeDirW = PlatformFilesystem.getBasePath().string(); std::string exeDirW = PlatformFilesystem.getBasePath().string();
std::string candidate = exeDirW + File::pathSeparator + mediapath; std::string candidate = exeDirW + File::pathSeparator + mediapath;
if (File(candidate).exists()) { if (File(candidate).exists()) {
@@ -33,9 +28,6 @@ void ArchiveManager::loadMediaArchive() {
} else { } else {
m_mediaArchive = new ArchiveFile(File(mediapath)); m_mediaArchive = new ArchiveFile(File(mediapath));
} }
#else
m_mediaArchive = new ArchiveFile(File(mediapath));
#endif
} }
} }
@@ -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;
}
@@ -4,7 +4,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "minecraft/sounds/SoundTypes.h" #include "SoundTypes.h"
class File; class File;
@@ -21,6 +21,11 @@ typedef struct {
class Options; class Options;
class Mob; 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 { class ConsoleSoundEngine {
public: public:
ConsoleSoundEngine() ConsoleSoundEngine()
@@ -29,6 +34,8 @@ public:
m_bIsPlayingEndMusic(false), m_bIsPlayingEndMusic(false),
m_bIsPlayingNetherMusic(false) {} m_bIsPlayingNetherMusic(false) {}
virtual ~ConsoleSoundEngine() = default;
virtual void tick(std::shared_ptr<Mob>* players, float a) = 0; virtual void tick(std::shared_ptr<Mob>* players, float a) = 0;
virtual void destroy() = 0; virtual void destroy() = 0;
virtual void play(int iSound, float x, float y, float z, float volume, virtual void play(int iSound, float x, float y, float z, float volume,
@@ -1,24 +0,0 @@
#include "Consoles_SoundEngine.h"
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() {
return m_bIsPlayingStreamingCDMusic;
}
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() {
return m_bIsPlayingStreamingGameMusic;
}
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) {
m_bIsPlayingStreamingCDMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) {
m_bIsPlayingStreamingGameMusic = bVal;
}
bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; }
bool ConsoleSoundEngine::GetIsPlayingNetherMusic() {
return m_bIsPlayingNetherMusic;
}
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
m_bIsPlayingEndMusic = bVal;
}
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
m_bIsPlayingNetherMusic = bVal;
}
File diff suppressed because it is too large Load Diff
+21 -15
View File
@@ -4,13 +4,19 @@ class Options;
class C4JThread; class C4JThread;
class Random; class Random;
#include <memory>
#include <string> #include <string>
#include "app/common/App_Defines.h" #include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/Audio/Consoles_SoundEngine.h" #include "app/common/Audio/SoundTypes.h"
#include "app/linux/Iggy/include/rrCore.h" #include "app/common/Iggy/include/rrCore.h"
#include "minecraft/sounds/SoundTypes.h" #include "platform/PlatformTypes.h"
#include "miniaudio.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_MIN_DISTANCE = 1.0f;
constexpr float SFX_3D_MAX_DISTANCE = 16.0f; constexpr float SFX_3D_MAX_DISTANCE = 16.0f;
@@ -90,15 +96,15 @@ typedef struct {
char chName[64]; char chName[64];
#endif #endif
} AUDIO_INFO; } AUDIO_INFO;
struct MiniAudioSound {
ma_sound sound; // MiniAudioSound's definition lives in SoundEngine.cpp alongside the
AUDIO_INFO info; // miniaudio backend; consumers of this header don't need to see it.
bool active;
};
class SoundEngine : public ConsoleSoundEngine { class SoundEngine : public ConsoleSoundEngine {
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
public: public:
SoundEngine(); SoundEngine();
~SoundEngine();
virtual void destroy(); virtual void destroy();
#if defined(_DEBUG) #if defined(_DEBUG)
void GetSoundName(char* szSoundName, int iSound); void GetSoundName(char* szSoundName, int iSound);
@@ -136,15 +142,15 @@ private:
float getMasterMusicVolume(); float getMasterMusicVolume();
// platform specific functions // platform specific functions
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers; } int initAudioHardware(int iMinSpeakers) { return iMinSpeakers; }
#if defined(__linux__)
void updateMiniAudio(); void updateMiniAudio();
#endif
int GetRandomishTrack(int iStart, int iEnd); int GetRandomishTrack(int iStart, int iEnd);
ma_engine m_engine; // Miniaudio engine + music stream PIMPL'd into SoundEngineMiniAudio,
ma_engine_config m_engineConfig; // defined in SoundEngine.cpp. Owned via unique_ptr; the destructor
ma_sound m_musicStream; // is out-of-line so the unique_ptr instantiation can see the full
// type.
std::unique_ptr<SoundEngineMiniAudio> m_audio;
bool m_musicStreamActive; bool m_musicStreamActive;
static char m_szSoundPath[]; static char m_szSoundPath[];
+6 -6
View File
@@ -1,5 +1,5 @@
#include "Consoles_SoundEngine.h" #include "app/common/Audio/ConsoleSoundEngine.h"
#include "minecraft/sounds/SoundTypes.h" #include "app/common/Audio/SoundTypes.h"
const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT "mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
@@ -58,7 +58,7 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/cat/meow", // eSoundType_MOB_CAT_MEOW "mob/cat/meow", // eSoundType_MOB_CAT_MEOW
// 4J-PB - correct the name of the event for hitting ocelots // 4J-PB - correct the name of the event for hitting ocelots
"mob/cat/hitt", // eSoundType_MOB_CAT_HITT "mob/cat/hitt", // eSoundType_MOB_CAT_HITT
// "mob.irongolem.throw", // // "mob.irongolem.throw", //
// eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit", // eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit",
//// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death", //// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death",
//// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk", //// 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/horse/jump", // eSoundType_MOB_HORSE_JUMP,
"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <--- "mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <---
// missing // missing
"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <--- "mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <---
// missing // missing
"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <--- "mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <---
// missing // missing
"mob/slime/big", // eSoundType_MOB_SLIME_BIG, "mob/slime/big", // eSoundType_MOB_SLIME_BIG,
"mob/slime/small", // eSoundType_MOB_SLIME_SMALL, "mob/slime/small", // eSoundType_MOB_SLIME_SMALL,
+4 -7
View File
@@ -29,8 +29,8 @@ void BannedListManager::invalidate(int iPad) {
} }
} }
void BannedListManager::addLevel(int iPad, PlayerUID xuid, void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName,
char* pszLevelName, bool bWriteToTMS) { bool bWriteToTMS) {
// we will have retrieved the banned level list from TMS, so add this one to // we will have retrieved the banned level list from TMS, so add this one to
// it and write it back to TMS // it and write it back to TMS
@@ -64,8 +64,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid,
// update telemetry too // update telemetry too
} }
bool BannedListManager::isInList(int iPad, PlayerUID xuid, bool BannedListManager::isInList(int iPad, PlayerUID xuid, char* pszLevelName) {
char* pszLevelName) {
for (auto it = m_vBannedListA[iPad]->begin(); for (auto it = m_vBannedListA[iPad]->begin();
it != m_vBannedListA[iPad]->end(); ++it) { it != m_vBannedListA[iPad]->end(); ++it) {
PBANNEDLISTDATA pData = *it; PBANNEDLISTDATA pData = *it;
@@ -126,6 +125,4 @@ void BannedListManager::setUniqueMapName(char* pszUniqueMapName) {
memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); memcpy(m_pszUniqueMapName, pszUniqueMapName, 14);
} }
char* BannedListManager::getUniqueMapName() { char* BannedListManager::getUniqueMapName() { return m_pszUniqueMapName; }
return m_pszUniqueMapName;
}
+1 -6
View File
@@ -7,17 +7,12 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h" #include "app/common/Game.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h" #include "platform/renderer/renderer.h"
#include "platform/storage/storage.h" #include "platform/storage/storage.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
namespace { namespace {
constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2; constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h" #include "app/common/Game.h"
DLCCapeFile::DLCCapeFile(const std::string& path) DLCCapeFile::DLCCapeFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Cape, path) {} : DLCFile(DLCManager::e_DLCType_Cape, path) {}
@@ -1,10 +1,10 @@
#include "DLCColourTableFile.h" #include "DLCColourTableFile.h"
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCFile.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/Minecraft.h"
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/skins/TexturePackRepository.h"
+1 -1
View File
@@ -2,8 +2,8 @@
#include <sstream> #include <sstream>
#include "app/common/Minecraft_Macros.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "minecraft/Minecraft_Macros.h"
DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) { DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) {
m_type = type; m_type = type;
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "DLCFile.h" #include "DLCFile.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
class DLCGameRules : public DLCFile { class DLCGameRules : public DLCFile {
public: public:
@@ -4,8 +4,8 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCGameRules.h" #include "app/common/DLC/DLCGameRules.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
class StringTable; class StringTable;
+1 -1
View File
@@ -4,7 +4,7 @@
#include <string> #include <string>
#include "DLCGameRules.h" #include "DLCGameRules.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
class StringTable; class StringTable;
@@ -2,7 +2,8 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.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) DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) { : DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
@@ -11,5 +12,6 @@ DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
void DLCLocalisationFile::addData(std::uint8_t* pbData, void DLCLocalisationFile::addData(std::uint8_t* pbData,
std::uint32_t dataBytes) { std::uint32_t dataBytes) {
m_strings = new StringTable(pbData, dataBytes); m_strings = new StringTable(
std::span<const std::uint8_t>(pbData, dataBytes), app.getLocale());
} }
+19 -14
View File
@@ -13,20 +13,19 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "simdutf.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "DLCFile.h" #include "DLCFile.h"
#include "DLCPack.h" #include "DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h" #include "app/common/UI/ConsoleUIController.h"
#include "app/linux/Linux_UIController.h"
#include "platform/fs/fs.h"
#include "util/StringHelpers.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePackRepository.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 "strings.h"
#include "util/StringHelpers.h"
// 4jcraft, this is the size of wchar_t on disk // 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 // 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; std::string readPath = path;
#if defined(_WINDOWS64) #if defined(_WINDOWS64)
const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str()); const std::string mountedPath =
PlatformStorage.GetMountedPath(path.c_str());
if (!mountedPath.empty()) { if (!mountedPath.empty()) {
readPath = mountedPath; readPath = mountedPath;
} }
@@ -240,7 +240,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
if (pack == nullptr) { if (pack == nullptr) {
app.DebugPrintf( app.DebugPrintf(
"DLCManager: Attempting to find the index for a nullptr pack\n"); "DLCManager: Attempting to find the index for a nullptr pack\n");
//assert(0); // assert(0);
return foundIndex; return foundIndex;
} }
if (type != e_DLCType_All) { if (type != e_DLCType_All) {
@@ -401,10 +401,12 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
// for details, read in the function below // for details, read in the function below
#define DLC_PARAM_WSTR(buf, off) \ #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) \ #define DLC_DETAIL_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) DLC_WSTRING((buf) + (off) + \
offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile))
{ {
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping; std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte = 0; unsigned int uiCurrentByte = 0;
@@ -462,7 +464,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount); uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount);
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
} }
// ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); // ulCurrentByte+=ulParameterCount *
// sizeof(IPlatformStorage::DLC_FILE_PARAM);
unsigned int uiFileCount; unsigned int uiFileCount;
DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte); DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte);
@@ -477,7 +480,9 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); DLC_READ_DETAIL(&fileBuf, pbData, dwTemp);
} }
std::uint8_t* pbTemp = 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); DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiFileCount; i++) { for (unsigned int i = 0; i < uiFileCount; i++) {
+64 -37
View File
@@ -3,50 +3,77 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>
#include "minecraft/world/level/dlc/DLCConstants.h"
class DLCPack; class DLCPack;
class DLCSkinFile; class DLCSkinFile;
class DLCManager { class DLCManager {
public: public:
enum EDLCType { // Re-export the file-scope enums as nested type aliases so existing
e_DLCType_Skin = 0, // app-side call sites that use DLCManager::EDLCType /
e_DLCType_Cape, // DLCManager::e_DLCType_Texture continue to compile. minecraft/-side
e_DLCType_Texture, // call sites should use the namespaced names from DLCConstants.h
e_DLCType_UIData, // directly.
e_DLCType_PackConfig, using EDLCType = ::minecraft::dlc::EDLCType;
e_DLCType_TexturePack, using EDLCParameterType = ::minecraft::dlc::EDLCParameterType;
e_DLCType_LocalisationData,
e_DLCType_GameRules,
e_DLCType_Audio,
e_DLCType_ColourTable,
e_DLCType_GameRulesHeader,
e_DLCType_Max, static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin;
e_DLCType_All, 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 static constexpr EDLCParameterType e_DLCParamType_Invalid =
// These are the names used in the XML for the parameters ::minecraft::dlc::e_DLCParamType_Invalid;
enum EDLCParameterType { static constexpr EDLCParameterType e_DLCParamType_DisplayName =
e_DLCParamType_Invalid = -1, ::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]; const static char* wchTypeNamesA[e_DLCParamType_Max];
private: private:
@@ -83,7 +110,7 @@ public:
EDLCType type = e_DLCType_All); EDLCType type = e_DLCType_All);
DLCSkinFile* getSkinFile( DLCSkinFile* getSkinFile(
const std::string& path); // Will hunt all packs of type skin to find 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); DLCPack* getPackContainingSkin(const std::string& path);
unsigned int getPackIndexContainingSkin(const std::string& path, unsigned int getPackIndexContainingSkin(const std::string& path,
+5 -6
View File
@@ -6,7 +6,6 @@
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include "platform/profile/profile.h"
#include "DLCAudioFile.h" #include "DLCAudioFile.h"
#include "DLCCapeFile.h" #include "DLCCapeFile.h"
#include "DLCColourTableFile.h" #include "DLCColourTableFile.h"
@@ -15,13 +14,13 @@
#include "DLCLocalisationFile.h" #include "DLCLocalisationFile.h"
#include "DLCTextureFile.h" #include "DLCTextureFile.h"
#include "DLCUIDataFile.h" #include "DLCUIDataFile.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h" #include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Localisation/StringTable.h" #include "app/common/Game.h"
#include "app/linux/LinuxGame.h" #include "minecraft/Console_Debug_enum.h"
#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/locale/StringTable.h"
#include "platform/profile/profile.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) { DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) {
@@ -352,6 +351,6 @@ void DLCPack::UpdateLanguage() {
DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile( DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile(
DLCManager::e_DLCType_LocalisationData, "languages.loc"); DLCManager::e_DLCType_LocalisationData, "languages.loc");
StringTable* strTable = localisationFile->getStringTable(); StringTable* strTable = localisationFile->getStringTable();
strTable->ReloadStringTable(); strTable->ReloadStringTable(app.getLocale());
} }
} }
+1 -1
View File
@@ -5,9 +5,9 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "platform/PlatformTypes.h"
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h" #include "app/common/DLC/DLCSkinFile.h"
#include "platform/PlatformTypes.h"
class DLCFile; class DLCFile;
class DLCSkinFile; class DLCSkinFile;
+8 -9
View File
@@ -3,12 +3,12 @@
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#include "platform/renderer/renderer.h"
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h" #include "app/common/Game.h"
#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h"
DLCSkinFile::DLCSkinFile(const std::string& path) DLCSkinFile::DLCSkinFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Skin, path) { : DLCFile(DLCManager::e_DLCType_Skin, path) {
@@ -56,8 +56,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
int maximumChars = 55; int maximumChars = 55;
bool bIsSDMode = bool bIsSDMode = !PlatformRenderer.IsHiDef() &&
!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); !PlatformRenderer.IsWidescreen();
if (bIsSDMode) { if (bIsSDMode) {
maximumChars = 45; maximumChars = 45;
@@ -110,9 +110,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
SKIN_BOX* pSkinBox = new SKIN_BOX; SKIN_BOX* pSkinBox = new SKIN_BOX;
memset(pSkinBox, 0, sizeof(SKIN_BOX)); memset(pSkinBox, 0, sizeof(SKIN_BOX));
sscanf(value.c_str(), "%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
if (strcmp(wchBodyPart, "HEAD") == 0) { if (strcmp(wchBodyPart, "HEAD") == 0) {
pSkinBox->ePart = eBodyPart_Head; pSkinBox->ePart = eBodyPart_Head;
@@ -132,8 +132,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
m_AdditionalBoxes.push_back(pSkinBox); m_AdditionalBoxes.push_back(pSkinBox);
} break; } break;
case DLCManager::e_DLCParamType_Anim: { case DLCManager::e_DLCParamType_Anim: {
sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask, sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask);
sizeof(unsigned int));
uint32_t skinId = app.getSkinIdFromPath(m_path); uint32_t skinId = app.getSkinIdFromPath(m_path);
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask); app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
break; break;
+20 -11
View File
@@ -6,10 +6,11 @@
#include "DLCFile.h" #include "DLCFile.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/HumanoidModel.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: private:
std::string m_displayName; std::string m_displayName;
std::string m_themeName; std::string m_themeName;
@@ -21,15 +22,23 @@ private:
public: public:
DLCSkinFile(const std::string& path); DLCSkinFile(const std::string& path);
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); void addData(std::uint8_t* pbData, std::uint32_t dataBytes) override;
virtual void addParameter(DLCManager::EDLCParameterType type, void addParameter(DLCManager::EDLCParameterType type,
const std::string& value); const std::string& value) override;
std::string getParameterAsString(
DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
// ISkinAssetData
[[nodiscard]] std::uint32_t getSkinID() override {
return DLCFile::getSkinID();
}
[[nodiscard]] unsigned int getAnimOverrideBitmask() override {
return m_uiAnimOverrideBitmask;
}
[[nodiscard]] int getAdditionalBoxesCount() override;
[[nodiscard]] std::vector<SKIN_BOX*>* getAdditionalBoxes() override;
virtual std::string getParameterAsString(
DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
std::vector<SKIN_BOX*>* getAdditionalBoxes();
int getAdditionalBoxesCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask; }
bool isFree() { return m_bIsFree; } bool isFree() { return m_bIsFree; }
}; };
+1 -1
View File
@@ -2,7 +2,7 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h" #include "app/common/Game.h"
DLCUIDataFile::DLCUIDataFile(const std::string& path) DLCUIDataFile::DLCUIDataFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_UIData, path) { : DLCFile(DLCManager::e_DLCType_UIData, path) {
+32 -51
View File
@@ -1,22 +1,20 @@
#include "app/common/DLCController.h" #include "app/common/DLCController.h"
#include "app/common/Game.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/storage/storage.h"
#include "platform/profile/profile.h"
#include "platform/XboxStubs.h"
#include <cstring> #include <cstring>
#include <mutex> #include <mutex>
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "app/common/UI/ConsoleUIController.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/XboxStubs.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
DLCController::DLCController() { DLCController::DLCController() {
m_pDLCFileBuffer = nullptr; m_pDLCFileBuffer = nullptr;
m_dwDLCFileSize = 0; m_dwDLCFileSize = 0;
@@ -76,10 +74,9 @@ bool DLCController::startInstallDLCProcess(int iPad) {
"--- DLCController::startInstallDLCProcess - " "--- DLCController::startInstallDLCProcess - "
"PlatformStorage.GetInstalledDLC\n"); "PlatformStorage.GetInstalledDLC\n");
PlatformStorage.GetInstalledDLC( PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) {
iPad, [this](int iInstalledC, int pad) { return dlcInstalledCallback(iInstalledC, pad);
return dlcInstalledCallback(iInstalledC, pad); });
});
return true; return true;
} else { } else {
app.DebugPrintf( app.DebugPrintf(
@@ -105,7 +102,7 @@ void DLCController::mountNextDLC(int iPad) {
[this](int pad, std::uint32_t dwErr, [this](int pad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) { std::uint32_t dwLicenceMask) {
return dlcMountedCallback(pad, dwErr, dwLicenceMask); return dlcMountedCallback(pad, dwErr, dwLicenceMask);
}) != ERROR_IO_PENDING) { }) != 997 /* ERROR_IO_PENDING */) {
app.DebugPrintf("Failed to mount DLC %d for pad %d\n", app.DebugPrintf("Failed to mount DLC %d for pad %d\n",
m_iTotalDLCInstalled, iPad); m_iTotalDLCInstalled, iPad);
++m_iTotalDLCInstalled; ++m_iTotalDLCInstalled;
@@ -131,7 +128,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
#if defined(_WINDOWS64) #if defined(_WINDOWS64)
app.DebugPrintf("--- DLCController::dlcMountedCallback\n"); 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.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr);
app.m_dlcManager.incrementUnnamedCorruptCount(); app.m_dlcManager.incrementUnnamedCorruptCount();
} else { } else {
@@ -188,13 +185,11 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
void DLCController::handleDLC(DLCPack* pack) { void DLCController::handleDLC(DLCPack* pack) {
unsigned int dwFilesProcessed = 0; unsigned int dwFilesProcessed = 0;
#if defined(_WINDOWS64) || defined(__linux__)
std::vector<std::string> dlcFilenames; std::vector<std::string> dlcFilenames;
#endif
PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames);
for (int i = 0; i < dlcFilenames.size(); i++) { for (int i = 0; i < dlcFilenames.size(); i++) {
app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i],
pack); pack);
} }
if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack); if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack);
} }
@@ -229,7 +224,6 @@ SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) {
return vDLCCredits.at(iIndex); return vDLCCredits.at(iIndex);
} }
#if defined(_WINDOWS64)
int32_t DLCController::registerDLCData(char* pType, char* pBannerName, int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
int iGender, uint64_t ullOfferID_Full, int iGender, uint64_t ullOfferID_Full,
uint64_t ullOfferID_Trial, uint64_t ullOfferID_Trial,
@@ -246,11 +240,11 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
pDLCData->uiSortIndex = uiSortIndex; pDLCData->uiSortIndex = uiSortIndex;
pDLCData->iConfig = iConfig; pDLCData->iConfig = iConfig;
if (pBannerName != "") { if (strcmp(pBannerName, "") != 0) {
wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
} }
if (pDataFile[0] != 0) { if (pDataFile[0] != 0) {
wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); strncpy(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
} }
if (pType != nullptr) { if (pType != nullptr) {
@@ -277,19 +271,6 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
return hr; 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, bool DLCController::getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) { uint64_t* pullVal) {
@@ -314,8 +295,7 @@ bool DLCController::getDLCFullOfferIDForPackID(const int iPackID,
} }
} }
DLC_INFO* DLCController::getDLCInfoForTrialOfferID( DLC_INFO* DLCController::getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) {
uint64_t ullOfferID_Trial) {
if (DLCInfo_Trial.size() > 0) { if (DLCInfo_Trial.size() > 0) {
auto it = DLCInfo_Trial.find(ullOfferID_Trial); auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if (it == DLCInfo_Trial.end()) { if (it == DLCInfo_Trial.end()) {
@@ -437,12 +417,13 @@ bool DLCController::retrieveNextDLCContent() {
app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", app.DebugPrintf("RetrieveNextDLCContent - type = %d\n",
pCurrent->dwType); pCurrent->dwType);
#endif #endif
IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers( IPlatformStorage::EDLCStatus status =
PlatformProfile.GetPrimaryPad(), PlatformStorage.GetDLCOffers(
[this](int iOfferC, std::uint32_t dwType, int pad) { PlatformProfile.GetPrimaryPad(),
return dlcOffersReturned(iOfferC, dwType, pad); [this](int iOfferC, std::uint32_t dwType, int pad) {
}, return dlcOffersReturned(iOfferC, dwType, pad);
pCurrent->dwType); },
pCurrent->dwType);
if (status == IPlatformStorage::EDLC_Pending) { if (status == IPlatformStorage::EDLC_Pending) {
pCurrent->eState = e_DLC_ContentState_Retrieving; pCurrent->eState = e_DLC_ContentState_Retrieving;
} else { } else {
@@ -670,9 +651,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
return 1; return 1;
} }
int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, int DLCController::tmsPPFileReturned(
IPlatformStorage::PTMSPP_FILEDATA pFileData, void* pParam, int iPad, int iUserData,
const char* szFilename) { IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) {
DLCController* pClass = (DLCController*)pParam; DLCController* pClass = (DLCController*)pParam;
{ {
+3 -4
View File
@@ -8,8 +8,8 @@
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "platform/storage/storage.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/storage/storage.h"
struct SCreditTextItemDef; struct SCreditTextItemDef;
@@ -36,9 +36,8 @@ public:
int iPad); int iPad);
// DLC info registration // DLC info registration
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*,
char*, unsigned int, int, unsigned int, int, char* pDataFile);
char* pDataFile);
bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin, bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal); uint64_t* pullVal);
bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal); bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal);
+1 -2
View File
@@ -27,7 +27,6 @@ DebugOptions::DebugOptions() {
#if defined(_DEBUG_MENUS_ENABLED) #if defined(_DEBUG_MENUS_ENABLED)
bool DebugOptions::debugArtToolsOn(unsigned int debugMask) { bool DebugOptions::debugArtToolsOn(unsigned int debugMask) {
return settingsOn() && return settingsOn() && (debugMask & (1L << eDebugSetting_ArtTools)) != 0;
(debugMask & (1L << eDebugSetting_ArtTools)) != 0;
} }
#endif #endif
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "app/common/Console_Debug_enum.h" #include "minecraft/Console_Debug_enum.h"
class DebugOptions { class DebugOptions {
public: public:
+82 -170
View File
@@ -1,58 +1,5 @@
#include "minecraft/GameHostOptions.h"
#include "app/common/Game.h" #include "app/common/Game.h"
#include "platform/PlatformTypes.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h"
#include "app/common/App_structs.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "java/Class.h"
#include "java/File.h"
#include "java/Random.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/multiplayer/ClientConnection.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
#include "minecraft/client/multiplayer/MultiPlayerLevel.h"
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "minecraft/client/renderer/GameRenderer.h"
#include "minecraft/client/renderer/Textures.h"
#include "minecraft/client/renderer/entity/EntityRenderer.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/stats/StatsCounter.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "strings.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@@ -72,24 +19,71 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "platform/input/input.h" #include "app/common/App_structs.h"
#include "app/common/Audio/SoundEngine.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/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/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 "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h"
#include "Minecraft_Macros.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h"
#include "util/Timer.h" #include "java/Class.h"
#include "util/StringHelpers.h" #include "java/File.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.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/User.h"
#include "minecraft/client/gui/Gui.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/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/DLCTexturePack.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.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/PlayerList.h"
#include "minecraft/server/level/ServerPlayer.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 BeaconTileEntity;
class BrewingStandTileEntity; class BrewingStandTileEntity;
@@ -190,31 +184,14 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; }
// Load*Menu methods moved to MenuController // Load*Menu methods moved to MenuController
////////////////////////////////////////////// //////////////////////////////////////////////
// GAME SETTINGS // GAME SETTINGS
////////////////////////////////////////////// //////////////////////////////////////////////
// Skin/Cape/FavoriteSkin methods moved to SkinManager // Skin/Cape/FavoriteSkin methods moved to SkinManager
// Mash-up pack worlds // Mash-up pack worlds
/////////////////////////// ///////////////////////////
// //
// Remove the debug settings in the content package build // 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) #if !defined(_DEBUG_MENUS_ENABLED)
#else #else
#endif #endif
int Game::BannedLevelDialogReturned( int Game::BannedLevelDialogReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
Game* pApp = (Game*)pParam; Game* pApp = (Game*)pParam;
@@ -285,17 +256,10 @@ int Game::GetLocalPlayerCount(void) {
return iPlayerC; return iPlayerC;
} }
// Installed DLC callback // Installed DLC callback
// 4J-JEV: For the sake of clarity in DLCMountedCallback. // 4J-JEV: For the sake of clarity in DLCMountedCallback.
#if defined(_WINDOWS64)
#define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) #define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName)
#else
#define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName)
#endif
#undef CONTENT_DATA_DISPLAY_NAME #undef CONTENT_DATA_DISPLAY_NAME
@@ -327,7 +291,6 @@ int Game::GetLocalPlayerCount(void) {
// } // }
// } // }
// int Game::DLCReadCallback(void* // int Game::DLCReadCallback(void*
// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData) // pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData)
// { // {
@@ -366,8 +329,9 @@ void Game::UpdateTime() {
} }
bool Game::isXuidDeadmau5(PlayerUID xuid) { bool Game::isXuidDeadmau5(PlayerUID xuid) {
auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors auto it = DLCController::MojangData.find(
// insert elements if they don't exist xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
if (it != DLCController::MojangData.end()) { if (it != DLCController::MojangData.end()) {
MOJANG_DATA* pMojangData = DLCController::MojangData[xuid]; MOJANG_DATA* pMojangData = DLCController::MojangData[xuid];
if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) {
@@ -380,16 +344,13 @@ bool Game::isXuidDeadmau5(PlayerUID xuid) {
void Game::StoreLaunchData() {} void Game::StoreLaunchData() {}
void Game::ExitGame() {} void Game::ExitGame() {
DebugPrintf("[Game] ExitGame AFTER START\n");
PlatformRenderer.Close();
}
// Invites // Invites
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// //
// FatalLoadError // 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. // 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 // Game Host options
void Game::SetGameHostOption(eGameHostOption eVal, void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) {
unsigned int uiVal) {
GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal); GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal);
} }
unsigned int Game::GetGameHostOption(eGameHostOption eVal) { unsigned int Game::GetGameHostOption(eGameHostOption eVal) {
return GameHostOptions::get(m_uiGameHostSettings, eVal); return GameHostOptions::get(m_uiGameHostSettings, eVal);
} }
void Game::processSchematics(LevelChunk* levelChunk) { void Game::processSchematics(LevelChunk* levelChunk) {
m_gameRules.processSchematics(levelChunk); m_gameRules.processSchematics(levelChunk);
} }
@@ -429,12 +383,9 @@ void Game::processSchematicsLighting(LevelChunk* levelChunk) {
m_gameRules.processSchematicsLighting(levelChunk); m_gameRules.processSchematicsLighting(levelChunk);
} }
void Game::loadDefaultGameRules() { void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); }
m_gameRules.loadDefaultGameRules();
}
void Game::setLevelGenerationOptions( void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
LevelGenerationOptions* levelGen) {
m_gameRules.setLevelGenerationOptions(levelGen); m_gameRules.setLevelGenerationOptions(levelGen);
} }
@@ -442,16 +393,8 @@ const char* Game::GetGameRulesString(const std::string& key) {
return m_gameRules.GetGameRulesString(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) { std::string Game::getEntityName(eINSTANCEOF type) {
switch (type) { switch (type) {
@@ -507,12 +450,8 @@ std::string Game::getEntityName(eINSTANCEOF type) {
// m_dwContentTypeA moved to DLCController // 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; int32_t hr = 0;
eXUID eTempXuid = eXUID_Undefined; eXUID eTempXuid = eXUID_Undefined;
MOJANG_DATA* pMojangData = nullptr; MOJANG_DATA* pMojangData = nullptr;
@@ -574,39 +513,12 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) {
return hr; return hr;
} }
#if defined(_WINDOWS64)
#elif defined(__linux__)
#else
#endif
// DLC // DLC
// AUTOSAVE // AUTOSAVE
void Game::SetAutosaveTimerTime(void) { void Game::SetAutosaveTimerTime(void) {
int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); int settingValue =
GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave);
m_saveManager.setAutosaveTimerTime(settingValue); m_saveManager.setAutosaveTimerTime(settingValue);
} }
@@ -642,7 +554,8 @@ bool Game::IsLocalMultiplayerAvailable() {
// #else // #else
// for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) // 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)) ) // PlatformProfile.IsSignedIn(i)) )
// { // {
// iOtherConnectedControllers++; // iOtherConnectedControllers++;
@@ -655,10 +568,8 @@ bool Game::IsLocalMultiplayerAvailable() {
// (moved to manager class) // (moved to manager class)
std::string Game::getFilePath(std::uint32_t packId, std::string Game::getFilePath(std::uint32_t packId, std::string filename,
std::string filename, bool bAddDataFolder, std::string mountPoint) {
bool bAddDataFolder,
std::string mountPoint) {
std::string path = std::string path =
getRootPath(packId, true, bAddDataFolder, mountPoint) + filename; getRootPath(packId, true, bAddDataFolder, mountPoint) + filename;
File f(path); File f(path);
@@ -690,9 +601,8 @@ std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\";
std::string titleUpdateTexturePackRoot = "CU\\DLC\\"; std::string titleUpdateTexturePackRoot = "CU\\DLC\\";
#endif #endif
std::string Game::getRootPath(std::uint32_t packId, std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
bool allowOverride, bool bAddDataFolder, bool bAddDataFolder, std::string mountPoint) {
std::string mountPoint) {
std::string path = mountPoint; std::string path = mountPoint;
if (allowOverride) { if (allowOverride) {
switch (packId) { switch (packId) {
@@ -712,3 +622,5 @@ std::string Game::getRootPath(std::uint32_t packId,
return path + "\\"; return path + "\\";
} }
} }
Game app;
+199 -158
View File
@@ -3,38 +3,38 @@
#include <cstdint> #include <cstdint>
#include <mutex> #include <mutex>
#include "util/Timer.h"
#include "platform/profile/profile.h" #include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h" #include "platform/storage/storage.h"
#include "util/Timer.h"
// using namespace std; // 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/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/LocalizationManager.h"
#include "app/common/MenuController.h" #include "app/common/MenuController.h"
#include "app/common/NetworkController.h" #include "app/common/NetworkController.h"
#include "app/common/SaveManager.h" #include "app/common/SaveManager.h"
#include "app/common/SkinManager.h" #include "app/common/SkinManager.h"
#include "app/common/TerrainFeatureManager.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/ArchiveFile.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "minecraft/locale/StringTable.h"
#include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/world/entity/item/MinecartHopper.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 // JoinFromInviteData moved to NetworkController.h
@@ -62,7 +62,7 @@ class Merchant;
class CMinecraftAudio; class CMinecraftAudio;
class Game : public IPlatformGame { class Game {
public: public:
Game(); Game();
@@ -145,7 +145,8 @@ public:
bool IsAppPaused(); bool IsAppPaused();
void SetAppPaused(bool val); 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); return m_gameSettingsManager.displaySavingMessage(eMsg, iPad);
} }
bool GetGameStarted() { return m_bGameStarted; } bool GetGameStarted() { return m_bGameStarted; }
@@ -169,7 +170,8 @@ public:
bool LoadEnchantingMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadEnchantingMenu(int iPad, std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level, int x, int y, int z, Level* level,
const std::string& name) { const std::string& name) {
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name); return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z,
level, name);
} }
bool LoadFurnaceMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadFurnaceMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) { std::shared_ptr<FurnaceTileEntity> furnace) {
@@ -178,7 +180,8 @@ public:
bool LoadBrewingStandMenu( bool LoadBrewingStandMenu(
int iPad, std::shared_ptr<Inventory> inventory, int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) { std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand); return m_menuController.loadBrewingStandMenu(iPad, inventory,
brewingStand);
} }
bool LoadContainerMenu(int iPad, std::shared_ptr<Container> inventory, bool LoadContainerMenu(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) { std::shared_ptr<Container> container) {
@@ -204,12 +207,14 @@ public:
} }
bool LoadRepairingMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadRepairingMenu(int iPad, std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) { Level* level, int x, int y, int z) {
return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z); return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y,
z);
} }
bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader, Level* level, std::shared_ptr<Merchant> trader, Level* level,
const std::string& name) { const std::string& name) {
return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name); return m_menuController.loadTradingMenu(iPad, inventory, trader, level,
name);
} }
bool LoadCommandBlockMenu( bool LoadCommandBlockMenu(
@@ -227,7 +232,8 @@ public:
bool LoadHorseMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadHorseMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container, std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) { std::shared_ptr<EntityHorse> horse) {
return m_menuController.loadHorseMenu(iPad, inventory, container, horse); return m_menuController.loadHorseMenu(iPad, inventory, container,
horse);
} }
bool LoadBeaconMenu(int iPad, std::shared_ptr<Inventory> inventory, bool LoadBeaconMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) { std::shared_ptr<BeaconTileEntity> beacon) {
@@ -242,38 +248,31 @@ public:
} }
static const char* GetString(int iID); 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; } eGameMode GetGameMode() { return m_eGameMode; }
void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; } void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; }
eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); } eXuiAction GetGlobalXuiAction() {
void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); } return m_menuController.getGlobalXuiAction();
eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); } }
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) { void SetAction(int iPad, eXuiAction action, void* param = nullptr) {
m_menuController.setAction(iPad, action, param); m_menuController.setAction(iPad, action, param);
} }
void SetTMSAction(int iPad, eTMSAction action) { void SetTMSAction(int iPad, eTMSAction action) {
m_menuController.setTMSAction(iPad, action); m_menuController.setTMSAction(iPad, action);
} }
eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); } eTMSAction GetTMSAction(int iPad) {
eXuiServerAction GetXuiServerAction(int iPad) { return m_menuController.getTMSAction(iPad);
return m_menuController.getXuiServerAction(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() { DisconnectPacket::eDisconnectReason GetDisconnectReason() {
return m_networkController.getDisconnectReason(); return m_networkController.getDisconnectReason();
} }
@@ -281,10 +280,16 @@ public:
m_networkController.setDisconnectReason(bVal); m_networkController.setDisconnectReason(bVal);
} }
bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); } bool GetChangingSessionType() {
void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); } 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) { void SetReallyChangingSessionType(bool bVal) {
m_networkController.setReallyChangingSessionType(bVal); m_networkController.setReallyChangingSessionType(bVal);
} }
@@ -340,19 +345,20 @@ public:
static int OldProfileVersionCallback(void* pParam, unsigned char* pucData, static int OldProfileVersionCallback(void* pParam, unsigned char* pucData,
const unsigned short usVersion, const unsigned short usVersion,
const int iPad) { const int iPad) {
return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad); return GameSettingsManager::oldProfileVersionCallback(pParam, pucData,
usVersion, iPad);
} }
static int DefaultOptionsCallback(void* pParam, static int DefaultOptionsCallback(
IPlatformProfile::PROFILESETTINGS* pSettings, void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) { const int iPad) {
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad); return GameSettingsManager::defaultOptionsCallback(pParam, pSettings,
iPad);
} }
int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) { const int iPad) {
return m_gameSettingsManager.setDefaultOptions(pSettings, iPad); return m_gameSettingsManager.setDefaultOptions(pSettings, iPad);
} }
void SetRichPresenceContext(int iPad, int contextId) override = 0;
void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) { void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) {
m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal); m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal);
@@ -376,7 +382,8 @@ public:
m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA); m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA);
} }
void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) { 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) { unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) {
return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA); return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA);
@@ -427,9 +434,7 @@ public:
void SetOpacityTimer(int iPad) { void SetOpacityTimer(int iPad) {
m_menuController.setOpacityTimer(iPad); m_menuController.setOpacityTimer(iPad);
} // 6 seconds } // 6 seconds
void TickOpacityTimer(int iPad) { void TickOpacityTimer(int iPad) { m_menuController.tickOpacityTimer(iPad); }
m_menuController.tickOpacityTimer(iPad);
}
public: public:
std::string GetPlayerSkinName(int iPad) { std::string GetPlayerSkinName(int iPad) {
@@ -449,7 +454,8 @@ public:
} }
void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false, void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false,
int iPad = XUSER_INDEX_ANY) { int iPad = XUSER_INDEX_ANY) {
m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad); m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer,
iPad);
} }
void ApplyGameSettingsChanged(int iPad) { void ApplyGameSettingsChanged(int iPad) {
m_gameSettingsManager.applyGameSettingsChanged(iPad); m_gameSettingsManager.applyGameSettingsChanged(iPad);
@@ -462,7 +468,8 @@ public:
} }
unsigned int GetGameSettingsDebugMask(int iPad = -1, unsigned int GetGameSettingsDebugMask(int iPad = -1,
bool bOverridePlayer = false) { bool bOverridePlayer = false) {
return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer); return m_gameSettingsManager.getGameSettingsDebugMask(iPad,
bOverridePlayer);
} }
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) {
m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal); m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal);
@@ -485,13 +492,15 @@ public:
static int SignoutExitWorldThreadProc(void* lpParameter) { static int SignoutExitWorldThreadProc(void* lpParameter) {
return NetworkController::signoutExitWorldThreadProc(lpParameter); return NetworkController::signoutExitWorldThreadProc(lpParameter);
} }
static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, static int PrimaryPlayerSignedOutReturned(
const IPlatformStorage::EMessageResult result) { void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad,
result);
} }
static int EthernetDisconnectReturned(void* pParam, int iPad, static int EthernetDisconnectReturned(
const IPlatformStorage::EMessageResult result) { void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); return NetworkController::ethernetDisconnectReturned(pParam, iPad,
result);
} }
static void ProfileReadErrorCallback(void* pParam) { static void ProfileReadErrorCallback(void* pParam) {
NetworkController::profileReadErrorCallback(pParam); NetworkController::profileReadErrorCallback(pParam);
@@ -504,15 +513,20 @@ public:
static void NotificationsCallback(void* pParam, static void NotificationsCallback(void* pParam,
std::uint32_t dwNotification, std::uint32_t dwNotification,
unsigned int uiParam) { unsigned int uiParam) {
NetworkController::notificationsCallback(pParam, dwNotification, uiParam); NetworkController::notificationsCallback(pParam, dwNotification,
uiParam);
} }
// for the ethernet being disconnected // for the ethernet being disconnected
static void LiveLinkChangeCallback(void* pParam, bool bConnected) { static void LiveLinkChangeCallback(void* pParam, bool bConnected) {
NetworkController::liveLinkChangeCallback(pParam, bConnected); NetworkController::liveLinkChangeCallback(pParam, bConnected);
} }
bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); } bool GetLiveLinkRequired() {
void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); } return m_networkController.getLiveLinkRequired();
}
void SetLiveLinkRequired(bool required) {
m_networkController.setLiveLinkRequired(required);
}
#if defined(_DEBUG_MENUS_ENABLED) #if defined(_DEBUG_MENUS_ENABLED)
bool DebugSettingsOn() { return m_debugOptions.settingsOn(); } bool DebugSettingsOn() { return m_debugOptions.settingsOn(); }
@@ -523,11 +537,15 @@ public:
#endif #endif
void SetDebugSequence(const char* pchSeq); void SetDebugSequence(const char* pchSeq);
// bool UploadFileToGlobalStorage(int iQuadrant, // bool UploadFileToGlobalStorage(int iQuadrant,
// IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile ); // IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile );
// Installed DLC - delegated to DLCController // Installed DLC - delegated to DLCController
bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } bool StartInstallDLCProcess(int iPad) {
int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); } return m_dlcController.startInstallDLCProcess(iPad);
}
int dlcInstalledCallback(int iOfferC, int iPad) {
return m_dlcController.dlcInstalledCallback(iOfferC, iPad);
}
void HandleDLCLicenseChange(); void HandleDLCLicenseChange();
int dlcMountedCallback(int iPad, std::uint32_t dwErr, int dlcMountedCallback(int iPad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) { std::uint32_t dwLicenceMask) {
@@ -536,11 +554,12 @@ public:
void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); } void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); }
void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); } void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); }
bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); } bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); }
bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } bool DLCInstallProcessCompleted() {
return m_dlcController.dlcInstallProcessCompleted();
}
void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); }
static int MarketplaceCountsCallback(void* pParam, static int MarketplaceCountsCallback(
IPlatformStorage::DLC_TMS_DETAILS* details, void* pParam, IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) {
int iPad) {
return DLCController::marketplaceCountsCallback(pParam, details, iPad); return DLCController::marketplaceCountsCallback(pParam, details, iPad);
} }
@@ -558,9 +577,7 @@ public:
virtual void StoreLaunchData(); virtual void StoreLaunchData();
virtual void ExitGame(); virtual void ExitGame();
bool isXuidNotch(PlayerUID xuid) { bool isXuidNotch(PlayerUID xuid) { return m_skinManager.isXuidNotch(xuid); }
return m_skinManager.isXuidNotch(xuid);
}
bool isXuidDeadmau5(PlayerUID xuid); bool isXuidDeadmau5(PlayerUID xuid);
void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData, void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData,
@@ -597,9 +614,7 @@ public:
return m_archiveManager.getTPConfigVal(pwchDataFile); return m_archiveManager.getTPConfigVal(pwchDataFile);
} }
bool DefaultCapeExists() { bool DefaultCapeExists() { return m_skinManager.defaultCapeExists(); }
return m_skinManager.defaultCapeExists();
}
// void InstallDefaultCape(); // attempt to install the default cape once // void InstallDefaultCape(); // attempt to install the default cape once
// per game launch // per game launch
@@ -607,11 +622,14 @@ public:
void ProcessInvite(std::uint32_t dwUserIndex, void ProcessInvite(std::uint32_t dwUserIndex,
std::uint32_t dwLocalUsersMask, std::uint32_t dwLocalUsersMask,
const INVITE_INFO* pInviteInfo) { const INVITE_INFO* pInviteInfo) {
m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo); m_networkController.processInvite(dwUserIndex, dwLocalUsersMask,
pInviteInfo);
} }
// Add credits for DLC installed - delegated to DLCController // 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: private:
std::unordered_map<PlayerUID, std::uint8_t*> m_GTS_Files; std::unordered_map<PlayerUID, std::uint8_t*> m_GTS_Files;
@@ -654,14 +672,16 @@ public:
bool m_bTutorialMode; bool m_bTutorialMode;
bool m_bIsAppPaused; 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 // trial, and trying to unlock full
// version on an upsell // version on an upsell
void loadMediaArchive() { m_archiveManager.loadMediaArchive(); } void loadMediaArchive() { m_archiveManager.loadMediaArchive(); }
void loadStringTable() { void loadStringTable() {
m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive()); m_localizationManager.loadStringTable(
m_archiveManager.getMediaArchive());
} }
public: public:
@@ -676,10 +696,10 @@ public:
} }
private: private:
static int BannedLevelDialogReturned(void* pParam, int iPad, static int BannedLevelDialogReturned(
const IPlatformStorage::EMessageResult); void* pParam, int iPad, const IPlatformStorage::EMessageResult);
static int TexturePackDialogReturned(void* pParam, int iPad, static int TexturePackDialogReturned(
IPlatformStorage::EMessageResult result) { void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::texturePackDialogReturned(pParam, iPad, result); return MenuController::texturePackDialogReturned(pParam, iPad, result);
} }
@@ -703,7 +723,8 @@ private:
eGameMode m_eGameMode; // single or multiplayer eGameMode m_eGameMode; // single or multiplayer
// GameSettingsA reference alias into GameSettingsManager // 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 // m_uiLastSignInData moved to NetworkController
@@ -728,7 +749,6 @@ public:
} }
private: private:
static int UnlockFullExitReturned(void* pParam, int iPad, static int UnlockFullExitReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) { IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullExitReturned(pParam, iPad, result); return MenuController::unlockFullExitReturned(pParam, iPad, result);
@@ -737,8 +757,8 @@ private:
IPlatformStorage::EMessageResult result) { IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullSaveReturned(pParam, iPad, result); return MenuController::unlockFullSaveReturned(pParam, iPad, result);
} }
static int UnlockFullInviteReturned(void* pParam, int iPad, static int UnlockFullInviteReturned(
IPlatformStorage::EMessageResult result) { void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullInviteReturned(pParam, iPad, result); return MenuController::unlockFullInviteReturned(pParam, iPad, result);
} }
static int TrialOverReturned(void* pParam, int iPad, static int TrialOverReturned(void* pParam, int iPad,
@@ -751,21 +771,25 @@ private:
} }
static int ExitAndJoinFromInviteSaveDialogReturned( static int ExitAndJoinFromInviteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) { void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); return NetworkController::exitAndJoinFromInviteSaveDialogReturned(
pParam, iPad, result);
} }
static int ExitAndJoinFromInviteAndSaveReturned( static int ExitAndJoinFromInviteAndSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) { void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); return NetworkController::exitAndJoinFromInviteAndSaveReturned(
pParam, iPad, result);
} }
static int ExitAndJoinFromInviteDeclineSaveReturned( static int ExitAndJoinFromInviteDeclineSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) { 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, static int FatalErrorDialogReturned(
IPlatformStorage::EMessageResult result); void* pParam, int iPad, IPlatformStorage::EMessageResult result);
static int WarningTrialTexturePackReturned( static int WarningTrialTexturePackReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) { 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; JoinFromInviteData& m_InviteData = m_networkController.m_InviteData;
@@ -794,7 +818,7 @@ public:
return m_localizationManager.getHTMLFontSize(size); return m_localizationManager.getHTMLFontSize(size);
} }
std::string FormatHTMLString(int iPad, const std::string& desc, std::string FormatHTMLString(int iPad, const std::string& desc,
int shadowColour = 0xFFFFFFFF) { int shadowColour = 0xFFFFFFFF) {
return m_localizationManager.formatHTMLString(iPad, desc, shadowColour); return m_localizationManager.formatHTMLString(iPad, desc, shadowColour);
} }
std::string GetActionReplacement(int iPad, unsigned char ucAction) { std::string GetActionReplacement(int iPad, unsigned char ucAction) {
@@ -818,7 +842,8 @@ public:
} }
static int ExitGameFromRemoteSaveDialogReturned( static int ExitGameFromRemoteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) { void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); return MenuController::exitGameFromRemoteSaveDialogReturned(
pParam, iPad, result);
} }
// XML // XML
@@ -840,10 +865,11 @@ public:
MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid); MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid);
static int32_t RegisterConfigValues(char* pType, int iValue); static int32_t RegisterConfigValues(char* pType, int iValue);
static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, uint64_t e, static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d,
char* f, unsigned int g, int h, uint64_t e, char* f, unsigned int g, int h,
char* pDataFile) { 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, bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) { uint64_t* pullVal) {
@@ -856,8 +882,12 @@ public:
return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full); return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full);
} }
unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); } unsigned int GetDLCCreditsCount() {
SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); } return m_dlcController.getDLCCreditsCount();
}
SCreditTextItemDef* GetDLCCredits(int iIndex) {
return m_dlcController.getDLCCredits(iIndex);
}
// TMS // TMS
void ReadDLCFileFromTMS(int iPad, eTMSAction action, void ReadDLCFileFromTMS(int iPad, eTMSAction action,
@@ -865,26 +895,15 @@ public:
void ReadXuidsFileFromTMS(int iPad, eTMSAction action, void ReadXuidsFileFromTMS(int iPad, eTMSAction action,
bool bCallback = false); 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 // DLC data members moved to DLCController
// Sign-in info moved to NetworkController // Sign-in info moved to NetworkController
public: public:
// void OverrideFontRenderer(bool set, bool immediate = true); // void OverrideFontRenderer(bool set, bool immediate = true);
// void ToggleFontRenderer() { // void ToggleFontRenderer() {
// OverrideFontRenderer(!m_bFontRendererOverridden,false); } // OverrideFontRenderer(!m_bFontRendererOverridden,false); }
BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; BANNEDLIST(&BannedListA)
[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA;
public: public:
void SetBanListCheck(int iPad, bool bVal) { void SetBanListCheck(int iPad, bool bVal) {
@@ -902,7 +921,8 @@ public:
// m_uiOpacityCountDown moved to MenuController // m_uiOpacityCountDown moved to MenuController
// DLC flags moved to DLCController // DLC flags moved to DLCController
// Host options - m_uiGameHostSettings moved to GameSettingsManager // 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) #if defined(_LARGE_WORLDS)
unsigned int m_GameNewWorldSize; unsigned int m_GameNewWorldSize;
@@ -945,13 +965,17 @@ public:
// World seed from png image - delegated to MenuController // World seed from png image - delegated to MenuController
void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes, void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes,
unsigned char* seedText, unsigned int& uiHostOptions, unsigned char* seedText, unsigned int& uiHostOptions,
bool& bHostOptionsRead, std::uint32_t& uiTexturePack) { bool& bHostOptionsRead,
m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack); std::uint32_t& uiTexturePack) {
m_menuController.getImageTextData(imageData, imageBytes, seedText,
uiHostOptions, bHostOptionsRead,
uiTexturePack);
} }
unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed, unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions, bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) { unsigned int uiTexturePackId) {
return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); return m_menuController.createImageTextData(
textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId);
} }
// Game rules // Game rules
@@ -979,7 +1003,8 @@ public:
void UpdatePlayerInfo(std::uint8_t networkSmallId, void UpdatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex, int16_t playerColourIndex,
unsigned int playerGamePrivileges) { unsigned int playerGamePrivileges) {
m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges); m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex,
playerGamePrivileges);
} }
short GetPlayerColour(std::uint8_t networkSmallId) { short GetPlayerColour(std::uint8_t networkSmallId) {
return m_networkController.getPlayerColour(networkSmallId); return m_networkController.getPlayerColour(networkSmallId);
@@ -994,7 +1019,9 @@ public:
bool bPromote = false) { bool bPromote = false) {
return m_dlcController.addDLCRequest(eContentType, bPromote); return m_dlcController.addDLCRequest(eContentType, bPromote);
} }
bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); } bool RetrieveNextDLCContent() {
return m_dlcController.retrieveNextDLCContent();
}
bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); } bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); }
int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) { int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) {
return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad); return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad);
@@ -1010,26 +1037,45 @@ public:
return m_dlcController.dlcContentRetrieved(eType); return m_dlcController.dlcContentRetrieved(eType);
} }
void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); } void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); }
void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); } void ClearAndResetDLCDownloadQueue() {
bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); } m_dlcController.clearAndResetDLCDownloadQueue();
void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); } }
void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); } bool RetrieveNextTMSPPContent() {
return m_dlcController.retrieveNextTMSPPContent();
}
void TickTMSPPFilesRetrieved() {
m_dlcController.tickTMSPPFilesRetrieved();
}
void ClearTMSPPFilesRetrieved() {
m_dlcController.clearTMSPPFilesRetrieved();
}
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType,
bool bPromote = false) { bool bPromote = false) {
return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote); 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, static int TMSPPFileReturned(void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData, IPlatformStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) { 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 GetDLCInfoTrialOffersCount() {
int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); } return m_dlcController.getDLCInfoTrialOffersCount();
}
int GetDLCInfoFullOffersCount() {
return m_dlcController.getDLCInfoFullOffersCount();
}
bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) { bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) {
return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal); return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal);
} }
@@ -1046,8 +1092,10 @@ public:
// Download status members moved to DLCController // Download status members moved to DLCController
bool m_bCorruptSaveDeleted; bool m_bCorruptSaveDeleted;
std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer; std::uint8_t*& m_pBannedListFileBuffer =
unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize; m_bannedListManager.m_pBannedListFileBuffer;
unsigned int& m_dwBannedListFileSize =
m_bannedListManager.m_dwBannedListFileSize;
public: public:
unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize; unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize;
@@ -1090,14 +1138,6 @@ public:
return SkinManager::getSkinPathFromId(skinId); 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 GetTMSGlobalFileListRead() { return true; }
virtual bool GetTMSDLCInfoRead() { return true; } virtual bool GetTMSDLCInfoRead() { return true; }
virtual bool GetTMSXUIDsFileRead() { return true; } virtual bool GetTMSXUIDsFileRead() { return true; }
@@ -1132,10 +1172,17 @@ private:
// 4J-PB - language and locale functions // 4J-PB - language and locale functions
public: public:
void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); } void LocaleAndLanguageInit() {
m_localizationManager.localeAndLanguageInit();
}
void getLocale(std::vector<std::string>& vecWstrLocales) { void getLocale(std::vector<std::string>& vecWstrLocales) {
m_localizationManager.getLocale(vecWstrLocales); m_localizationManager.getLocale(vecWstrLocales);
} }
[[nodiscard]] std::vector<std::string> getLocale() {
std::vector<std::string> v;
m_localizationManager.getLocale(v);
return v;
}
int get_eMCLang(char* pwchLocale) { int get_eMCLang(char* pwchLocale) {
return m_localizationManager.get_eMCLang(pwchLocale); return m_localizationManager.get_eMCLang(pwchLocale);
} }
@@ -1143,24 +1190,18 @@ public:
return m_localizationManager.get_xcLang(pwchLocale); 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, std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder, bool bAddDataFolder,
std::string mountPoint = "TPACK:"); std::string mountPoint = "TPACK:");
private: private:
std::string getRootPath(std::uint32_t packId, bool allowOverride, 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
}; };
extern Game app;
// singleton
// extern CMinecraftApp app;
+48 -17
View File
@@ -2,57 +2,88 @@
#include "app/common/Game.h" #include "app/common/Game.h"
bool GameMenuService::openInventory(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) { bool GameMenuService::openInventory(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
return game_.LoadInventoryMenu(iPad, player, navigateBack); return game_.LoadInventoryMenu(iPad, player, navigateBack);
} }
bool GameMenuService::openCreative(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) { bool GameMenuService::openCreative(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
return game_.LoadCreativeMenu(iPad, player, navigateBack); return game_.LoadCreativeMenu(iPad, player, navigateBack);
} }
bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr<LocalPlayer> player) { bool GameMenuService::openCrafting2x2(int iPad,
std::shared_ptr<LocalPlayer> player) {
return game_.LoadCrafting2x2Menu(iPad, player); return game_.LoadCrafting2x2Menu(iPad, player);
} }
bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) { bool GameMenuService::openCrafting3x3(int iPad,
std::shared_ptr<LocalPlayer> player,
int x, int y, int z) {
return game_.LoadCrafting3x3Menu(iPad, player, x, y, z); return game_.LoadCrafting3x3Menu(iPad, player, x, y, z);
} }
bool GameMenuService::openEnchanting(int iPad, std::shared_ptr<Inventory> inventory, int x, int y, int z, Level* level, const std::string& name) { bool GameMenuService::openEnchanting(int iPad,
std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level,
const std::string& name) {
return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name); return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name);
} }
bool GameMenuService::openFurnace(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace) { bool GameMenuService::openFurnace(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) {
return game_.LoadFurnaceMenu(iPad, inventory, furnace); return game_.LoadFurnaceMenu(iPad, inventory, furnace);
} }
bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand) { bool GameMenuService::openBrewingStand(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand); return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand);
} }
bool GameMenuService::openContainer(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<Container> container) { bool GameMenuService::openContainer(int iPad,
std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) {
return game_.LoadContainerMenu(iPad, inventory, container); return game_.LoadContainerMenu(iPad, inventory, container);
} }
bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap) { bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<DispenserTileEntity> trap) {
return game_.LoadTrapMenu(iPad, inventory, trap); return game_.LoadTrapMenu(iPad, inventory, trap);
} }
bool GameMenuService::openFireworks(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) { bool GameMenuService::openFireworks(int iPad,
std::shared_ptr<LocalPlayer> player, int x,
int y, int z) {
return game_.LoadFireworksMenu(iPad, player, x, y, z); return game_.LoadFireworksMenu(iPad, player, x, y, z);
} }
bool GameMenuService::openSign(int iPad, std::shared_ptr<SignTileEntity> sign) { bool GameMenuService::openSign(int iPad, std::shared_ptr<SignTileEntity> sign) {
return game_.LoadSignEntryMenu(iPad, sign); return game_.LoadSignEntryMenu(iPad, sign);
} }
bool GameMenuService::openRepairing(int iPad, std::shared_ptr<Inventory> inventory, Level* level, int x, int y, int z) { bool GameMenuService::openRepairing(int iPad,
std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) {
return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z); return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z);
} }
bool GameMenuService::openTrading(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level* level, const std::string& name) { bool GameMenuService::openTrading(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader,
Level* level, const std::string& name) {
return game_.LoadTradingMenu(iPad, inventory, trader, level, name); return game_.LoadTradingMenu(iPad, inventory, trader, level, name);
} }
bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) { bool GameMenuService::openCommandBlock(
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) {
return game_.LoadCommandBlockMenu(iPad, commandBlock); return game_.LoadCommandBlockMenu(iPad, commandBlock);
} }
bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<HopperTileEntity> hopper) { bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper); return game_.LoadHopperMenu(iPad, inventory, hopper);
} }
bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<MinecartHopper> hopper) { bool GameMenuService::openHopperMinecart(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper); return game_.LoadHopperMenu(iPad, inventory, hopper);
} }
bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Container> container, std::shared_ptr<EntityHorse> horse) { bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) {
return game_.LoadHorseMenu(iPad, inventory, container, horse); return game_.LoadHorseMenu(iPad, inventory, container, horse);
} }
bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BeaconTileEntity> beacon) { bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) {
return game_.LoadBeaconMenu(iPad, inventory, beacon); return game_.LoadBeaconMenu(iPad, inventory, beacon);
} }
+2 -3
View File
@@ -40,9 +40,8 @@ public:
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) override; int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) override;
bool openHopper(int iPad, std::shared_ptr<Inventory> inventory, bool openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) override; std::shared_ptr<HopperTileEntity> hopper) override;
bool openHopperMinecart( bool openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory,
int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<MinecartHopper> hopper) override;
std::shared_ptr<MinecartHopper> hopper) override;
bool openHorse(int iPad, std::shared_ptr<Inventory> inventory, bool openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container, std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) override; std::shared_ptr<EntityHorse> horse) override;
@@ -5,7 +5,6 @@
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.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/StartFeature.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.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/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.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/LevelRuleset.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include "minecraft/world/level/GameRules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
@@ -12,21 +12,21 @@
#include "app/common/DLC/DLCLocalisationFile.h" #include "app/common/DLC/DLCLocalisationFile.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.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/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/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h"
#include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.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/FileHeader.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "strings.h" #include "strings.h"
const char* GameRuleManager::wchTagNameA[] = { const char* GameRuleManager::wchTagNameA[] = {
@@ -223,8 +223,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn,
unsigned int bStringTableSize = dis2.readInt(); unsigned int bStringTableSize = dis2.readInt();
std::vector<uint8_t> bStringTable(bStringTableSize); std::vector<uint8_t> bStringTable(bStringTableSize);
dis2.read(bStringTable); dis2.read(bStringTable);
StringTable* strings = StringTable* strings = new StringTable(bStringTable, app.getLocale());
new StringTable(bStringTable.data(), bStringTable.size());
// Read RuleFile. // Read RuleFile.
std::vector<uint8_t> bRuleFile(content.size() - bStringTable.size()); std::vector<uint8_t> bRuleFile(content.size() - bStringTable.size());
@@ -641,7 +640,7 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
} }
void GameRuleManager::loadDefaultGameRules() { void GameRuleManager::loadDefaultGameRules() {
#if !defined(__linux__) #if 0
#if defined(_WINDOWS64) #if defined(_WINDOWS64)
File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck"); File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck");
if (!packedTutorialFile.exists()) if (!packedTutorialFile.exists())
@@ -657,6 +656,8 @@ void GameRuleManager::loadDefaultGameRules() {
app.GetString(IDS_TUTORIALSAVENAME)); app.GetString(IDS_TUTORIALSAVENAME));
} }
#else #else
// 4jcraft: brought over from TU18 so the tutorial world loads from assets
// TODO clean this up
std::string fpTutorial = "Tutorial.pck"; std::string fpTutorial = "Tutorial.pck";
if (app.getArchiveFileSize(fpTutorial) >= 0) { if (app.getArchiveFileSize(fpTutorial) >= 0) {
DLCPack* pack = new DLCPack("", 0xffffffff); DLCPack* pack = new DLCPack("", 0xffffffff);
@@ -8,9 +8,9 @@
#include <unordered_map> #include <unordered_map>
#include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.h" #include "app/common/GameRules/LevelRules/LevelRules.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class LevelGenerationOptions; class LevelGenerationOptions;
class RootGameRulesDefinition; class RootGameRulesDefinition;
@@ -27,8 +27,6 @@ class DLCGameRulesHeader;
class File; class File;
class LevelRuleset; class LevelRuleset;
#define GAME_RULE_SAVENAME "requiredGameRules.grf"
// 4J-JEV: // 4J-JEV:
#define LEVEL_GEN_ID int #define LEVEL_GEN_ID int
#define LEVEL_GEN_ID_NULL 0 #define LEVEL_GEN_ID_NULL 0
@@ -3,17 +3,17 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include "ConsoleSchematicFile.h" #include "app/common/Game.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 "java/InputOutputStream/DataOutputStream.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/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/AABB.h"
#include "util/StringHelpers.h"
ApplySchematicRuleDefinition::ApplySchematicRuleDefinition( ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
LevelGenerationOptions* levelGenOptions) { LevelGenerationOptions* levelGenOptions) {
@@ -4,9 +4,9 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include "ConsoleSchematicFile.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/AABB.h"
#include "minecraft/world/phys/Vec3.h" #include "minecraft/world/phys/Vec3.h"
@@ -1,10 +1,10 @@
#include "BiomeOverride.h" #include "BiomeOverride.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.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() { BiomeOverride::BiomeOverride() {
m_tile = 0; m_tile = 0;
@@ -4,8 +4,8 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class BiomeOverride : public GameRuleDefinition { class BiomeOverride : public GameRuleDefinition {
private: private:
@@ -4,20 +4,20 @@
#include <algorithm> #include <algorithm>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.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 "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Direction.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/Level.h"
#include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "util/StringHelpers.h"
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
m_x = m_y = m_z = 0; m_x = m_y = m_z = 0;
@@ -77,8 +77,8 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos,
dos->writeUTF(toWString(m_dimension)); dos->writeUTF(toWString(m_dimension));
} }
void ConsoleGenerateStructure::addAttribute( void ConsoleGenerateStructure::addAttribute(const std::string& attributeName,
const std::string& attributeName, const std::string& attributeValue) { const std::string& attributeValue) {
if (attributeName.compare("x") == 0) { if (attributeName.compare("x") == 0) {
int value = fromWString<int>(attributeValue); int value = fromWString<int>(attributeValue);
m_x = value; m_x = value;
@@ -2,8 +2,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h" #include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h"
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class ConsoleGenerateStructureAction : public GameRuleDefinition { class ConsoleGenerateStructureAction : public GameRuleDefinition {
public: public:
@@ -1,4 +1,4 @@
#include "LevelGenerationOptions.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include <limits.h> #include <limits.h>
#include <wchar.h> #include <wchar.h>
@@ -6,28 +6,27 @@
#include <unordered_set> #include <unordered_set>
#include <utility> #include <utility>
#include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" #include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h"
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.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/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/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/GameEnums.h"
#include "minecraft/Pos.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/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.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/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/AABB.h"
#include "platform/fs/fs.h" #include "platform/fs/fs.h"
@@ -441,8 +440,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
auto it = m_schematics.find(filename); auto it = m_schematics.find(filename);
if (it != m_schematics.end()) { if (it != m_schematics.end()) {
#if !defined(_CONTENT_PACKAGE) #if !defined(_CONTENT_PACKAGE)
printf("We have already loaded schematic file %s\n", printf("We have already loaded schematic file %s\n", filename.c_str());
filename.c_str());
#endif #endif
it->second->incrementRefCount(); it->second->incrementRefCount();
return it->second; return it->second;
@@ -471,8 +469,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
return schematic; return schematic;
} }
void LevelGenerationOptions::releaseSchematicFile( void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) {
const std::string& filename) {
// 4J Stu - We don't want to delete them when done, but probably want to // 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 // keep a set of active schematics for the current world
// auto it = m_schematics.find(filename); // auto it = m_schematics.find(filename);
@@ -556,7 +553,7 @@ void LevelGenerationOptions::loadBaseSaveData() {
[this](int pad, std::uint32_t err, std::uint32_t lic) { [this](int pad, std::uint32_t err, std::uint32_t lic) {
return onPackMounted(pad, err, lic); return onPackMounted(pad, err, lic);
}, },
"WPACK") != ERROR_IO_PENDING) { "WPACK") != 997 /* ERROR_IO_PENDING */) {
// corrupt DLC // corrupt DLC
setLoadedData(); setLoadedData();
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n", 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) { uint32_t dwLicenceMask) {
LevelGenerationOptions* lgo = this; LevelGenerationOptions* lgo = this;
lgo->m_bLoadingData = false; lgo->m_bLoadingData = false;
if (dwErr != ERROR_SUCCESS) { if (dwErr != 0 /* ERROR_SUCCESS */) {
// corrupt DLC // corrupt DLC
app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad, app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad,
dwErr); dwErr);
@@ -628,7 +625,8 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
auto readResult = PlatformFilesystem.readFile( auto readResult = PlatformFilesystem.readFile(
save.getPath(), pbData, dwFileSize); save.getPath(), pbData, dwFileSize);
if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { if (readResult.status !=
IPlatformFilesystem::ReadStatus::Ok) {
app.FatalLoadError(); app.FatalLoadError();
} }
@@ -2,7 +2,7 @@
#include <algorithm> #include <algorithm>
#include "LevelGenerationOptions.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
LevelGenerators::LevelGenerators() {} LevelGenerators::LevelGenerators() {}
@@ -1,10 +1,10 @@
#include "StartFeature.h" #include "StartFeature.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.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() { StartFeature::StartFeature() {
m_chunkX = 0; m_chunkX = 0;
@@ -3,8 +3,8 @@
#include <string> #include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeature.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h"
class StartFeature : public GameRuleDefinition { class StartFeature : public GameRuleDefinition {
@@ -1,12 +1,12 @@
#include "XboxStructureActionGenerateBox.h" #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/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 "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 "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "util/StringHelpers.h"
XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() { XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() {
m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0; m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0;
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <string> #include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece; class StructurePiece;
class Level; class Level;
@@ -1,12 +1,12 @@
#include "XboxStructureActionPlaceBlock.h" #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/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 "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 "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "util/StringHelpers.h"
XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() { XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() {
m_x = m_y = m_z = m_tile = m_data = 0; m_x = m_y = m_z = m_tile = m_data = 0;
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <string> #include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece; class StructurePiece;
class Level; class Level;
@@ -4,17 +4,17 @@
#include <memory> #include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.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/Container.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h" #include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h"
#include "util/StringHelpers.h"
XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() { XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() {
m_tile = Tile::chest_Id; m_tile = Tile::chest_Id;
@@ -3,8 +3,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h" #include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class AddItemRuleDefinition; class AddItemRuleDefinition;
class StructurePiece; class StructurePiece;
@@ -4,9 +4,9 @@
#include <memory> #include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h" #include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h"
@@ -33,9 +33,8 @@ void XboxStructureActionPlaceSpawner::addAttribute(
if (attributeName.compare("entity") == 0) { if (attributeName.compare("entity") == 0) {
m_entityId = attributeValue; m_entityId = attributeValue;
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf( printf("XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n",
"XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n", m_entityId.c_str());
m_entityId.c_str());
#endif #endif
} else { } else {
XboxStructureActionPlaceBlock::addAttribute(attributeName, XboxStructureActionPlaceBlock::addAttribute(attributeName,
@@ -2,8 +2,8 @@
#include <string> #include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h" #include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece; class StructurePiece;
class Level; class Level;
@@ -3,10 +3,7 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/EnchantedBookItem.h"
#include "minecraft/world/item/Item.h" #include "minecraft/world/item/Item.h"
@@ -14,6 +11,9 @@
#include "minecraft/world/item/enchantment/Enchantment.h" #include "minecraft/world/item/enchantment/Enchantment.h"
#include "minecraft/world/item/enchantment/EnchantmentCategory.h" #include "minecraft/world/item/enchantment/EnchantmentCategory.h"
#include "minecraft/world/item/enchantment/EnchantmentInstance.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() { AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() {
m_enchantmentId = m_enchantmentLevel = 0; m_enchantmentId = m_enchantmentLevel = 0;
@@ -3,8 +3,8 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class ItemInstance; class ItemInstance;
@@ -3,14 +3,14 @@
#include <algorithm> #include <algorithm>
#include "AddEnchantmentRuleDefinition.h" #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 "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/Container.h" #include "minecraft/world/Container.h"
#include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/item/Item.h" #include "minecraft/world/item/Item.h"
#include "minecraft/world/item/ItemInstance.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() { AddItemRuleDefinition::AddItemRuleDefinition() {
m_itemId = m_quantity = m_auxValue = m_dataTag = 0; m_itemId = m_quantity = m_auxValue = m_dataTag = 0;
@@ -4,8 +4,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class Container; class Container;
class AddEnchantmentRuleDefinition; class AddEnchantmentRuleDefinition;
@@ -1,15 +1,15 @@
#include "CollectItemRuleDefinition.h" #include "CollectItemRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.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 "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/network/Connection.h" #include "minecraft/network/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h"
#include "minecraft/world/item/ItemInstance.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() { CollectItemRuleDefinition::CollectItemRuleDefinition() {
m_itemId = 0; m_itemId = 0;
@@ -111,8 +111,7 @@ std::string CollectItemRuleDefinition::generateXml(
"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" " "\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
"promptName=\"OPTIONAL\""; "promptName=\"OPTIONAL\"";
if (item->getAuxValue() != 0) if (item->getAuxValue() != 0)
xml += xml += " auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
" auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
if (item->get4JData() != 0) if (item->get4JData() != 0)
xml += " dataTag=\"" + toWString<int>(item->get4JData()) + "\""; xml += " dataTag=\"" + toWString<int>(item->get4JData()) + "\"";
xml += "/>\n"; xml += "/>\n";
@@ -3,9 +3,9 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h"
class Pos; class Pos;
class UseTileRuleDefinition; class UseTileRuleDefinition;
@@ -4,13 +4,13 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.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/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.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( void CompleteAllRuleDefinition::getChildren(
std::vector<GameRuleDefinition*>* children) { std::vector<GameRuleDefinition*>* children) {
@@ -3,7 +3,7 @@
#include <string> #include <string>
#include "CompoundGameRuleDefinition.h" #include "CompoundGameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
class GameRule; class GameRule;
@@ -25,8 +25,8 @@ public:
virtual bool onCollectItem(GameRule* rule, virtual bool onCollectItem(GameRule* rule,
std::shared_ptr<ItemInstance> item); std::shared_ptr<ItemInstance> item);
static std::string generateDescriptionString( static std::string generateDescriptionString(const std::string& description,
const std::string& description, void* data, int dataLength); void* data, int dataLength);
private: private:
void updateStatus(GameRule* rule); void updateStatus(GameRule* rule);
@@ -7,14 +7,14 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.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/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include "minecraft/world/level/ConsoleGameRulesConstants.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 "util/StringHelpers.h" #include "util/StringHelpers.h"
CompoundGameRuleDefinition::CompoundGameRuleDefinition() { CompoundGameRuleDefinition::CompoundGameRuleDefinition() {
@@ -2,9 +2,9 @@
#include <vector> #include <vector>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h"
class CompoundGameRuleDefinition : public GameRuleDefinition { class CompoundGameRuleDefinition : public GameRuleDefinition {
protected: protected:
@@ -1,4 +1,4 @@
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include <assert.h> #include <assert.h>
#include <wchar.h> #include <wchar.h>
@@ -8,14 +8,14 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.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 "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; class Connection;
@@ -66,7 +66,7 @@ GameRuleDefinition* GameRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) { ConsoleGameRules::EGameRuleType ruleType) {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n", printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n",
ruleType); ruleType);
#endif #endif
return nullptr; return nullptr;
} }
@@ -77,13 +77,13 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_descriptionId = attributeValue; m_descriptionId = attributeValue;
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter descriptionId=%s\n", printf("GameRuleDefinition: Adding parameter descriptionId=%s\n",
m_descriptionId.c_str()); m_descriptionId.c_str());
#endif #endif
} else if (attributeName.compare("promptName") == 0) { } else if (attributeName.compare("promptName") == 0) {
m_promptId = attributeValue; m_promptId = attributeValue;
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter m_promptId=%s\n", printf("GameRuleDefinition: Adding parameter m_promptId=%s\n",
m_promptId.c_str()); m_promptId.c_str());
#endif #endif
} else if (attributeName.compare("dataTag") == 0) { } else if (attributeName.compare("dataTag") == 0) {
m_4JDataValue = fromWString<int>(attributeValue); m_4JDataValue = fromWString<int>(attributeValue);
@@ -92,9 +92,8 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_4JDataValue); m_4JDataValue);
} else { } else {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf( printf("GameRuleDefinition: Attempted to add invalid attribute: %s\n",
"GameRuleDefinition: Attempted to add invalid attribute: %s\n", attributeName.c_str());
attributeName.c_str());
#endif #endif
} }
} }
@@ -1,9 +1,9 @@
#include "LevelRuleset.h" #include "LevelRuleset.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.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; class AABB;
@@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include "CompoundGameRuleDefinition.h" #include "CompoundGameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
class NamedAreaRuleDefinition; class NamedAreaRuleDefinition;
class AABB; class AABB;
@@ -2,11 +2,11 @@
#include <wchar.h> #include <wchar.h>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.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() { NamedAreaRuleDefinition::NamedAreaRuleDefinition() {
m_name = ""; m_name = "";
@@ -41,7 +41,7 @@ void NamedAreaRuleDefinition::addAttribute(const std::string& attributeName,
m_name = attributeValue; m_name = attributeValue;
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("NamedAreaRuleDefinition: Adding parameter name=%s\n", printf("NamedAreaRuleDefinition: Adding parameter name=%s\n",
m_name.c_str()); m_name.c_str());
#endif #endif
} else if (attributeName.compare("x0") == 0) { } else if (attributeName.compare("x0") == 0) {
m_area.x0 = fromWString<int>(attributeValue); m_area.x0 = fromWString<int>(attributeValue);
@@ -2,8 +2,8 @@
#include <string> #include <string>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/AABB.h"
class NamedAreaRuleDefinition : public GameRuleDefinition { class NamedAreaRuleDefinition : public GameRuleDefinition {
@@ -4,16 +4,16 @@
#include <memory> #include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/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 "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Pos.h" #include "minecraft/Pos.h"
#include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/food/FoodData.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() { UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() {
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false; m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;
@@ -4,8 +4,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class AddItemRuleDefinition; class AddItemRuleDefinition;
class Pos; class Pos;
@@ -1,10 +1,10 @@
#include "UseTileRuleDefinition.h" #include "UseTileRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.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() { UseTileRuleDefinition::UseTileRuleDefinition() {
m_tileId = -1; m_tileId = -1;
@@ -3,9 +3,9 @@
#include <string> #include <string>
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/Pos.h" #include "minecraft/Pos.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class UseTileRuleDefinition : public GameRuleDefinition { class UseTileRuleDefinition : public GameRuleDefinition {
private: private:
@@ -1,5 +1,5 @@
#include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include "minecraft/world/level/GameRules/GameRule.h"
#include <wchar.h> #include <wchar.h>
@@ -8,10 +8,9 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
class Connection; class Connection;
class ItemInstance; class ItemInstance;
@@ -33,15 +32,14 @@ GameRule::ValueType GameRule::getParameter(const std::string& parameterName) {
if (m_parameters.find(parameterName) == m_parameters.end()) { if (m_parameters.find(parameterName) == m_parameters.end()) {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("WARNING: Parameter %s was not set before being fetched\n", printf("WARNING: Parameter %s was not set before being fetched\n",
parameterName.c_str()); parameterName.c_str());
assert(0); assert(0);
#endif #endif
} }
return m_parameters[parameterName]; return m_parameters[parameterName];
} }
void GameRule::setParameter(const std::string& parameterName, void GameRule::setParameter(const std::string& parameterName, ValueType value) {
ValueType value) {
if (m_parameters.find(parameterName) == m_parameters.end()) { if (m_parameters.find(parameterName) == m_parameters.end()) {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("Adding parameter %s to GameRule\n", parameterName.c_str()); printf("Adding parameter %s to GameRule\n", parameterName.c_str());
+42 -44
View File
@@ -1,12 +1,15 @@
#include "app/common/GameSettingsManager.h" #include "app/common/GameSettingsManager.h"
#include <cstring>
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Game.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/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h" #include "app/common/UI/ConsoleUIController.h"
#include "app/linux/Linux_UIController.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/Minecraft.h"
#include "minecraft/client/Options.h" #include "minecraft/client/Options.h"
#include "minecraft/client/gui/Gui.h" #include "minecraft/client/gui/Gui.h"
@@ -17,15 +20,14 @@
#include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/skins/TexturePackRepository.h"
#include "minecraft/server/MinecraftServer.h" #include "minecraft/server/MinecraftServer.h"
#include "minecraft/server/PlayerList.h" #include "minecraft/server/PlayerList.h"
#include "minecraft/server/ServerAction.h"
#include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/level/ServerPlayer.h"
#include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/Tile.h"
#include "platform/input/input.h" #include "platform/input/input.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/renderer/renderer.h" #include "platform/renderer/renderer.h"
#include "platform/storage/storage.h" #include "platform/storage/storage.h"
#include "app/common/Audio/SoundEngine.h"
#include <cstring>
GameSettingsManager::GameSettingsManager() { GameSettingsManager::GameSettingsManager() {
memset(GameSettingsA, 0, sizeof(GameSettingsA)); memset(GameSettingsA, 0, sizeof(GameSettingsA));
@@ -39,17 +41,10 @@ void GameSettingsManager::initGameSettings() {
// clear the flag to say the settings have changed // clear the flag to say the settings have changed
GameSettingsA[i]->bSettingsChanged = false; GameSettingsA[i]->bSettingsChanged = false;
#if defined(_WINDOWS64)
IPlatformProfile::PROFILESETTINGS* pProfileSettings = IPlatformProfile::PROFILESETTINGS* pProfileSettings =
PlatformProfile.GetDashboardProfileSettings(i); PlatformProfile.GetDashboardProfileSettings(i);
memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS)); memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS));
setDefaultOptions(pProfileSettings, i); 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); setGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0);
if (!app.GetGameStarted()) { if (!app.GetGameStarted()) {
GameSettingsA[iPad]->ucLanguage = GameSettingsA[iPad]->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT;
MINECRAFT_LANGUAGE_DEFAULT; GameSettingsA[iPad]->ucLocale = MINECRAFT_LANGUAGE_DEFAULT;
GameSettingsA[iPad]->ucLocale =
MINECRAFT_LANGUAGE_DEFAULT;
} }
return 0; return 0;
} }
int GameSettingsManager::defaultOptionsCallback( int GameSettingsManager::defaultOptionsCallback(
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
Game* pApp = (Game*)pParam; Game* pApp = (Game*)pParam;
pApp->DebugPrintf("Setting default options for player %d", iPad); pApp->DebugPrintf("Setting default options for player %d", iPad);
@@ -194,8 +188,7 @@ int GameSettingsManager::oldProfileVersionCallback(
pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND; pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND;
pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM; pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM;
pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES; pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES;
pGameSettings->uiBitmaskValues |= pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800);
(GAMESETTING_UISIZE & 0x00000800);
pGameSettings->uiBitmaskValues |= pGameSettings->uiBitmaskValues |=
(GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000);
pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER;
@@ -283,8 +276,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
if (bInGame && g_NetworkManager.IsHost() && if (bInGame && g_NetworkManager.IsHost() &&
(iPad == PlatformProfile.GetPrimaryPad())) { (iPad == PlatformProfile.GetPrimaryPad())) {
app.SetXuiServerAction( MinecraftServer::getInstance()->queueServerAction(
iPad, eXuiServerAction_ServerSettingChanged_Difficulty); minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
Difficulty});
} }
} else { } else {
app.DebugPrintf( app.DebugPrintf(
@@ -309,30 +304,30 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
case eGameSetting_ControlSouthPaw: case eGameSetting_ControlSouthPaw:
if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { if (GameSettingsA[iPad]->usBitmaskValues & 0x80) {
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX,
AXIS_MAP_RX); AXIS_MAP_RX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY,
AXIS_MAP_RY); AXIS_MAP_RY);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX,
AXIS_MAP_LX); AXIS_MAP_LX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY,
AXIS_MAP_LY); AXIS_MAP_LY);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0,
TRIGGER_MAP_1); TRIGGER_MAP_1);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1,
TRIGGER_MAP_0); TRIGGER_MAP_0);
} else { } else {
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX,
AXIS_MAP_LX); AXIS_MAP_LX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY,
AXIS_MAP_LY); AXIS_MAP_LY);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX,
AXIS_MAP_RX); AXIS_MAP_RX);
PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY,
AXIS_MAP_RY); AXIS_MAP_RY);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0,
TRIGGER_MAP_0); TRIGGER_MAP_0);
PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1,
TRIGGER_MAP_1); TRIGGER_MAP_1);
} }
break; break;
case eGameSetting_SplitScreenVertical: case eGameSetting_SplitScreenVertical:
@@ -350,8 +345,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
eGameHostOption_Gamertags, eGameHostOption_Gamertags,
((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1
: 0); : 0);
app.SetXuiServerAction( MinecraftServer::getInstance()->queueServerAction(
iPad, eXuiServerAction_ServerSettingChanged_Gamertags); minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
Gamertags});
PlayerList* players = PlayerList* players =
MinecraftServer::getInstance()->getPlayerList(); MinecraftServer::getInstance()->getPlayerList();
@@ -407,8 +404,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) {
app.SetGameHostOption( app.SetGameHostOption(
eGameHostOption_BedrockFog, eGameHostOption_BedrockFog,
getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0);
app.SetXuiServerAction( MinecraftServer::getInstance()->queueServerAction(
iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); minecraft::server::BroadcastSettingChanged{
minecraft::server::BroadcastSettingChanged::Kind::
BedrockFog});
} }
} break; } break;
case eGameSetting_DisplayHUD: case eGameSetting_DisplayHUD:
@@ -464,8 +463,7 @@ unsigned char GameSettingsManager::getMinecraftLanguage(int iPad) {
} }
} }
void GameSettingsManager::setMinecraftLocale(int iPad, void GameSettingsManager::setMinecraftLocale(int iPad, unsigned char ucLocale) {
unsigned char ucLocale) {
GameSettingsA[iPad]->ucLocale = ucLocale; GameSettingsA[iPad]->ucLocale = ucLocale;
GameSettingsA[iPad]->bSettingsChanged = true; GameSettingsA[iPad]->bSettingsChanged = true;
} }
@@ -1345,8 +1343,8 @@ void GameSettingsManager::setGameHostOption(unsigned int& uiHostSettings,
} }
} }
unsigned int GameSettingsManager::getGameHostOption( unsigned int GameSettingsManager::getGameHostOption(unsigned int uiHostSettings,
unsigned int uiHostSettings, eGameHostOption eVal) { eGameHostOption eVal) {
switch (eVal) { switch (eVal) {
case eGameHostOption_FriendsOfFriends: case eGameHostOption_FriendsOfFriends:
return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS);
+6 -5
View File
@@ -3,8 +3,8 @@
#include <cstdint> #include <cstdint>
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "platform/profile/profile.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/profile/profile.h"
class GameSettingsManager { class GameSettingsManager {
public: public:
@@ -14,9 +14,9 @@ public:
static int oldProfileVersionCallback(void* pParam, unsigned char* pucData, static int oldProfileVersionCallback(void* pParam, unsigned char* pucData,
const unsigned short usVersion, const unsigned short usVersion,
const int iPad); const int iPad);
static int defaultOptionsCallback(void* pParam, static int defaultOptionsCallback(
IPlatformProfile::PROFILESETTINGS* pSettings, void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad); const int iPad);
int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad); const int iPad);
@@ -64,7 +64,8 @@ public:
static void setActionConfirmed(void* param); static void setActionConfirmed(void* param);
// Saving message // 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 array - public, referenced by Game via alias
GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT];
+25 -19
View File
@@ -1,16 +1,15 @@
#include "app/common/App_Defines.h" #include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/Game.h" #include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.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/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/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h" #include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/ProgressRenderer.h"
@@ -28,10 +27,12 @@
#include "minecraft/server/MinecraftServer.h" #include "minecraft/server/MinecraftServer.h"
#include "minecraft/stats/StatsCounter.h" #include "minecraft/stats/StatsCounter.h"
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/game/game.h"
#include "platform/network/network.h"
#include "platform/profile/profile.h" #include "platform/profile/profile.h"
#include "platform/storage/storage.h" #include "platform/storage/storage.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
#include "app/common/Audio/SoundEngine.h" #include "strings.h"
void Game::HandleXuiActions(void) { void Game::HandleXuiActions(void) {
eXuiAction eAction; eXuiAction eAction;
@@ -215,8 +216,8 @@ void Game::HandleXuiActions(void) {
// app.CloseAllPlayersXuiScenes(); // app.CloseAllPlayersXuiScenes();
// Hide the other players scenes // Hide the other players scenes
ui.ShowOtherPlayersBaseScene(PlatformProfile.GetPrimaryPad(), ui.ShowOtherPlayersBaseScene(
false); PlatformProfile.GetPrimaryPad(), false);
// This just allows it to be shown // This just allows it to be shown
if (pMinecraft if (pMinecraft
@@ -454,13 +455,13 @@ void Game::HandleXuiActions(void) {
for (int j = 0; j < XUSER_MAX_COUNT; j++) { for (int j = 0; j < XUSER_MAX_COUNT; j++) {
if (pMinecraft->localplayers[j]) { if (pMinecraft->localplayers[j]) {
if (g_NetworkManager.IsLocalGame()) { if (g_NetworkManager.IsLocalGame()) {
app.SetRichPresenceContext( PlatformGame.SetRichPresenceContext(
j, CONTEXT_GAME_STATE_BLANK); j, CONTEXT_GAME_STATE_BLANK);
PlatformProfile.SetCurrentGameActivity( PlatformProfile.SetCurrentGameActivity(
j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,
false); false);
} else { } else {
app.SetRichPresenceContext( PlatformGame.SetRichPresenceContext(
j, CONTEXT_GAME_STATE_BLANK); j, CONTEXT_GAME_STATE_BLANK);
PlatformProfile.SetCurrentGameActivity( PlatformProfile.SetCurrentGameActivity(
j, CONTEXT_PRESENCE_MULTIPLAYER, false); j, CONTEXT_PRESENCE_MULTIPLAYER, false);
@@ -468,7 +469,8 @@ void Game::HandleXuiActions(void) {
} }
} }
} else { } else {
app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); PlatformGame.SetRichPresenceContext(
i, CONTEXT_GAME_STATE_BLANK);
if (g_NetworkManager.IsLocalGame()) { if (g_NetworkManager.IsLocalGame()) {
PlatformProfile.SetCurrentGameActivity( PlatformProfile.SetCurrentGameActivity(
i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,
@@ -992,10 +994,12 @@ void Game::HandleXuiActions(void) {
// need to stop the streaming audio - by playing // need to stop the streaming audio - by playing
// streaming audio from the default texture pack now // streaming audio from the default texture pack now
// reset the streaming sounds back to the normal ones // reset the streaming sounds back to the normal ones
pMinecraft->soundEngine->SetStreamingSounds( static_cast<SoundEngine*>(pMinecraft->soundEngine)
eStream_Overworld_Calm1, eStream_Overworld_piano3, ->SetStreamingSounds(
eStream_Nether1, eStream_Nether4, eStream_Overworld_Calm1,
eStream_end_dragon, eStream_end_end, eStream_CD_1); eStream_Overworld_piano3, eStream_Nether1,
eStream_Nether4, eStream_end_dragon,
eStream_end_end, eStream_CD_1);
pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1, pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1,
1); 1);
@@ -1148,7 +1152,8 @@ void Game::HandleXuiActions(void) {
} break; } break;
case eAppAction_SetDefaultOptions: case eAppAction_SetDefaultOptions:
SetAction(i, eAppAction_Idle); SetAction(i, eAppAction_Idle);
SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param, i); SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param,
i);
// if the profile data has been changed, then force a // if the profile data has been changed, then force a
// profile write It seems we're allowed to break the 5 // profile write It seems we're allowed to break the 5
@@ -1211,10 +1216,11 @@ void Game::HandleXuiActions(void) {
case eAppAction_FailedToJoinNoPrivileges: { case eAppAction_FailedToJoinNoPrivileges: {
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IPlatformStorage::EMessageResult result =
IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, ui.RequestErrorMessage(
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
PlatformProfile.GetPrimaryPad()); IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
PlatformProfile.GetPrimaryPad());
if (result != IPlatformStorage::EMessage_Busy) if (result != IPlatformStorage::EMessage_Busy)
SetAction(i, eAppAction_Idle); SetAction(i, eAppAction_Idle);
} break; } break;
@@ -1,17 +1,20 @@
#define GDRAW_ASSERTS #define GDRAW_ASSERTS
#include "gdraw.h" #include "gdraw.h"
#if defined(_WIN32)
#include <GL/gl.h> #define WIN32_LEAN_AND_MEAN
#include <dlfcn.h> #define NOMINMAX
#include <windows.h>
#endif
#include <GL/glew.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "app/linux/Iggy/include/iggy.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "app/common/Iggy/include/iggy.h"
#ifndef _ENABLEIGGY #ifndef _ENABLEIGGY
void* IggyGDrawMallocAnnotated(SINTa size, const char* file, int line) { void* IggyGDrawMallocAnnotated(SINTa size, const char* file, int line) {
@@ -38,23 +41,23 @@ void IggyDiscardVertexBufferCallback(void* owner, void* buf) {
} }
#endif #endif
static void* get_gl_proc(const char* name) { // static void* get_gl_proc(const char* name) {
void* p = SDL_GL_GetProcAddress(name); // void* p = SDL_GL_GetProcAddress(name);
if (!p) p = dlsym(RTLD_DEFAULT, name); // if (!p) p = dlsym(RTLD_DEFAULT, name);
if (!p) { // if (!p) {
char buf[256]; // char buf[256];
strncpy(buf, name, sizeof(buf) - 1); // strncpy(buf, name, sizeof(buf) - 1);
buf[255] = '\0'; // buf[255] = '\0';
char* ext = strstr(buf, "ARB"); // char* ext = strstr(buf, "ARB");
if (!ext) ext = strstr(buf, "EXT"); // if (!ext) ext = strstr(buf, "EXT");
if (ext && ext == buf + strlen(buf) - 3) { // if (ext && ext == buf + strlen(buf) - 3) {
*ext = '\0'; // *ext = '\0';
p = SDL_GL_GetProcAddress(buf); // p = SDL_GL_GetProcAddress(buf);
if (!p) p = dlsym(RTLD_DEFAULT, buf); // if (!p) p = dlsym(RTLD_DEFAULT, buf);
} // }
} // }
return p; // return p;
} // }
#define GDRAW_GL_EXTENSION_LIST \ #define GDRAW_GL_EXTENSION_LIST \
/* identifier import procname */ \ /* identifier import procname */ \
@@ -129,33 +132,33 @@ typedef gdraw_gl_resourcetype gdraw_resourcetype;
GDRAW_GL_EXTENSION_LIST GDRAW_GL_EXTENSION_LIST
#undef GLE #undef GLE
typedef const GLubyte*(APIENTRYP PFNGLGETSTRINGIPROC_)(GLenum name, typedef const GLubyte*(APIENTRY* PFNGLGETSTRINGIPROC_)(GLenum name,
GLuint index); GLuint index);
static PFNGLGETSTRINGIPROC_ gdraw_glGetStringi = NULL; static PFNGLGETSTRINGIPROC_ gdraw_glGetStringi = NULL;
typedef void(APIENTRYP PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays); typedef void(APIENTRY* PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays);
typedef void(APIENTRYP PFNGLBINDVERTEXARRAYPROC_)(GLuint array); typedef void(APIENTRY* PFNGLBINDVERTEXARRAYPROC_)(GLuint array);
static PFNGLGENVERTEXARRAYSPROC_ gdraw_glGenVertexArrays = NULL; static PFNGLGENVERTEXARRAYSPROC_ gdraw_glGenVertexArrays = NULL;
static PFNGLBINDVERTEXARRAYPROC_ gdraw_glBindVertexArray = NULL; static PFNGLBINDVERTEXARRAYPROC_ gdraw_glBindVertexArray = NULL;
static GLuint gdraw_vao = 0; 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*); GLsizei, const void*);
static gdraw_vtxattrib_fn gdraw_real_vtxattrib = NULL; static gdraw_vtxattrib_fn gdraw_real_vtxattrib = NULL;
static GLuint gdraw_screenvbo = 0; static GLuint gdraw_screenvbo = 0;
static const void* gdraw_screenvbo_base = NULL; static const void* gdraw_screenvbo_base = NULL;
static size_t gdraw_expected_vbo_size = 0; 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); GLenum type, const void* indices);
static gdraw_drawelements_fn gdraw_real_drawelements = NULL; static gdraw_drawelements_fn gdraw_real_drawelements = NULL;
static GLuint gdraw_screenibo = 0; static GLuint gdraw_screenibo = 0;
typedef GLuint(APIENTRYP gdraw_createshader_fn)(GLenum); typedef GLuint(APIENTRY* gdraw_createshader_fn)(GLenum);
typedef void(APIENTRYP gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**, typedef void(APIENTRY* gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**,
const GLint*); const GLint*);
typedef void(APIENTRYP gdraw_compileshader_fn)(GLuint); typedef void(APIENTRY* gdraw_compileshader_fn)(GLuint);
typedef void(APIENTRYP gdraw_linkprogram_fn)(GLuint); typedef void(APIENTRY* gdraw_linkprogram_fn)(GLuint);
static gdraw_createshader_fn gdraw_real_createshader = NULL; static gdraw_createshader_fn gdraw_real_createshader = NULL;
static gdraw_shadersource_fn gdraw_real_shadersource = NULL; static gdraw_shadersource_fn gdraw_real_shadersource = NULL;
static gdraw_compileshader_fn gdraw_real_compileshader = 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 // 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 gdraw_useprogram_fn gdraw_real_useprogram = NULL;
static GLuint gdraw_null_program = 0; 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, GLsizei, GLint, GLenum, GLenum,
const void*); 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, GLsizei, GLsizei, GLenum, GLenum,
const void*); const void*);
static gdraw_teximage2d_fn gdraw_real_teximage2d = NULL; static gdraw_teximage2d_fn gdraw_real_teximage2d = NULL;
static gdraw_texsubimage2d_fn gdraw_real_texsubimage2d = NULL; static gdraw_texsubimage2d_fn gdraw_real_texsubimage2d = NULL;
#define TRY(ptr, arb, core) \ #define TRY(ptr, arb, core) \
do { \ do { \
void* _p = get_gl_proc(core); \ void* _p = SDL_GL_GetProcAddress(core); \
if (!_p) _p = get_gl_proc(arb); \ if (!_p) _p = SDL_GL_GetProcAddress(arb); \
*(void**)&(ptr) = _p; \ *(void**)&(ptr) = _p; \
} while (0) } while (0)
static void load_extensions(void) { static void load_extensions(void) {
// gl_shared requires ts shit ugh // gl_shared requires ts shit ugh
#define GLE(id, import, procname) \ #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 GDRAW_GL_EXTENSION_LIST
#undef GLE #undef GLE
@@ -248,26 +251,30 @@ static void load_extensions(void) {
// Save raw pointers before we #define over the names below // Save raw pointers before we #define over the names below
gdraw_real_vtxattrib = gdraw_real_vtxattrib =
(gdraw_vtxattrib_fn)get_gl_proc("glVertexAttribPointer"); (gdraw_vtxattrib_fn)SDL_GL_GetProcAddress("glVertexAttribPointer");
gdraw_real_createshader = gdraw_real_createshader =
(gdraw_createshader_fn)get_gl_proc("glCreateShader"); (gdraw_createshader_fn)SDL_GL_GetProcAddress("glCreateShader");
gdraw_real_shadersource = gdraw_real_shadersource =
(gdraw_shadersource_fn)get_gl_proc("glShaderSource"); (gdraw_shadersource_fn)SDL_GL_GetProcAddress("glShaderSource");
gdraw_real_compileshader = gdraw_real_compileshader =
(gdraw_compileshader_fn)get_gl_proc("glCompileShader"); (gdraw_compileshader_fn)SDL_GL_GetProcAddress("glCompileShader");
gdraw_real_linkprogram = (gdraw_linkprogram_fn)get_gl_proc("glLinkProgram"); gdraw_real_linkprogram =
gdraw_real_teximage2d = (gdraw_teximage2d_fn)get_gl_proc("glTexImage2D"); (gdraw_linkprogram_fn)SDL_GL_GetProcAddress("glLinkProgram");
gdraw_real_teximage2d =
(gdraw_teximage2d_fn)SDL_GL_GetProcAddress("glTexImage2D");
gdraw_real_texsubimage2d = gdraw_real_texsubimage2d =
(gdraw_texsubimage2d_fn)get_gl_proc("glTexSubImage2D"); (gdraw_texsubimage2d_fn)SDL_GL_GetProcAddress("glTexSubImage2D");
gdraw_real_useprogram = (gdraw_useprogram_fn)get_gl_proc("glUseProgram"); gdraw_real_useprogram =
(gdraw_useprogram_fn)SDL_GL_GetProcAddress("glUseProgram");
gdraw_real_drawelements = 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 = gdraw_glGenVertexArrays =
(PFNGLGENVERTEXARRAYSPROC_)get_gl_proc("glGenVertexArrays"); (PFNGLGENVERTEXARRAYSPROC_)SDL_GL_GetProcAddress("glGenVertexArrays");
gdraw_glBindVertexArray = gdraw_glBindVertexArray =
(PFNGLBINDVERTEXARRAYPROC_)get_gl_proc("glBindVertexArray"); (PFNGLBINDVERTEXARRAYPROC_)SDL_GL_GetProcAddress("glBindVertexArray");
if (gdraw_glGenVertexArrays && gdraw_glBindVertexArray && gdraw_vao == 0) { if (gdraw_glGenVertexArrays && gdraw_glBindVertexArray && gdraw_vao == 0) {
gdraw_glGenVertexArrays(1, &gdraw_vao); gdraw_glGenVertexArrays(1, &gdraw_vao);
@@ -688,7 +695,7 @@ static void gdraw_FramebufferRenderbufferSafe(GLenum target, GLenum attachment,
#define glFramebufferRenderbuffer_SAFE gdraw_FramebufferRenderbufferSafe #define glFramebufferRenderbuffer_SAFE gdraw_FramebufferRenderbufferSafe
#define glFramebufferRenderbuffer glFramebufferRenderbuffer_SAFE #define glFramebufferRenderbuffer glFramebufferRenderbuffer_SAFE
#include "app/windows/Iggy/gdraw/gdraw_gl_shared.inl" #include "gdraw_gl_shared.inl"
#undef glVertexAttribPointer #undef glVertexAttribPointer
#define glVertexAttribPointer gdraw_real_vtxattrib #define glVertexAttribPointer gdraw_real_vtxattrib
@@ -1,9 +1,9 @@
#ifndef __LINUX_IGGY_GDRAW_H__ #ifndef __LINUX_IGGY_GDRAW_H__
#define __LINUX_IGGY_GDRAW_H__ #define __LINUX_IGGY_GDRAW_H__
#include "app/linux/Iggy/include/rrCore.h" #include "app/common/Iggy/include/gdraw.h"
#include "app/windows/Iggy/include/gdraw.h" #include "app/common/Iggy/include/iggy.h"
#include "app/windows/Iggy/include/iggy.h" #include "app/common/Iggy/include/rrCore.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -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(void) { return vshader_vsglihud_arr[0]; }
static char* vshader_vsglihud_vars[] = {"worldview", "material", "textmode", static char* vshader_vsglihud_vars[] = {"worldview", "material", "textmode",
NULL}; NULL};
@@ -2692,4 +2692,4 @@ void gdraw_GLx_(DestroyContext)(void) {
opengl_check(); opengl_check();
free_gdraw(); free_gdraw();
} }

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