2 Commits

Author SHA1 Message Date
DecalOverdose 31ca5ff0fb Merge pull request #419 from silverhadch/inputs
Update Inputs.
2026-04-09 12:23:45 +04:00
Hadi Chokr 96bd7d36ba Update Inputs. 2026-04-09 09:50:56 +02:00
1053 changed files with 26095 additions and 10292 deletions
Generated
+6 -6
View File
@@ -62,11 +62,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1775036866,
"narHash": "sha256-ZojAnPuCdy657PbTq5V0Y+AHKhZAIwSIT2cb8UgAz/U=",
"lastModified": 1775423009,
"narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6201e203d09599479a3b3450ed24fa81537ebc4e",
"rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
"type": "github"
},
"original": {
@@ -108,11 +108,11 @@
"simdutf": {
"flake": false,
"locked": {
"lastModified": 1775095916,
"narHash": "sha256-eKMjANt0fbqemtll6iSiFHwYzGWAsuZoVqOXqXNfodc=",
"lastModified": 1775422815,
"narHash": "sha256-ybQGXx7ULmlaiNUEEAGJurblG3sA1HzLTuXE8t/LFnM=",
"owner": "simdutf",
"repo": "simdutf",
"rev": "1ac2c2245ce9df6a7d26550e34734882c4a16e9b",
"rev": "06258b2c046d233fa53957cced61bc279fadfb41",
"type": "github"
},
"original": {
+50 -66
View File
@@ -1,21 +1,16 @@
# MARK: build configuration
project(
'4jcraft',
['cpp', 'c'],
version: '0.1.0',
meson_version: '>= 1.3',
default_options: [
'cpp_std=c++20',
'warning_level=0',
'unity=on', # merge source files per target
'unity_size=8', # TODO: mess around with this
'buildtype=debug',
'b_pch=true', # precompiled headers
'default_library=static', # static linkage to subprojects
# 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld)
# 'b_ndebug=if-release', # drop assert() in --buildtype=release
],
'4jcraft',
['cpp', 'c'],
version: '0.1.0',
meson_version: '>= 1.3',
default_options: [
'cpp_std=c++23',
'warning_level=0',
'buildtype=debugoptimized', # for now
'unity=on', # merge source files per target
'unity_size=8', # TODO: mess around with this
'b_pch=true', # precompiled headers
],
)
pymod = import('python')
@@ -23,33 +18,31 @@ python = pymod.find_installation('python3', required: true)
cc = meson.get_compiler('cpp')
global_cpp_args = []
global_cpp_defs = [
'-DSPLIT_SAVES',
'-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS',
'-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h)
'-DSPLIT_SAVES',
'-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS',
'-D_DEBUG_MENUS_ENABLED',
'-D_DEBUG',
'-D_FORTIFY_SOURCE=2',
'-DDEBUG',
]
# Debug-only defines: keep for debug + debugoptimized so iteration is unchanged.
# --buildtype=release strips them so shipping builds don't carry debug logging,
# debug menu UI, or assert-driven sanity checks.
if get_option('buildtype') in ['debug', 'debugoptimized']
global_cpp_defs += [
'-D_DEBUG',
'-DDEBUG',
'-D_DEBUG_MENUS_ENABLED',
]
if host_machine.system() == 'linux'
global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__']
endif
if get_option('buildtype') == 'debugoptimized'
global_cpp_defs += ['-D_FORTIFY_SOURCE=2']
if get_option('renderer') == 'gles'
global_cpp_defs += ['-DGLES']
gl_dep = dependency('glesv2', required: true)
glu_dep = dependency('', required: false)
else
gl_dep = dependency('gl', required: true)
glu_dep = dependency('glu', required: true)
endif
# MARK: meson options
if get_option('enable_vsync')
global_cpp_defs += ['-DENABLE_VSYNC']
global_cpp_defs += ['-DENABLE_VSYNC']
endif
if get_option('classic_panorama')
@@ -57,52 +50,43 @@ if get_option('classic_panorama')
endif
if get_option('enable_frame_profiler')
global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
endif
if get_option('ui_backend') == 'shiggy'
global_cpp_defs += ['-D_ENABLEIGGY']
global_cpp_defs += ['-D_ENABLEIGGY']
endif
if get_option('ui_backend') == 'java'
global_cpp_defs += '-DENABLE_JAVA_GUIS'
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']
global_cpp_defs += '-DENABLE_JAVA_GUIS'
endif
add_project_arguments(global_cpp_defs, language: ['cpp', 'c'])
global_cpp_args = [
'-Wshift-count-overflow',
'-pipe',
]
add_project_arguments(global_cpp_args, language: 'cpp')
sdl2_dep = dependency('sdl2')
thread_dep = dependency('threads')
dl_dep = cc.find_library('dl', required: true)
glm_dep = dependency('glm')
stb = subproject('stb').get_variable('stb_inc')
stb_dep = declare_dependency(include_directories: stb)
simdutf_dep = dependency('simdutf',
fallback: ['simdutf', 'simdutf_dep'],
default_options: ['utf8=true', 'utf16=true', 'utf32=true']
)
miniaudio_dep = dependency('miniaudio')
subdir('targets/util')
subdir('targets/java')
subdir('targets/nbt')
subdir('targets/platform')
# MARK: platform configuration
if host_machine.system() in ['linux', 'windows']
platform_fs_dep = platform_fs_std_dep
platform_game_dep = platform_game_stub_dep
platform_input_dep = platform_input_sdl2_dep
platform_leaderboard_dep = platform_leaderboard_stub_dep
platform_network_dep = platform_network_stub_dep
platform_profile_dep = platform_profile_stub_dep
platform_renderer_dep = platform_renderer_gl_dep
platform_sound_dep = platform_sound_miniaudio_dep
platform_storage_dep = platform_storage_stub_dep
platform_thread_dep = platform_thread_dep # standardized backend (for now)
app_platform_sources = files('targets/app/desktop/main.cpp')
endif
subdir('targets/resources')
subdir('targets/minecraft')
subdir('targets/app')
-7
View File
@@ -40,10 +40,3 @@ option(
value: 'frustum',
description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
)
option(
'enable_mimalloc',
type: 'feature',
value: 'auto',
description: 'Link mimalloc as the malloc implementation. Requires libmimalloc-dev.',
)
-183
View File
@@ -1,183 +0,0 @@
#!/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
@@ -1,97 +0,0 @@
#!/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,3 +3,7 @@ c = 'clang'
cpp = 'clang++'
c_ld = 'lld'
cpp_ld = 'lld'
[built-in options]
cpp_args = ['-stdlib=libc++']
cpp_link_args = ['-stdlib=libc++']
-12
View File
@@ -1,12 +0,0 @@
[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
@@ -1,13 +0,0 @@
[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',
'cpp',
default_options: ['cpp_std=c++20'],
default_options: ['cpp_std=c++23'],
version: '8.2.0',
meson_version: '>= 1.1',
license: ['MIT'],
+1 -5
View File
@@ -1,7 +1,3 @@
project('stb', 'c')
stb_dep = declare_dependency(
include_directories: include_directories('.'),
)
meson.override_dependency('stb', stb_dep)
stb_inc = include_directories('.')
-15
View File
@@ -1,15 +0,0 @@
[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]
url = https://github.com/simdutf/simdutf.git
depth = 1
revision = fd476229424b40ae71a58dd5a205795c3d76b5f1
revision = v8.2.0
patch_directory = simdutf
[provide]
-14
View File
@@ -1,14 +0,0 @@
[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
@@ -0,0 +1,48 @@
# 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
@@ -0,0 +1,27 @@
========================================================================
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.
/////////////////////////////////////////////////////////////////////////////
+72 -47
View File
@@ -1,22 +1,26 @@
#include "app/common/AppGameServices.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "java/Class.h" // eINSTANCEOF
#include "platform/game/game.h"
AppGameServices::AppGameServices(Game& game, IMenuService& menus)
: game_(game), menus_(menus) {}
// -- Strings --
const char* AppGameServices::getString(int id) { return Game::GetString(id); }
const char* AppGameServices::getString(int id) {
return Game::GetString(id);
}
// -- Debug settings --
bool AppGameServices::debugSettingsOn() { return game_.DebugSettingsOn(); }
bool AppGameServices::debugSettingsOn() {
return game_.DebugSettingsOn();
}
bool AppGameServices::debugArtToolsOn() { return game_.DebugArtToolsOn(); }
bool AppGameServices::debugArtToolsOn() {
return game_.DebugArtToolsOn();
}
unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) {
return game_.GetGameSettingsDebugMask(iPad, overridePlayer);
@@ -30,7 +34,9 @@ bool AppGameServices::debugMobsDontTick() {
return game_.GetMobsDontTickEnabled();
}
bool AppGameServices::debugFreezePlayers() { return game_.GetFreezePlayers(); }
bool AppGameServices::debugFreezePlayers() {
return game_.GetFreezePlayers();
}
// -- Game host options --
@@ -87,7 +93,9 @@ unsigned char AppGameServices::getGameSettings(int setting) {
// -- App time --
float AppGameServices::getAppTime() { return game_.getAppTime(); }
float AppGameServices::getAppTime() {
return game_.getAppTime();
}
// -- Game state --
@@ -96,14 +104,10 @@ void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); }
bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); }
void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); }
bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); }
int AppGameServices::getLocalPlayerCount() {
return game_.GetLocalPlayerCount();
}
int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); }
bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); }
void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); }
int64_t AppGameServices::secondsToAutosave() {
return game_.SecondsToAutosave();
}
int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); }
void AppGameServices::setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) {
@@ -111,13 +115,9 @@ void AppGameServices::setDisconnectReason(
}
void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); }
void AppGameServices::unlockSaveNotification() {
game_.unlockSaveNotification();
}
void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); }
bool AppGameServices::getResetNether() { return game_.GetResetNether(); }
bool AppGameServices::getUseDPadForDebug() {
return game_.GetUseDPadForDebug();
}
bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); }
bool AppGameServices::getWriteSavesToFolderEnabled() {
return game_.GetWriteSavesToFolderEnabled();
@@ -127,7 +127,9 @@ bool AppGameServices::isLocalMultiplayerAvailable() {
return game_.IsLocalMultiplayerAvailable();
}
bool AppGameServices::dlcInstallPending() { return game_.DLCInstallPending(); }
bool AppGameServices::dlcInstallPending() {
return game_.DLCInstallPending();
}
bool AppGameServices::dlcInstallProcessCompleted() {
return game_.DLCInstallProcessCompleted();
@@ -175,15 +177,30 @@ void AppGameServices::setAction(int iPad, eXuiAction action, void* param) {
game_.SetAction(iPad, action, param);
}
void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action,
void* param) {
game_.SetXuiServerAction(iPad, action, param);
}
eXuiAction AppGameServices::getXuiAction(int iPad) {
return game_.GetXuiAction(iPad);
}
eXuiServerAction AppGameServices::getXuiServerAction(int iPad) {
return game_.GetXuiServerAction(iPad);
}
void* AppGameServices::getXuiServerActionParam(int iPad) {
return game_.GetXuiServerActionParam(iPad);
}
void AppGameServices::setGlobalXuiAction(eXuiAction action) {
game_.SetGlobalXuiAction(action);
}
void AppGameServices::handleButtonPresses() { game_.HandleButtonPresses(); }
void AppGameServices::handleButtonPresses() {
game_.HandleButtonPresses();
}
void AppGameServices::setTMSAction(int iPad, eTMSAction action) {
game_.SetTMSAction(iPad, action);
@@ -237,7 +254,8 @@ void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID,
game_.SetAnimOverrideBitmask(dwSkinID, bitmask);
}
unsigned int AppGameServices::getAnimOverrideBitmask(std::uint32_t dwSkinID) {
unsigned int AppGameServices::getAnimOverrideBitmask(
std::uint32_t dwSkinID) {
return game_.GetAnimOverrideBitmask(dwSkinID);
}
@@ -249,7 +267,9 @@ std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) {
return Game::getSkinPathFromId(skinId);
}
bool AppGameServices::defaultCapeExists() { return game_.DefaultCapeExists(); }
bool AppGameServices::defaultCapeExists() {
return game_.DefaultCapeExists();
}
bool AppGameServices::isXuidNotch(PlayerUID xuid) {
return game_.isXuidNotch(xuid);
@@ -264,21 +284,19 @@ bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) {
void AppGameServices::fatalLoadError() { game_.FatalLoadError(); }
void AppGameServices::setRichPresenceContext(int iPad, int contextId) {
PlatformGame.SetRichPresenceContext(iPad, contextId);
game_.SetRichPresenceContext(iPad, contextId);
}
void AppGameServices::captureSaveThumbnail() {
PlatformGame.CaptureSaveThumbnail();
}
void AppGameServices::captureSaveThumbnail() { game_.CaptureSaveThumbnail(); }
void AppGameServices::getSaveThumbnail(std::uint8_t** data,
unsigned int* size) {
PlatformGame.GetSaveThumbnail(data, size);
game_.GetSaveThumbnail(data, size);
}
void AppGameServices::readBannedList(int iPad, eTMSAction action,
bool bCallback) {
PlatformGame.ReadBannedList(iPad, action, bCallback);
game_.ReadBannedList(iPad, action, bCallback);
}
void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
@@ -287,7 +305,8 @@ void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
}
unsigned int AppGameServices::getPlayerPrivileges(std::uint8_t networkSmallId) {
unsigned int AppGameServices::getPlayerPrivileges(
std::uint8_t networkSmallId) {
return game_.GetPlayerPrivileges(networkSmallId);
}
@@ -315,7 +334,9 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type,
return game_.GetTerrainFeaturePosition(type, pX, pZ);
}
void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); }
void AppGameServices::loadDefaultGameRules() {
game_.loadDefaultGameRules();
}
// -- Archive / resources --
@@ -342,21 +363,24 @@ const char* AppGameServices::getGameRulesString(const std::string& key) {
return game_.GetGameRulesString(key);
}
unsigned int AppGameServices::createImageTextData(
std::uint8_t* textMetadata, int64_t seed, bool hasSeed,
unsigned int uiHostOptions, unsigned int uiTexturePackId) {
return game_.CreateImageTextData(textMetadata, seed, hasSeed, uiHostOptions,
uiTexturePackId);
unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return game_.CreateImageTextData(textMetadata, seed, hasSeed,
uiHostOptions, uiTexturePackId);
}
std::string AppGameServices::getFilePath(std::uint32_t packId,
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint);
}
char* AppGameServices::getUniqueMapName() { return game_.GetUniqueMapName(); }
char* AppGameServices::getUniqueMapName() {
return game_.GetUniqueMapName();
}
void AppGameServices::setUniqueMapName(char* name) {
game_.SetUniqueMapName(name);
@@ -366,7 +390,9 @@ unsigned int AppGameServices::getOpacityTimer(int iPad) {
return game_.GetOpacityTimer(iPad);
}
void AppGameServices::setOpacityTimer(int iPad) { game_.SetOpacityTimer(iPad); }
void AppGameServices::setOpacityTimer(int iPad) {
game_.SetOpacityTimer(iPad);
}
void AppGameServices::tickOpacityTimer(int iPad) {
game_.TickOpacityTimer(iPad);
@@ -387,7 +413,7 @@ void AppGameServices::debugPrintf(const char* msg) {
// -- DLC --
ISkinAssetData* AppGameServices::getSkinAssetData(const std::string& name) {
DLCSkinFile* AppGameServices::getDLCSkinFile(const std::string& name) {
return game_.m_dlcManager.getSkinFile(name);
}
bool AppGameServices::dlcNeedsCorruptCheck() {
@@ -397,8 +423,8 @@ unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) {
return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage);
}
bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed,
const std::string& path, DLCPack* pack,
bool fromArchive) {
const std::string& path,
DLCPack* pack, bool fromArchive) {
return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack,
fromArchive);
}
@@ -409,7 +435,7 @@ void AppGameServices::dlcRemovePack(DLCPack* pack) {
// -- Game rules --
LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data,
unsigned int size) {
unsigned int size) {
return game_.m_gameRules.loadGameRules(data, size);
}
void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) {
@@ -418,8 +444,7 @@ void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) {
void AppGameServices::unloadCurrentGameRules() {
game_.m_gameRules.unloadCurrentGameRules();
}
void AppGameServices::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
game_.m_gameRules.setLevelGenerationOptions(levelGen);
}
+18 -11
View File
@@ -4,7 +4,6 @@
class Game;
class IMenuService;
class ISkinAssetData;
class AppGameServices : public IGameServices {
public:
@@ -23,7 +22,8 @@ public:
// -- Game host options --
unsigned int getGameHostOption(eGameHostOption option) override;
void setGameHostOption(eGameHostOption option, unsigned int value) override;
void setGameHostOption(eGameHostOption option,
unsigned int value) override;
// -- Level generation --
LevelGenerationOptions* getLevelGenerationOptions() override;
@@ -76,7 +76,11 @@ public:
// -- UI dispatch --
void setAction(int iPad, eXuiAction action, void* param) override;
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param) override;
eXuiAction getXuiAction(int iPad) override;
eXuiServerAction getXuiServerAction(int iPad) override;
void* getXuiServerActionParam(int iPad) override;
void setGlobalXuiAction(eXuiAction action) override;
void handleButtonPresses() override;
void setTMSAction(int iPad, eTMSAction action) override;
@@ -109,7 +113,8 @@ public:
void setRichPresenceContext(int iPad, int contextId) override;
void captureSaveThumbnail() override;
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override;
void readBannedList(int iPad, eTMSAction action, bool bCallback) override;
void readBannedList(int iPad, eTMSAction action,
bool bCallback) override;
void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) override;
@@ -134,12 +139,13 @@ public:
int getHTMLColour(eMinecraftColour colour) override;
std::string getEntityName(EntityTypeId type) override;
const char* getGameRulesString(const std::string& key) override;
unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) override;
std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder,
std::string mountPoint) override;
bool bAddDataFolder,
std::string mountPoint) override;
char* getUniqueMapName() override;
void setUniqueMapName(char* name) override;
unsigned int getOpacityTimer(int iPad) override;
@@ -151,16 +157,17 @@ public:
void debugPrintf(const char* msg) override;
// -- DLC --
ISkinAssetData* getSkinAssetData(const std::string& name) override;
DLCSkinFile* getDLCSkinFile(const std::string& name) override;
bool dlcNeedsCorruptCheck() override;
unsigned int dlcCheckForCorrupt(bool showMessage) override;
bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path,
DLCPack* pack, bool fromArchive) override;
bool dlcReadDataFile(unsigned int& filesProcessed,
const std::string& path, DLCPack* pack,
bool fromArchive) override;
void dlcRemovePack(DLCPack* pack) override;
// -- Game rules --
LevelGenerationOptions* loadGameRules(std::uint8_t* data,
unsigned int size) override;
unsigned int size) override;
void saveGameRules(std::uint8_t** data, unsigned int* size) override;
void unloadCurrentGameRules() override;
void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override;
+135
View File
@@ -0,0 +1,135 @@
#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 "app/common/UI/All Platforms/UIEnums.h"
#include "platform/storage/storage.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/world/tutorial/TutorialEnum.h"
#include "platform/XboxStubs.h"
#include "platform/network/NetTypes.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/storage/storage.h"
typedef struct {
char* wchFilename;
+10 -2
View File
@@ -3,14 +3,14 @@
#include <mutex>
#include <string>
#include "app/common/Game.h"
#include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/linux/LinuxGame.h"
#include "java/File.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/PlatformTypes.h"
#include "platform/fs/fs.h"
#include "platform/PlatformTypes.h"
ArchiveManager::ArchiveManager()
: m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {}
@@ -18,9 +18,14 @@ ArchiveManager::ArchiveManager()
void ArchiveManager::loadMediaArchive() {
std::string mediapath = "";
#if _WINDOWS64
mediapath = "Common\\Media\\MediaWindows64.arc";
#elif __linux__
mediapath = "app/common/Media/MediaLinux.arc";
#endif
if (!mediapath.empty()) {
#if defined(__linux__)
std::string exeDirW = PlatformFilesystem.getBasePath().string();
std::string candidate = exeDirW + File::pathSeparator + mediapath;
if (File(candidate).exists()) {
@@ -28,6 +33,9 @@ void ArchiveManager::loadMediaArchive() {
} else {
m_mediaArchive = new ArchiveFile(File(mediapath));
}
#else
m_mediaArchive = new ArchiveFile(File(mediapath));
#endif
}
}
@@ -1,62 +0,0 @@
#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;
}
@@ -0,0 +1,24 @@
#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;
}
@@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "SoundTypes.h"
#include "minecraft/sounds/SoundTypes.h"
class File;
@@ -21,11 +21,6 @@ typedef struct {
class Options;
class Mob;
// Game-side sound engine interface. The concrete backend
// (app/common/Audio/SoundEngine) inherits from this and forwards into
// IPlatformSound. minecraft/ consumers see only the abstract base, so
// they don't have to drag the concrete backend (and its miniaudio
// pimpl) into their compilation units.
class ConsoleSoundEngine {
public:
ConsoleSoundEngine()
@@ -34,8 +29,6 @@ public:
m_bIsPlayingEndMusic(false),
m_bIsPlayingNetherMusic(false) {}
virtual ~ConsoleSoundEngine() = default;
virtual void tick(std::shared_ptr<Mob>* players, float a) = 0;
virtual void destroy() = 0;
virtual void play(int iSound, float x, float y, float z, float volume,
File diff suppressed because it is too large Load Diff
+15 -21
View File
@@ -4,19 +4,13 @@ class Options;
class C4JThread;
class Random;
#include <memory>
#include <string>
#include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/Audio/SoundTypes.h"
#include "app/common/Iggy/include/rrCore.h"
#include "platform/PlatformTypes.h"
// Forward-declare the miniaudio backing state. The full struct lives in
// SoundEngine.cpp where miniaudio.h is actually included. This keeps
// miniaudio.h out of the 9 minecraft files that include SoundEngine.h
// via the 4j include chain.
struct SoundEngineMiniAudio;
#include "app/common/App_Defines.h"
#include "app/common/Audio/Consoles_SoundEngine.h"
#include "app/linux/Iggy/include/rrCore.h"
#include "minecraft/sounds/SoundTypes.h"
#include "miniaudio.h"
constexpr float SFX_3D_MIN_DISTANCE = 1.0f;
constexpr float SFX_3D_MAX_DISTANCE = 16.0f;
@@ -96,15 +90,15 @@ typedef struct {
char chName[64];
#endif
} AUDIO_INFO;
// MiniAudioSound's definition lives in SoundEngine.cpp alongside the
// miniaudio backend; consumers of this header don't need to see it.
struct MiniAudioSound {
ma_sound sound;
AUDIO_INFO info;
bool active;
};
class SoundEngine : public ConsoleSoundEngine {
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
public:
SoundEngine();
~SoundEngine();
virtual void destroy();
#if defined(_DEBUG)
void GetSoundName(char* szSoundName, int iSound);
@@ -142,15 +136,15 @@ private:
float getMasterMusicVolume();
// platform specific functions
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers; }
#if defined(__linux__)
void updateMiniAudio();
#endif
int GetRandomishTrack(int iStart, int iEnd);
// Miniaudio engine + music stream PIMPL'd into SoundEngineMiniAudio,
// defined in SoundEngine.cpp. Owned via unique_ptr; the destructor
// is out-of-line so the unique_ptr instantiation can see the full
// type.
std::unique_ptr<SoundEngineMiniAudio> m_audio;
ma_engine m_engine;
ma_engine_config m_engineConfig;
ma_sound m_musicStream;
bool m_musicStreamActive;
static char m_szSoundPath[];
+6 -6
View File
@@ -1,5 +1,5 @@
#include "app/common/Audio/ConsoleSoundEngine.h"
#include "app/common/Audio/SoundTypes.h"
#include "Consoles_SoundEngine.h"
#include "minecraft/sounds/SoundTypes.h"
const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
@@ -58,7 +58,7 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/cat/meow", // eSoundType_MOB_CAT_MEOW
// 4J-PB - correct the name of the event for hitting ocelots
"mob/cat/hitt", // eSoundType_MOB_CAT_HITT
// "mob.irongolem.throw", //
// "mob.irongolem.throw", //
// eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit",
//// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death",
//// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk",
@@ -205,11 +205,11 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
"mob/horse/jump", // eSoundType_MOB_HORSE_JUMP,
"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <---
// missing
// missing
"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <---
// missing
// missing
"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <---
// missing
// missing
"mob/slime/big", // eSoundType_MOB_SLIME_BIG,
"mob/slime/small", // eSoundType_MOB_SLIME_SMALL,
+7 -4
View File
@@ -29,8 +29,8 @@ void BannedListManager::invalidate(int iPad) {
}
}
void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName,
bool bWriteToTMS) {
void BannedListManager::addLevel(int iPad, PlayerUID xuid,
char* pszLevelName, bool bWriteToTMS) {
// we will have retrieved the banned level list from TMS, so add this one to
// it and write it back to TMS
@@ -64,7 +64,8 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName,
// update telemetry too
}
bool BannedListManager::isInList(int iPad, PlayerUID xuid, char* pszLevelName) {
bool BannedListManager::isInList(int iPad, PlayerUID xuid,
char* pszLevelName) {
for (auto it = m_vBannedListA[iPad]->begin();
it != m_vBannedListA[iPad]->end(); ++it) {
PBANNEDLISTDATA pData = *it;
@@ -125,4 +126,6 @@ void BannedListManager::setUniqueMapName(char* pszUniqueMapName) {
memcpy(m_pszUniqueMapName, pszUniqueMapName, 14);
}
char* BannedListManager::getUniqueMapName() { return m_pszUniqueMapName; }
char* BannedListManager::getUniqueMapName() {
return m_pszUniqueMapName;
}
@@ -10,11 +10,6 @@
#define VER_PRODUCTBUILD 560
// This goes up if there is any change to network traffic or code in a build
#define VER_NETWORK 560
// Network protocol version. Sent in the pre-login packet so client and
// server can detect mismatched builds.
#define MINECRAFT_NET_VERSION VER_NETWORK
#define VER_PRODUCTBUILD_QFE 0
#define VER_FILEVERSION_STRING "1.6"
@@ -48,9 +43,9 @@
#define VER_FILEVERSION_STR2(x, y) \
VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y
#define VER_FILEVERSION_STR2_W(x, y) \
VER_FILEVERSION_STRING_W \
"." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y)
#define VER_FILEVERSION_STR2_W(x, y) \
VER_FILEVERSION_STRING_W "." VER_FILEBPAD_W VER_WIDE_PREFIX( \
#x) "." VER_WIDE_PREFIX(#y)
#define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y)
#define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y)
@@ -1,15 +1,16 @@
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "ColourTable.h"
#include <cstring>
#include <utility>
#include <vector>
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "minecraft/GameEnums.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
std::unordered_map<std::string, eMinecraftColour> ColourTable::s_colourNamesMap;
std::unordered_map<std::string, eMinecraftColour>
ColourTable::s_colourNamesMap;
const char* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = {
"NOTSET",
+6 -1
View File
@@ -7,12 +7,17 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "app/linux/LinuxGame.h"
#include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "util/StringHelpers.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
namespace {
constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "app/linux/LinuxGame.h"
DLCCapeFile::DLCCapeFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Cape, path) {}
@@ -1,10 +1,10 @@
#include "DLCColourTableFile.h"
#include "DLCManager.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
+1 -1
View File
@@ -2,8 +2,8 @@
#include <sstream>
#include "app/common/Minecraft_Macros.h"
#include "app/common/DLC/DLCManager.h"
#include "minecraft/Minecraft_Macros.h"
DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) {
m_type = type;
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include "DLCFile.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
class DLCGameRules : public DLCFile {
public:
@@ -4,8 +4,8 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCGameRules.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
class StringTable;
+1 -1
View File
@@ -4,7 +4,7 @@
#include <string>
#include "DLCGameRules.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
class StringTable;
@@ -2,8 +2,7 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "minecraft/locale/StringTable.h"
#include "app/common/Localisation/StringTable.h"
DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
@@ -12,6 +11,5 @@ DLCLocalisationFile::DLCLocalisationFile(const std::string& path)
void DLCLocalisationFile::addData(std::uint8_t* pbData,
std::uint32_t dataBytes) {
m_strings = new StringTable(
std::span<const std::uint8_t>(pbData, dataBytes), app.getLocale());
m_strings = new StringTable(pbData, dataBytes);
}
+17 -22
View File
@@ -13,19 +13,20 @@
#include <unordered_map>
#include <utility>
#include "DLCFile.h"
#include "DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/UI/ConsoleUIController.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "platform/fs/fs.h"
#include "simdutf.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "simdutf.h"
#include "strings.h"
#include "DLCFile.h"
#include "DLCPack.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "platform/fs/fs.h"
#include "util/StringHelpers.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "strings.h"
// 4jcraft, this is the size of wchar_t on disk
// the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16
@@ -70,8 +71,7 @@ std::string getMountedDlcReadPath(const std::string& path) {
std::string readPath = path;
#if defined(_WINDOWS64)
const std::string mountedPath =
PlatformStorage.GetMountedPath(path.c_str());
const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str());
if (!mountedPath.empty()) {
readPath = mountedPath;
}
@@ -240,7 +240,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
if (pack == nullptr) {
app.DebugPrintf(
"DLCManager: Attempting to find the index for a nullptr pack\n");
// assert(0);
//assert(0);
return foundIndex;
}
if (type != e_DLCType_All) {
@@ -401,12 +401,10 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
// for details, read in the function below
#define DLC_PARAM_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + \
offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData))
DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData))
#define DLC_DETAIL_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + \
offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile))
DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile))
{
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte = 0;
@@ -464,8 +462,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount);
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
}
// ulCurrentByte+=ulParameterCount *
// sizeof(IPlatformStorage::DLC_FILE_PARAM);
// ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM);
unsigned int uiFileCount;
DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte);
@@ -480,9 +477,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp);
}
std::uint8_t* pbTemp =
&pbData
[dwTemp]; //+
// sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount;
&pbData[dwTemp]; //+ sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount;
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiFileCount; i++) {
+37 -64
View File
@@ -3,77 +3,50 @@
#include <cstdint>
#include <string>
#include <vector>
#include "minecraft/world/level/dlc/DLCConstants.h"
class DLCPack;
class DLCSkinFile;
class DLCManager {
public:
// Re-export the file-scope enums as nested type aliases so existing
// app-side call sites that use DLCManager::EDLCType /
// DLCManager::e_DLCType_Texture continue to compile. minecraft/-side
// call sites should use the namespaced names from DLCConstants.h
// directly.
using EDLCType = ::minecraft::dlc::EDLCType;
using EDLCParameterType = ::minecraft::dlc::EDLCParameterType;
enum EDLCType {
e_DLCType_Skin = 0,
e_DLCType_Cape,
e_DLCType_Texture,
e_DLCType_UIData,
e_DLCType_PackConfig,
e_DLCType_TexturePack,
e_DLCType_LocalisationData,
e_DLCType_GameRules,
e_DLCType_Audio,
e_DLCType_ColourTable,
e_DLCType_GameRulesHeader,
static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin;
static constexpr EDLCType e_DLCType_Cape = ::minecraft::dlc::e_DLCType_Cape;
static constexpr EDLCType e_DLCType_Texture =
::minecraft::dlc::e_DLCType_Texture;
static constexpr EDLCType e_DLCType_UIData =
::minecraft::dlc::e_DLCType_UIData;
static constexpr EDLCType e_DLCType_PackConfig =
::minecraft::dlc::e_DLCType_PackConfig;
static constexpr EDLCType e_DLCType_TexturePack =
::minecraft::dlc::e_DLCType_TexturePack;
static constexpr EDLCType e_DLCType_LocalisationData =
::minecraft::dlc::e_DLCType_LocalisationData;
static constexpr EDLCType e_DLCType_GameRules =
::minecraft::dlc::e_DLCType_GameRules;
static constexpr EDLCType e_DLCType_Audio =
::minecraft::dlc::e_DLCType_Audio;
static constexpr EDLCType e_DLCType_ColourTable =
::minecraft::dlc::e_DLCType_ColourTable;
static constexpr EDLCType e_DLCType_GameRulesHeader =
::minecraft::dlc::e_DLCType_GameRulesHeader;
static constexpr EDLCType e_DLCType_Max = ::minecraft::dlc::e_DLCType_Max;
static constexpr EDLCType e_DLCType_All = ::minecraft::dlc::e_DLCType_All;
e_DLCType_Max,
e_DLCType_All,
};
static constexpr EDLCParameterType e_DLCParamType_Invalid =
::minecraft::dlc::e_DLCParamType_Invalid;
static constexpr EDLCParameterType e_DLCParamType_DisplayName =
::minecraft::dlc::e_DLCParamType_DisplayName;
static constexpr EDLCParameterType e_DLCParamType_ThemeName =
::minecraft::dlc::e_DLCParamType_ThemeName;
static constexpr EDLCParameterType e_DLCParamType_Free =
::minecraft::dlc::e_DLCParamType_Free;
static constexpr EDLCParameterType e_DLCParamType_Credit =
::minecraft::dlc::e_DLCParamType_Credit;
static constexpr EDLCParameterType e_DLCParamType_Cape =
::minecraft::dlc::e_DLCParamType_Cape;
static constexpr EDLCParameterType e_DLCParamType_Box =
::minecraft::dlc::e_DLCParamType_Box;
static constexpr EDLCParameterType e_DLCParamType_Anim =
::minecraft::dlc::e_DLCParamType_Anim;
static constexpr EDLCParameterType e_DLCParamType_PackId =
::minecraft::dlc::e_DLCParamType_PackId;
static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour =
::minecraft::dlc::e_DLCParamType_NetherParticleColour;
static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour =
::minecraft::dlc::e_DLCParamType_EnchantmentTextColour;
static constexpr EDLCParameterType
e_DLCParamType_EnchantmentTextFocusColour =
::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour;
static constexpr EDLCParameterType e_DLCParamType_DataPath =
::minecraft::dlc::e_DLCParamType_DataPath;
static constexpr EDLCParameterType e_DLCParamType_PackVersion =
::minecraft::dlc::e_DLCParamType_PackVersion;
static constexpr EDLCParameterType e_DLCParamType_Max =
::minecraft::dlc::e_DLCParamType_Max;
// If you add to the Enum,then you need to add the array of type names
// These are the names used in the XML for the parameters
enum EDLCParameterType {
e_DLCParamType_Invalid = -1,
e_DLCParamType_DisplayName = 0,
e_DLCParamType_ThemeName,
e_DLCParamType_Free, // identify free skins
e_DLCParamType_Credit, // legal credits for DLC
e_DLCParamType_Cape,
e_DLCParamType_Box,
e_DLCParamType_Anim,
e_DLCParamType_PackId,
e_DLCParamType_NetherParticleColour,
e_DLCParamType_EnchantmentTextColour,
e_DLCParamType_EnchantmentTextFocusColour,
e_DLCParamType_DataPath,
e_DLCParamType_PackVersion,
e_DLCParamType_Max,
};
const static char* wchTypeNamesA[e_DLCParamType_Max];
private:
@@ -110,7 +83,7 @@ public:
EDLCType type = e_DLCType_All);
DLCSkinFile* getSkinFile(
const std::string& path); // Will hunt all packs of type skin to find
// the right skinfile
// the right skinfile
DLCPack* getPackContainingSkin(const std::string& path);
unsigned int getPackIndexContainingSkin(const std::string& path,
+6 -5
View File
@@ -6,6 +6,7 @@
#include <sstream>
#include <utility>
#include "platform/profile/profile.h"
#include "DLCAudioFile.h"
#include "DLCCapeFile.h"
#include "DLCColourTableFile.h"
@@ -14,13 +15,13 @@
#include "DLCLocalisationFile.h"
#include "DLCTextureFile.h"
#include "DLCUIDataFile.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "minecraft/Console_Debug_enum.h"
#include "minecraft/locale/StringTable.h"
#include "platform/profile/profile.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "util/StringHelpers.h"
DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) {
@@ -351,6 +352,6 @@ void DLCPack::UpdateLanguage() {
DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile(
DLCManager::e_DLCType_LocalisationData, "languages.loc");
StringTable* strTable = localisationFile->getStringTable();
strTable->ReloadStringTable(app.getLocale());
strTable->ReloadStringTable();
}
}
+1 -1
View File
@@ -5,9 +5,9 @@
#include <unordered_map>
#include <vector>
#include "platform/PlatformTypes.h"
#include "DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "platform/PlatformTypes.h"
class DLCFile;
class DLCSkinFile;
+9 -8
View File
@@ -3,12 +3,12 @@
#include <string.h>
#include <wchar.h>
#include "platform/renderer/renderer.h"
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "platform/renderer/renderer.h"
DLCSkinFile::DLCSkinFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_Skin, path) {
@@ -56,8 +56,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
int maximumChars = 55;
bool bIsSDMode = !PlatformRenderer.IsHiDef() &&
!PlatformRenderer.IsWidescreen();
bool bIsSDMode =
!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen();
if (bIsSDMode) {
maximumChars = 45;
@@ -110,9 +110,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
SKIN_BOX* pSkinBox = new SKIN_BOX;
memset(pSkinBox, 0, sizeof(SKIN_BOX));
sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
sscanf(value.c_str(), "%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
if (strcmp(wchBodyPart, "HEAD") == 0) {
pSkinBox->ePart = eBodyPart_Head;
@@ -132,7 +132,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
m_AdditionalBoxes.push_back(pSkinBox);
} break;
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);
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
break;
+11 -20
View File
@@ -6,11 +6,10 @@
#include "DLCFile.h"
#include "app/common/DLC/DLCManager.h"
#include "minecraft/client/model/HumanoidModel.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/skins/ISkinAssetData.h"
#include "minecraft/client/model/HumanoidModel.h"
class DLCSkinFile : public DLCFile, public ISkinAssetData {
class DLCSkinFile : public DLCFile {
private:
std::string m_displayName;
std::string m_themeName;
@@ -22,23 +21,15 @@ private:
public:
DLCSkinFile(const std::string& path);
void addData(std::uint8_t* pbData, std::uint32_t dataBytes) override;
void addParameter(DLCManager::EDLCParameterType type,
const std::string& value) override;
std::string getParameterAsString(
DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
// ISkinAssetData
[[nodiscard]] std::uint32_t getSkinID() override {
return DLCFile::getSkinID();
}
[[nodiscard]] unsigned int getAnimOverrideBitmask() override {
return m_uiAnimOverrideBitmask;
}
[[nodiscard]] int getAdditionalBoxesCount() override;
[[nodiscard]] std::vector<SKIN_BOX*>* getAdditionalBoxes() override;
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
virtual void addParameter(DLCManager::EDLCParameterType type,
const std::string& value);
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; }
};
+1 -1
View File
@@ -2,7 +2,7 @@
#include "DLCManager.h"
#include "app/common/DLC/DLCFile.h"
#include "app/common/Game.h"
#include "app/linux/LinuxGame.h"
DLCUIDataFile::DLCUIDataFile(const std::string& path)
: DLCFile(DLCManager::e_DLCType_UIData, path) {
+48 -29
View File
@@ -1,19 +1,21 @@
#include "app/common/DLCController.h"
#include <cstring>
#include <mutex>
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/Game.h"
#include "app/common/UI/ConsoleUIController.h"
#include "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/XboxStubs.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
#include "platform/profile/profile.h"
#include "platform/XboxStubs.h"
#include <cstring>
#include <mutex>
DLCController::DLCController() {
m_pDLCFileBuffer = nullptr;
@@ -74,9 +76,10 @@ bool DLCController::startInstallDLCProcess(int iPad) {
"--- DLCController::startInstallDLCProcess - "
"PlatformStorage.GetInstalledDLC\n");
PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) {
return dlcInstalledCallback(iInstalledC, pad);
});
PlatformStorage.GetInstalledDLC(
iPad, [this](int iInstalledC, int pad) {
return dlcInstalledCallback(iInstalledC, pad);
});
return true;
} else {
app.DebugPrintf(
@@ -102,7 +105,7 @@ void DLCController::mountNextDLC(int iPad) {
[this](int pad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) {
return dlcMountedCallback(pad, dwErr, dwLicenceMask);
}) != 997 /* ERROR_IO_PENDING */) {
}) != ERROR_IO_PENDING) {
app.DebugPrintf("Failed to mount DLC %d for pad %d\n",
m_iTotalDLCInstalled, iPad);
++m_iTotalDLCInstalled;
@@ -128,7 +131,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
#if defined(_WINDOWS64)
app.DebugPrintf("--- DLCController::dlcMountedCallback\n");
if (dwErr != 0 /* ERROR_SUCCESS */) {
if (dwErr != ERROR_SUCCESS) {
app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr);
app.m_dlcManager.incrementUnnamedCorruptCount();
} else {
@@ -185,11 +188,13 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
void DLCController::handleDLC(DLCPack* pack) {
unsigned int dwFilesProcessed = 0;
#if defined(_WINDOWS64) || defined(__linux__)
std::vector<std::string> dlcFilenames;
#endif
PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames);
for (int i = 0; i < dlcFilenames.size(); i++) {
app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i],
pack);
pack);
}
if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack);
}
@@ -224,6 +229,7 @@ SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) {
return vDLCCredits.at(iIndex);
}
#if defined(_WINDOWS64)
int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
int iGender, uint64_t ullOfferID_Full,
uint64_t ullOfferID_Trial,
@@ -240,11 +246,11 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
pDLCData->uiSortIndex = uiSortIndex;
pDLCData->iConfig = iConfig;
if (strcmp(pBannerName, "") != 0) {
strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
if (pBannerName != "") {
wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
}
if (pDataFile[0] != 0) {
strncpy(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
}
if (pType != nullptr) {
@@ -271,6 +277,19 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
return hr;
}
#elif defined(__linux__)
int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
int iGender, uint64_t ullOfferID_Full,
uint64_t ullOfferID_Trial,
char* pFirstSkin,
unsigned int uiSortIndex, int iConfig,
char* pDataFile) {
fprintf(stderr,
"warning: DLCController::registerDLCData unimplemented for "
"platform `__linux__`\n");
return 0;
}
#endif
bool DLCController::getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) {
@@ -295,7 +314,8 @@ bool DLCController::getDLCFullOfferIDForPackID(const int iPackID,
}
}
DLC_INFO* DLCController::getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) {
DLC_INFO* DLCController::getDLCInfoForTrialOfferID(
uint64_t ullOfferID_Trial) {
if (DLCInfo_Trial.size() > 0) {
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if (it == DLCInfo_Trial.end()) {
@@ -417,13 +437,12 @@ bool DLCController::retrieveNextDLCContent() {
app.DebugPrintf("RetrieveNextDLCContent - type = %d\n",
pCurrent->dwType);
#endif
IPlatformStorage::EDLCStatus status =
PlatformStorage.GetDLCOffers(
PlatformProfile.GetPrimaryPad(),
[this](int iOfferC, std::uint32_t dwType, int pad) {
return dlcOffersReturned(iOfferC, dwType, pad);
},
pCurrent->dwType);
IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers(
PlatformProfile.GetPrimaryPad(),
[this](int iOfferC, std::uint32_t dwType, int pad) {
return dlcOffersReturned(iOfferC, dwType, pad);
},
pCurrent->dwType);
if (status == IPlatformStorage::EDLC_Pending) {
pCurrent->eState = e_DLC_ContentState_Retrieving;
} else {
@@ -651,9 +670,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
return 1;
}
int DLCController::tmsPPFileReturned(
void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) {
int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) {
DLCController* pClass = (DLCController*)pParam;
{
+4 -3
View File
@@ -8,8 +8,8 @@
#include "app/common/App_structs.h"
#include "app/common/DLC/DLCManager.h"
#include "platform/XboxStubs.h"
#include "platform/storage/storage.h"
#include "platform/XboxStubs.h"
struct SCreditTextItemDef;
@@ -36,8 +36,9 @@ public:
int iPad);
// DLC info registration
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*,
unsigned int, int, char* pDataFile);
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t,
char*, unsigned int, int,
char* pDataFile);
bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal);
bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal);
+2 -1
View File
@@ -27,6 +27,7 @@ DebugOptions::DebugOptions() {
#if defined(_DEBUG_MENUS_ENABLED)
bool DebugOptions::debugArtToolsOn(unsigned int debugMask) {
return settingsOn() && (debugMask & (1L << eDebugSetting_ArtTools)) != 0;
return settingsOn() &&
(debugMask & (1L << eDebugSetting_ArtTools)) != 0;
}
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "minecraft/Console_Debug_enum.h"
#include "app/common/Console_Debug_enum.h"
class DebugOptions {
public:
+170 -82
View File
@@ -1,5 +1,58 @@
#include "minecraft/GameHostOptions.h"
#include "app/common/Game.h"
#include "platform/PlatformTypes.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "app/common/App_Defines.h"
#include "minecraft/GameEnums.h"
#include "app/common/App_structs.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h"
#include "java/Class.h"
#include "java/File.h"
#include "java/Random.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/multiplayer/ClientConnection.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
#include "minecraft/client/multiplayer/MultiPlayerLevel.h"
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "minecraft/client/renderer/GameRenderer.h"
#include "minecraft/client/renderer/Textures.h"
#include "minecraft/client/renderer/entity/EntityRenderer.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/stats/StatsCounter.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "strings.h"
#if defined(_WINDOWS64)
#include "app/windows/XML/ATGXmlParser.h"
#include "app/windows/XML/xmlFilesCallback.h"
#endif
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@@ -19,71 +72,24 @@
#include <utility>
#include <vector>
#include "app/common/App_structs.h"
#include "platform/input/input.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCPack.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/Localisation/StringTable.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/UIScene_FullscreenProgress.h"
#include "java/Class.h"
#include "java/File.h"
#include "java/Random.h"
#include "minecraft/Console_Debug_enum.h"
#include "minecraft/GameEnums.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/GameTypes.h"
#include "minecraft/Minecraft_Macros.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/Options.h"
#include "minecraft/client/ProgressRenderer.h"
#include "Minecraft_Macros.h"
#include "util/Timer.h"
#include "util/StringHelpers.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "minecraft/client/User.h"
#include "minecraft/client/gui/Gui.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/multiplayer/ClientConnection.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
#include "minecraft/client/multiplayer/MultiPlayerLevel.h"
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "minecraft/client/renderer/GameRenderer.h"
#include "minecraft/client/renderer/Textures.h"
#include "minecraft/client/renderer/entity/EntityRenderDispatcher.h"
#include "minecraft/client/renderer/entity/EntityRenderer.h"
#include "minecraft/client/resources/Colours/ColourTable.h"
#include "minecraft/client/skins/DLCTexturePack.h"
#include "minecraft/client/skins/TexturePack.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/server/PlayerList.h"
#include "minecraft/server/level/ServerPlayer.h"
#include "minecraft/stats/StatsCounter.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "platform/PlatformTypes.h"
#include "platform/XboxStubs.h"
#include "platform/input/input.h"
#include "platform/network/NetTypes.h"
#include "platform/network/network.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "strings.h"
#include "util/StringHelpers.h"
#include "util/Timer.h"
class BeaconTileEntity;
class BrewingStandTileEntity;
@@ -184,14 +190,31 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; }
// Load*Menu methods moved to MenuController
//////////////////////////////////////////////
// GAME SETTINGS
//////////////////////////////////////////////
// Skin/Cape/FavoriteSkin methods moved to SkinManager
// Mash-up pack worlds
///////////////////////////
//
// Remove the debug settings in the content package build
@@ -199,10 +222,16 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; }
////////////////////////////
#if !defined(_DEBUG_MENUS_ENABLED)
#else
#endif
int Game::BannedLevelDialogReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
Game* pApp = (Game*)pParam;
@@ -256,10 +285,17 @@ int Game::GetLocalPlayerCount(void) {
return iPlayerC;
}
// Installed DLC callback
// 4J-JEV: For the sake of clarity in DLCMountedCallback.
#if defined(_WINDOWS64)
#define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName)
#else
#define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName)
#endif
#undef CONTENT_DATA_DISPLAY_NAME
@@ -291,6 +327,7 @@ int Game::GetLocalPlayerCount(void) {
// }
// }
// int Game::DLCReadCallback(void*
// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData)
// {
@@ -329,9 +366,8 @@ void Game::UpdateTime() {
}
bool Game::isXuidDeadmau5(PlayerUID xuid) {
auto it = DLCController::MojangData.find(
xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
if (it != DLCController::MojangData.end()) {
MOJANG_DATA* pMojangData = DLCController::MojangData[xuid];
if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) {
@@ -344,13 +380,16 @@ bool Game::isXuidDeadmau5(PlayerUID xuid) {
void Game::StoreLaunchData() {}
void Game::ExitGame() {
DebugPrintf("[Game] ExitGame AFTER START\n");
PlatformRenderer.Close();
}
void Game::ExitGame() {}
// Invites
//////////////////////////////////////////////////////////////////////////
//
// FatalLoadError
@@ -360,21 +399,28 @@ void Game::ExitGame() {
// We have to assume that we've not been able to load the text for the game.
//
//////////////////////////////////////////////////////////////////////////
void Game::FatalLoadError() {
DebugPrintf("FatalLoadError - asserting 0 and dying...\n");
assert(0);
}
void Game::FatalLoadError() {}
// Game Host options
void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) {
void Game::SetGameHostOption(eGameHostOption eVal,
unsigned int uiVal) {
GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal);
}
unsigned int Game::GetGameHostOption(eGameHostOption eVal) {
return GameHostOptions::get(m_uiGameHostSettings, eVal);
}
void Game::processSchematics(LevelChunk* levelChunk) {
m_gameRules.processSchematics(levelChunk);
}
@@ -383,9 +429,12 @@ void Game::processSchematicsLighting(LevelChunk* levelChunk) {
m_gameRules.processSchematicsLighting(levelChunk);
}
void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); }
void Game::loadDefaultGameRules() {
m_gameRules.loadDefaultGameRules();
}
void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
void Game::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
m_gameRules.setLevelGenerationOptions(levelGen);
}
@@ -393,8 +442,16 @@ const char* Game::GetGameRulesString(const std::string& key) {
return m_gameRules.GetGameRulesString(key);
}
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to
// MenuController
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController
std::string Game::getEntityName(eINSTANCEOF type) {
switch (type) {
@@ -450,8 +507,12 @@ std::string Game::getEntityName(eINSTANCEOF type) {
// m_dwContentTypeA moved to DLCController
int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin,
char* pCape) {
int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid,
char* pSkin, char* pCape) {
int32_t hr = 0;
eXUID eTempXuid = eXUID_Undefined;
MOJANG_DATA* pMojangData = nullptr;
@@ -513,12 +574,39 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) {
return hr;
}
#if defined(_WINDOWS64)
#elif defined(__linux__)
#else
#endif
// DLC
// AUTOSAVE
void Game::SetAutosaveTimerTime(void) {
int settingValue =
GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave);
int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave);
m_saveManager.setAutosaveTimerTime(settingValue);
}
@@ -554,8 +642,7 @@ bool Game::IsLocalMultiplayerAvailable() {
// #else
// for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
// {
// if( (i!=userIndex) && (PlatformInput.IsPadConnected(i)
//||
// if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) ||
// PlatformProfile.IsSignedIn(i)) )
// {
// iOtherConnectedControllers++;
@@ -568,8 +655,10 @@ bool Game::IsLocalMultiplayerAvailable() {
// (moved to manager class)
std::string Game::getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder, std::string mountPoint) {
std::string Game::getFilePath(std::uint32_t packId,
std::string filename,
bool bAddDataFolder,
std::string mountPoint) {
std::string path =
getRootPath(packId, true, bAddDataFolder, mountPoint) + filename;
File f(path);
@@ -601,8 +690,9 @@ std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\";
std::string titleUpdateTexturePackRoot = "CU\\DLC\\";
#endif
std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
bool bAddDataFolder, std::string mountPoint) {
std::string Game::getRootPath(std::uint32_t packId,
bool allowOverride, bool bAddDataFolder,
std::string mountPoint) {
std::string path = mountPoint;
if (allowOverride) {
switch (packId) {
@@ -622,5 +712,3 @@ std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
return path + "\\";
}
}
Game app;
+156 -197
View File
@@ -3,38 +3,38 @@
#include <cstdint>
#include <mutex>
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"
#include "platform/storage/storage.h"
#include "util/Timer.h"
#include "platform/profile/profile.h"
#include "platform/storage/storage.h"
// using namespace std;
#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/DLCController.h"
#include "app/common/GameSettingsManager.h"
#include "app/common/IPlatformGame.h"
#include "app/common/App_structs.h"
#include "app/common/LocalizationManager.h"
#include "app/common/MenuController.h"
#include "app/common/NetworkController.h"
#include "app/common/SaveManager.h"
#include "app/common/SkinManager.h"
#include "app/common/TerrainFeatureManager.h"
#include "app/common/Audio/Consoles_SoundEngine.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/Localisation/StringTable.h"
#include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/common/UI/All Platforms/UIStructs.h"
#include "platform/NetTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/locale/StringTable.h"
#include "platform/XboxStubs.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/tutorial/TutorialEnum.h"
#include "platform/XboxStubs.h"
#include "platform/network/NetTypes.h"
// JoinFromInviteData moved to NetworkController.h
@@ -62,7 +62,7 @@ class Merchant;
class CMinecraftAudio;
class Game {
class Game : public IPlatformGame {
public:
Game();
@@ -145,8 +145,7 @@ public:
bool IsAppPaused();
void SetAppPaused(bool val);
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg,
int iPad) {
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) {
return m_gameSettingsManager.displaySavingMessage(eMsg, iPad);
}
bool GetGameStarted() { return m_bGameStarted; }
@@ -170,8 +169,7 @@ public:
bool LoadEnchantingMenu(int iPad, std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level,
const std::string& name) {
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z,
level, name);
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name);
}
bool LoadFurnaceMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) {
@@ -180,8 +178,7 @@ public:
bool LoadBrewingStandMenu(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return m_menuController.loadBrewingStandMenu(iPad, inventory,
brewingStand);
return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand);
}
bool LoadContainerMenu(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) {
@@ -207,14 +204,12 @@ public:
}
bool LoadRepairingMenu(int iPad, std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) {
return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y,
z);
return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z);
}
bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader, Level* level,
const std::string& name) {
return m_menuController.loadTradingMenu(iPad, inventory, trader, level,
name);
return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name);
}
bool LoadCommandBlockMenu(
@@ -232,8 +227,7 @@ public:
bool LoadHorseMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) {
return m_menuController.loadHorseMenu(iPad, inventory, container,
horse);
return m_menuController.loadHorseMenu(iPad, inventory, container, horse);
}
bool LoadBeaconMenu(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) {
@@ -248,31 +242,38 @@ public:
}
static const char* GetString(int iID);
StringTable* getStringTable() const {
return m_localizationManager.getStringTable();
}
StringTable* getStringTable() const { return m_localizationManager.getStringTable(); }
eGameMode GetGameMode() { return m_eGameMode; }
void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; }
eXuiAction GetGlobalXuiAction() {
return m_menuController.getGlobalXuiAction();
}
void SetGlobalXuiAction(eXuiAction action) {
m_menuController.setGlobalXuiAction(action);
}
eXuiAction GetXuiAction(int iPad) {
return m_menuController.getXuiAction(iPad);
}
eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); }
void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); }
eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); }
void SetAction(int iPad, eXuiAction action, void* param = nullptr) {
m_menuController.setAction(iPad, action, param);
}
void SetTMSAction(int iPad, eTMSAction action) {
m_menuController.setTMSAction(iPad, action);
}
eTMSAction GetTMSAction(int iPad) {
return m_menuController.getTMSAction(iPad);
eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); }
eXuiServerAction GetXuiServerAction(int 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() {
return m_networkController.getDisconnectReason();
}
@@ -280,16 +281,10 @@ public:
m_networkController.setDisconnectReason(bVal);
}
bool GetChangingSessionType() {
return m_networkController.getChangingSessionType();
}
void SetChangingSessionType(bool bVal) {
m_networkController.setChangingSessionType(bVal);
}
bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); }
void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); }
bool GetReallyChangingSessionType() {
return m_networkController.getReallyChangingSessionType();
}
bool GetReallyChangingSessionType() { return m_networkController.getReallyChangingSessionType(); }
void SetReallyChangingSessionType(bool bVal) {
m_networkController.setReallyChangingSessionType(bVal);
}
@@ -345,20 +340,19 @@ public:
static int OldProfileVersionCallback(void* pParam, unsigned char* pucData,
const unsigned short usVersion,
const int iPad) {
return GameSettingsManager::oldProfileVersionCallback(pParam, pucData,
usVersion, iPad);
return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad);
}
static int DefaultOptionsCallback(
void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings,
iPad);
static int DefaultOptionsCallback(void* pParam,
IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad);
}
int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
const int iPad) {
return m_gameSettingsManager.setDefaultOptions(pSettings, iPad);
}
void SetRichPresenceContext(int iPad, int contextId) override = 0;
void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) {
m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal);
@@ -382,8 +376,7 @@ public:
m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA);
}
void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) {
m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID,
GameSettingsA);
m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, GameSettingsA);
}
unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) {
return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA);
@@ -434,7 +427,9 @@ public:
void SetOpacityTimer(int iPad) {
m_menuController.setOpacityTimer(iPad);
} // 6 seconds
void TickOpacityTimer(int iPad) { m_menuController.tickOpacityTimer(iPad); }
void TickOpacityTimer(int iPad) {
m_menuController.tickOpacityTimer(iPad);
}
public:
std::string GetPlayerSkinName(int iPad) {
@@ -454,8 +449,7 @@ public:
}
void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false,
int iPad = XUSER_INDEX_ANY) {
m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer,
iPad);
m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad);
}
void ApplyGameSettingsChanged(int iPad) {
m_gameSettingsManager.applyGameSettingsChanged(iPad);
@@ -468,8 +462,7 @@ public:
}
unsigned int GetGameSettingsDebugMask(int iPad = -1,
bool bOverridePlayer = false) {
return m_gameSettingsManager.getGameSettingsDebugMask(iPad,
bOverridePlayer);
return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer);
}
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) {
m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal);
@@ -492,15 +485,13 @@ public:
static int SignoutExitWorldThreadProc(void* lpParameter) {
return NetworkController::signoutExitWorldThreadProc(lpParameter);
}
static int PrimaryPlayerSignedOutReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad,
result);
static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult result) {
return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result);
}
static int EthernetDisconnectReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult result) {
return NetworkController::ethernetDisconnectReturned(pParam, iPad,
result);
static int EthernetDisconnectReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult result) {
return NetworkController::ethernetDisconnectReturned(pParam, iPad, result);
}
static void ProfileReadErrorCallback(void* pParam) {
NetworkController::profileReadErrorCallback(pParam);
@@ -513,20 +504,15 @@ public:
static void NotificationsCallback(void* pParam,
std::uint32_t dwNotification,
unsigned int uiParam) {
NetworkController::notificationsCallback(pParam, dwNotification,
uiParam);
NetworkController::notificationsCallback(pParam, dwNotification, uiParam);
}
// for the ethernet being disconnected
static void LiveLinkChangeCallback(void* pParam, bool bConnected) {
NetworkController::liveLinkChangeCallback(pParam, bConnected);
}
bool GetLiveLinkRequired() {
return m_networkController.getLiveLinkRequired();
}
void SetLiveLinkRequired(bool required) {
m_networkController.setLiveLinkRequired(required);
}
bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); }
void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); }
#if defined(_DEBUG_MENUS_ENABLED)
bool DebugSettingsOn() { return m_debugOptions.settingsOn(); }
@@ -537,15 +523,11 @@ public:
#endif
void SetDebugSequence(const char* pchSeq);
// bool UploadFileToGlobalStorage(int iQuadrant,
// IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile );
// IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile );
// Installed DLC - delegated to DLCController
bool StartInstallDLCProcess(int iPad) {
return m_dlcController.startInstallDLCProcess(iPad);
}
int dlcInstalledCallback(int iOfferC, int iPad) {
return m_dlcController.dlcInstalledCallback(iOfferC, iPad);
}
bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); }
int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); }
void HandleDLCLicenseChange();
int dlcMountedCallback(int iPad, std::uint32_t dwErr,
std::uint32_t dwLicenceMask) {
@@ -554,12 +536,11 @@ public:
void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); }
void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); }
bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); }
bool DLCInstallProcessCompleted() {
return m_dlcController.dlcInstallProcessCompleted();
}
bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); }
void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); }
static int MarketplaceCountsCallback(
void* pParam, IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) {
static int MarketplaceCountsCallback(void* pParam,
IPlatformStorage::DLC_TMS_DETAILS* details,
int iPad) {
return DLCController::marketplaceCountsCallback(pParam, details, iPad);
}
@@ -577,7 +558,9 @@ public:
virtual void StoreLaunchData();
virtual void ExitGame();
bool isXuidNotch(PlayerUID xuid) { return m_skinManager.isXuidNotch(xuid); }
bool isXuidNotch(PlayerUID xuid) {
return m_skinManager.isXuidNotch(xuid);
}
bool isXuidDeadmau5(PlayerUID xuid);
void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData,
@@ -614,7 +597,9 @@ public:
return m_archiveManager.getTPConfigVal(pwchDataFile);
}
bool DefaultCapeExists() { return m_skinManager.defaultCapeExists(); }
bool DefaultCapeExists() {
return m_skinManager.defaultCapeExists();
}
// void InstallDefaultCape(); // attempt to install the default cape once
// per game launch
@@ -622,14 +607,11 @@ public:
void ProcessInvite(std::uint32_t dwUserIndex,
std::uint32_t dwLocalUsersMask,
const INVITE_INFO* pInviteInfo) {
m_networkController.processInvite(dwUserIndex, dwLocalUsersMask,
pInviteInfo);
m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo);
}
// Add credits for DLC installed - delegated to DLCController
void AddCreditText(const char* lpStr) {
m_dlcController.addCreditText(lpStr);
}
void AddCreditText(const char* lpStr) { m_dlcController.addCreditText(lpStr); }
private:
std::unordered_map<PlayerUID, std::uint8_t*> m_GTS_Files;
@@ -672,16 +654,14 @@ public:
bool m_bTutorialMode;
bool m_bIsAppPaused;
// m_bChangingSessionType and m_bReallyChangingSessionType moved to
// NetworkController
// m_bChangingSessionType and m_bReallyChangingSessionType moved to NetworkController
// trial, and trying to unlock full
// version on an upsell
void loadMediaArchive() { m_archiveManager.loadMediaArchive(); }
void loadStringTable() {
m_localizationManager.loadStringTable(
m_archiveManager.getMediaArchive());
m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive());
}
public:
@@ -696,10 +676,10 @@ public:
}
private:
static int BannedLevelDialogReturned(
void* pParam, int iPad, const IPlatformStorage::EMessageResult);
static int TexturePackDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
static int BannedLevelDialogReturned(void* pParam, int iPad,
const IPlatformStorage::EMessageResult);
static int TexturePackDialogReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
return MenuController::texturePackDialogReturned(pParam, iPad, result);
}
@@ -723,8 +703,7 @@ private:
eGameMode m_eGameMode; // single or multiplayer
// GameSettingsA reference alias into GameSettingsManager
GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] =
m_gameSettingsManager.GameSettingsA;
GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = m_gameSettingsManager.GameSettingsA;
// m_uiLastSignInData moved to NetworkController
@@ -749,6 +728,7 @@ public:
}
private:
static int UnlockFullExitReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullExitReturned(pParam, iPad, result);
@@ -757,8 +737,8 @@ private:
IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullSaveReturned(pParam, iPad, result);
}
static int UnlockFullInviteReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
static int UnlockFullInviteReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result) {
return MenuController::unlockFullInviteReturned(pParam, iPad, result);
}
static int TrialOverReturned(void* pParam, int iPad,
@@ -771,25 +751,21 @@ private:
}
static int ExitAndJoinFromInviteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(
pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result);
}
static int ExitAndJoinFromInviteAndSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteAndSaveReturned(
pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result);
}
static int ExitAndJoinFromInviteDeclineSaveReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(
pParam, iPad, result);
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result);
}
static int FatalErrorDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result);
static int FatalErrorDialogReturned(void* pParam, int iPad,
IPlatformStorage::EMessageResult result);
static int WarningTrialTexturePackReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return NetworkController::warningTrialTexturePackReturned(pParam, iPad,
result);
return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result);
}
JoinFromInviteData& m_InviteData = m_networkController.m_InviteData;
@@ -818,7 +794,7 @@ public:
return m_localizationManager.getHTMLFontSize(size);
}
std::string FormatHTMLString(int iPad, const std::string& desc,
int shadowColour = 0xFFFFFFFF) {
int shadowColour = 0xFFFFFFFF) {
return m_localizationManager.formatHTMLString(iPad, desc, shadowColour);
}
std::string GetActionReplacement(int iPad, unsigned char ucAction) {
@@ -842,8 +818,7 @@ public:
}
static int ExitGameFromRemoteSaveDialogReturned(
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
return MenuController::exitGameFromRemoteSaveDialogReturned(
pParam, iPad, result);
return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result);
}
// XML
@@ -865,11 +840,10 @@ public:
MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid);
static int32_t RegisterConfigValues(char* pType, int iValue);
static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d,
uint64_t e, char* f, unsigned int g, int h,
static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, uint64_t e,
char* f, unsigned int g, int h,
char* pDataFile) {
return DLCController::registerDLCData(a, b, c, d, e, f, g, h,
pDataFile);
return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile);
}
bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin,
uint64_t* pullVal) {
@@ -882,12 +856,8 @@ public:
return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full);
}
unsigned int GetDLCCreditsCount() {
return m_dlcController.getDLCCreditsCount();
}
SCreditTextItemDef* GetDLCCredits(int iIndex) {
return m_dlcController.getDLCCredits(iIndex);
}
unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); }
SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); }
// TMS
void ReadDLCFileFromTMS(int iPad, eTMSAction action,
@@ -895,15 +865,26 @@ public:
void ReadXuidsFileFromTMS(int iPad, eTMSAction action,
bool bCallback = false);
// images for save thumbnail/social post
void CaptureSaveThumbnail() override = 0;
void GetSaveThumbnail(std::uint8_t** thumbnailData,
unsigned int* thumbnailSize) override = 0;
void ReleaseSaveThumbnail() override = 0;
void GetScreenshot(int iPad, std::uint8_t** screenshotData,
unsigned int* screenshotSize) override = 0;
void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false) override = 0;
// DLC data members moved to DLCController
// Sign-in info moved to NetworkController
public:
// void OverrideFontRenderer(bool set, bool immediate = true);
// void ToggleFontRenderer() {
// OverrideFontRenderer(!m_bFontRendererOverridden,false); }
BANNEDLIST(&BannedListA)
[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA;
BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA;
public:
void SetBanListCheck(int iPad, bool bVal) {
@@ -921,8 +902,7 @@ public:
// m_uiOpacityCountDown moved to MenuController
// DLC flags moved to DLCController
// Host options - m_uiGameHostSettings moved to GameSettingsManager
unsigned int& m_uiGameHostSettings =
m_gameSettingsManager.m_uiGameHostSettings;
unsigned int& m_uiGameHostSettings = m_gameSettingsManager.m_uiGameHostSettings;
#if defined(_LARGE_WORLDS)
unsigned int m_GameNewWorldSize;
@@ -965,17 +945,13 @@ public:
// World seed from png image - delegated to MenuController
void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes,
unsigned char* seedText, unsigned int& uiHostOptions,
bool& bHostOptionsRead,
std::uint32_t& uiTexturePack) {
m_menuController.getImageTextData(imageData, imageBytes, seedText,
uiHostOptions, bHostOptionsRead,
uiTexturePack);
bool& bHostOptionsRead, std::uint32_t& uiTexturePack) {
m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack);
}
unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return m_menuController.createImageTextData(
textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId);
return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId);
}
// Game rules
@@ -1003,8 +979,7 @@ public:
void UpdatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerGamePrivileges) {
m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex,
playerGamePrivileges);
m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges);
}
short GetPlayerColour(std::uint8_t networkSmallId) {
return m_networkController.getPlayerColour(networkSmallId);
@@ -1019,9 +994,7 @@ public:
bool bPromote = false) {
return m_dlcController.addDLCRequest(eContentType, bPromote);
}
bool RetrieveNextDLCContent() {
return m_dlcController.retrieveNextDLCContent();
}
bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); }
bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); }
int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) {
return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad);
@@ -1037,45 +1010,26 @@ public:
return m_dlcController.dlcContentRetrieved(eType);
}
void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); }
void ClearAndResetDLCDownloadQueue() {
m_dlcController.clearAndResetDLCDownloadQueue();
}
bool RetrieveNextTMSPPContent() {
return m_dlcController.retrieveNextTMSPPContent();
}
void TickTMSPPFilesRetrieved() {
m_dlcController.tickTMSPPFilesRetrieved();
}
void ClearTMSPPFilesRetrieved() {
m_dlcController.clearTMSPPFilesRetrieved();
}
void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); }
bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); }
void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); }
void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); }
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType,
bool bPromote = false) {
return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote);
}
int GetDLCInfoTexturesOffersCount() {
return m_dlcController.getDLCInfoTexturesOffersCount();
}
int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); }
static int TMSPPFileReturned(void* pParam, int iPad, int iUserData,
IPlatformStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) {
return DLCController::tmsPPFileReturned(pParam, iPad, iUserData,
pFileData, szFilename);
}
DLC_INFO* GetDLCInfoTrialOffer(int iIndex) {
return m_dlcController.getDLCInfoTrialOffer(iIndex);
}
DLC_INFO* GetDLCInfoFullOffer(int iIndex) {
return m_dlcController.getDLCInfoFullOffer(iIndex);
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); }
int GetDLCInfoTrialOffersCount() {
return m_dlcController.getDLCInfoTrialOffersCount();
}
int GetDLCInfoFullOffersCount() {
return m_dlcController.getDLCInfoFullOffersCount();
}
int GetDLCInfoTrialOffersCount() { return m_dlcController.getDLCInfoTrialOffersCount(); }
int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); }
bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) {
return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal);
}
@@ -1092,10 +1046,8 @@ public:
// Download status members moved to DLCController
bool m_bCorruptSaveDeleted;
std::uint8_t*& m_pBannedListFileBuffer =
m_bannedListManager.m_pBannedListFileBuffer;
unsigned int& m_dwBannedListFileSize =
m_bannedListManager.m_dwBannedListFileSize;
std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer;
unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize;
public:
unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize;
@@ -1138,6 +1090,14 @@ public:
return SkinManager::getSkinPathFromId(skinId);
}
int LoadLocalTMSFile(char* wchTMSFile) override = 0;
int LoadLocalTMSFile(char* wchTMSFile,
eFileExtensionType eExt) override = 0;
void FreeLocalTMSFiles(eTMSFileType eType) override = 0;
int GetLocalTMSFileIndex(char* wchTMSFile,
bool bFilenameIncludesExtension,
eFileExtensionType eEXT) override = 0;
virtual bool GetTMSGlobalFileListRead() { return true; }
virtual bool GetTMSDLCInfoRead() { return true; }
virtual bool GetTMSXUIDsFileRead() { return true; }
@@ -1172,17 +1132,10 @@ private:
// 4J-PB - language and locale functions
public:
void LocaleAndLanguageInit() {
m_localizationManager.localeAndLanguageInit();
}
void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); }
void getLocale(std::vector<std::string>& vecWstrLocales) {
m_localizationManager.getLocale(vecWstrLocales);
}
[[nodiscard]] std::vector<std::string> getLocale() {
std::vector<std::string> v;
m_localizationManager.getLocale(v);
return v;
}
int get_eMCLang(char* pwchLocale) {
return m_localizationManager.get_eMCLang(pwchLocale);
}
@@ -1190,18 +1143,24 @@ public:
return m_localizationManager.get_xcLang(pwchLocale);
}
void SetTickTMSDLCFiles(bool bVal) {
m_dlcController.setTickTMSDLCFiles(bVal);
}
void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); }
std::string getFilePath(std::uint32_t packId, std::string filename,
bool bAddDataFolder,
std::string mountPoint = "TPACK:");
bool bAddDataFolder,
std::string mountPoint = "TPACK:");
private:
std::string getRootPath(std::uint32_t packId, bool allowOverride,
bool bAddDataFolder, std::string mountPoint);
bool bAddDataFolder, std::string mountPoint);
public:
#if defined(_WINDOWS64)
// CMinecraftAudio audio;
#else
#endif
};
extern Game app;
// singleton
// extern CMinecraftApp app;
+17 -48
View File
@@ -2,88 +2,57 @@
#include "app/common/Game.h"
bool GameMenuService::openInventory(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
bool GameMenuService::openInventory(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) {
return game_.LoadInventoryMenu(iPad, player, navigateBack);
}
bool GameMenuService::openCreative(int iPad,
std::shared_ptr<LocalPlayer> player,
bool navigateBack) {
bool GameMenuService::openCreative(int iPad, std::shared_ptr<LocalPlayer> player, bool navigateBack) {
return game_.LoadCreativeMenu(iPad, player, navigateBack);
}
bool GameMenuService::openCrafting2x2(int iPad,
std::shared_ptr<LocalPlayer> player) {
bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr<LocalPlayer> player) {
return game_.LoadCrafting2x2Menu(iPad, player);
}
bool GameMenuService::openCrafting3x3(int iPad,
std::shared_ptr<LocalPlayer> player,
int x, int y, int z) {
bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) {
return game_.LoadCrafting3x3Menu(iPad, player, x, y, z);
}
bool GameMenuService::openEnchanting(int iPad,
std::shared_ptr<Inventory> inventory,
int x, int y, int z, Level* level,
const std::string& name) {
bool GameMenuService::openEnchanting(int iPad, std::shared_ptr<Inventory> inventory, int x, int y, int z, Level* level, const std::string& name) {
return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name);
}
bool GameMenuService::openFurnace(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<FurnaceTileEntity> furnace) {
bool GameMenuService::openFurnace(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace) {
return game_.LoadFurnaceMenu(iPad, inventory, furnace);
}
bool GameMenuService::openBrewingStand(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BrewingStandTileEntity> brewingStand) {
bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand) {
return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand);
}
bool GameMenuService::openContainer(int iPad,
std::shared_ptr<Container> inventory,
std::shared_ptr<Container> container) {
bool GameMenuService::openContainer(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<Container> container) {
return game_.LoadContainerMenu(iPad, inventory, container);
}
bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory,
std::shared_ptr<DispenserTileEntity> trap) {
bool GameMenuService::openTrap(int iPad, std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap) {
return game_.LoadTrapMenu(iPad, inventory, trap);
}
bool GameMenuService::openFireworks(int iPad,
std::shared_ptr<LocalPlayer> player, int x,
int y, int z) {
bool GameMenuService::openFireworks(int iPad, std::shared_ptr<LocalPlayer> player, int x, int y, int z) {
return game_.LoadFireworksMenu(iPad, player, x, y, z);
}
bool GameMenuService::openSign(int iPad, std::shared_ptr<SignTileEntity> sign) {
return game_.LoadSignEntryMenu(iPad, sign);
}
bool GameMenuService::openRepairing(int iPad,
std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z) {
bool GameMenuService::openRepairing(int iPad, std::shared_ptr<Inventory> inventory, Level* level, int x, int y, int z) {
return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z);
}
bool GameMenuService::openTrading(int iPad,
std::shared_ptr<Inventory> inventory,
std::shared_ptr<Merchant> trader,
Level* level, const std::string& name) {
bool GameMenuService::openTrading(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level* level, const std::string& name) {
return game_.LoadTradingMenu(iPad, inventory, trader, level, name);
}
bool GameMenuService::openCommandBlock(
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) {
bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) {
return game_.LoadCommandBlockMenu(iPad, commandBlock);
}
bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) {
bool GameMenuService::openHopper(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<HopperTileEntity> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper);
}
bool GameMenuService::openHopperMinecart(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) {
bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<MinecartHopper> hopper) {
return game_.LoadHopperMenu(iPad, inventory, hopper);
}
bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) {
bool GameMenuService::openHorse(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Container> container, std::shared_ptr<EntityHorse> horse) {
return game_.LoadHorseMenu(iPad, inventory, container, horse);
}
bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<BeaconTileEntity> beacon) {
bool GameMenuService::openBeacon(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<BeaconTileEntity> beacon) {
return game_.LoadBeaconMenu(iPad, inventory, beacon);
}
+3 -2
View File
@@ -40,8 +40,9 @@ public:
int iPad, std::shared_ptr<CommandBlockEntity> commandBlock) override;
bool openHopper(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<HopperTileEntity> hopper) override;
bool openHopperMinecart(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) override;
bool openHopperMinecart(
int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<MinecartHopper> hopper) override;
bool openHorse(int iPad, std::shared_ptr<Inventory> inventory,
std::shared_ptr<Container> container,
std::shared_ptr<EntityHorse> horse) override;
@@ -5,6 +5,7 @@
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/StartFeature.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
@@ -15,11 +16,10 @@
#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
@@ -2,12 +2,6 @@
#include "java/InputOutputStream/DataOutputStream.h"
// Filename for the per-save game rules blob written by GameRuleManager
// and consumed by the save / converter / level storage paths. Defined
// here in minecraft/ so save-path consumers don't need to drag in the
// full app-side GameRuleManager header just for this string.
inline constexpr const char* GAME_RULE_SAVENAME = "requiredGameRules.grf";
class ConsoleGameRules {
public:
enum EGameRuleType {
@@ -12,21 +12,21 @@
#include "app/common/DLC/DLCLocalisationFile.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "java/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "strings.h"
const char* GameRuleManager::wchTagNameA[] = {
@@ -223,7 +223,8 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn,
unsigned int bStringTableSize = dis2.readInt();
std::vector<uint8_t> bStringTable(bStringTableSize);
dis2.read(bStringTable);
StringTable* strings = new StringTable(bStringTable, app.getLocale());
StringTable* strings =
new StringTable(bStringTable.data(), bStringTable.size());
// Read RuleFile.
std::vector<uint8_t> bRuleFile(content.size() - bStringTable.size());
@@ -640,7 +641,7 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
}
void GameRuleManager::loadDefaultGameRules() {
#if 0
#if !defined(__linux__)
#if defined(_WINDOWS64)
File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck");
if (!packedTutorialFile.exists())
@@ -656,8 +657,6 @@ void GameRuleManager::loadDefaultGameRules() {
app.GetString(IDS_TUTORIALSAVENAME));
}
#else
// 4jcraft: brought over from TU18 so the tutorial world loads from assets
// TODO clean this up
std::string fpTutorial = "Tutorial.pck";
if (app.getArchiveFileSize(fpTutorial) >= 0) {
DLCPack* pack = new DLCPack("", 0xffffffff);
@@ -8,9 +8,9 @@
#include <unordered_map>
#include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerators.h"
#include "app/common/GameRules/LevelRules/LevelRules.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class LevelGenerationOptions;
class RootGameRulesDefinition;
@@ -27,6 +27,8 @@ class DLCGameRulesHeader;
class File;
class LevelRuleset;
#define GAME_RULE_SAVENAME "requiredGameRules.grf"
// 4J-JEV:
#define LEVEL_GEN_ID int
#define LEVEL_GEN_ID_NULL 0
@@ -3,17 +3,17 @@
#include <algorithm>
#include <cmath>
#include "app/common/Game.h"
#include "ConsoleSchematicFile.h"
#include "LevelGenerationOptions.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/phys/AABB.h"
#include "util/StringHelpers.h"
ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
LevelGenerationOptions* levelGenOptions) {
@@ -4,9 +4,9 @@
#include <optional>
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "ConsoleSchematicFile.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/phys/AABB.h"
#include "minecraft/world/phys/Vec3.h"
@@ -1,10 +1,10 @@
#include "BiomeOverride.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "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"
BiomeOverride::BiomeOverride() {
m_tile = 0;
@@ -4,8 +4,8 @@
#include <cstdint>
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
class BiomeOverride : public GameRuleDefinition {
private:
@@ -4,20 +4,20 @@
#include <algorithm>
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Direction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "util/StringHelpers.h"
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
m_x = m_y = m_z = 0;
@@ -77,8 +77,8 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos,
dos->writeUTF(toWString(m_dimension));
}
void ConsoleGenerateStructure::addAttribute(const std::string& attributeName,
const std::string& attributeValue) {
void ConsoleGenerateStructure::addAttribute(
const std::string& attributeName, const std::string& attributeValue) {
if (attributeName.compare("x") == 0) {
int value = fromWString<int>(attributeValue);
m_x = value;
@@ -2,8 +2,8 @@
#include <string>
#include <vector>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
@@ -1,6 +1,6 @@
#pragma once
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
class ConsoleGenerateStructureAction : public GameRuleDefinition {
public:
@@ -1,4 +1,4 @@
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "ConsoleSchematicFile.h"
#include <assert.h>
#include <string.h>
@@ -8,10 +8,12 @@
#include <unordered_map>
#include <vector>
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "java/Class.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/util/Log.h"
#include "minecraft/world/entity/Entity.h"
#include "minecraft/world/entity/EntityIO.h"
#include "minecraft/world/entity/ItemFrame.h"
@@ -20,7 +22,6 @@
#include "minecraft/world/level/LightLayer.h"
#include "minecraft/world/level/TilePos.h"
#include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/TileEntity.h"
#include "minecraft/world/phys/AABB.h"
@@ -38,7 +39,7 @@ ConsoleSchematicFile::ConsoleSchematicFile() {
}
ConsoleSchematicFile::~ConsoleSchematicFile() {
Log::info("Deleting schematic file\n");
app.DebugPrintf("Deleting schematic file\n");
}
void ConsoleSchematicFile::save(DataOutputStream* dos) {
@@ -111,7 +112,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
m_data.resize(m_dataSize);
break;
default:
Log::info(
app.DebugPrintf(
"Unrecognized compression type for Schematic file "
"(%d)\n",
(int)compressionType);
@@ -138,7 +139,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
if (te == nullptr) {
#ifndef _CONTENT_PACKAGE
Log::info(
app.DebugPrintf(
"ConsoleSchematicFile has read a nullptr tile "
"entity\n");
assert(0);
@@ -215,8 +216,8 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk,
int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16);
#ifdef _DEBUG
Log::info("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, zStart,
xEnd - 1, yEnd - 1, zEnd - 1);
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart,
zStart, xEnd - 1, yEnd - 1, zEnd - 1);
#endif
int rowBlocksIncluded = (yEnd - yStart) * (zEnd - zStart);
@@ -290,7 +291,8 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk,
dataP += (rowBlockCount - rowBlocksIncluded) / 2;
}
} else {
Log::info("ERROR: Rotation of block and data not implemented!!\n");
app.DebugPrintf(
"ERROR: Rotation of block and data not implemented!!\n");
}
// 4J Stu - Hack for ME pack to replace sand with end stone in schematics
@@ -554,8 +556,8 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
e->absMoveTo(targetX, targetY, targetZ, e->yRot, e->xRot);
}
#ifdef _DEBUG
Log::info("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), e->x,
e->y, e->z);
app.DebugPrintf("Adding entity type %d at (%f,%f,%f)\n", e->GetType(),
e->x, e->y, e->z);
#endif
e->setLevel(chunk->level);
e->resetSmallId();
@@ -615,7 +617,7 @@ void ConsoleSchematicFile::generateSchematicFile(
int ySize = yEnd - yStart + 1;
int zSize = zEnd - zStart + 1;
Log::info(
app.DebugPrintf(
"Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), "
"%dx%dx%d\n",
xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize);
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
#include "app/linux/Stubs/winapi_stubs.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
#include "minecraft/world/phys/Vec3.h"
@@ -42,6 +43,26 @@ public:
void decrementRefCount() { --m_refCount; }
bool shouldDelete() { return m_refCount <= 0; }
typedef struct _XboxSchematicInitParam {
char name[64];
int startX;
int startY;
int startZ;
int endX;
int endY;
int endZ;
bool bSaveMobs;
Compression::ECompressionTypes compressionType;
_XboxSchematicInitParam() {
memset(name, 0, 64 * (sizeof(char)));
startX = startY = startZ = endX = endY = endZ = 0;
bSaveMobs = false;
compressionType = Compression::eCompressionType_None;
}
} XboxSchematicInitParam;
private:
int m_xSize, m_ySize, m_zSize;
std::vector<std::shared_ptr<TileEntity> > m_tileEntities;
@@ -1,4 +1,4 @@
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "LevelGenerationOptions.h"
#include <limits.h>
#include <wchar.h>
@@ -6,27 +6,28 @@
#include <unordered_set>
#include <utility>
#include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h"
#include "app/common/GameRules/LevelGeneration/BiomeOverride.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "app/common/GameRules/LevelGeneration/StartFeature.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/Localisation/StringTable.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "java/File.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/GameEnums.h"
#include "minecraft/Pos.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/chunk/LevelChunk.h"
#include "minecraft/world/level/dimension/Dimension.h"
#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/phys/AABB.h"
#include "platform/fs/fs.h"
@@ -440,7 +441,8 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
auto it = m_schematics.find(filename);
if (it != m_schematics.end()) {
#if !defined(_CONTENT_PACKAGE)
printf("We have already loaded schematic file %s\n", filename.c_str());
printf("We have already loaded schematic file %s\n",
filename.c_str());
#endif
it->second->incrementRefCount();
return it->second;
@@ -469,7 +471,8 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
return schematic;
}
void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) {
void LevelGenerationOptions::releaseSchematicFile(
const std::string& filename) {
// 4J Stu - We don't want to delete them when done, but probably want to
// keep a set of active schematics for the current world
// auto it = m_schematics.find(filename);
@@ -553,7 +556,7 @@ void LevelGenerationOptions::loadBaseSaveData() {
[this](int pad, std::uint32_t err, std::uint32_t lic) {
return onPackMounted(pad, err, lic);
},
"WPACK") != 997 /* ERROR_IO_PENDING */) {
"WPACK") != ERROR_IO_PENDING) {
// corrupt DLC
setLoadedData();
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",
@@ -574,7 +577,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
uint32_t dwLicenceMask) {
LevelGenerationOptions* lgo = this;
lgo->m_bLoadingData = false;
if (dwErr != 0 /* ERROR_SUCCESS */) {
if (dwErr != ERROR_SUCCESS) {
// corrupt DLC
app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad,
dwErr);
@@ -625,8 +628,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
auto readResult = PlatformFilesystem.readFile(
save.getPath(), pbData, dwFileSize);
if (readResult.status !=
IPlatformFilesystem::ReadStatus::Ok) {
if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) {
app.FatalLoadError();
}
@@ -8,9 +8,10 @@
#include <unordered_map>
#include <vector>
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/DLC/DLCPack.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/Localisation/StringTable.h"
#include "minecraft/world/level/levelgen/structure/StructureFeature.h"
class ApplySchematicRuleDefinition;
@@ -188,8 +189,7 @@ private:
bool m_bHaveMinY;
int m_minY;
std::unordered_map<std::string, ConsoleSchematicFile*> m_schematics;
std::unordered_map<ChunkRuleCacheKey, ChunkRuleCacheEntry,
ChunkRuleCacheKeyHash>
std::unordered_map<ChunkRuleCacheKey, ChunkRuleCacheEntry, ChunkRuleCacheKeyHash>
m_chunkRuleCache;
std::vector<BiomeOverride*> m_biomeOverrides;
std::vector<StartFeature*> m_features;
@@ -2,7 +2,7 @@
#include <algorithm>
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "LevelGenerationOptions.h"
LevelGenerators::LevelGenerators() {}
@@ -1,10 +1,10 @@
#include "StartFeature.h"
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "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"
StartFeature::StartFeature() {
m_chunkX = 0;
@@ -3,8 +3,8 @@
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "minecraft/world/level/levelgen/structure/StructureFeature.h"
class StartFeature : public GameRuleDefinition {
@@ -1,12 +1,12 @@
#include "XboxStructureActionGenerateBox.h"
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.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 "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() {
m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0;
@@ -1,8 +1,8 @@
#pragma once
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;
@@ -1,12 +1,12 @@
#include "XboxStructureActionPlaceBlock.h"
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.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 "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() {
m_x = m_y = m_z = m_tile = m_data = 0;
@@ -1,8 +1,8 @@
#pragma once
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;
@@ -4,17 +4,17 @@
#include <memory>
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/TileEntity.h"
#include "util/StringHelpers.h"
XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() {
m_tile = Tile::chest_Id;
@@ -3,8 +3,8 @@
#include <string>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class AddItemRuleDefinition;
class StructurePiece;
@@ -4,9 +4,9 @@
#include <memory>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/levelgen/structure/BoundingBox.h"
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
@@ -33,8 +33,9 @@ void XboxStructureActionPlaceSpawner::addAttribute(
if (attributeName.compare("entity") == 0) {
m_entityId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n",
m_entityId.c_str());
printf(
"XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n",
m_entityId.c_str());
#endif
} else {
XboxStructureActionPlaceBlock::addAttribute(attributeName,
@@ -2,8 +2,8 @@
#include <string>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "XboxStructureActionPlaceBlock.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
class StructurePiece;
class Level;
@@ -3,7 +3,10 @@
#include <algorithm>
#include <vector>
#include "app/common/Game.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 "minecraft/world/item/EnchantedBookItem.h"
#include "minecraft/world/item/Item.h"
@@ -11,9 +14,6 @@
#include "minecraft/world/item/enchantment/Enchantment.h"
#include "minecraft/world/item/enchantment/EnchantmentCategory.h"
#include "minecraft/world/item/enchantment/EnchantmentInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() {
m_enchantmentId = m_enchantmentLevel = 0;
@@ -3,8 +3,8 @@
#include <memory>
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
class ItemInstance;
@@ -3,14 +3,14 @@
#include <algorithm>
#include "AddEnchantmentRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/Container.h"
#include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/item/Item.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
AddItemRuleDefinition::AddItemRuleDefinition() {
m_itemId = m_quantity = m_auxValue = m_dataTag = 0;
@@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
class Container;
class AddEnchantmentRuleDefinition;
@@ -1,15 +1,15 @@
#include "CollectItemRuleDefinition.h"
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/network/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "util/StringHelpers.h"
CollectItemRuleDefinition::CollectItemRuleDefinition() {
m_itemId = 0;
@@ -111,7 +111,8 @@ std::string CollectItemRuleDefinition::generateXml(
"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
"promptName=\"OPTIONAL\"";
if (item->getAuxValue() != 0)
xml += " auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
xml +=
" auxValue=\"" + toWString<int>(item->getAuxValue()) + "\"";
if (item->get4JData() != 0)
xml += " dataTag=\"" + toWString<int>(item->get4JData()) + "\"";
xml += "/>\n";
@@ -3,9 +3,9 @@
#include <memory>
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
class Pos;
class UseTileRuleDefinition;
@@ -4,13 +4,13 @@
#include <unordered_map>
#include <utility>
#include "app/common/Game.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "minecraft/network/Connection.h"
#include "minecraft/network/packet/UpdateGameRuleProgressPacket.h"
#include "minecraft/world/level/GameRules/GameRule.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
void CompleteAllRuleDefinition::getChildren(
std::vector<GameRuleDefinition*>* children) {
@@ -3,7 +3,7 @@
#include <string>
#include "CompoundGameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
class GameRule;
@@ -25,8 +25,8 @@ public:
virtual bool onCollectItem(GameRule* rule,
std::shared_ptr<ItemInstance> item);
static std::string generateDescriptionString(const std::string& description,
void* data, int dataLength);
static std::string generateDescriptionString(
const std::string& description, void* data, int dataLength);
private:
void updateStatus(GameRule* rule);
@@ -7,14 +7,14 @@
#include <unordered_map>
#include <utility>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h"
#include "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 "app/common/GameRules/LevelRules/Rules/GameRule.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "util/StringHelpers.h"
CompoundGameRuleDefinition::CompoundGameRuleDefinition() {
@@ -2,9 +2,9 @@
#include <vector>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
class CompoundGameRuleDefinition : public GameRuleDefinition {
protected:
@@ -1,4 +1,4 @@
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include <assert.h>
#include <wchar.h>
@@ -8,14 +8,14 @@
#include <utility>
#include <vector>
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.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 "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"
class Connection;
@@ -66,7 +66,7 @@ GameRuleDefinition* GameRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n",
ruleType);
ruleType);
#endif
return nullptr;
}
@@ -77,13 +77,13 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_descriptionId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter descriptionId=%s\n",
m_descriptionId.c_str());
m_descriptionId.c_str());
#endif
} else if (attributeName.compare("promptName") == 0) {
m_promptId = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Adding parameter m_promptId=%s\n",
m_promptId.c_str());
m_promptId.c_str());
#endif
} else if (attributeName.compare("dataTag") == 0) {
m_4JDataValue = fromWString<int>(attributeValue);
@@ -92,8 +92,9 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName,
m_4JDataValue);
} else {
#ifndef _CONTENT_PACKAGE
printf("GameRuleDefinition: Attempted to add invalid attribute: %s\n",
attributeName.c_str());
printf(
"GameRuleDefinition: Attempted to add invalid attribute: %s\n",
attributeName.c_str());
#endif
}
}
@@ -6,9 +6,9 @@
#include <unordered_map>
#include <vector>
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRulesInstance.h"
class GameRule;
class LevelRuleset;
@@ -81,6 +81,7 @@ public:
GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules,
Connection* connection);
static std::string generateDescriptionString(
ConsoleGameRules::EGameRuleType defType, const std::string& description,
void* data = nullptr, int dataLength = 0);
ConsoleGameRules::EGameRuleType defType,
const std::string& description, void* data = nullptr,
int dataLength = 0);
};
@@ -1,9 +1,9 @@
#include "LevelRuleset.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h"
#include "minecraft/locale/StringTable.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/Localisation/StringTable.h"
class AABB;
@@ -4,7 +4,7 @@
#include <vector>
#include "CompoundGameRuleDefinition.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
class NamedAreaRuleDefinition;
class AABB;
@@ -2,11 +2,11 @@
#include <wchar.h>
#include "app/common/Game.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "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"
NamedAreaRuleDefinition::NamedAreaRuleDefinition() {
m_name = "";
@@ -41,7 +41,7 @@ void NamedAreaRuleDefinition::addAttribute(const std::string& attributeName,
m_name = attributeValue;
#ifndef _CONTENT_PACKAGE
printf("NamedAreaRuleDefinition: Adding parameter name=%s\n",
m_name.c_str());
m_name.c_str());
#endif
} else if (attributeName.compare("x0") == 0) {
m_area.x0 = fromWString<int>(attributeValue);
@@ -2,8 +2,8 @@
#include <string>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "minecraft/world/phys/AABB.h"
class NamedAreaRuleDefinition : public GameRuleDefinition {
@@ -4,16 +4,16 @@
#include <memory>
#include "app/common/Game.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/linux/LinuxGame.h"
#include "util/StringHelpers.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "minecraft/Pos.h"
#include "minecraft/world/entity/player/Inventory.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/food/FoodData.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "util/StringHelpers.h"
UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() {
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;
@@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "minecraft/world/level/GameRules/GameRuleDefinition.h"
#include "GameRuleDefinition.h"
#include "app/common/GameRules/ConsoleGameRulesConstants.h"
class AddItemRuleDefinition;
class Pos;

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