Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1386b366a3 | |||
| f6d41eba4d | |||
| 93c0d1b1e1 | |||
| 04abf10331 | |||
| 4cdc29bbf4 |
@@ -1,62 +1,36 @@
|
||||
FROM ubuntu:24.04 as clang
|
||||
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ARG LLVM_VERSION=20
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
wget \
|
||||
lsb-release \
|
||||
software-properties-common \
|
||||
gnupg
|
||||
|
||||
RUN wget https://apt.llvm.org/llvm.sh \
|
||||
&& chmod +x llvm.sh \
|
||||
&& ./llvm.sh ${LLVM_VERSION} \
|
||||
&& rm llvm.sh
|
||||
|
||||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION}
|
||||
|
||||
RUN update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${LLVM_VERSION} 100
|
||||
|
||||
RUN apt-get install -y \
|
||||
libc++-${LLVM_VERSION}-dev \
|
||||
libc++abi-${LLVM_VERSION}-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV CC="clang" \
|
||||
CXX="clang++" \
|
||||
CC_LD="lld" \
|
||||
CXX_LD="lld"
|
||||
|
||||
FROM clang AS ivjcraft
|
||||
|
||||
ARG MESON_VERSION=1.10.2
|
||||
|
||||
# Dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y software-properties-common \
|
||||
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
|
||||
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
gcc-14 g++-14 \
|
||||
python3 \
|
||||
ninja-build \
|
||||
libsdl2-dev \
|
||||
libgl-dev \
|
||||
libglm-dev \
|
||||
libglu1-mesa-dev \
|
||||
libpthread-stubs0-dev \
|
||||
libssl-dev \
|
||||
gcc-15 g++-15 \
|
||||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100 \
|
||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 100 \
|
||||
# Set GCC 14 as the default compiler
|
||||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
|
||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 \
|
||||
# Clean up lol
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget -qO meson.tar.gz https://github.com/mesonbuild/meson/releases/latest/download/meson-${MESON_VERSION}.tar.gz \
|
||||
# Use the latest version of Meson -> $(curl -s "https://api.github.com/repos/mesonbuild/meson/releases/latest" | grep -Po '"tag_name": "\K[0-9.]+')
|
||||
RUN MESON_VERSION=1.10.2 \
|
||||
&& wget -qO meson.tar.gz https://github.com/mesonbuild/meson/releases/latest/download/meson-${MESON_VERSION}.tar.gz \
|
||||
&& mkdir /opt/meson \
|
||||
&& tar xf meson.tar.gz --strip-components=1 -C /opt/meson \
|
||||
&& mv /opt/meson/meson.py /opt/meson/meson \
|
||||
&& ln -s /opt/meson/meson /usr/bin/meson \
|
||||
&& rm -rf meson.tar.gz
|
||||
|
||||
ENV DEBIAN_FRONTEND=dialog
|
||||
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 438 B |
|
After Width: | Height: | Size: 477 B |
@@ -1,5 +1,7 @@
|
||||
# <img src=".github-assets/logo.jpg" alt="Logo" width="50" height="50" style="vertical-align: middle;"> 4JCraft
|
||||
|
||||
     
|
||||
   
|
||||
---
|
||||
|
||||
4JCraft is a modified version of the Minecraft Console Legacy Edition, aimed at porting old Minecraft to different platforms (such as Linux, Android, Emscripten, etc.) and refactoring the codebase to improve organization and use modern C++ features.
|
||||
@@ -87,6 +89,12 @@ pip install meson ninja
|
||||
|
||||
Or follow the [Meson quickstart guide](https://mesonbuild.com/Quick-guide.html).
|
||||
|
||||
### Tracy profiler
|
||||
|
||||
This project can be built with Tracy profiling support. Tracy is available as a meson subproject (bundled in `subprojects/tracy`) and many distributions provide the Tracy tooling; on Arch/Manjaro you can get the latest build from the AUR as `tracy-git`.
|
||||
|
||||
Tracy can be directly enabled if you enable the tracy meson option before compiling.
|
||||
|
||||
#### Docker (alternative)
|
||||
|
||||
If you don't want to install dependencies, use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension, or build manually:
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
# MARK: build configuration
|
||||
|
||||
project(
|
||||
'4jcraft',
|
||||
['cpp', 'c'],
|
||||
version: '0.1.0',
|
||||
meson_version: '>= 1.3',
|
||||
default_options: [
|
||||
'cpp_std=c++20',
|
||||
'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
|
||||
'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
|
||||
],
|
||||
)
|
||||
|
||||
@@ -23,31 +18,29 @@ 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)
|
||||
'-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']
|
||||
endif
|
||||
@@ -68,41 +61,43 @@ 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']
|
||||
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)
|
||||
|
||||
miniaudio_dep = dependency('miniaudio')
|
||||
|
||||
tracy_opt = get_option('tracy')
|
||||
|
||||
if not tracy_opt.disabled()
|
||||
tracy_proj = subproject('tracy', required: tracy_opt, default_options: ['tracy_enable=true'])
|
||||
if tracy_proj.found()
|
||||
tracy_client_dep = tracy_proj.get_variable('tracy_dep')
|
||||
add_project_arguments('-DTRACY_ENABLE', language: ['cpp', 'c'])
|
||||
else
|
||||
tracy_client_dep = dependency('', required: false)
|
||||
endif
|
||||
else
|
||||
tracy_client_dep = dependency('', required: false)
|
||||
endif
|
||||
|
||||
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')
|
||||
subdir('targets/app')
|
||||
@@ -7,8 +7,8 @@ option(
|
||||
)
|
||||
|
||||
option('classic_panorama',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Enable classic java edition panorama (ui_backend=java ONLY).')
|
||||
|
||||
option(
|
||||
@@ -42,8 +42,8 @@ option(
|
||||
)
|
||||
|
||||
option(
|
||||
'enable_mimalloc',
|
||||
'tracy',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Link mimalloc as the malloc implementation. Requires libmimalloc-dev.',
|
||||
description: 'Enable Tracy profiler'
|
||||
)
|
||||
|
||||
@@ -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())
|
||||
@@ -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())
|
||||
@@ -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++']
|
||||
|
||||
@@ -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
|
||||
@@ -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,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'],
|
||||
@@ -55,7 +55,7 @@ simdutf_lib = static_library(
|
||||
)
|
||||
|
||||
simdutf_dep = declare_dependency(
|
||||
include_directories: include_directories('.'),
|
||||
sources: simdutf_amalgamate,
|
||||
link_with: simdutf_lib,
|
||||
)
|
||||
|
||||
|
||||
@@ -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('.')
|
||||
@@ -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,7 +1,7 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/simdutf/simdutf.git
|
||||
depth = 1
|
||||
revision = fd476229424b40ae71a58dd5a205795c3d76b5f1
|
||||
revision = v8.2.0
|
||||
patch_directory = simdutf
|
||||
|
||||
[provide]
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/wolfpld/tracy.git
|
||||
revision = master
|
||||
depth = 1
|
||||
@@ -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`
|
||||
@@ -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.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -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 wchar_t* 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 --
|
||||
|
||||
@@ -55,23 +61,23 @@ LevelRuleset* AppGameServices::getGameRuleDefinitions() {
|
||||
|
||||
// -- Texture cache --
|
||||
|
||||
void AppGameServices::addMemoryTextureFile(const std::string& name,
|
||||
void AppGameServices::addMemoryTextureFile(const std::wstring& name,
|
||||
std::uint8_t* data,
|
||||
unsigned int size) {
|
||||
game_.AddMemoryTextureFile(name, data, size);
|
||||
}
|
||||
|
||||
void AppGameServices::removeMemoryTextureFile(const std::string& name) {
|
||||
void AppGameServices::removeMemoryTextureFile(const std::wstring& name) {
|
||||
game_.RemoveMemoryTextureFile(name);
|
||||
}
|
||||
|
||||
void AppGameServices::getMemFileDetails(const std::string& name,
|
||||
void AppGameServices::getMemFileDetails(const std::wstring& name,
|
||||
std::uint8_t** data,
|
||||
unsigned int* size) {
|
||||
game_.GetMemFileDetails(name, data, size);
|
||||
}
|
||||
|
||||
bool AppGameServices::isFileInMemoryTextures(const std::string& name) {
|
||||
bool AppGameServices::isFileInMemoryTextures(const std::wstring& name) {
|
||||
return game_.IsFileInMemoryTextures(name);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -191,7 +208,7 @@ void AppGameServices::setTMSAction(int iPad, eTMSAction action) {
|
||||
|
||||
// -- Skin / cape / animation --
|
||||
|
||||
std::string AppGameServices::getPlayerSkinName(int iPad) {
|
||||
std::wstring AppGameServices::getPlayerSkinName(int iPad) {
|
||||
return game_.GetPlayerSkinName(iPad);
|
||||
}
|
||||
|
||||
@@ -199,7 +216,7 @@ std::uint32_t AppGameServices::getPlayerSkinId(int iPad) {
|
||||
return game_.GetPlayerSkinId(iPad);
|
||||
}
|
||||
|
||||
std::string AppGameServices::getPlayerCapeName(int iPad) {
|
||||
std::wstring AppGameServices::getPlayerCapeName(int iPad) {
|
||||
return game_.GetPlayerCapeName(iPad);
|
||||
}
|
||||
|
||||
@@ -237,19 +254,22 @@ 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);
|
||||
}
|
||||
|
||||
std::uint32_t AppGameServices::getSkinIdFromPath(const std::string& skin) {
|
||||
std::uint32_t AppGameServices::getSkinIdFromPath(const std::wstring& skin) {
|
||||
return Game::getSkinIdFromPath(skin);
|
||||
}
|
||||
|
||||
std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) {
|
||||
std::wstring 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,16 +334,18 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type,
|
||||
return game_.GetTerrainFeaturePosition(type, pX, pZ);
|
||||
}
|
||||
|
||||
void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); }
|
||||
void AppGameServices::loadDefaultGameRules() {
|
||||
game_.loadDefaultGameRules();
|
||||
}
|
||||
|
||||
// -- Archive / resources --
|
||||
|
||||
bool AppGameServices::hasArchiveFile(const std::string& filename) {
|
||||
bool AppGameServices::hasArchiveFile(const std::wstring& filename) {
|
||||
return game_.hasArchiveFile(filename);
|
||||
}
|
||||
|
||||
std::vector<std::uint8_t> AppGameServices::getArchiveFile(
|
||||
const std::string& filename) {
|
||||
const std::wstring& filename) {
|
||||
return game_.getArchiveFile(filename);
|
||||
}
|
||||
|
||||
@@ -334,29 +355,32 @@ int AppGameServices::getHTMLColour(eMinecraftColour colour) {
|
||||
return game_.GetHTMLColour(colour);
|
||||
}
|
||||
|
||||
std::string AppGameServices::getEntityName(EntityTypeId type) {
|
||||
std::wstring AppGameServices::getEntityName(EntityTypeId type) {
|
||||
return game_.getEntityName(static_cast<eINSTANCEOF>(type));
|
||||
}
|
||||
|
||||
const char* AppGameServices::getGameRulesString(const std::string& key) {
|
||||
const wchar_t* AppGameServices::getGameRulesString(const std::wstring& 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::wstring AppGameServices::getFilePath(std::uint32_t packId,
|
||||
std::wstring filename,
|
||||
bool bAddDataFolder,
|
||||
std::wstring 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::wstring& 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::wstring& 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,14 +444,13 @@ 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);
|
||||
}
|
||||
|
||||
// -- Shared data --
|
||||
|
||||
std::vector<std::string>& AppGameServices::getSkinNames() {
|
||||
std::vector<std::wstring>& AppGameServices::getSkinNames() {
|
||||
return game_.vSkinNames;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
|
||||
class Game;
|
||||
class IMenuService;
|
||||
class ISkinAssetData;
|
||||
|
||||
class AppGameServices : public IGameServices {
|
||||
public:
|
||||
AppGameServices(Game& game, IMenuService& menus);
|
||||
|
||||
// -- Strings --
|
||||
const char* getString(int id) override;
|
||||
const wchar_t* getString(int id) override;
|
||||
|
||||
// -- Debug settings --
|
||||
bool debugSettingsOn() override;
|
||||
@@ -23,19 +22,20 @@ 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;
|
||||
LevelRuleset* getGameRuleDefinitions() override;
|
||||
|
||||
// -- Texture cache --
|
||||
void addMemoryTextureFile(const std::string& name, std::uint8_t* data,
|
||||
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
|
||||
unsigned int size) override;
|
||||
void removeMemoryTextureFile(const std::string& name) override;
|
||||
void getMemFileDetails(const std::string& name, std::uint8_t** data,
|
||||
void removeMemoryTextureFile(const std::wstring& name) override;
|
||||
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
|
||||
unsigned int* size) override;
|
||||
bool isFileInMemoryTextures(const std::string& name) override;
|
||||
bool isFileInMemoryTextures(const std::wstring& name) override;
|
||||
|
||||
// -- Player settings --
|
||||
unsigned char getGameSettings(int iPad, int setting) override;
|
||||
@@ -76,15 +76,19 @@ 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;
|
||||
|
||||
// -- Skin / cape / animation --
|
||||
std::string getPlayerSkinName(int iPad) override;
|
||||
std::wstring getPlayerSkinName(int iPad) override;
|
||||
std::uint32_t getPlayerSkinId(int iPad) override;
|
||||
std::string getPlayerCapeName(int iPad) override;
|
||||
std::wstring getPlayerCapeName(int iPad) override;
|
||||
std::uint32_t getPlayerCapeId(int iPad) override;
|
||||
std::uint32_t getAdditionalModelPartsForPad(int iPad) override;
|
||||
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
|
||||
@@ -98,8 +102,8 @@ public:
|
||||
void setAnimOverrideBitmask(std::uint32_t dwSkinID,
|
||||
unsigned int bitmask) override;
|
||||
unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) override;
|
||||
std::uint32_t getSkinIdFromPath(const std::string& skin) override;
|
||||
std::string getSkinPathFromId(std::uint32_t skinId) override;
|
||||
std::uint32_t getSkinIdFromPath(const std::wstring& skin) override;
|
||||
std::wstring getSkinPathFromId(std::uint32_t skinId) override;
|
||||
bool defaultCapeExists() override;
|
||||
bool isXuidNotch(PlayerUID xuid) override;
|
||||
bool isXuidDeadmau5(PlayerUID xuid) 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;
|
||||
@@ -126,20 +131,21 @@ public:
|
||||
void loadDefaultGameRules() override;
|
||||
|
||||
// -- Archive / resources --
|
||||
bool hasArchiveFile(const std::string& filename) override;
|
||||
bool hasArchiveFile(const std::wstring& filename) override;
|
||||
std::vector<std::uint8_t> getArchiveFile(
|
||||
const std::string& filename) override;
|
||||
const std::wstring& filename) override;
|
||||
|
||||
// -- Strings / formatting / misc queries --
|
||||
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,
|
||||
std::wstring getEntityName(EntityTypeId type) override;
|
||||
const wchar_t* getGameRulesString(const std::wstring& key) override;
|
||||
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;
|
||||
std::wstring getFilePath(std::uint32_t packId, std::wstring filename,
|
||||
bool bAddDataFolder,
|
||||
std::wstring mountPoint) override;
|
||||
char* getUniqueMapName() override;
|
||||
void setUniqueMapName(char* name) override;
|
||||
unsigned int getOpacityTimer(int iPad) override;
|
||||
@@ -151,22 +157,23 @@ public:
|
||||
void debugPrintf(const char* msg) override;
|
||||
|
||||
// -- DLC --
|
||||
ISkinAssetData* getSkinAssetData(const std::string& name) override;
|
||||
DLCSkinFile* getDLCSkinFile(const std::wstring& 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::wstring& 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;
|
||||
|
||||
// -- Shared data --
|
||||
std::vector<std::string>& getSkinNames() override;
|
||||
std::vector<std::wstring>& getSkinNames() override;
|
||||
std::vector<FEATURE_DATA*>& getTerrainFeatures() override;
|
||||
|
||||
// -- Menu service --
|
||||
|
||||
@@ -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;
|
||||
*/
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "app/common/UI/All Platforms/UIEnums.h"
|
||||
#include "platform/sdl2/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;
|
||||
wchar_t* wchFilename;
|
||||
eFileExtensionType eEXT;
|
||||
eTMSFileType eTMSType;
|
||||
std::uint8_t* pbData;
|
||||
@@ -150,8 +150,8 @@ typedef struct {
|
||||
|
||||
uint64_t ullOfferID_Full;
|
||||
uint64_t ullOfferID_Trial;
|
||||
char wchBanner[MAX_BANNERNAME_SIZE];
|
||||
char wchDataFile[MAX_BANNERNAME_SIZE];
|
||||
wchar_t wchBanner[MAX_BANNERNAME_SIZE];
|
||||
wchar_t wchDataFile[MAX_BANNERNAME_SIZE];
|
||||
int iGender;
|
||||
int iConfig;
|
||||
unsigned int uiSortIndex;
|
||||
@@ -171,12 +171,12 @@ typedef struct _DLCRequest {
|
||||
typedef struct _TMSPPRequest {
|
||||
eTMSContentState eState;
|
||||
eDLCContentType eType;
|
||||
IPlatformStorage::eGlobalStorage eStorageFacility;
|
||||
IPlatformStorage::eTMS_FILETYPEVAL eFileTypeVal;
|
||||
C4JStorage::eGlobalStorage eStorageFacility;
|
||||
C4JStorage::eTMS_FILETYPEVAL eFileTypeVal;
|
||||
// char szFilename[MAX_TMSFILENAME_SIZE];
|
||||
int (*CallbackFunc)(void*, int, int, IPlatformStorage::PTMSPP_FILEDATA,
|
||||
int (*CallbackFunc)(void*, int, int, C4JStorage::PTMSPP_FILEDATA,
|
||||
const char* szFilename);
|
||||
char wchFilename[MAX_TMSFILENAME_SIZE];
|
||||
wchar_t wchFilename[MAX_TMSFILENAME_SIZE];
|
||||
|
||||
void* lpCallbackParam;
|
||||
} TMSPPRequest;
|
||||
|
||||
@@ -3,35 +3,43 @@
|
||||
#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/PlatformServices.h"
|
||||
#include "platform/PlatformTypes.h"
|
||||
#include "platform/fs/fs.h"
|
||||
|
||||
ArchiveManager::ArchiveManager()
|
||||
: m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {}
|
||||
|
||||
void ArchiveManager::loadMediaArchive() {
|
||||
std::string mediapath = "";
|
||||
std::wstring mediapath = L"";
|
||||
|
||||
mediapath = "Common\\Media\\MediaWindows64.arc";
|
||||
#if _WINDOWS64
|
||||
mediapath = L"Common\\Media\\MediaWindows64.arc";
|
||||
#elif __linux__
|
||||
mediapath = L"app/common/Media/MediaLinux.arc";
|
||||
#endif
|
||||
|
||||
if (!mediapath.empty()) {
|
||||
std::string exeDirW = PlatformFilesystem.getBasePath().string();
|
||||
std::string candidate = exeDirW + File::pathSeparator + mediapath;
|
||||
#if defined(__linux__)
|
||||
std::wstring exeDirW = PlatformFileIO.getBasePath().wstring();
|
||||
std::wstring candidate = exeDirW + File::pathSeparator + mediapath;
|
||||
if (File(candidate).exists()) {
|
||||
m_mediaArchive = new ArchiveFile(File(candidate));
|
||||
} else {
|
||||
m_mediaArchive = new ArchiveFile(File(mediapath));
|
||||
}
|
||||
#else
|
||||
m_mediaArchive = new ArchiveFile(File(mediapath));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int ArchiveManager::getArchiveFileSize(const std::string& filename) {
|
||||
int ArchiveManager::getArchiveFileSize(const std::wstring& filename) {
|
||||
TexturePack* tPack = nullptr;
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft && pMinecraft->skins)
|
||||
@@ -43,7 +51,7 @@ int ArchiveManager::getArchiveFileSize(const std::string& filename) {
|
||||
return m_mediaArchive->getFileSize(filename);
|
||||
}
|
||||
|
||||
bool ArchiveManager::hasArchiveFile(const std::string& filename) {
|
||||
bool ArchiveManager::hasArchiveFile(const std::wstring& filename) {
|
||||
TexturePack* tPack = nullptr;
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft && pMinecraft->skins)
|
||||
@@ -56,7 +64,7 @@ bool ArchiveManager::hasArchiveFile(const std::string& filename) {
|
||||
}
|
||||
|
||||
std::vector<uint8_t> ArchiveManager::getArchiveFile(
|
||||
const std::string& filename) {
|
||||
const std::wstring& filename) {
|
||||
TexturePack* tPack = nullptr;
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft && pMinecraft->skins)
|
||||
@@ -94,7 +102,7 @@ void ArchiveManager::removeMemoryTPDFile(int iConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
int ArchiveManager::getTPConfigVal(char* pwchDataFile) { return -1; }
|
||||
int ArchiveManager::getTPConfigVal(wchar_t* pwchDataFile) { return -1; }
|
||||
|
||||
bool ArchiveManager::isFileInTPD(int iConfig) {
|
||||
bool val = false;
|
||||
|
||||
@@ -17,9 +17,9 @@ public:
|
||||
void loadMediaArchive();
|
||||
ArchiveFile* getMediaArchive() const { return m_mediaArchive; }
|
||||
|
||||
int getArchiveFileSize(const std::string& filename);
|
||||
bool hasArchiveFile(const std::string& filename);
|
||||
std::vector<uint8_t> getArchiveFile(const std::string& filename);
|
||||
int getArchiveFileSize(const std::wstring& filename);
|
||||
bool hasArchiveFile(const std::wstring& filename);
|
||||
std::vector<uint8_t> getArchiveFile(const std::wstring& filename);
|
||||
|
||||
// Texture Pack Data files (icon, banner, comparison shot & text)
|
||||
void addMemoryTPDFile(int iConfig, std::uint8_t* pbData,
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
bool isFileInTPD(int iConfig);
|
||||
void getTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount);
|
||||
int getTPDSize() { return m_MEM_TPD.size(); }
|
||||
int getTPConfigVal(char* pwchDataFile);
|
||||
int getTPConfigVal(wchar_t* pwchDataFile);
|
||||
|
||||
void setRequiredTexturePackID(std::uint32_t texturePackId) {
|
||||
m_dwRequiredTexturePackID = texturePackId;
|
||||
|
||||
@@ -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,13 +29,11 @@ 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,
|
||||
float pitch) = 0;
|
||||
virtual void playStreaming(const std::string& name, float x, float y,
|
||||
virtual void playStreaming(const std::wstring& name, float x, float y,
|
||||
float z, float volume, float pitch,
|
||||
bool bMusicDelay = true) = 0;
|
||||
virtual void playUI(int iSound, float volume, float pitch) = 0;
|
||||
@@ -48,10 +41,10 @@ public:
|
||||
virtual void updateSystemMusicPlaying(bool isPlaying) = 0;
|
||||
virtual void updateSoundEffectVolume(float fVal) = 0;
|
||||
virtual void init(Options*) = 0;
|
||||
virtual void add(const std::string& name, File* file) = 0;
|
||||
virtual void addMusic(const std::string& name, File* file) = 0;
|
||||
virtual void addStreaming(const std::string& name, File* file) = 0;
|
||||
virtual char* ConvertSoundPathToName(const std::string& name,
|
||||
virtual void add(const std::wstring& name, File* file) = 0;
|
||||
virtual void addMusic(const std::wstring& name, File* file) = 0;
|
||||
virtual void addStreaming(const std::wstring& name, File* file) = 0;
|
||||
virtual char* ConvertSoundPathToName(const std::wstring& name,
|
||||
bool bConvertSpaces) = 0;
|
||||
virtual void playMusicTick() = 0;
|
||||
|
||||
@@ -64,8 +57,8 @@ public:
|
||||
virtual void SetIsPlayingEndMusic(bool bVal);
|
||||
virtual void SetIsPlayingNetherMusic(bool bVal);
|
||||
|
||||
static const char* wchSoundNames[eSoundType_MAX];
|
||||
static const char* wchUISoundNames[eSFX_MAX];
|
||||
static const wchar_t* wchSoundNames[eSoundType_MAX];
|
||||
static const wchar_t* wchUISoundNames[eSFX_MAX];
|
||||
|
||||
public:
|
||||
void tick();
|
||||
@@ -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,22 +90,22 @@ 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);
|
||||
#endif
|
||||
virtual void play(int iSound, float x, float y, float z, float volume,
|
||||
float pitch);
|
||||
virtual void playStreaming(const std::string& name, float x, float y,
|
||||
virtual void playStreaming(const std::wstring& name, float x, float y,
|
||||
float z, float volume, float pitch,
|
||||
bool bMusicDelay = true);
|
||||
virtual void playUI(int iSound, float volume, float pitch);
|
||||
@@ -123,14 +117,14 @@ public:
|
||||
virtual void tick(std::shared_ptr<Mob>* players,
|
||||
float a); // 4J - updated to take array of local players
|
||||
// rather than single one
|
||||
virtual void add(const std::string& name, File* file);
|
||||
virtual void addMusic(const std::string& name, File* file);
|
||||
virtual void addStreaming(const std::string& name, File* file);
|
||||
virtual char* ConvertSoundPathToName(const std::string& name,
|
||||
virtual void add(const std::wstring& name, File* file);
|
||||
virtual void addMusic(const std::wstring& name, File* file);
|
||||
virtual void addStreaming(const std::wstring& name, File* file);
|
||||
virtual char* ConvertSoundPathToName(const std::wstring& name,
|
||||
bool bConvertSpaces = false);
|
||||
bool isStreamingWavebankReady(); // 4J Added
|
||||
int getMusicID(int iDomain);
|
||||
int getMusicID(const std::string& name);
|
||||
int getMusicID(const std::wstring& name);
|
||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax,
|
||||
int iNetherMin, int iNetherMax, int iEndMin,
|
||||
int iEndMax, int iCD1);
|
||||
@@ -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[];
|
||||
@@ -167,7 +161,7 @@ private:
|
||||
int m_StreamState;
|
||||
int m_MusicType;
|
||||
AUDIO_INFO m_StreamingAudioInfo;
|
||||
std::string m_CDMusic;
|
||||
std::wstring m_CDMusic;
|
||||
bool m_bSystemMusicPlaying;
|
||||
float m_MasterMusicVolume;
|
||||
float m_MasterEffectsVolume;
|
||||
|
||||
@@ -1,228 +1,228 @@
|
||||
#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
|
||||
"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT
|
||||
"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP
|
||||
"mob/cow/say", // eSoundType_MOB_COW_AMBIENT
|
||||
"mob/cow/hurt", // eSoundType_MOB_COW_HURT
|
||||
"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT
|
||||
"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH
|
||||
"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT
|
||||
"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL
|
||||
"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE
|
||||
"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING
|
||||
"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK
|
||||
"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT
|
||||
"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH
|
||||
"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE
|
||||
"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE
|
||||
"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT
|
||||
"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH
|
||||
"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN
|
||||
"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM
|
||||
"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH
|
||||
"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL
|
||||
"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE
|
||||
"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE
|
||||
"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT
|
||||
"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH
|
||||
"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL
|
||||
"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT
|
||||
"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT
|
||||
"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH
|
||||
"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY
|
||||
"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT,
|
||||
"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT
|
||||
"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH,
|
||||
"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP,
|
||||
"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
|
||||
"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
|
||||
"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT,
|
||||
"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
|
||||
"mob/slime/slime", // eSoundType_MOB_SLIME,
|
||||
"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK,
|
||||
"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT,
|
||||
"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
|
||||
"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
|
||||
"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
|
||||
"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
|
||||
"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD,
|
||||
"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
|
||||
"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL,
|
||||
"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG,
|
||||
"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL,
|
||||
"mob/cat/purr", // eSoundType_MOB_CAT_PURR
|
||||
"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW
|
||||
"mob/cat/meow", // eSoundType_MOB_CAT_MEOW
|
||||
const wchar_t* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
|
||||
L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
|
||||
L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT
|
||||
L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP
|
||||
L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT
|
||||
L"mob/cow/hurt", // eSoundType_MOB_COW_HURT
|
||||
L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT
|
||||
L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH
|
||||
L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT
|
||||
L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL
|
||||
L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE
|
||||
L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING
|
||||
L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK
|
||||
L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT
|
||||
L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH
|
||||
L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE
|
||||
L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE
|
||||
L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT
|
||||
L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH
|
||||
L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN
|
||||
L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM
|
||||
L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH
|
||||
L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL
|
||||
L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE
|
||||
L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE
|
||||
L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT
|
||||
L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH
|
||||
L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL
|
||||
L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT
|
||||
L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT
|
||||
L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH
|
||||
L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY
|
||||
L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT,
|
||||
L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT
|
||||
L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH,
|
||||
L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP,
|
||||
L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
|
||||
L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
|
||||
L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT,
|
||||
L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
|
||||
L"mob/slime/slime", // eSoundType_MOB_SLIME,
|
||||
L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK,
|
||||
L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT,
|
||||
L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
|
||||
L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
|
||||
L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
|
||||
L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
|
||||
L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD,
|
||||
L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
|
||||
L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL,
|
||||
L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG,
|
||||
L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL,
|
||||
L"mob/cat/purr", // eSoundType_MOB_CAT_PURR
|
||||
L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW
|
||||
L"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", //
|
||||
// eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit",
|
||||
//// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death",
|
||||
//// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk",
|
||||
L"mob/cat/hitt", // eSoundType_MOB_CAT_HITT
|
||||
// L"mob.irongolem.throw", //
|
||||
// eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit",
|
||||
//// eSoundType_MOB_IRONGOLEM_HIT L"mob.irongolem.death",
|
||||
//// eSoundType_MOB_IRONGOLEM_DEATH L"mob.irongolem.walk",
|
||||
//// eSoundType_MOB_IRONGOLEM_WALK
|
||||
"random/bow", // eSoundType_RANDOM_BOW,
|
||||
"random/bowhit", // eSoundType_RANDOM_BOW_HIT,
|
||||
"random/explode", // eSoundType_RANDOM_EXPLODE,
|
||||
"random/fizz", // eSoundType_RANDOM_FIZZ,
|
||||
"random/pop", // eSoundType_RANDOM_POP,
|
||||
"random/fuse", // eSoundType_RANDOM_FUSE,
|
||||
"random/drink", // eSoundType_RANDOM_DRINK,
|
||||
"random/eat", // eSoundType_RANDOM_EAT,
|
||||
"random/burp", // eSoundType_RANDOM_BURP,
|
||||
"random/splash", // eSoundType_RANDOM_SPLASH,
|
||||
"random/click", // eSoundType_RANDOM_CLICK,
|
||||
"random/glass", // eSoundType_RANDOM_GLASS,
|
||||
"random/orb", // eSoundType_RANDOM_ORB,
|
||||
"random/break", // eSoundType_RANDOM_BREAK,
|
||||
"random/chestopen", // eSoundType_RANDOM_CHEST_OPEN,
|
||||
"random/chestclosed", // eSoundType_RANDOM_CHEST_CLOSE,
|
||||
"random/door_open", // eSoundType_RANDOM_DOOR_OPEN,
|
||||
"random/door_close", // eSoundType_RANDOM_DOOR_CLOSE,
|
||||
"ambient/weather/rain", // eSoundType_AMBIENT_WEATHER_RAIN,
|
||||
"ambient/weather/thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
|
||||
"ambient/cave/cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
|
||||
"portal/portal", // eSoundType_PORTAL_PORTAL,
|
||||
// 4J-PB - added a couple that were still using std::string
|
||||
"portal/trigger", // eSoundType_PORTAL_TRIGGER
|
||||
"portal/travel", // eSoundType_PORTAL_TRAVEL
|
||||
L"random/bow", // eSoundType_RANDOM_BOW,
|
||||
L"random/bowhit", // eSoundType_RANDOM_BOW_HIT,
|
||||
L"random/explode", // eSoundType_RANDOM_EXPLODE,
|
||||
L"random/fizz", // eSoundType_RANDOM_FIZZ,
|
||||
L"random/pop", // eSoundType_RANDOM_POP,
|
||||
L"random/fuse", // eSoundType_RANDOM_FUSE,
|
||||
L"random/drink", // eSoundType_RANDOM_DRINK,
|
||||
L"random/eat", // eSoundType_RANDOM_EAT,
|
||||
L"random/burp", // eSoundType_RANDOM_BURP,
|
||||
L"random/splash", // eSoundType_RANDOM_SPLASH,
|
||||
L"random/click", // eSoundType_RANDOM_CLICK,
|
||||
L"random/glass", // eSoundType_RANDOM_GLASS,
|
||||
L"random/orb", // eSoundType_RANDOM_ORB,
|
||||
L"random/break", // eSoundType_RANDOM_BREAK,
|
||||
L"random/chestopen", // eSoundType_RANDOM_CHEST_OPEN,
|
||||
L"random/chestclosed", // eSoundType_RANDOM_CHEST_CLOSE,
|
||||
L"random/door_open", // eSoundType_RANDOM_DOOR_OPEN,
|
||||
L"random/door_close", // eSoundType_RANDOM_DOOR_CLOSE,
|
||||
L"ambient/weather/rain", // eSoundType_AMBIENT_WEATHER_RAIN,
|
||||
L"ambient/weather/thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
|
||||
L"ambient/cave/cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
|
||||
L"portal/portal", // eSoundType_PORTAL_PORTAL,
|
||||
// 4J-PB - added a couple that were still using std::wstring
|
||||
L"portal/trigger", // eSoundType_PORTAL_TRIGGER
|
||||
L"portal/travel", // eSoundType_PORTAL_TRAVEL
|
||||
|
||||
"fire/ignite", // eSoundType_FIRE_IGNITE,
|
||||
"fire/fire", // eSoundType_FIRE_FIRE,
|
||||
"damage/hit", // eSoundType_DAMAGE_HURT,
|
||||
"damage/fallsmall", // eSoundType_DAMAGE_FALL_SMALL,
|
||||
"damage/fallbig", // eSoundType_DAMAGE_FALL_BIG,
|
||||
"note/harp", // eSoundType_NOTE_HARP,
|
||||
"note/bd", // eSoundType_NOTE_BD,
|
||||
"note/snare", // eSoundType_NOTE_SNARE,
|
||||
"note/hat", // eSoundType_NOTE_HAT,
|
||||
"note/bassattack", // eSoundType_NOTE_BASSATTACK,
|
||||
"tile/piston.in", // eSoundType_TILE_PISTON_IN,
|
||||
"tile/piston.out", // eSoundType_TILE_PISTON_OUT,
|
||||
"liquid/water", // eSoundType_LIQUID_WATER,
|
||||
"liquid/lavapop", // eSoundType_LIQUID_LAVA_POP,
|
||||
"liquid/lava", // eSoundType_LIQUID_LAVA,
|
||||
"step/stone", // eSoundType_STEP_STONE,
|
||||
"step/wood", // eSoundType_STEP_WOOD,
|
||||
"step/gravel", // eSoundType_STEP_GRAVEL,
|
||||
"step/grass", // eSoundType_STEP_GRASS,
|
||||
"step/metal", // eSoundType_STEP_METAL,
|
||||
"step/cloth", // eSoundType_STEP_CLOTH,
|
||||
"step/sand", // eSoundType_STEP_SAND,
|
||||
L"fire/ignite", // eSoundType_FIRE_IGNITE,
|
||||
L"fire/fire", // eSoundType_FIRE_FIRE,
|
||||
L"damage/hit", // eSoundType_DAMAGE_HURT,
|
||||
L"damage/fallsmall", // eSoundType_DAMAGE_FALL_SMALL,
|
||||
L"damage/fallbig", // eSoundType_DAMAGE_FALL_BIG,
|
||||
L"note/harp", // eSoundType_NOTE_HARP,
|
||||
L"note/bd", // eSoundType_NOTE_BD,
|
||||
L"note/snare", // eSoundType_NOTE_SNARE,
|
||||
L"note/hat", // eSoundType_NOTE_HAT,
|
||||
L"note/bassattack", // eSoundType_NOTE_BASSATTACK,
|
||||
L"tile/piston.in", // eSoundType_TILE_PISTON_IN,
|
||||
L"tile/piston.out", // eSoundType_TILE_PISTON_OUT,
|
||||
L"liquid/water", // eSoundType_LIQUID_WATER,
|
||||
L"liquid/lavapop", // eSoundType_LIQUID_LAVA_POP,
|
||||
L"liquid/lava", // eSoundType_LIQUID_LAVA,
|
||||
L"step/stone", // eSoundType_STEP_STONE,
|
||||
L"step/wood", // eSoundType_STEP_WOOD,
|
||||
L"step/gravel", // eSoundType_STEP_GRAVEL,
|
||||
L"step/grass", // eSoundType_STEP_GRASS,
|
||||
L"step/metal", // eSoundType_STEP_METAL,
|
||||
L"step/cloth", // eSoundType_STEP_CLOTH,
|
||||
L"step/sand", // eSoundType_STEP_SAND,
|
||||
|
||||
// below this are the additional sounds from the second soundbank
|
||||
"mob/enderdragon/end", // eSoundType_MOB_ENDERDRAGON_END
|
||||
"mob/enderdragon/growl", // eSoundType_MOB_ENDERDRAGON_GROWL
|
||||
"mob/enderdragon/hit", // eSoundType_MOB_ENDERDRAGON_HIT
|
||||
"mob/enderdragon/wings", // eSoundType_MOB_ENDERDRAGON_MOVE
|
||||
"mob/irongolem/throw", // eSoundType_MOB_IRONGOLEM_THROW
|
||||
"mob/irongolem/hit", // eSoundType_MOB_IRONGOLEM_HIT
|
||||
"mob/irongolem/death", // eSoundType_MOB_IRONGOLEM_DEATH
|
||||
"mob/irongolem/walk", // eSoundType_MOB_IRONGOLEM_WALK
|
||||
L"mob/enderdragon/end", // eSoundType_MOB_ENDERDRAGON_END
|
||||
L"mob/enderdragon/growl", // eSoundType_MOB_ENDERDRAGON_GROWL
|
||||
L"mob/enderdragon/hit", // eSoundType_MOB_ENDERDRAGON_HIT
|
||||
L"mob/enderdragon/wings", // eSoundType_MOB_ENDERDRAGON_MOVE
|
||||
L"mob/irongolem/throw", // eSoundType_MOB_IRONGOLEM_THROW
|
||||
L"mob/irongolem/hit", // eSoundType_MOB_IRONGOLEM_HIT
|
||||
L"mob/irongolem/death", // eSoundType_MOB_IRONGOLEM_DEATH
|
||||
L"mob/irongolem/walk", // eSoundType_MOB_IRONGOLEM_WALK
|
||||
|
||||
// TU14
|
||||
"damage/thorns", // eSoundType_DAMAGE_THORNS
|
||||
"random/anvil_break", // eSoundType_RANDOM_ANVIL_BREAK
|
||||
"random/anvil_land", // eSoundType_RANDOM_ANVIL_LAND
|
||||
"random/anvil_use", // eSoundType_RANDOM_ANVIL_USE
|
||||
"mob/villager/haggle", // eSoundType_MOB_VILLAGER_HAGGLE
|
||||
"mob/villager/idle", // eSoundType_MOB_VILLAGER_IDLE
|
||||
"mob/villager/hit", // eSoundType_MOB_VILLAGER_HIT
|
||||
"mob/villager/death", // eSoundType_MOB_VILLAGER_DEATH
|
||||
"mob/villager/yes", // eSoundType_MOB_VILLAGER_YES
|
||||
"mob/villager/no", // eSoundType_MOB_VILLAGER_NO
|
||||
"mob/zombie/infect", // eSoundType_MOB_ZOMBIE_INFECT
|
||||
"mob/zombie/unfect", // eSoundType_MOB_ZOMBIE_UNFECT
|
||||
"mob/zombie/remedy", // eSoundType_MOB_ZOMBIE_REMEDY
|
||||
"step/snow", // eSoundType_STEP_SNOW
|
||||
"step/ladder", // eSoundType_STEP_LADDER
|
||||
"dig/cloth", // eSoundType_DIG_CLOTH
|
||||
"dig/grass", // eSoundType_DIG_GRASS
|
||||
"dig/gravel", // eSoundType_DIG_GRAVEL
|
||||
"dig/sand", // eSoundType_DIG_SAND
|
||||
"dig/snow", // eSoundType_DIG_SNOW
|
||||
"dig/stone", // eSoundType_DIG_STONE
|
||||
"dig/wood", // eSoundType_DIG_WOOD
|
||||
L"damage/thorns", // eSoundType_DAMAGE_THORNS
|
||||
L"random/anvil_break", // eSoundType_RANDOM_ANVIL_BREAK
|
||||
L"random/anvil_land", // eSoundType_RANDOM_ANVIL_LAND
|
||||
L"random/anvil_use", // eSoundType_RANDOM_ANVIL_USE
|
||||
L"mob/villager/haggle", // eSoundType_MOB_VILLAGER_HAGGLE
|
||||
L"mob/villager/idle", // eSoundType_MOB_VILLAGER_IDLE
|
||||
L"mob/villager/hit", // eSoundType_MOB_VILLAGER_HIT
|
||||
L"mob/villager/death", // eSoundType_MOB_VILLAGER_DEATH
|
||||
L"mob/villager/yes", // eSoundType_MOB_VILLAGER_YES
|
||||
L"mob/villager/no", // eSoundType_MOB_VILLAGER_NO
|
||||
L"mob/zombie/infect", // eSoundType_MOB_ZOMBIE_INFECT
|
||||
L"mob/zombie/unfect", // eSoundType_MOB_ZOMBIE_UNFECT
|
||||
L"mob/zombie/remedy", // eSoundType_MOB_ZOMBIE_REMEDY
|
||||
L"step/snow", // eSoundType_STEP_SNOW
|
||||
L"step/ladder", // eSoundType_STEP_LADDER
|
||||
L"dig/cloth", // eSoundType_DIG_CLOTH
|
||||
L"dig/grass", // eSoundType_DIG_GRASS
|
||||
L"dig/gravel", // eSoundType_DIG_GRAVEL
|
||||
L"dig/sand", // eSoundType_DIG_SAND
|
||||
L"dig/snow", // eSoundType_DIG_SNOW
|
||||
L"dig/stone", // eSoundType_DIG_STONE
|
||||
L"dig/wood", // eSoundType_DIG_WOOD
|
||||
|
||||
// 1.6.4
|
||||
"fireworks/launch", // eSoundType_FIREWORKS_LAUNCH,
|
||||
"fireworks/blast", // eSoundType_FIREWORKS_BLAST,
|
||||
"fireworks/blast_far", // eSoundType_FIREWORKS_BLAST_FAR,
|
||||
"fireworks/large_blast", // eSoundType_FIREWORKS_LARGE_BLAST,
|
||||
"fireworks/large_blast_far", // eSoundType_FIREWORKS_LARGE_BLAST_FAR,
|
||||
"fireworks/twinkle", // eSoundType_FIREWORKS_TWINKLE,
|
||||
"fireworks/twinkle_far", // eSoundType_FIREWORKS_TWINKLE_FAR,
|
||||
L"fireworks/launch", // eSoundType_FIREWORKS_LAUNCH,
|
||||
L"fireworks/blast", // eSoundType_FIREWORKS_BLAST,
|
||||
L"fireworks/blast_far", // eSoundType_FIREWORKS_BLAST_FAR,
|
||||
L"fireworks/large_blast", // eSoundType_FIREWORKS_LARGE_BLAST,
|
||||
L"fireworks/large_blast_far", // eSoundType_FIREWORKS_LARGE_BLAST_FAR,
|
||||
L"fireworks/twinkle", // eSoundType_FIREWORKS_TWINKLE,
|
||||
L"fireworks/twinkle_far", // eSoundType_FIREWORKS_TWINKLE_FAR,
|
||||
|
||||
"mob/bat/idle", // eSoundType_MOB_BAT_IDLE,
|
||||
"mob/bat/hurt", // eSoundType_MOB_BAT_HURT,
|
||||
"mob/bat/death", // eSoundType_MOB_BAT_DEATH,
|
||||
"mob/bat/takeoff", // eSoundType_MOB_BAT_TAKEOFF,
|
||||
L"mob/bat/idle", // eSoundType_MOB_BAT_IDLE,
|
||||
L"mob/bat/hurt", // eSoundType_MOB_BAT_HURT,
|
||||
L"mob/bat/death", // eSoundType_MOB_BAT_DEATH,
|
||||
L"mob/bat/takeoff", // eSoundType_MOB_BAT_TAKEOFF,
|
||||
|
||||
"mob/wither/spawn", // eSoundType_MOB_WITHER_SPAWN,
|
||||
"mob/wither/idle", // eSoundType_MOB_WITHER_IDLE,
|
||||
"mob/wither/hurt", // eSoundType_MOB_WITHER_HURT,
|
||||
"mob/wither/death", // eSoundType_MOB_WITHER_DEATH,
|
||||
"mob/wither/shoot", // eSoundType_MOB_WITHER_SHOOT,
|
||||
L"mob/wither/spawn", // eSoundType_MOB_WITHER_SPAWN,
|
||||
L"mob/wither/idle", // eSoundType_MOB_WITHER_IDLE,
|
||||
L"mob/wither/hurt", // eSoundType_MOB_WITHER_HURT,
|
||||
L"mob/wither/death", // eSoundType_MOB_WITHER_DEATH,
|
||||
L"mob/wither/shoot", // eSoundType_MOB_WITHER_SHOOT,
|
||||
|
||||
"mob/cow/step", // eSoundType_MOB_COW_STEP,
|
||||
"mob/chicken/step", // eSoundType_MOB_CHICKEN_STEP,
|
||||
"mob/pig/step", // eSoundType_MOB_PIG_STEP,
|
||||
"mob/enderman/stare", // eSoundType_MOB_ENDERMAN_STARE,
|
||||
"mob/enderman/scream", // eSoundType_MOB_ENDERMAN_SCREAM,
|
||||
"mob/sheep/shear", // eSoundType_MOB_SHEEP_SHEAR,
|
||||
"mob/sheep/step", // eSoundType_MOB_SHEEP_STEP,
|
||||
"mob/skeleton.death", // eSoundType_MOB_SKELETON_DEATH,
|
||||
"mob/skeleton/step", // eSoundType_MOB_SKELETON_STEP,
|
||||
"mob/spider/step", // eSoundType_MOB_SPIDER_STEP,
|
||||
"mob/wolf/step", // eSoundType_MOB_WOLF_STEP,
|
||||
"mob/zombie/step", // eSoundType_MOB_ZOMBIE_STEP,
|
||||
L"mob/cow/step", // eSoundType_MOB_COW_STEP,
|
||||
L"mob/chicken/step", // eSoundType_MOB_CHICKEN_STEP,
|
||||
L"mob/pig/step", // eSoundType_MOB_PIG_STEP,
|
||||
L"mob/enderman/stare", // eSoundType_MOB_ENDERMAN_STARE,
|
||||
L"mob/enderman/scream", // eSoundType_MOB_ENDERMAN_SCREAM,
|
||||
L"mob/sheep/shear", // eSoundType_MOB_SHEEP_SHEAR,
|
||||
L"mob/sheep/step", // eSoundType_MOB_SHEEP_STEP,
|
||||
L"mob/skeleton.death", // eSoundType_MOB_SKELETON_DEATH,
|
||||
L"mob/skeleton/step", // eSoundType_MOB_SKELETON_STEP,
|
||||
L"mob/spider/step", // eSoundType_MOB_SPIDER_STEP,
|
||||
L"mob/wolf/step", // eSoundType_MOB_WOLF_STEP,
|
||||
L"mob/zombie/step", // eSoundType_MOB_ZOMBIE_STEP,
|
||||
|
||||
"liquid/swim", // eSoundType_LIQUID_SWIM,
|
||||
L"liquid/swim", // eSoundType_LIQUID_SWIM,
|
||||
|
||||
"mob/horse/land", // eSoundType_MOB_HORSE_LAND,
|
||||
"mob/horse/armor", // eSoundType_MOB_HORSE_ARMOR,
|
||||
"mob/horse/leather", // eSoundType_MOB_HORSE_LEATHER,
|
||||
"mob/horse/zombie.death", // eSoundType_MOB_HORSE_ZOMBIE_DEATH,
|
||||
"mob/horse/skeleton.death", // eSoundType_MOB_HORSE_SKELETON_DEATH,
|
||||
"mob/horse/donkey.death", // eSoundType_MOB_HORSE_DONKEY_DEATH,
|
||||
"mob/horse/death", // eSoundType_MOB_HORSE_DEATH,
|
||||
"mob/horse/zombie.hit", // eSoundType_MOB_HORSE_ZOMBIE_HIT,
|
||||
"mob/horse/skeleton.hit", // eSoundType_MOB_HORSE_SKELETON_HIT,
|
||||
"mob/horse/donkey.hit", // eSoundType_MOB_HORSE_DONKEY_HIT,
|
||||
"mob/horse/hit", // eSoundType_MOB_HORSE_HIT,
|
||||
"mob/horse/zombie.idle", // eSoundType_MOB_HORSE_ZOMBIE_IDLE,
|
||||
"mob/horse/skeleton.idle", // eSoundType_MOB_HORSE_SKELETON_IDLE,
|
||||
"mob/horse/donkey.idle", // eSoundType_MOB_HORSE_DONKEY_IDLE,
|
||||
"mob/horse/idle", // eSoundType_MOB_HORSE_IDLE,
|
||||
"mob/horse/donkey.angry", // eSoundType_MOB_HORSE_DONKEY_ANGRY,
|
||||
"mob/horse/angry", // eSoundType_MOB_HORSE_ANGRY,
|
||||
"mob/horse/gallop", // eSoundType_MOB_HORSE_GALLOP,
|
||||
"mob/horse/breathe", // eSoundType_MOB_HORSE_BREATHE,
|
||||
"mob/horse/wood", // eSoundType_MOB_HORSE_WOOD,
|
||||
"mob/horse/soft", // eSoundType_MOB_HORSE_SOFT,
|
||||
"mob/horse/jump", // eSoundType_MOB_HORSE_JUMP,
|
||||
L"mob/horse/land", // eSoundType_MOB_HORSE_LAND,
|
||||
L"mob/horse/armor", // eSoundType_MOB_HORSE_ARMOR,
|
||||
L"mob/horse/leather", // eSoundType_MOB_HORSE_LEATHER,
|
||||
L"mob/horse/zombie.death", // eSoundType_MOB_HORSE_ZOMBIE_DEATH,
|
||||
L"mob/horse/skeleton.death", // eSoundType_MOB_HORSE_SKELETON_DEATH,
|
||||
L"mob/horse/donkey.death", // eSoundType_MOB_HORSE_DONKEY_DEATH,
|
||||
L"mob/horse/death", // eSoundType_MOB_HORSE_DEATH,
|
||||
L"mob/horse/zombie.hit", // eSoundType_MOB_HORSE_ZOMBIE_HIT,
|
||||
L"mob/horse/skeleton.hit", // eSoundType_MOB_HORSE_SKELETON_HIT,
|
||||
L"mob/horse/donkey.hit", // eSoundType_MOB_HORSE_DONKEY_HIT,
|
||||
L"mob/horse/hit", // eSoundType_MOB_HORSE_HIT,
|
||||
L"mob/horse/zombie.idle", // eSoundType_MOB_HORSE_ZOMBIE_IDLE,
|
||||
L"mob/horse/skeleton.idle", // eSoundType_MOB_HORSE_SKELETON_IDLE,
|
||||
L"mob/horse/donkey.idle", // eSoundType_MOB_HORSE_DONKEY_IDLE,
|
||||
L"mob/horse/idle", // eSoundType_MOB_HORSE_IDLE,
|
||||
L"mob/horse/donkey.angry", // eSoundType_MOB_HORSE_DONKEY_ANGRY,
|
||||
L"mob/horse/angry", // eSoundType_MOB_HORSE_ANGRY,
|
||||
L"mob/horse/gallop", // eSoundType_MOB_HORSE_GALLOP,
|
||||
L"mob/horse/breathe", // eSoundType_MOB_HORSE_BREATHE,
|
||||
L"mob/horse/wood", // eSoundType_MOB_HORSE_WOOD,
|
||||
L"mob/horse/soft", // eSoundType_MOB_HORSE_SOFT,
|
||||
L"mob/horse/jump", // eSoundType_MOB_HORSE_JUMP,
|
||||
|
||||
"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <---
|
||||
// missing
|
||||
"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <---
|
||||
// missing
|
||||
"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <---
|
||||
// missing
|
||||
L"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <---
|
||||
// missing
|
||||
L"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <---
|
||||
// missing
|
||||
L"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <---
|
||||
// missing
|
||||
|
||||
"mob/slime/big", // eSoundType_MOB_SLIME_BIG,
|
||||
"mob/slime/small", // eSoundType_MOB_SLIME_SMALL,
|
||||
L"mob/slime/big", // eSoundType_MOB_SLIME_BIG,
|
||||
L"mob/slime/small", // eSoundType_MOB_SLIME_SMALL,
|
||||
|
||||
"eating", // eSoundType_EATING <--- missing
|
||||
"random/levelup", // eSoundType_RANDOM_LEVELUP
|
||||
L"eating", // eSoundType_EATING <--- missing
|
||||
L"random/levelup", // eSoundType_RANDOM_LEVELUP
|
||||
|
||||
// 4J-PB - Some sounds were updated, but we can't do that for the 360 or we
|
||||
// have to do a new sound bank instead, we'll add the sounds as new ones and
|
||||
// change the code to reference them
|
||||
"fire/new_ignite",
|
||||
L"fire/new_ignite",
|
||||
};
|
||||
|
||||
const char* ConsoleSoundEngine::wchUISoundNames[eSFX_MAX] = {
|
||||
"back", "craft", "craftfail", "focus", "press", "scroll",
|
||||
const wchar_t* ConsoleSoundEngine::wchUISoundNames[eSFX_MAX] = {
|
||||
L"back", L"craft", L"craftfail", L"focus", L"press", L"scroll",
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,7 +56,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName,
|
||||
// 4J-PB - write to TMS++ now
|
||||
|
||||
// bool
|
||||
// bRes=PlatformStorage.WriteTMSFile(iPad,IPlatformStorage::eGlobalStorage_TitleUser,"BannedList",(std::uint8_t*)pBannedList,
|
||||
// bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList,
|
||||
// dwDataBytes);
|
||||
|
||||
delete[] pBannedList;
|
||||
@@ -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,16 +10,11 @@
|
||||
#define VER_PRODUCTBUILD 560
|
||||
// This goes up if there is any change to network traffic or code in a build
|
||||
#define VER_NETWORK 560
|
||||
|
||||
// Network protocol version. Sent in the pre-login packet so client and
|
||||
// server can detect mismatched builds.
|
||||
#define MINECRAFT_NET_VERSION VER_NETWORK
|
||||
|
||||
#define VER_PRODUCTBUILD_QFE 0
|
||||
|
||||
#define VER_FILEVERSION_STRING "1.6"
|
||||
#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING
|
||||
#define VER_FILEVERSION_STRING_W "1.6"
|
||||
#define VER_FILEVERSION_STRING_W L"1.6"
|
||||
#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W
|
||||
#define VER_FILEBETA_STR ""
|
||||
#undef VER_FILEVERSION
|
||||
@@ -32,25 +27,25 @@
|
||||
|
||||
#if (VER_PRODUCTBUILD < 10)
|
||||
#define VER_FILEBPAD "000"
|
||||
#define VER_FILEBPAD_W "000"
|
||||
#define VER_FILEBPAD_W L"000"
|
||||
#elif (VER_PRODUCTBUILD < 100)
|
||||
#define VER_FILEBPAD "00"
|
||||
#define VER_FILEBPAD_W "00"
|
||||
#define VER_FILEBPAD_W L"00"
|
||||
#elif (VER_PRODUCTBUILD < 1000)
|
||||
#define VER_FILEBPAD "0"
|
||||
#define VER_FILEBPAD_W "0"
|
||||
#define VER_FILEBPAD_W L"0"
|
||||
#else
|
||||
#define VER_FILEBPAD
|
||||
#define VER_FILEBPAD_W
|
||||
#endif
|
||||
|
||||
#define VER_WIDE_PREFIX(x) x
|
||||
#define VER_WIDE_PREFIX(x) L##x
|
||||
|
||||
#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 L"." VER_FILEBPAD_W VER_WIDE_PREFIX( \
|
||||
#x) L"." 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)
|
||||
|
||||
@@ -0,0 +1,385 @@
|
||||
#include "ColourTable.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "minecraft/GameEnums.h"
|
||||
#include "util/StringHelpers.h"
|
||||
#include "java/InputOutputStream/ByteArrayInputStream.h"
|
||||
#include "java/InputOutputStream/DataInputStream.h"
|
||||
|
||||
std::unordered_map<std::wstring, eMinecraftColour>
|
||||
ColourTable::s_colourNamesMap;
|
||||
|
||||
const wchar_t* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = {
|
||||
L"NOTSET",
|
||||
|
||||
L"Foliage_Evergreen",
|
||||
L"Foliage_Birch",
|
||||
L"Foliage_Default",
|
||||
L"Foliage_Common",
|
||||
L"Foliage_Ocean",
|
||||
L"Foliage_Plains",
|
||||
L"Foliage_Desert",
|
||||
L"Foliage_ExtremeHills",
|
||||
L"Foliage_Forest",
|
||||
L"Foliage_Taiga",
|
||||
L"Foliage_Swampland",
|
||||
L"Foliage_River",
|
||||
L"Foliage_Hell",
|
||||
L"Foliage_Sky",
|
||||
L"Foliage_FrozenOcean",
|
||||
L"Foliage_FrozenRiver",
|
||||
L"Foliage_IcePlains",
|
||||
L"Foliage_IceMountains",
|
||||
L"Foliage_MushroomIsland",
|
||||
L"Foliage_MushroomIslandShore",
|
||||
L"Foliage_Beach",
|
||||
L"Foliage_DesertHills",
|
||||
L"Foliage_ForestHills",
|
||||
L"Foliage_TaigaHills",
|
||||
L"Foliage_ExtremeHillsEdge",
|
||||
L"Foliage_Jungle",
|
||||
L"Foliage_JungleHills",
|
||||
|
||||
L"Grass_Common",
|
||||
L"Grass_Ocean",
|
||||
L"Grass_Plains",
|
||||
L"Grass_Desert",
|
||||
L"Grass_ExtremeHills",
|
||||
L"Grass_Forest",
|
||||
L"Grass_Taiga",
|
||||
L"Grass_Swampland",
|
||||
L"Grass_River",
|
||||
L"Grass_Hell",
|
||||
L"Grass_Sky",
|
||||
L"Grass_FrozenOcean",
|
||||
L"Grass_FrozenRiver",
|
||||
L"Grass_IcePlains",
|
||||
L"Grass_IceMountains",
|
||||
L"Grass_MushroomIsland",
|
||||
L"Grass_MushroomIslandShore",
|
||||
L"Grass_Beach",
|
||||
L"Grass_DesertHills",
|
||||
L"Grass_ForestHills",
|
||||
L"Grass_TaigaHills",
|
||||
L"Grass_ExtremeHillsEdge",
|
||||
L"Grass_Jungle",
|
||||
L"Grass_JungleHills",
|
||||
|
||||
L"Water_Ocean",
|
||||
L"Water_Plains",
|
||||
L"Water_Desert",
|
||||
L"Water_ExtremeHills",
|
||||
L"Water_Forest",
|
||||
L"Water_Taiga",
|
||||
L"Water_Swampland",
|
||||
L"Water_River",
|
||||
L"Water_Hell",
|
||||
L"Water_Sky",
|
||||
L"Water_FrozenOcean",
|
||||
L"Water_FrozenRiver",
|
||||
L"Water_IcePlains",
|
||||
L"Water_IceMountains",
|
||||
L"Water_MushroomIsland",
|
||||
L"Water_MushroomIslandShore",
|
||||
L"Water_Beach",
|
||||
L"Water_DesertHills",
|
||||
L"Water_ForestHills",
|
||||
L"Water_TaigaHills",
|
||||
L"Water_ExtremeHillsEdge",
|
||||
L"Water_Jungle",
|
||||
L"Water_JungleHills",
|
||||
|
||||
L"Sky_Ocean",
|
||||
L"Sky_Plains",
|
||||
L"Sky_Desert",
|
||||
L"Sky_ExtremeHills",
|
||||
L"Sky_Forest",
|
||||
L"Sky_Taiga",
|
||||
L"Sky_Swampland",
|
||||
L"Sky_River",
|
||||
L"Sky_Hell",
|
||||
L"Sky_Sky",
|
||||
L"Sky_FrozenOcean",
|
||||
L"Sky_FrozenRiver",
|
||||
L"Sky_IcePlains",
|
||||
L"Sky_IceMountains",
|
||||
L"Sky_MushroomIsland",
|
||||
L"Sky_MushroomIslandShore",
|
||||
L"Sky_Beach",
|
||||
L"Sky_DesertHills",
|
||||
L"Sky_ForestHills",
|
||||
L"Sky_TaigaHills",
|
||||
L"Sky_ExtremeHillsEdge",
|
||||
L"Sky_Jungle",
|
||||
L"Sky_JungleHills",
|
||||
|
||||
L"Tile_RedstoneDust",
|
||||
L"Tile_RedstoneDustUnlit",
|
||||
L"Tile_RedstoneDustLitMin",
|
||||
L"Tile_RedstoneDustLitMax",
|
||||
L"Tile_StemMin",
|
||||
L"Tile_StemMax",
|
||||
L"Tile_WaterLily",
|
||||
|
||||
L"Sky_Dawn_Dark",
|
||||
L"Sky_Dawn_Bright",
|
||||
|
||||
L"Material_None",
|
||||
L"Material_Grass",
|
||||
L"Material_Sand",
|
||||
L"Material_Cloth",
|
||||
L"Material_Fire",
|
||||
L"Material_Ice",
|
||||
L"Material_Metal",
|
||||
L"Material_Plant",
|
||||
L"Material_Snow",
|
||||
L"Material_Clay",
|
||||
L"Material_Dirt",
|
||||
L"Material_Stone",
|
||||
L"Material_Water",
|
||||
L"Material_Wood",
|
||||
L"Material_Emerald",
|
||||
|
||||
L"Particle_Note_00",
|
||||
L"Particle_Note_01",
|
||||
L"Particle_Note_02",
|
||||
L"Particle_Note_03",
|
||||
L"Particle_Note_04",
|
||||
L"Particle_Note_05",
|
||||
L"Particle_Note_06",
|
||||
L"Particle_Note_07",
|
||||
L"Particle_Note_08",
|
||||
L"Particle_Note_09",
|
||||
L"Particle_Note_10",
|
||||
L"Particle_Note_11",
|
||||
L"Particle_Note_12",
|
||||
L"Particle_Note_13",
|
||||
L"Particle_Note_14",
|
||||
L"Particle_Note_15",
|
||||
L"Particle_Note_16",
|
||||
L"Particle_Note_17",
|
||||
L"Particle_Note_18",
|
||||
L"Particle_Note_19",
|
||||
L"Particle_Note_20",
|
||||
L"Particle_Note_21",
|
||||
L"Particle_Note_22",
|
||||
L"Particle_Note_23",
|
||||
L"Particle_Note_24",
|
||||
|
||||
L"Particle_NetherPortal",
|
||||
L"Particle_EnderPortal",
|
||||
L"Particle_Smoke",
|
||||
L"Particle_Ender",
|
||||
|
||||
L"Particle_Explode",
|
||||
L"Particle_HugeExplosion",
|
||||
|
||||
L"Particle_DripWater",
|
||||
L"Particle_DripLavaStart",
|
||||
L"Particle_DripLavaEnd",
|
||||
|
||||
L"Particle_EnchantmentTable",
|
||||
L"Particle_DragonBreathMin",
|
||||
L"Particle_DragonBreathMax",
|
||||
L"Particle_Suspend",
|
||||
|
||||
L"Particle_CritStart", // arrow in air
|
||||
L"Particle_CritEnd", // arrow in air
|
||||
|
||||
L"Effect_MovementSpeed",
|
||||
L"Effect_MovementSlowDown",
|
||||
L"Effect_DigSpeed",
|
||||
L"Effect_DigSlowdown",
|
||||
L"Effect_DamageBoost",
|
||||
L"Effect_Heal",
|
||||
L"Effect_Harm",
|
||||
L"Effect_Jump",
|
||||
L"Effect_Confusion",
|
||||
L"Effect_Regeneration",
|
||||
L"Effect_DamageResistance",
|
||||
L"Effect_FireResistance",
|
||||
L"Effect_WaterBreathing",
|
||||
L"Effect_Invisiblity",
|
||||
L"Effect_Blindness",
|
||||
L"Effect_NightVision",
|
||||
L"Effect_Hunger",
|
||||
L"Effect_Weakness",
|
||||
L"Effect_Poison",
|
||||
L"Effect_Wither",
|
||||
L"Effect_HealthBoost",
|
||||
L"Effect_Absorption",
|
||||
L"Effect_Saturation",
|
||||
|
||||
L"Potion_BaseColour",
|
||||
|
||||
L"Mob_Creeper_Colour1",
|
||||
L"Mob_Creeper_Colour2",
|
||||
L"Mob_Skeleton_Colour1",
|
||||
L"Mob_Skeleton_Colour2",
|
||||
L"Mob_Spider_Colour1",
|
||||
L"Mob_Spider_Colour2",
|
||||
L"Mob_Zombie_Colour1",
|
||||
L"Mob_Zombie_Colour2",
|
||||
L"Mob_Slime_Colour1",
|
||||
L"Mob_Slime_Colour2",
|
||||
L"Mob_Ghast_Colour1",
|
||||
L"Mob_Ghast_Colour2",
|
||||
L"Mob_PigZombie_Colour1",
|
||||
L"Mob_PigZombie_Colour2",
|
||||
L"Mob_Enderman_Colour1",
|
||||
L"Mob_Enderman_Colour2",
|
||||
L"Mob_CaveSpider_Colour1",
|
||||
L"Mob_CaveSpider_Colour2",
|
||||
L"Mob_Silverfish_Colour1",
|
||||
L"Mob_Silverfish_Colour2",
|
||||
L"Mob_Blaze_Colour1",
|
||||
L"Mob_Blaze_Colour2",
|
||||
L"Mob_LavaSlime_Colour1",
|
||||
L"Mob_LavaSlime_Colour2",
|
||||
L"Mob_Pig_Colour1",
|
||||
L"Mob_Pig_Colour2",
|
||||
L"Mob_Sheep_Colour1",
|
||||
L"Mob_Sheep_Colour2",
|
||||
L"Mob_Cow_Colour1",
|
||||
L"Mob_Cow_Colour2",
|
||||
L"Mob_Chicken_Colour1",
|
||||
L"Mob_Chicken_Colour2",
|
||||
L"Mob_Squid_Colour1",
|
||||
L"Mob_Squid_Colour2",
|
||||
L"Mob_Wolf_Colour1",
|
||||
L"Mob_Wolf_Colour2",
|
||||
L"Mob_MushroomCow_Colour1",
|
||||
L"Mob_MushroomCow_Colour2",
|
||||
L"Mob_Ocelot_Colour1",
|
||||
L"Mob_Ocelot_Colour2",
|
||||
L"Mob_Villager_Colour1",
|
||||
L"Mob_Villager_Colour2",
|
||||
L"Mob_Bat_Colour1",
|
||||
L"Mob_Bat_Colour2",
|
||||
L"Mob_Witch_Colour1",
|
||||
L"Mob_Witch_Colour2",
|
||||
L"Mob_Horse_Colour1",
|
||||
L"Mob_Horse_Colour2",
|
||||
|
||||
L"Armour_Default_Leather_Colour",
|
||||
L"Under_Water_Clear_Colour",
|
||||
L"Under_Lava_Clear_Colour",
|
||||
L"In_Cloud_Base_Colour",
|
||||
|
||||
L"Under_Water_Fog_Colour",
|
||||
L"Under_Lava_Fog_Colour",
|
||||
L"In_Cloud_Fog_Colour",
|
||||
|
||||
L"Default_Fog_Colour",
|
||||
L"Nether_Fog_Colour",
|
||||
L"End_Fog_Colour",
|
||||
|
||||
L"Sign_Text",
|
||||
L"Map_Text",
|
||||
|
||||
L"Leash_Light_Colour",
|
||||
L"Leash_Dark_Colour",
|
||||
|
||||
L"Fire_Overlay",
|
||||
|
||||
L"HTMLColor_0",
|
||||
L"HTMLColor_1",
|
||||
L"HTMLColor_2",
|
||||
L"HTMLColor_3",
|
||||
L"HTMLColor_4",
|
||||
L"HTMLColor_5",
|
||||
L"HTMLColor_6",
|
||||
L"HTMLColor_7",
|
||||
L"HTMLColor_8",
|
||||
L"HTMLColor_9",
|
||||
L"HTMLColor_a",
|
||||
L"HTMLColor_b",
|
||||
L"HTMLColor_c",
|
||||
L"HTMLColor_d",
|
||||
L"HTMLColor_e",
|
||||
L"HTMLColor_f",
|
||||
L"HTMLColor_dark_0",
|
||||
L"HTMLColor_dark_1",
|
||||
L"HTMLColor_dark_2",
|
||||
L"HTMLColor_dark_3",
|
||||
L"HTMLColor_dark_4",
|
||||
L"HTMLColor_dark_5",
|
||||
L"HTMLColor_dark_6",
|
||||
L"HTMLColor_dark_7",
|
||||
L"HTMLColor_dark_8",
|
||||
L"HTMLColor_dark_9",
|
||||
L"HTMLColor_dark_a",
|
||||
L"HTMLColor_dark_b",
|
||||
L"HTMLColor_dark_c",
|
||||
L"HTMLColor_dark_d",
|
||||
L"HTMLColor_dark_e",
|
||||
L"HTMLColor_dark_f",
|
||||
L"HTMLColor_T1",
|
||||
L"HTMLColor_T2",
|
||||
L"HTMLColor_T3",
|
||||
L"HTMLColor_Black",
|
||||
L"HTMLColor_White",
|
||||
L"Color_EnchantText",
|
||||
L"Color_EnchantTextFocus",
|
||||
L"Color_EnchantTextDisabled",
|
||||
L"Color_RenamedItemTitle",
|
||||
};
|
||||
|
||||
void ColourTable::staticCtor() {
|
||||
for (unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT;
|
||||
++i) {
|
||||
s_colourNamesMap.insert(
|
||||
std::unordered_map<std::wstring, eMinecraftColour>::value_type(
|
||||
ColourTableElements[i], (eMinecraftColour)i));
|
||||
}
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(std::uint8_t* pbData, std::uint32_t dataLength) {
|
||||
loadColoursFromData(pbData, dataLength);
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(ColourTable* defaultColours, std::uint8_t* pbData,
|
||||
std::uint32_t dataLength) {
|
||||
// 4J Stu - Default the colours that of the table passed in
|
||||
memcpy((void*)m_colourValues, (void*)defaultColours->m_colourValues,
|
||||
sizeof(int) * eMinecraftColour_COUNT);
|
||||
loadColoursFromData(pbData, dataLength);
|
||||
}
|
||||
void ColourTable::loadColoursFromData(std::uint8_t* pbData,
|
||||
std::uint32_t dataLength) {
|
||||
std::vector<uint8_t> src(pbData, pbData + dataLength);
|
||||
|
||||
ByteArrayInputStream bais(src);
|
||||
DataInputStream dis(&bais);
|
||||
|
||||
int versionNumber = dis.readInt();
|
||||
int coloursCount = dis.readInt();
|
||||
|
||||
for (int i = 0; i < coloursCount; ++i) {
|
||||
std::wstring colourId = dis.readUTF();
|
||||
int colourValue = dis.readInt();
|
||||
setColour(colourId, colourValue);
|
||||
auto it = s_colourNamesMap.find(colourId);
|
||||
}
|
||||
|
||||
bais.reset();
|
||||
}
|
||||
|
||||
void ColourTable::setColour(const std::wstring& colourName, int value) {
|
||||
auto it = s_colourNamesMap.find(colourName);
|
||||
if (it != s_colourNamesMap.end()) {
|
||||
m_colourValues[(int)it->second] = value;
|
||||
}
|
||||
}
|
||||
|
||||
void ColourTable::setColour(const std::wstring& colourName,
|
||||
const std::wstring& value) {
|
||||
setColour(colourName, fromHexWString<int>(value));
|
||||
}
|
||||
|
||||
unsigned int ColourTable::getColour(eMinecraftColour id) {
|
||||
return m_colourValues[(int)id];
|
||||
}
|
||||
@@ -9,8 +9,8 @@ class ColourTable {
|
||||
private:
|
||||
unsigned int m_colourValues[eMinecraftColour_COUNT];
|
||||
|
||||
static const char* ColourTableElements[eMinecraftColour_COUNT];
|
||||
static std::unordered_map<std::string, eMinecraftColour> s_colourNamesMap;
|
||||
static const wchar_t* ColourTableElements[eMinecraftColour_COUNT];
|
||||
static std::unordered_map<std::wstring, eMinecraftColour> s_colourNamesMap;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
@@ -23,6 +23,6 @@ public:
|
||||
unsigned int getColor(eMinecraftColour id) { return getColour(id); }
|
||||
|
||||
void loadColoursFromData(std::uint8_t* pbData, std::uint32_t dataLength);
|
||||
void setColour(const std::string& colourName, int value);
|
||||
void setColour(const std::string& colourName, const std::string& value);
|
||||
void setColour(const std::wstring& colourName, int value);
|
||||
void setColour(const std::wstring& colourName, const std::wstring& value);
|
||||
};
|
||||
@@ -5,17 +5,40 @@
|
||||
#include <cstring>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "platform/sdl2/Render.h"
|
||||
#include "platform/sdl2/Storage.h"
|
||||
#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;
|
||||
|
||||
#if WCHAR_MAX > 0xFFFF
|
||||
static std::wstring ReadAudioDlcWString(const void* data) {
|
||||
const std::uint16_t* chars = static_cast<const std::uint16_t*>(data);
|
||||
const std::uint16_t* end = chars;
|
||||
while (*end != 0) {
|
||||
++end;
|
||||
}
|
||||
|
||||
std::wstring out(static_cast<std::size_t>(end - chars), 0);
|
||||
for (std::size_t i = 0; i < out.size(); ++i) {
|
||||
out[i] = static_cast<wchar_t>(chars[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#else
|
||||
static std::wstring ReadAudioDlcWString(const void* data) {
|
||||
return std::wstring(static_cast<const wchar_t*>(data));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
T ReadAudioDlcValue(const std::uint8_t* data, unsigned int offset = 0) {
|
||||
T value;
|
||||
@@ -30,24 +53,23 @@ void ReadAudioDlcStruct(T* out, const std::uint8_t* data,
|
||||
}
|
||||
|
||||
inline unsigned int AudioParamAdvance(unsigned int wcharCount) {
|
||||
return static_cast<unsigned int>(sizeof(IPlatformStorage::DLC_FILE_PARAM) +
|
||||
return static_cast<unsigned int>(sizeof(C4JStorage::DLC_FILE_PARAM) +
|
||||
wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE);
|
||||
}
|
||||
|
||||
inline unsigned int AudioDetailAdvance(unsigned int wcharCount) {
|
||||
return static_cast<unsigned int>(
|
||||
sizeof(IPlatformStorage::DLC_FILE_DETAILS) +
|
||||
wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE);
|
||||
return static_cast<unsigned int>(sizeof(C4JStorage::DLC_FILE_DETAILS) +
|
||||
wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE);
|
||||
}
|
||||
|
||||
inline std::string ReadAudioParamString(const std::uint8_t* data,
|
||||
unsigned int offset) {
|
||||
return dlc_read_wstring(
|
||||
data + offset + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData));
|
||||
inline std::wstring ReadAudioParamString(const std::uint8_t* data,
|
||||
unsigned int offset) {
|
||||
return ReadAudioDlcWString(data + offset +
|
||||
offsetof(C4JStorage::DLC_FILE_PARAM, wchData));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
DLCAudioFile::DLCAudioFile(const std::string& path)
|
||||
DLCAudioFile::DLCAudioFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_Audio, path) {
|
||||
m_pbData = nullptr;
|
||||
m_dataBytes = 0;
|
||||
@@ -65,13 +87,13 @@ std::uint8_t* DLCAudioFile::getData(std::uint32_t& dataBytes) {
|
||||
return m_pbData;
|
||||
}
|
||||
|
||||
const char* DLCAudioFile::wchTypeNamesA[] = {
|
||||
"CUENAME",
|
||||
"CREDIT",
|
||||
const wchar_t* DLCAudioFile::wchTypeNamesA[] = {
|
||||
L"CUENAME",
|
||||
L"CREDIT",
|
||||
};
|
||||
|
||||
DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(
|
||||
const std::string& paramName) {
|
||||
const std::wstring& paramName) {
|
||||
EAudioParameterType type = e_AudioParamType_Invalid;
|
||||
|
||||
for (int i = 0; i < e_AudioParamType_Max; ++i) {
|
||||
@@ -85,7 +107,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(
|
||||
}
|
||||
|
||||
void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype,
|
||||
const std::string& value) {
|
||||
const std::wstring& value) {
|
||||
switch (ptype) {
|
||||
case e_AudioParamType_Credit: // If this parameter exists, then mark
|
||||
// this as free
|
||||
@@ -100,8 +122,8 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype,
|
||||
|
||||
int maximumChars = 55;
|
||||
|
||||
bool bIsSDMode = !PlatformRenderer.IsHiDef() &&
|
||||
!PlatformRenderer.IsWidescreen();
|
||||
bool bIsSDMode =
|
||||
!RenderManager.IsHiDef() && !RenderManager.IsWidescreen();
|
||||
|
||||
if (bIsSDMode) {
|
||||
maximumChars = 45;
|
||||
@@ -114,14 +136,14 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype,
|
||||
maximumChars = 35;
|
||||
break;
|
||||
}
|
||||
std::string creditValue = value;
|
||||
std::wstring creditValue = value;
|
||||
while (creditValue.length() > maximumChars) {
|
||||
unsigned int i = 1;
|
||||
while (i < creditValue.length() &&
|
||||
(i + 1) <= maximumChars) {
|
||||
i++;
|
||||
}
|
||||
int iLast = (int)creditValue.find_last_of(" ", i);
|
||||
int iLast = (int)creditValue.find_last_of(L" ", i);
|
||||
switch (XGetLanguage()) {
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
case XC_LANGUAGE_TCHINESE:
|
||||
@@ -129,7 +151,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype,
|
||||
iLast = maximumChars;
|
||||
break;
|
||||
default:
|
||||
iLast = (int)creditValue.find_last_of(" ", i);
|
||||
iLast = (int)creditValue.find_last_of(L" ", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -174,13 +196,14 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData,
|
||||
unsigned int uiParameterTypeCount =
|
||||
ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
IPlatformStorage::DLC_FILE_PARAM paramBuf;
|
||||
C4JStorage::DLC_FILE_PARAM paramBuf;
|
||||
ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
|
||||
for (unsigned int i = 0; i < uiParameterTypeCount; i++) {
|
||||
// Map DLC strings to application strings, then store the DLC index
|
||||
// mapping to application index
|
||||
std::string parameterName = ReadAudioParamString(pbData, uiCurrentByte);
|
||||
std::wstring parameterName =
|
||||
ReadAudioParamString(pbData, uiCurrentByte);
|
||||
EAudioParameterType type = getParameterType(parameterName);
|
||||
if (type != e_AudioParamType_Invalid) {
|
||||
parameterMapping[paramBuf.dwType] = type;
|
||||
@@ -191,7 +214,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData,
|
||||
unsigned int uiFileCount =
|
||||
ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
IPlatformStorage::DLC_FILE_DETAILS fileBuf;
|
||||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
unsigned int tempByteOffset = uiCurrentByte;
|
||||
@@ -234,7 +257,7 @@ int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType) {
|
||||
return m_parameters[eType].size();
|
||||
}
|
||||
|
||||
std::string& DLCAudioFile::GetSoundName(int iIndex) {
|
||||
std::wstring& DLCAudioFile::GetSoundName(int iIndex) {
|
||||
int iWorldType = e_AudioType_Overworld;
|
||||
while (iIndex >= m_parameters[iWorldType].size()) {
|
||||
iIndex -= m_parameters[iWorldType].size();
|
||||
|
||||
@@ -27,16 +27,16 @@ public:
|
||||
e_AudioParamType_Max,
|
||||
|
||||
};
|
||||
static const char* wchTypeNamesA[e_AudioParamType_Max];
|
||||
static const wchar_t* wchTypeNamesA[e_AudioParamType_Max];
|
||||
|
||||
DLCAudioFile(const std::string& path);
|
||||
DLCAudioFile(const std::wstring& path);
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t* getData(std::uint32_t& dataBytes);
|
||||
|
||||
bool processDLCDataFile(std::uint8_t* pbData, std::uint32_t dataLength);
|
||||
int GetCountofType(DLCAudioFile::EAudioType ptype);
|
||||
std::string& GetSoundName(int iIndex);
|
||||
std::wstring& GetSoundName(int iIndex);
|
||||
|
||||
private:
|
||||
using DLCFile::addParameter;
|
||||
@@ -44,13 +44,13 @@ private:
|
||||
std::uint8_t* m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
static const int CURRENT_AUDIO_VERSION_NUM = 1;
|
||||
// std::unordered_map<int, std::string> m_parameters;
|
||||
std::vector<std::string> m_parameters[e_AudioType_Max];
|
||||
// std::unordered_map<int, std::wstring> m_parameters;
|
||||
std::vector<std::wstring> m_parameters[e_AudioType_Max];
|
||||
|
||||
// use the EAudioType to order these
|
||||
void addParameter(DLCAudioFile::EAudioType type,
|
||||
DLCAudioFile::EAudioParameterType ptype,
|
||||
const std::string& value);
|
||||
const std::wstring& value);
|
||||
DLCAudioFile::EAudioParameterType getParameterType(
|
||||
const std::string& paramName);
|
||||
const std::wstring& paramName);
|
||||
};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#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)
|
||||
DLCCapeFile::DLCCapeFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_Cape, path) {}
|
||||
|
||||
void DLCCapeFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class DLCCapeFile : public DLCFile {
|
||||
public:
|
||||
DLCCapeFile(const std::string& path);
|
||||
DLCCapeFile(const std::wstring& path);
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
};
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#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"
|
||||
|
||||
DLCColourTableFile::DLCColourTableFile(const std::string& path)
|
||||
DLCColourTableFile::DLCColourTableFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_ColourTable, path) {
|
||||
m_colourTable = nullptr;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ private:
|
||||
ColourTable* m_colourTable;
|
||||
|
||||
public:
|
||||
DLCColourTableFile(const std::string& path);
|
||||
DLCColourTableFile(const std::wstring& path);
|
||||
~DLCColourTableFile();
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
#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) {
|
||||
DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||
m_type = type;
|
||||
m_path = path;
|
||||
|
||||
// store the id
|
||||
bool dlcSkin = path.substr(0, 3).compare("dlc") == 0;
|
||||
bool dlcSkin = path.substr(0, 3).compare(L"dlc") == 0;
|
||||
|
||||
if (dlcSkin) {
|
||||
std::string skinValue = path.substr(7, path.size());
|
||||
skinValue = skinValue.substr(0, skinValue.find_first_of('.'));
|
||||
std::stringstream ss;
|
||||
std::wstring skinValue = path.substr(7, path.size());
|
||||
skinValue = skinValue.substr(0, skinValue.find_first_of(L'.'));
|
||||
std::wstringstream ss;
|
||||
ss << std::dec << skinValue.c_str();
|
||||
ss >> m_dwSkinId;
|
||||
m_dwSkinId = MAKE_SKIN_BITMASK(true, m_dwSkinId);
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
class DLCFile {
|
||||
protected:
|
||||
DLCManager::EDLCType m_type;
|
||||
std::string m_path;
|
||||
std::wstring m_path;
|
||||
std::uint32_t m_dwSkinId;
|
||||
|
||||
public:
|
||||
DLCFile(DLCManager::EDLCType type, const std::string& path);
|
||||
DLCFile(DLCManager::EDLCType type, const std::wstring& path);
|
||||
virtual ~DLCFile() {}
|
||||
|
||||
DLCManager::EDLCType getType() { return m_type; }
|
||||
std::string getPath() { return m_path; }
|
||||
std::wstring getPath() { return m_path; }
|
||||
std::uint32_t getSkinID() { return m_dwSkinId; }
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes) {}
|
||||
@@ -24,11 +24,11 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value) {}
|
||||
const std::wstring& value) {}
|
||||
|
||||
virtual std::string getParameterAsString(
|
||||
virtual std::wstring getParameterAsString(
|
||||
DLCManager::EDLCParameterType type) {
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) {
|
||||
return false;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "DLCFile.h"
|
||||
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
|
||||
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
|
||||
|
||||
class DLCGameRules : public DLCFile {
|
||||
public:
|
||||
DLCGameRules(DLCManager::EDLCType type, const std::string& path)
|
||||
DLCGameRules(DLCManager::EDLCType type, const std::wstring& path)
|
||||
: DLCFile(type, path) {}
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "DLCManager.h"
|
||||
#include "app/common/DLC/DLCGameRules.h"
|
||||
|
||||
DLCGameRulesFile::DLCGameRulesFile(const std::string& path)
|
||||
DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path)
|
||||
: DLCGameRules(DLCManager::e_DLCType_GameRules, path) {
|
||||
m_pbData = nullptr;
|
||||
m_dataBytes = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ private:
|
||||
std::uint32_t m_dataBytes;
|
||||
|
||||
public:
|
||||
DLCGameRulesFile(const std::string& path);
|
||||
DLCGameRulesFile(const std::wstring& path);
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t* getData(std::uint32_t& dataBytes);
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
|
||||
#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;
|
||||
|
||||
DLCGameRulesHeader::DLCGameRulesHeader(const std::string& path)
|
||||
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring& path)
|
||||
: DLCGameRules(DLCManager::e_DLCType_GameRulesHeader, path) {
|
||||
m_pbData = nullptr;
|
||||
m_dataBytes = 0;
|
||||
|
||||
m_hasData = false;
|
||||
|
||||
m_grfPath = path.substr(0, path.length() - 4) + ".grf";
|
||||
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
||||
|
||||
lgo = nullptr;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,26 +21,26 @@ public:
|
||||
virtual std::uint32_t getRequiredTexturePackId() {
|
||||
return m_requiredTexturePackId;
|
||||
}
|
||||
virtual std::string getDefaultSaveName() { return m_defaultSaveName; }
|
||||
virtual const char* getWorldName() { return m_worldName.c_str(); }
|
||||
virtual const char* getDisplayName() { return m_displayName.c_str(); }
|
||||
virtual std::string getGrfPath() { return "GameRules.grf"; }
|
||||
virtual std::wstring getDefaultSaveName() { return m_defaultSaveName; }
|
||||
virtual const wchar_t* getWorldName() { return m_worldName.c_str(); }
|
||||
virtual const wchar_t* getDisplayName() { return m_displayName.c_str(); }
|
||||
virtual std::wstring getGrfPath() { return L"GameRules.grf"; }
|
||||
|
||||
virtual void setRequiresTexturePack(bool x) { m_bRequiresTexturePack = x; }
|
||||
virtual void setRequiredTexturePackId(std::uint32_t x) {
|
||||
m_requiredTexturePackId = x;
|
||||
}
|
||||
virtual void setDefaultSaveName(const std::string& x) {
|
||||
virtual void setDefaultSaveName(const std::wstring& x) {
|
||||
m_defaultSaveName = x;
|
||||
}
|
||||
virtual void setWorldName(const std::string& x) { m_worldName = x; }
|
||||
virtual void setDisplayName(const std::string& x) { m_displayName = x; }
|
||||
virtual void setGrfPath(const std::string& x) { m_grfPath = x; }
|
||||
virtual void setWorldName(const std::wstring& x) { m_worldName = x; }
|
||||
virtual void setDisplayName(const std::wstring& x) { m_displayName = x; }
|
||||
virtual void setGrfPath(const std::wstring& x) { m_grfPath = x; }
|
||||
|
||||
LevelGenerationOptions* lgo;
|
||||
|
||||
public:
|
||||
DLCGameRulesHeader(const std::string& path);
|
||||
DLCGameRulesHeader(const std::wstring& path);
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t* getData(std::uint32_t& dataBytes);
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
|
||||
#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)
|
||||
DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
|
||||
m_strings = nullptr;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ private:
|
||||
StringTable* m_strings;
|
||||
|
||||
public:
|
||||
DLCLocalisationFile(const std::string& path);
|
||||
DLCLocalisationFile(const std::wstring& path);
|
||||
DLCLocalisationFile(
|
||||
std::uint8_t* pbData,
|
||||
std::uint32_t dataBytes); // when we load in a texture pack details
|
||||
|
||||
@@ -13,45 +13,65 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "platform/sdl2/Profile.h"
|
||||
#include "platform/sdl2/Storage.h"
|
||||
#include "DLCFile.h"
|
||||
#include "DLCPack.h"
|
||||
#include "app/common/Game.h"
|
||||
#include "app/common/GameRules/GameRuleManager.h"
|
||||
#include "app/common/UI/ConsoleUIController.h"
|
||||
#include "app/linux/LinuxGame.h"
|
||||
#include "app/linux/Linux_UIController.h"
|
||||
#include "platform/PlatformServices.h"
|
||||
#include "util/StringHelpers.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/skins/TexturePackRepository.h"
|
||||
#include "platform/fs/fs.h"
|
||||
#include "platform/profile/profile.h"
|
||||
#include "platform/storage/storage.h"
|
||||
#include "simdutf.h"
|
||||
#include "strings.h"
|
||||
#include "util/StringHelpers.h"
|
||||
|
||||
// 4jcraft, this is the size of wchar_t on disk
|
||||
// the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16
|
||||
static const std::size_t DLC_WCHAR_BIN_SIZE = 2;
|
||||
|
||||
std::string dlc_read_wstring(const void* data) {
|
||||
const char16_t* chars = static_cast<const char16_t*>(data);
|
||||
const char16_t* end = chars;
|
||||
while (*end != 0) {
|
||||
#if WCHAR_MAX > 0xFFFF
|
||||
// than sizeof(wchar_t) != DLC_WCHAR_BIN_SIZE
|
||||
// e.g. Linux and all Posix/Unix systems with wchar_t beeing 4B/32bit
|
||||
static_assert(sizeof(wchar_t) == 4,
|
||||
"wchar_t is not 4bytes but larger than 2bytes ???");
|
||||
|
||||
static inline std::wstring dlc_read_wstring(const void* data) {
|
||||
const std::uint16_t* p = static_cast<const std::uint16_t*>(data);
|
||||
// find the end (nullterminated)
|
||||
const std::uint16_t* end = p;
|
||||
while (*end) {
|
||||
++end;
|
||||
}
|
||||
|
||||
const std::size_t len16 = static_cast<std::size_t>(end - chars);
|
||||
std::string result(simdutf::utf8_length_from_utf16le(chars, len16), '\0');
|
||||
auto len = simdutf::convert_utf16le_to_utf8(chars, len16, result.data());
|
||||
result.resize(len);
|
||||
std::size_t len = static_cast<std::size_t>(end - p);
|
||||
|
||||
return result;
|
||||
// allocate wstring with length len
|
||||
// it will be nullterminated internally, do not worry.
|
||||
std::wstring out(len, 0);
|
||||
|
||||
// and copy them into thje string
|
||||
for (std::size_t i = 0; i < len; ++i) {
|
||||
out[i] = static_cast<wchar_t>(p[i]);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
#define DLC_WSTRING(ptr) dlc_read_wstring(ptr)
|
||||
|
||||
#else
|
||||
// just in case.
|
||||
static_assert(sizeof(wchar_t) == 2,
|
||||
"How did we get here? wide char smaller than 2 bytes");
|
||||
// perfectly fine scince wchar_t will be 2 bytes (UCS-2/UTF-16)
|
||||
#define DLC_WSTRING(ptr) std::wstring((wchar_t*)(ptr))
|
||||
#endif
|
||||
|
||||
#define DLC_PARAM_ADV(n) \
|
||||
(sizeof(IPlatformStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
(sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
#define DLC_DETAIL_ADV(n) \
|
||||
(sizeof(IPlatformStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
(sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
@@ -66,14 +86,13 @@ void ReadDlcStruct(T* out, const std::uint8_t* data, unsigned int offset = 0) {
|
||||
std::memcpy(out, data + offset, sizeof(*out));
|
||||
}
|
||||
|
||||
std::string getMountedDlcReadPath(const std::string& path) {
|
||||
std::string readPath = path;
|
||||
std::wstring getMountedDlcReadPath(const std::string& path) {
|
||||
std::wstring readPath = convStringToWstring(path);
|
||||
|
||||
#if defined(_WINDOWS64)
|
||||
const std::string mountedPath =
|
||||
PlatformStorage.GetMountedPath(path.c_str());
|
||||
const std::string mountedPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if (!mountedPath.empty()) {
|
||||
readPath = mountedPath;
|
||||
readPath = convStringToWstring(mountedPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -85,15 +104,15 @@ bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
|
||||
*ppData = nullptr;
|
||||
*pBytesRead = 0;
|
||||
|
||||
const std::string readPath = getMountedDlcReadPath(path);
|
||||
const std::size_t fSize = PlatformFilesystem.fileSize(readPath);
|
||||
const std::wstring readPath = getMountedDlcReadPath(path);
|
||||
const std::size_t fSize = PlatformFileIO.fileSize(readPath);
|
||||
if (fSize == 0 || fSize > std::numeric_limits<unsigned int>::max()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::uint8_t* data = new std::uint8_t[fSize];
|
||||
auto result = PlatformFilesystem.readFile(readPath, data, fSize);
|
||||
if (result.status != IPlatformFilesystem::ReadStatus::Ok) {
|
||||
auto result = PlatformFileIO.readFile(readPath, data, fSize);
|
||||
if (result.status != IPlatformFileIO::ReadStatus::Ok) {
|
||||
delete[] data;
|
||||
return false;
|
||||
}
|
||||
@@ -104,20 +123,20 @@ bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
const char* DLCManager::wchTypeNamesA[] = {
|
||||
"DISPLAYNAME",
|
||||
"THEMENAME",
|
||||
"FREE",
|
||||
"CREDIT",
|
||||
"CAPEPATH",
|
||||
"BOX",
|
||||
"ANIM",
|
||||
"PACKID",
|
||||
"NETHERPARTICLECOLOUR",
|
||||
"ENCHANTTEXTCOLOUR",
|
||||
"ENCHANTTEXTFOCUSCOLOUR",
|
||||
"DATAPATH",
|
||||
"PACKVERSION",
|
||||
const wchar_t* DLCManager::wchTypeNamesA[] = {
|
||||
L"DISPLAYNAME",
|
||||
L"THEMENAME",
|
||||
L"FREE",
|
||||
L"CREDIT",
|
||||
L"CAPEPATH",
|
||||
L"BOX",
|
||||
L"ANIM",
|
||||
L"PACKID",
|
||||
L"NETHERPARTICLECOLOUR",
|
||||
L"ENCHANTTEXTCOLOUR",
|
||||
L"ENCHANTTEXTFOCUSCOLOUR",
|
||||
L"DATAPATH",
|
||||
L"PACKVERSION",
|
||||
};
|
||||
|
||||
DLCManager::DLCManager() {
|
||||
@@ -133,7 +152,7 @@ DLCManager::~DLCManager() {
|
||||
}
|
||||
|
||||
DLCManager::EDLCParameterType DLCManager::getParameterType(
|
||||
const std::string& paramName) {
|
||||
const std::wstring& paramName) {
|
||||
EDLCParameterType type = e_DLCParamType_Invalid;
|
||||
|
||||
for (unsigned int i = 0; i < e_DLCParamType_Max; ++i) {
|
||||
@@ -188,13 +207,13 @@ void DLCManager::LanguageChanged(void) {
|
||||
}
|
||||
}
|
||||
|
||||
DLCPack* DLCManager::getPack(const std::string& name) {
|
||||
DLCPack* DLCManager::getPack(const std::wstring& name) {
|
||||
DLCPack* pack = nullptr;
|
||||
// uint32_t currentIndex = 0;
|
||||
DLCPack* currentPack = nullptr;
|
||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||
currentPack = *it;
|
||||
std::string wsName = currentPack->getName();
|
||||
std::wstring wsName = currentPack->getName();
|
||||
|
||||
if (wsName.compare(name) == 0) {
|
||||
pack = currentPack;
|
||||
@@ -240,7 +259,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);
|
||||
//__debugbreak();
|
||||
return foundIndex;
|
||||
}
|
||||
if (type != e_DLCType_All) {
|
||||
@@ -271,7 +290,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
|
||||
return foundIndex;
|
||||
}
|
||||
|
||||
unsigned int DLCManager::getPackIndexContainingSkin(const std::string& path,
|
||||
unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path,
|
||||
bool& found) {
|
||||
unsigned int foundIndex = 0;
|
||||
found = false;
|
||||
@@ -290,7 +309,7 @@ unsigned int DLCManager::getPackIndexContainingSkin(const std::string& path,
|
||||
return foundIndex;
|
||||
}
|
||||
|
||||
DLCPack* DLCManager::getPackContainingSkin(const std::string& path) {
|
||||
DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) {
|
||||
DLCPack* foundPack = nullptr;
|
||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||
DLCPack* pack = *it;
|
||||
@@ -304,7 +323,7 @@ DLCPack* DLCManager::getPackContainingSkin(const std::string& path) {
|
||||
return foundPack;
|
||||
}
|
||||
|
||||
DLCSkinFile* DLCManager::getSkinFile(const std::string& path) {
|
||||
DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) {
|
||||
DLCSkinFile* foundSkinfile = nullptr;
|
||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||
DLCPack* pack = *it;
|
||||
@@ -336,18 +355,18 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
if (corruptDLCCount == 1 && firstCorruptPack != nullptr) {
|
||||
// pass in the pack format string
|
||||
char wchFormat[132];
|
||||
snprintf(wchFormat, 132, "%s\n\n%%s",
|
||||
wchar_t wchFormat[132];
|
||||
swprintf(wchFormat, 132, L"%ls\n\n%%ls",
|
||||
firstCorruptPack->getName().c_str());
|
||||
|
||||
IPlatformStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1,
|
||||
PlatformProfile.GetPrimaryPad(), nullptr, nullptr, wchFormat);
|
||||
ProfileManager.GetPrimaryPad(), nullptr, nullptr, wchFormat);
|
||||
|
||||
} else {
|
||||
IPlatformStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1,
|
||||
PlatformProfile.GetPrimaryPad());
|
||||
ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,18 +375,18 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
||||
return corruptDLCCount;
|
||||
}
|
||||
|
||||
// bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
// const std::string& path, DLCPack* pack,
|
||||
// bool fromArchive) {
|
||||
// return readDLCDataFile(dwFilesProcessed,
|
||||
// std::filesystem::path(path).string(), pack,
|
||||
// fromArchive);
|
||||
// }
|
||||
bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
const std::wstring& path, DLCPack* pack,
|
||||
bool fromArchive) {
|
||||
return readDLCDataFile(dwFilesProcessed,
|
||||
std::filesystem::path(path).string(), pack,
|
||||
fromArchive);
|
||||
}
|
||||
|
||||
bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
const std::string& path, DLCPack* pack,
|
||||
bool fromArchive) {
|
||||
std::string wPath = path;
|
||||
std::wstring wPath = convStringToWstring(path);
|
||||
if (fromArchive && app.getArchiveFileSize(wPath) >= 0) {
|
||||
std::vector<uint8_t> bytes = app.getArchiveFile(wPath);
|
||||
return processDLCDataFile(dwFilesProcessed, bytes.data(), bytes.size(),
|
||||
@@ -394,19 +413,17 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
memcpy((out), (buf) + (off), sizeof(unsigned int))
|
||||
|
||||
#define DLC_READ_PARAM(out, buf, off) \
|
||||
memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_PARAM))
|
||||
memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM))
|
||||
|
||||
#define DLC_READ_DETAIL(out, buf, off) \
|
||||
memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_DETAILS))
|
||||
memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS))
|
||||
|
||||
// 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(C4JStorage::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(C4JStorage::DLC_FILE_DETAILS, wchFile))
|
||||
{
|
||||
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte = 0;
|
||||
@@ -449,13 +466,13 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
|
||||
IPlatformStorage::DLC_FILE_PARAM parBuf;
|
||||
C4JStorage::DLC_FILE_PARAM parBuf;
|
||||
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
|
||||
// uint32_t dwwchCount=0;
|
||||
for (unsigned int i = 0; i < uiParameterCount; i++) {
|
||||
// Map DLC strings to application strings, then store the DLC index
|
||||
// mapping to application index
|
||||
std::string parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
|
||||
std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
|
||||
DLCManager::EDLCParameterType type =
|
||||
DLCManager::getParameterType(parameterName);
|
||||
if (type != DLCManager::e_DLCParamType_Invalid) {
|
||||
@@ -464,14 +481,13 @@ 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(C4JStorage::DLC_FILE_PARAM);
|
||||
|
||||
unsigned int uiFileCount;
|
||||
DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
|
||||
IPlatformStorage::DLC_FILE_DETAILS fileBuf;
|
||||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
unsigned int dwTemp = uiCurrentByte;
|
||||
@@ -480,9 +496,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(C4JStorage::DLC_FILE_DETAILS)*ulFileCount;
|
||||
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
for (unsigned int i = 0; i < uiFileCount; i++) {
|
||||
@@ -526,7 +540,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
pbTemp += DLC_PARAM_ADV(parBuf.dwWchCount);
|
||||
DLC_READ_PARAM(&parBuf, pbTemp, 0);
|
||||
}
|
||||
// pbTemp+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM);
|
||||
// pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||
|
||||
if (dlcTexturePack != nullptr) {
|
||||
unsigned int texturePackFilesProcessed = 0;
|
||||
@@ -629,12 +643,12 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData,
|
||||
unsigned int uiParameterCount =
|
||||
ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
IPlatformStorage::DLC_FILE_PARAM paramBuf;
|
||||
C4JStorage::DLC_FILE_PARAM paramBuf;
|
||||
ReadDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
for (unsigned int i = 0; i < uiParameterCount; i++) {
|
||||
// Map DLC strings to application strings, then store the DLC index
|
||||
// mapping to application index
|
||||
std::string parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
|
||||
std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
|
||||
DLCManager::EDLCParameterType type =
|
||||
DLCManager::getParameterType(parameterName);
|
||||
if (type != DLCManager::e_DLCParamType_Invalid) {
|
||||
@@ -647,7 +661,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData,
|
||||
unsigned int uiFileCount =
|
||||
ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte += sizeof(int);
|
||||
IPlatformStorage::DLC_FILE_DETAILS fileBuf;
|
||||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
unsigned int dwTemp = uiCurrentByte;
|
||||
@@ -671,8 +685,8 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData,
|
||||
if (it != parameterMapping.end()) {
|
||||
if (type == e_DLCType_PackConfig) {
|
||||
if (it->second == e_DLCParamType_PackId) {
|
||||
std::string wsTemp = DLC_PARAM_WSTR(pbTemp, 0);
|
||||
std::stringstream ss;
|
||||
std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0);
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for
|
||||
// artists/people to number manually
|
||||
ss << std::dec << wsTemp.c_str();
|
||||
|
||||
@@ -3,78 +3,51 @@
|
||||
#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,
|
||||
|
||||
const static char* wchTypeNamesA[e_DLCParamType_Max];
|
||||
e_DLCParamType_DisplayName = 0,
|
||||
e_DLCParamType_ThemeName,
|
||||
e_DLCParamType_Free, // identify free skins
|
||||
e_DLCParamType_Credit, // legal credits for DLC
|
||||
e_DLCParamType_Cape,
|
||||
e_DLCParamType_Box,
|
||||
e_DLCParamType_Anim,
|
||||
e_DLCParamType_PackId,
|
||||
e_DLCParamType_NetherParticleColour,
|
||||
e_DLCParamType_EnchantmentTextColour,
|
||||
e_DLCParamType_EnchantmentTextFocusColour,
|
||||
e_DLCParamType_DataPath,
|
||||
e_DLCParamType_PackVersion,
|
||||
|
||||
e_DLCParamType_Max,
|
||||
|
||||
};
|
||||
const static wchar_t* wchTypeNamesA[e_DLCParamType_Max];
|
||||
|
||||
private:
|
||||
std::vector<DLCPack*> m_packs;
|
||||
@@ -86,7 +59,7 @@ public:
|
||||
DLCManager();
|
||||
~DLCManager();
|
||||
|
||||
static EDLCParameterType getParameterType(const std::string& paramName);
|
||||
static EDLCParameterType getParameterType(const std::wstring& paramName);
|
||||
|
||||
unsigned int getPackCount(EDLCType type = e_DLCType_All);
|
||||
|
||||
@@ -104,23 +77,23 @@ public:
|
||||
void removeAllPacks(void);
|
||||
void LanguageChanged(void);
|
||||
|
||||
DLCPack* getPack(const std::string& name);
|
||||
DLCPack* getPack(const std::wstring& name);
|
||||
DLCPack* getPack(unsigned int index, EDLCType type = e_DLCType_All);
|
||||
unsigned int getPackIndex(DLCPack* pack, bool& found,
|
||||
EDLCType type = e_DLCType_All);
|
||||
DLCSkinFile* getSkinFile(
|
||||
const std::string& path); // Will hunt all packs of type skin to find
|
||||
// the right skinfile
|
||||
const std::wstring& path); // Will hunt all packs of type skin to find
|
||||
// the right skinfile
|
||||
|
||||
DLCPack* getPackContainingSkin(const std::string& path);
|
||||
unsigned int getPackIndexContainingSkin(const std::string& path,
|
||||
DLCPack* getPackContainingSkin(const std::wstring& path);
|
||||
unsigned int getPackIndexContainingSkin(const std::wstring& path,
|
||||
bool& found);
|
||||
|
||||
unsigned int checkForCorruptDLCAndAlert(bool showMessage = true);
|
||||
|
||||
// bool readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
// const std::wstring& path, DLCPack* pack,
|
||||
// bool fromArchive = false);
|
||||
bool readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
const std::wstring& path, DLCPack* pack,
|
||||
bool fromArchive = false);
|
||||
bool readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||
const std::string& path, DLCPack* pack,
|
||||
bool fromArchive = false);
|
||||
@@ -135,5 +108,3 @@ private:
|
||||
std::uint32_t retrievePackID(std::uint8_t* pbData, unsigned int dwLength,
|
||||
DLCPack* pack);
|
||||
};
|
||||
|
||||
std::string dlc_read_wstring(const void* data);
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "platform/sdl2/Profile.h"
|
||||
#include "DLCAudioFile.h"
|
||||
#include "DLCCapeFile.h"
|
||||
#include "DLCColourTableFile.h"
|
||||
@@ -14,17 +15,17 @@
|
||||
#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) {
|
||||
m_dataPath = "";
|
||||
DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) {
|
||||
m_dataPath = L"";
|
||||
m_packName = name;
|
||||
m_dwLicenseMask = dwLicenseMask;
|
||||
m_ullFullOfferId = 0LL;
|
||||
@@ -54,7 +55,7 @@ DLCPack::~DLCPack() {
|
||||
// invalidates ALL of it's children.
|
||||
if (m_data) {
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
printf("Deleting data for DLC pack %s\n", m_packName.c_str());
|
||||
wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str());
|
||||
#endif
|
||||
// For the same reason, don't delete data pointer for any child pack as
|
||||
// it just points to a region within the parent pack that has already
|
||||
@@ -83,7 +84,7 @@ void DLCPack::addChildPack(DLCPack* childPack) {
|
||||
const std::uint32_t packId = childPack->GetPackId();
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (packId < 0 || packId > 15) {
|
||||
assert(0);
|
||||
__debugbreak();
|
||||
}
|
||||
#endif
|
||||
childPack->SetPackId((packId << 24) | m_packId);
|
||||
@@ -95,12 +96,12 @@ void DLCPack::addChildPack(DLCPack* childPack) {
|
||||
void DLCPack::setParentPack(DLCPack* parentPack) { m_parentPack = parentPack; }
|
||||
|
||||
void DLCPack::addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value) {
|
||||
const std::wstring& value) {
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCParamType_PackId: {
|
||||
std::uint32_t packId = 0;
|
||||
|
||||
std::stringstream ss;
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for
|
||||
// artists/people to number manually
|
||||
ss << std::dec << value.c_str();
|
||||
@@ -111,7 +112,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type,
|
||||
case DLCManager::e_DLCParamType_PackVersion: {
|
||||
std::uint32_t version = 0;
|
||||
|
||||
std::stringstream ss;
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for
|
||||
// artists/people to number manually
|
||||
ss << std::dec << value.c_str();
|
||||
@@ -139,7 +140,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type,
|
||||
case DLCManager::e_DLCParamType_NetherParticleColour:
|
||||
case DLCManager::e_DLCParamType_EnchantmentTextColour:
|
||||
case DLCManager::e_DLCParamType_EnchantmentTextFocusColour: {
|
||||
std::stringstream ss;
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << it->second.c_str();
|
||||
ss >> param;
|
||||
} break;
|
||||
@@ -151,13 +152,13 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type,
|
||||
return false;
|
||||
}
|
||||
|
||||
DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::string& path) {
|
||||
DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||
DLCFile* newFile = nullptr;
|
||||
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCType_Skin: {
|
||||
std::vector<std::string> splitPath = stringSplit(path, '/');
|
||||
std::string strippedPath = splitPath.back();
|
||||
std::vector<std::wstring> splitPath = stringSplit(path, L'/');
|
||||
std::wstring strippedPath = splitPath.back();
|
||||
|
||||
newFile = new DLCSkinFile(strippedPath);
|
||||
|
||||
@@ -169,8 +170,8 @@ DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::string& path) {
|
||||
}
|
||||
} break;
|
||||
case DLCManager::e_DLCType_Cape: {
|
||||
std::vector<std::string> splitPath = stringSplit(path, '/');
|
||||
std::string strippedPath = splitPath.back();
|
||||
std::vector<std::wstring> splitPath = stringSplit(path, L'/');
|
||||
std::wstring strippedPath = splitPath.back();
|
||||
newFile = new DLCCapeFile(strippedPath);
|
||||
} break;
|
||||
case DLCManager::e_DLCType_Texture:
|
||||
@@ -207,13 +208,13 @@ DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::string& path) {
|
||||
|
||||
// MGH - added this comp func, as the embedded func in find_if was confusing the
|
||||
// PS3 compiler
|
||||
static const std::string* g_pathCmpString = nullptr;
|
||||
static const std::wstring* g_pathCmpString = nullptr;
|
||||
static bool pathCmp(DLCFile* val) {
|
||||
return (g_pathCmpString->compare(val->getPath()) == 0);
|
||||
}
|
||||
|
||||
bool DLCPack::doesPackContainFile(DLCManager::EDLCType type,
|
||||
const std::string& path) {
|
||||
const std::wstring& path) {
|
||||
bool hasFile = false;
|
||||
if (type == DLCManager::e_DLCType_All) {
|
||||
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
||||
@@ -252,7 +253,7 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, unsigned int index) {
|
||||
return file;
|
||||
}
|
||||
|
||||
DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::string& path) {
|
||||
DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||
DLCFile* file = nullptr;
|
||||
if (type == DLCManager::e_DLCType_All) {
|
||||
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
||||
@@ -297,11 +298,11 @@ unsigned int DLCPack::getDLCItemsCount(
|
||||
};
|
||||
|
||||
unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type,
|
||||
const std::string& path, bool& found) {
|
||||
const std::wstring& path, bool& found) {
|
||||
if (type == DLCManager::e_DLCType_All) {
|
||||
app.DebugPrintf("Unimplemented\n");
|
||||
#if !defined(__CONTENT_PACKAGE)
|
||||
assert(0);
|
||||
__debugbreak();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -322,16 +323,16 @@ unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type,
|
||||
}
|
||||
|
||||
bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type,
|
||||
const std::string& path) {
|
||||
const std::wstring& path) {
|
||||
if (type == DLCManager::e_DLCType_All) {
|
||||
app.DebugPrintf("Unimplemented\n");
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
assert(0);
|
||||
__debugbreak();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()) &
|
||||
if (app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_UnlockAllDLC)) {
|
||||
return true;
|
||||
} else
|
||||
@@ -349,8 +350,8 @@ void DLCPack::UpdateLanguage() {
|
||||
// find the language file
|
||||
if (m_files[DLCManager::e_DLCType_LocalisationData].size() > 0) {
|
||||
DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile(
|
||||
DLCManager::e_DLCType_LocalisationData, "languages.loc");
|
||||
DLCManager::e_DLCType_LocalisationData, L"languages.loc");
|
||||
StringTable* strTable = localisationFile->getStringTable();
|
||||
strTable->ReloadStringTable(app.getLocale());
|
||||
strTable->ReloadStringTable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -18,10 +18,10 @@ private:
|
||||
std::vector<DLCPack*> m_childPacks;
|
||||
DLCPack* m_parentPack;
|
||||
|
||||
std::unordered_map<int, std::string> m_parameters;
|
||||
std::unordered_map<int, std::wstring> m_parameters;
|
||||
|
||||
std::string m_packName;
|
||||
std::string m_dataPath;
|
||||
std::wstring m_packName;
|
||||
std::wstring m_dataPath;
|
||||
std::uint32_t m_dwLicenseMask;
|
||||
int m_dlcMountIndex;
|
||||
XCONTENTDEVICEID m_dlcDeviceID;
|
||||
@@ -34,10 +34,10 @@ private:
|
||||
m_data; // This pointer is for all the data used for this pack, so
|
||||
// deleting it invalidates ALL of it's children.
|
||||
public:
|
||||
DLCPack(const std::string& name, std::uint32_t dwLicenseMask);
|
||||
DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask);
|
||||
~DLCPack();
|
||||
|
||||
std::string getFullDataPath() { return m_dataPath; }
|
||||
std::wstring getFullDataPath() { return m_dataPath; }
|
||||
|
||||
void SetDataPointer(std::uint8_t* pbData) { m_data = pbData; }
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
void setParentPack(DLCPack* parentPack);
|
||||
|
||||
void addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value);
|
||||
const std::wstring& value);
|
||||
bool getParameterAsUInt(DLCManager::EDLCParameterType type,
|
||||
unsigned int& param);
|
||||
|
||||
@@ -71,38 +71,38 @@ public:
|
||||
}
|
||||
std::uint32_t getLicenseMask() { return m_dwLicenseMask; }
|
||||
|
||||
std::string getName() { return m_packName; }
|
||||
std::wstring getName() { return m_packName; }
|
||||
|
||||
void UpdateLanguage();
|
||||
uint64_t getPurchaseOfferId() { return m_ullFullOfferId; }
|
||||
|
||||
DLCFile* addFile(DLCManager::EDLCType type, const std::string& path);
|
||||
DLCFile* addFile(DLCManager::EDLCType type, const std::wstring& path);
|
||||
DLCFile* getFile(DLCManager::EDLCType type, unsigned int index);
|
||||
DLCFile* getFile(DLCManager::EDLCType type, const std::string& path);
|
||||
DLCFile* getFile(DLCManager::EDLCType type, const std::wstring& path);
|
||||
|
||||
unsigned int getDLCItemsCount(
|
||||
DLCManager::EDLCType type = DLCManager::e_DLCType_All);
|
||||
unsigned int getFileIndexAt(DLCManager::EDLCType type,
|
||||
const std::string& path, bool& found);
|
||||
const std::wstring& path, bool& found);
|
||||
bool doesPackContainFile(DLCManager::EDLCType type,
|
||||
const std::string& path);
|
||||
const std::wstring& path);
|
||||
std::uint32_t GetPackID() { return m_packId; }
|
||||
|
||||
unsigned int getSkinCount() {
|
||||
return getDLCItemsCount(DLCManager::e_DLCType_Skin);
|
||||
}
|
||||
unsigned int getSkinIndexAt(const std::string& path, bool& found) {
|
||||
unsigned int getSkinIndexAt(const std::wstring& path, bool& found) {
|
||||
return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found);
|
||||
}
|
||||
DLCSkinFile* getSkinFile(const std::string& path) {
|
||||
DLCSkinFile* getSkinFile(const std::wstring& path) {
|
||||
return (DLCSkinFile*)getFile(DLCManager::e_DLCType_Skin, path);
|
||||
}
|
||||
DLCSkinFile* getSkinFile(unsigned int index) {
|
||||
return (DLCSkinFile*)getFile(DLCManager::e_DLCType_Skin, index);
|
||||
}
|
||||
bool doesPackContainSkin(const std::string& path) {
|
||||
bool doesPackContainSkin(const std::wstring& path) {
|
||||
return doesPackContainFile(DLCManager::e_DLCType_Skin, path);
|
||||
}
|
||||
|
||||
bool hasPurchasedFile(DLCManager::EDLCType type, const std::string& path);
|
||||
bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring& path);
|
||||
};
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "platform/sdl2/Render.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)
|
||||
DLCSkinFile::DLCSkinFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_Skin, path) {
|
||||
m_displayName = "";
|
||||
m_themeName = "";
|
||||
m_cape = "";
|
||||
m_displayName = L"";
|
||||
m_themeName = L"";
|
||||
m_cape = L"";
|
||||
m_bIsFree = false;
|
||||
m_uiAnimOverrideBitmask = 0L;
|
||||
}
|
||||
@@ -24,13 +24,13 @@ void DLCSkinFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) {
|
||||
}
|
||||
|
||||
void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value) {
|
||||
const std::wstring& value) {
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCParamType_DisplayName: {
|
||||
// 4J Stu - In skin pack 2, the name for Zap is mis-spelt with two
|
||||
// p's as Zapp dlcskin00000109.png
|
||||
if (m_path.compare("dlcskin00000109.png") == 0) {
|
||||
m_displayName = "Zap";
|
||||
if (m_path.compare(L"dlcskin00000109.png") == 0) {
|
||||
m_displayName = L"Zap";
|
||||
} else {
|
||||
m_displayName = value;
|
||||
}
|
||||
@@ -52,12 +52,12 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
{
|
||||
if (app.AlreadySeenCreditText(value)) break;
|
||||
// first add a blank string for spacing
|
||||
app.AddCreditText("");
|
||||
app.AddCreditText(L"");
|
||||
|
||||
int maximumChars = 55;
|
||||
|
||||
bool bIsSDMode = !PlatformRenderer.IsHiDef() &&
|
||||
!PlatformRenderer.IsWidescreen();
|
||||
bool bIsSDMode =
|
||||
!RenderManager.IsHiDef() && !RenderManager.IsWidescreen();
|
||||
|
||||
if (bIsSDMode) {
|
||||
maximumChars = 45;
|
||||
@@ -72,14 +72,14 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
std::string creditValue = value;
|
||||
std::wstring creditValue = value;
|
||||
while (creditValue.length() > maximumChars) {
|
||||
unsigned int i = 1;
|
||||
while (i < creditValue.length() &&
|
||||
(i + 1) <= maximumChars) {
|
||||
i++;
|
||||
}
|
||||
int iLast = (int)creditValue.find_last_of(" ", i);
|
||||
int iLast = (int)creditValue.find_last_of(L" ", i);
|
||||
switch (XGetLanguage()) {
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
case XC_LANGUAGE_TCHINESE:
|
||||
@@ -87,7 +87,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
iLast = maximumChars;
|
||||
break;
|
||||
default:
|
||||
iLast = (int)creditValue.find_last_of(" ", i);
|
||||
iLast = (int)creditValue.find_last_of(L" ", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -106,25 +106,25 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
m_cape = value;
|
||||
break;
|
||||
case DLCManager::e_DLCParamType_Box: {
|
||||
char wchBodyPart[10];
|
||||
wchar_t wchBodyPart[10];
|
||||
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);
|
||||
swscanf(value.c_str(), L"%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) {
|
||||
if (wcscmp(wchBodyPart, L"HEAD") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Head;
|
||||
} else if (strcmp(wchBodyPart, "BODY") == 0) {
|
||||
} else if (wcscmp(wchBodyPart, L"BODY") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Body;
|
||||
} else if (strcmp(wchBodyPart, "ARM0") == 0) {
|
||||
} else if (wcscmp(wchBodyPart, L"ARM0") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Arm0;
|
||||
} else if (strcmp(wchBodyPart, "ARM1") == 0) {
|
||||
} else if (wcscmp(wchBodyPart, L"ARM1") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Arm1;
|
||||
} else if (strcmp(wchBodyPart, "LEG0") == 0) {
|
||||
} else if (wcscmp(wchBodyPart, L"LEG0") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Leg0;
|
||||
} else if (strcmp(wchBodyPart, "LEG1") == 0) {
|
||||
} else if (wcscmp(wchBodyPart, L"LEG1") == 0) {
|
||||
pSkinBox->ePart = eBodyPart_Leg1;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask,
|
||||
sizeof(unsigned int));
|
||||
uint32_t skinId = app.getSkinIdFromPath(m_path);
|
||||
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
|
||||
break;
|
||||
@@ -154,7 +155,7 @@ std::vector<SKIN_BOX*>* DLCSkinFile::getAdditionalBoxes() {
|
||||
return &m_AdditionalBoxes;
|
||||
}
|
||||
|
||||
std::string DLCSkinFile::getParameterAsString(
|
||||
std::wstring DLCSkinFile::getParameterAsString(
|
||||
DLCManager::EDLCParameterType type) {
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCParamType_DisplayName:
|
||||
@@ -164,7 +165,7 @@ std::string DLCSkinFile::getParameterAsString(
|
||||
case DLCManager::e_DLCParamType_Cape:
|
||||
return m_cape;
|
||||
default:
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,39 +6,30 @@
|
||||
|
||||
#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;
|
||||
std::string m_cape;
|
||||
std::wstring m_displayName;
|
||||
std::wstring m_themeName;
|
||||
std::wstring m_cape;
|
||||
unsigned int m_uiAnimOverrideBitmask;
|
||||
bool m_bIsFree;
|
||||
std::vector<SKIN_BOX*> m_AdditionalBoxes;
|
||||
|
||||
public:
|
||||
DLCSkinFile(const std::string& path);
|
||||
DLCSkinFile(const std::wstring& 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::wstring& value);
|
||||
|
||||
virtual std::wstring 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; }
|
||||
};
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#include "DLCManager.h"
|
||||
#include "app/common/DLC/DLCFile.h"
|
||||
|
||||
DLCTextureFile::DLCTextureFile(const std::string& path)
|
||||
DLCTextureFile::DLCTextureFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_Texture, path) {
|
||||
m_bIsAnim = false;
|
||||
m_animString = "";
|
||||
m_animString = L"";
|
||||
|
||||
m_pbData = nullptr;
|
||||
m_dataBytes = 0;
|
||||
@@ -24,7 +24,7 @@ std::uint8_t* DLCTextureFile::getData(std::uint32_t& dataBytes) {
|
||||
}
|
||||
|
||||
void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value) {
|
||||
const std::wstring& value) {
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCParamType_Anim:
|
||||
m_animString = value;
|
||||
@@ -36,13 +36,13 @@ void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type,
|
||||
}
|
||||
}
|
||||
|
||||
std::string DLCTextureFile::getParameterAsString(
|
||||
std::wstring DLCTextureFile::getParameterAsString(
|
||||
DLCManager::EDLCParameterType type) {
|
||||
switch (type) {
|
||||
case DLCManager::e_DLCParamType_Anim:
|
||||
return m_animString;
|
||||
default:
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
class DLCTextureFile : public DLCFile {
|
||||
private:
|
||||
bool m_bIsAnim;
|
||||
std::string m_animString;
|
||||
std::wstring m_animString;
|
||||
|
||||
std::uint8_t* m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
|
||||
public:
|
||||
DLCTextureFile(const std::string& path);
|
||||
DLCTextureFile(const std::wstring& path);
|
||||
|
||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t* getData(std::uint32_t& dataBytes);
|
||||
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type,
|
||||
const std::string& value);
|
||||
const std::wstring& value);
|
||||
|
||||
virtual std::string getParameterAsString(
|
||||
virtual std::wstring getParameterAsString(
|
||||
DLCManager::EDLCParameterType type);
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
|
||||
};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#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)
|
||||
DLCUIDataFile::DLCUIDataFile(const std::wstring& path)
|
||||
: DLCFile(DLCManager::e_DLCType_UIData, path) {
|
||||
m_pbData = nullptr;
|
||||
m_dataBytes = 0;
|
||||
|
||||
@@ -11,7 +11,7 @@ private:
|
||||
bool m_canDeleteData;
|
||||
|
||||
public:
|
||||
DLCUIDataFile(const std::string& path);
|
||||
DLCUIDataFile(const std::wstring& path);
|
||||
~DLCUIDataFile();
|
||||
|
||||
using DLCFile::addData;
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#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 "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/skins/TexturePack.h"
|
||||
#include "minecraft/client/skins/TexturePackRepository.h"
|
||||
#include "platform/sdl2/Storage.h"
|
||||
#include "platform/sdl2/Profile.h"
|
||||
#include "platform/XboxStubs.h"
|
||||
#include "platform/profile/profile.h"
|
||||
#include "platform/storage/storage.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
|
||||
DLCController::DLCController() {
|
||||
m_pDLCFileBuffer = nullptr;
|
||||
@@ -35,7 +36,7 @@ std::unordered_map<PlayerUID, MOJANG_DATA*> DLCController::MojangData;
|
||||
std::unordered_map<int, uint64_t> DLCController::DLCTextures_PackID;
|
||||
std::unordered_map<uint64_t, DLC_INFO*> DLCController::DLCInfo_Trial;
|
||||
std::unordered_map<uint64_t, DLC_INFO*> DLCController::DLCInfo_Full;
|
||||
std::unordered_map<std::string, uint64_t> DLCController::DLCInfo_SkinName;
|
||||
std::unordered_map<std::wstring, uint64_t> DLCController::DLCInfo_SkinName;
|
||||
|
||||
std::uint32_t DLCController::m_dwContentTypeA[e_Marketplace_MAX] = {
|
||||
XMARKETPLACE_OFFERING_TYPE_CONTENT,
|
||||
@@ -45,7 +46,7 @@ std::uint32_t DLCController::m_dwContentTypeA[e_Marketplace_MAX] = {
|
||||
};
|
||||
|
||||
int DLCController::marketplaceCountsCallback(
|
||||
void* pParam, IPlatformStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) {
|
||||
void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) {
|
||||
app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n",
|
||||
pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers);
|
||||
|
||||
@@ -72,11 +73,12 @@ bool DLCController::startInstallDLCProcess(int iPad) {
|
||||
m_iTotalDLCInstalled = 0;
|
||||
app.DebugPrintf(
|
||||
"--- DLCController::startInstallDLCProcess - "
|
||||
"PlatformStorage.GetInstalledDLC\n");
|
||||
"StorageManager.GetInstalledDLC\n");
|
||||
|
||||
PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) {
|
||||
return dlcInstalledCallback(iInstalledC, pad);
|
||||
});
|
||||
StorageManager.GetInstalledDLC(
|
||||
iPad, [this](int iInstalledC, int pad) {
|
||||
return dlcInstalledCallback(iInstalledC, pad);
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
app.DebugPrintf(
|
||||
@@ -97,18 +99,18 @@ int DLCController::dlcInstalledCallback(int iInstalledC, int iPad) {
|
||||
void DLCController::mountNextDLC(int iPad) {
|
||||
app.DebugPrintf("--- DLCController::mountNextDLC: pad=%i.\n", iPad);
|
||||
if (m_iTotalDLCInstalled < m_iTotalDLC) {
|
||||
if (PlatformStorage.MountInstalledDLC(
|
||||
if (StorageManager.MountInstalledDLC(
|
||||
iPad, m_iTotalDLCInstalled,
|
||||
[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;
|
||||
mountNextDLC(iPad);
|
||||
} else {
|
||||
app.DebugPrintf("PlatformStorage.MountInstalledDLC ok\n");
|
||||
app.DebugPrintf("StorageManager.MountInstalledDLC ok\n");
|
||||
}
|
||||
} else {
|
||||
m_bDLCInstallPending = false;
|
||||
@@ -128,26 +130,26 @@ 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 {
|
||||
XCONTENT_DATA ContentData =
|
||||
PlatformStorage.GetDLC(m_iTotalDLCInstalled);
|
||||
StorageManager.GetDLC(m_iTotalDLCInstalled);
|
||||
|
||||
DLCPack* pack =
|
||||
app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||
|
||||
if (pack != nullptr && pack->IsCorrupt()) {
|
||||
app.DebugPrintf(
|
||||
"Pack '%s' is corrupt, removing it from the DLC Manager.\n",
|
||||
"Pack '%ls' is corrupt, removing it from the DLC Manager.\n",
|
||||
CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||
app.m_dlcManager.removePack(pack);
|
||||
pack = nullptr;
|
||||
}
|
||||
|
||||
if (pack == nullptr) {
|
||||
app.DebugPrintf("Pack \"%s\" is not installed, so adding it\n",
|
||||
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n",
|
||||
CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||
|
||||
#if defined(_WINDOWS64)
|
||||
@@ -166,7 +168,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
|
||||
}
|
||||
} else {
|
||||
app.DebugPrintf(
|
||||
"Pack \"%s\" is already installed. Updating license to %u\n",
|
||||
"Pack \"%ls\" is already installed. Updating license to %u\n",
|
||||
CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask);
|
||||
|
||||
pack->SetDLCMountIndex(m_iTotalDLCInstalled);
|
||||
@@ -174,7 +176,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr,
|
||||
pack->updateLicenseMask(dwLicenceMask);
|
||||
}
|
||||
|
||||
PlatformStorage.UnmountInstalledDLC();
|
||||
StorageManager.UnmountInstalledDLC();
|
||||
}
|
||||
++m_iTotalDLCInstalled;
|
||||
mountNextDLC(iPad);
|
||||
@@ -185,34 +187,36 @@ 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;
|
||||
PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames);
|
||||
#endif
|
||||
StorageManager.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);
|
||||
}
|
||||
|
||||
void DLCController::addCreditText(const char* lpStr) {
|
||||
app.DebugPrintf("ADDING CREDIT - %s\n", lpStr);
|
||||
void DLCController::addCreditText(const wchar_t* lpStr) {
|
||||
app.DebugPrintf("ADDING CREDIT - %ls\n", lpStr);
|
||||
SCreditTextItemDef* pCreditStruct = new SCreditTextItemDef;
|
||||
pCreditStruct->m_eType = eSmallText;
|
||||
pCreditStruct->m_iStringID[0] = NO_TRANSLATED_STRING;
|
||||
pCreditStruct->m_iStringID[1] = NO_TRANSLATED_STRING;
|
||||
pCreditStruct->m_Text = new char[strlen(lpStr) + 1];
|
||||
strcpy((char*)pCreditStruct->m_Text, lpStr);
|
||||
pCreditStruct->m_Text = new wchar_t[wcslen(lpStr) + 1];
|
||||
wcscpy((wchar_t*)pCreditStruct->m_Text, lpStr);
|
||||
vDLCCredits.push_back(pCreditStruct);
|
||||
}
|
||||
|
||||
bool DLCController::alreadySeenCreditText(const std::string& wstemp) {
|
||||
bool DLCController::alreadySeenCreditText(const std::wstring& wstemp) {
|
||||
for (unsigned int i = 0; i < m_vCreditText.size(); i++) {
|
||||
std::string temp = m_vCreditText.at(i);
|
||||
std::wstring temp = m_vCreditText.at(i);
|
||||
if (temp.compare(wstemp) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
m_vCreditText.push_back((char*)wstemp.c_str());
|
||||
m_vCreditText.push_back((wchar_t*)wstemp.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -224,12 +228,13 @@ SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) {
|
||||
return vDLCCredits.at(iIndex);
|
||||
}
|
||||
|
||||
int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
|
||||
#if defined(_WINDOWS64)
|
||||
int32_t DLCController::registerDLCData(wchar_t* pType, wchar_t* pBannerName,
|
||||
int iGender, uint64_t ullOfferID_Full,
|
||||
uint64_t ullOfferID_Trial,
|
||||
char* pFirstSkin,
|
||||
wchar_t* pFirstSkin,
|
||||
unsigned int uiSortIndex, int iConfig,
|
||||
char* pDataFile) {
|
||||
wchar_t* pDataFile) {
|
||||
int32_t hr = 0;
|
||||
DLC_INFO* pDLCData = new DLC_INFO;
|
||||
memset(pDLCData, 0, sizeof(DLC_INFO));
|
||||
@@ -240,26 +245,26 @@ 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 != L"") {
|
||||
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) {
|
||||
if (strcmp(pType, "Skin") == 0) {
|
||||
if (wcscmp(pType, L"Skin") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_SkinPack;
|
||||
} else if (strcmp(pType, "Gamerpic") == 0) {
|
||||
} else if (wcscmp(pType, L"Gamerpic") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_Gamerpics;
|
||||
} else if (strcmp(pType, "Theme") == 0) {
|
||||
} else if (wcscmp(pType, L"Theme") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_Themes;
|
||||
} else if (strcmp(pType, "Avatar") == 0) {
|
||||
} else if (wcscmp(pType, L"Avatar") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_AvatarItems;
|
||||
} else if (strcmp(pType, "MashUpPack") == 0) {
|
||||
} else if (wcscmp(pType, L"MashUpPack") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_MashupPacks;
|
||||
DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full;
|
||||
} else if (strcmp(pType, "TexturePack") == 0) {
|
||||
} else if (wcscmp(pType, L"TexturePack") == 0) {
|
||||
pDLCData->eDLCType = e_DLC_TexturePacks;
|
||||
DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full;
|
||||
}
|
||||
@@ -271,8 +276,21 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName,
|
||||
|
||||
return hr;
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
int32_t DLCController::registerDLCData(wchar_t* pType, wchar_t* pBannerName,
|
||||
int iGender, uint64_t ullOfferID_Full,
|
||||
uint64_t ullOfferID_Trial,
|
||||
wchar_t* pFirstSkin,
|
||||
unsigned int uiSortIndex, int iConfig,
|
||||
wchar_t* pDataFile) {
|
||||
fprintf(stderr,
|
||||
"warning: DLCController::registerDLCData unimplemented for "
|
||||
"platform `__linux__`\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool DLCController::getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
|
||||
bool DLCController::getDLCFullOfferIDForSkinID(const std::wstring& FirstSkin,
|
||||
uint64_t* pullVal) {
|
||||
auto it = DLCInfo_SkinName.find(FirstSkin);
|
||||
if (it == DLCInfo_SkinName.end()) {
|
||||
@@ -295,7 +313,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()) {
|
||||
@@ -394,8 +413,8 @@ unsigned int DLCController::addDLCRequest(eDLCMarketplaceType eType,
|
||||
}
|
||||
|
||||
bool DLCController::retrieveNextDLCContent() {
|
||||
int primPad = PlatformProfile.GetPrimaryPad();
|
||||
if (primPad == -1 || !PlatformProfile.IsSignedInLive(primPad)) {
|
||||
int primPad = ProfileManager.GetPrimaryPad();
|
||||
if (primPad == -1 || !ProfileManager.IsSignedInLive(primPad)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -417,14 +436,13 @@ bool DLCController::retrieveNextDLCContent() {
|
||||
app.DebugPrintf("RetrieveNextDLCContent - type = %d\n",
|
||||
pCurrent->dwType);
|
||||
#endif
|
||||
IPlatformStorage::EDLCStatus status =
|
||||
PlatformStorage.GetDLCOffers(
|
||||
PlatformProfile.GetPrimaryPad(),
|
||||
[this](int iOfferC, std::uint32_t dwType, int pad) {
|
||||
return dlcOffersReturned(iOfferC, dwType, pad);
|
||||
},
|
||||
pCurrent->dwType);
|
||||
if (status == IPlatformStorage::EDLC_Pending) {
|
||||
C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers(
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
[this](int iOfferC, std::uint32_t dwType, int pad) {
|
||||
return dlcOffersReturned(iOfferC, dwType, pad);
|
||||
},
|
||||
pCurrent->dwType);
|
||||
if (status == C4JStorage::EDLC_Pending) {
|
||||
pCurrent->eState = e_DLC_ContentState_Retrieving;
|
||||
} else {
|
||||
app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n");
|
||||
@@ -566,7 +584,7 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
for (auto it = m_TMSPPDownloadQueue.begin();
|
||||
it != m_TMSPPDownloadQueue.end(); ++it) {
|
||||
TMSPPRequest* pCurrent = *it;
|
||||
if (strcmp(pDLC->wchDataFile,
|
||||
if (wcscmp(pDLC->wchDataFile,
|
||||
pCurrent->wchFilename) == 0) {
|
||||
bAlreadyInQueue = true;
|
||||
break;
|
||||
@@ -579,12 +597,12 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
&DLCController::tmsPPFileReturned;
|
||||
pTMSPPreq->lpCallbackParam = this;
|
||||
pTMSPPreq->eStorageFacility =
|
||||
IPlatformStorage::eGlobalStorage_Title;
|
||||
C4JStorage::eGlobalStorage_Title;
|
||||
pTMSPPreq->eFileTypeVal =
|
||||
IPlatformStorage::TMS_FILETYPE_BINARY;
|
||||
C4JStorage::TMS_FILETYPE_BINARY;
|
||||
memcpy(pTMSPPreq->wchFilename,
|
||||
pDLC->wchDataFile,
|
||||
sizeof(char) * MAX_BANNERNAME_SIZE);
|
||||
sizeof(wchar_t) * MAX_BANNERNAME_SIZE);
|
||||
pTMSPPreq->eType = e_DLC_TexturePackData;
|
||||
pTMSPPreq->eState = e_TMS_ContentState_Queued;
|
||||
m_bAllTMSContentRetrieved = false;
|
||||
@@ -604,7 +622,7 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
for (int i = 0; i < iCount; i++) {
|
||||
DLC_INFO* pDLC = getDLCInfoFullOffer(i);
|
||||
if (pDLC->eDLCType == eType) {
|
||||
char* cString = pDLC->wchBanner;
|
||||
wchar_t* cString = pDLC->wchBanner;
|
||||
{
|
||||
bool bPresent = app.IsFileInMemoryTextures(cString);
|
||||
|
||||
@@ -613,7 +631,7 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
for (auto it = m_TMSPPDownloadQueue.begin();
|
||||
it != m_TMSPPDownloadQueue.end(); ++it) {
|
||||
TMSPPRequest* pCurrent = *it;
|
||||
if (strcmp(pDLC->wchBanner,
|
||||
if (wcscmp(pDLC->wchBanner,
|
||||
pCurrent->wchFilename) == 0) {
|
||||
bAlreadyInQueue = true;
|
||||
break;
|
||||
@@ -627,17 +645,17 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
&DLCController::tmsPPFileReturned;
|
||||
pTMSPPreq->lpCallbackParam = this;
|
||||
pTMSPPreq->eStorageFacility =
|
||||
IPlatformStorage::eGlobalStorage_Title;
|
||||
C4JStorage::eGlobalStorage_Title;
|
||||
pTMSPPreq->eFileTypeVal =
|
||||
IPlatformStorage::TMS_FILETYPE_BINARY;
|
||||
C4JStorage::TMS_FILETYPE_BINARY;
|
||||
memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner,
|
||||
sizeof(char) * MAX_BANNERNAME_SIZE);
|
||||
sizeof(wchar_t) * MAX_BANNERNAME_SIZE);
|
||||
pTMSPPreq->eType = eType;
|
||||
pTMSPPreq->eState = e_TMS_ContentState_Queued;
|
||||
m_bAllTMSContentRetrieved = false;
|
||||
m_TMSPPDownloadQueue.push_back(pTMSPPreq);
|
||||
app.DebugPrintf(
|
||||
"===m_TMSPPDownloadQueue Adding %s, q size is "
|
||||
"===m_TMSPPDownloadQueue Adding %ls, q size is "
|
||||
"%d\n",
|
||||
pTMSPPreq->wchFilename,
|
||||
m_TMSPPDownloadQueue.size());
|
||||
@@ -651,9 +669,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,
|
||||
C4JStorage::PTMSPP_FILEDATA pFileData,
|
||||
const char* szFilename) {
|
||||
DLCController* pClass = (DLCController*)pParam;
|
||||
|
||||
{
|
||||
@@ -663,7 +681,7 @@ int DLCController::tmsPPFileReturned(
|
||||
TMSPPRequest* pCurrent = *it;
|
||||
#if defined(_WINDOWS64)
|
||||
char szFile[MAX_TMSFILENAME_SIZE];
|
||||
strncpy(szFile, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE);
|
||||
wcstombs(szFile, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE);
|
||||
|
||||
if (strcmp(szFilename, szFile) == 0)
|
||||
#endif
|
||||
@@ -673,7 +691,7 @@ int DLCController::tmsPPFileReturned(
|
||||
if (pFileData != nullptr) {
|
||||
switch (pCurrent->eType) {
|
||||
case e_DLC_TexturePackData: {
|
||||
app.DebugPrintf("--- Got texturepack data %s\n",
|
||||
app.DebugPrintf("--- Got texturepack data %ls\n",
|
||||
pCurrent->wchFilename);
|
||||
int iConfig =
|
||||
app.GetTPConfigVal(pCurrent->wchFilename);
|
||||
@@ -681,7 +699,7 @@ int DLCController::tmsPPFileReturned(
|
||||
pFileData->size);
|
||||
} break;
|
||||
default:
|
||||
app.DebugPrintf("--- Got image data - %s\n",
|
||||
app.DebugPrintf("--- Got image data - %ls\n",
|
||||
pCurrent->wchFilename);
|
||||
app.AddMemoryTextureFile(pCurrent->wchFilename,
|
||||
pFileData->pbData,
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#include "app/common/App_structs.h"
|
||||
#include "app/common/DLC/DLCManager.h"
|
||||
#include "platform/sdl2/Storage.h"
|
||||
#include "platform/XboxStubs.h"
|
||||
#include "platform/storage/storage.h"
|
||||
|
||||
struct SCreditTextItemDef;
|
||||
|
||||
@@ -32,13 +32,14 @@ public:
|
||||
void clearDLCInstalled() { m_bDLCInstallProcessCompleted = false; }
|
||||
|
||||
static int marketplaceCountsCallback(void* pParam,
|
||||
IPlatformStorage::DLC_TMS_DETAILS*,
|
||||
C4JStorage::DLC_TMS_DETAILS*,
|
||||
int iPad);
|
||||
|
||||
// DLC info registration
|
||||
static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*,
|
||||
unsigned int, int, char* pDataFile);
|
||||
bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin,
|
||||
static int32_t registerDLCData(wchar_t*, wchar_t*, int, uint64_t, uint64_t,
|
||||
wchar_t*, unsigned int, int,
|
||||
wchar_t* pDataFile);
|
||||
bool getDLCFullOfferIDForSkinID(const std::wstring& FirstSkin,
|
||||
uint64_t* pullVal);
|
||||
bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal);
|
||||
DLC_INFO* getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial);
|
||||
@@ -72,12 +73,12 @@ public:
|
||||
unsigned int addTMSPPFileTypeRequest(eDLCContentType eType,
|
||||
bool bPromote = false);
|
||||
static int tmsPPFileReturned(void* pParam, int iPad, int iUserData,
|
||||
IPlatformStorage::PTMSPP_FILEDATA pFileData,
|
||||
C4JStorage::PTMSPP_FILEDATA pFileData,
|
||||
const char* szFilename);
|
||||
|
||||
// Credit text
|
||||
void addCreditText(const char* lpStr);
|
||||
bool alreadySeenCreditText(const std::string& wstemp);
|
||||
void addCreditText(const wchar_t* lpStr);
|
||||
bool alreadySeenCreditText(const std::wstring& wstemp);
|
||||
unsigned int getDLCCreditsCount();
|
||||
SCreditTextItemDef* getDLCCredits(int iIndex);
|
||||
|
||||
@@ -99,7 +100,7 @@ public:
|
||||
void setTickTMSDLCFiles(bool bVal) { m_bTickTMSDLCFiles = bVal; }
|
||||
|
||||
// Public data needed by other parts
|
||||
std::vector<std::string> m_vCreditText;
|
||||
std::vector<std::wstring> m_vCreditText;
|
||||
std::uint8_t* m_pDLCFileBuffer;
|
||||
unsigned int m_dwDLCFileSize;
|
||||
|
||||
@@ -112,7 +113,7 @@ public:
|
||||
static std::unordered_map<int, uint64_t> DLCTextures_PackID;
|
||||
static std::unordered_map<uint64_t, DLC_INFO*> DLCInfo_Trial;
|
||||
static std::unordered_map<uint64_t, DLC_INFO*> DLCInfo_Full;
|
||||
static std::unordered_map<std::string, uint64_t> DLCInfo_SkinName;
|
||||
static std::unordered_map<std::wstring, uint64_t> DLCInfo_SkinName;
|
||||
static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX];
|
||||
|
||||
private:
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "minecraft/Console_Debug_enum.h"
|
||||
#include "app/common/Console_Debug_enum.h"
|
||||
|
||||
class DebugOptions {
|
||||
public:
|
||||
|
||||
@@ -1,5 +1,60 @@
|
||||
#include "minecraft/GameHostOptions.h"
|
||||
#include "app/common/Game.h"
|
||||
|
||||
#include "platform/PlatformTypes.h"
|
||||
#include "platform/InputActions.h"
|
||||
#include "platform/sdl2/Profile.h"
|
||||
#include "platform/sdl2/Render.h"
|
||||
#include "platform/sdl2/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 "platform/PlatformServices.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 +74,31 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "app/common/App_structs.h"
|
||||
#include "platform/sdl2/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"
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
#include <tracy/Tracy.hpp>
|
||||
#else
|
||||
#define ZoneScoped
|
||||
#define ZoneScopedN(name)
|
||||
#endif
|
||||
|
||||
class BeaconTileEntity;
|
||||
class BrewingStandTileEntity;
|
||||
@@ -106,6 +121,7 @@ const float Game::fSafeZoneX = 64.0f; // 5% of 1280
|
||||
const float Game::fSafeZoneY = 36.0f; // 5% of 720
|
||||
|
||||
Game::Game() {
|
||||
ZoneScopedN("Game::Game");
|
||||
if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) {
|
||||
DebugPrintf(
|
||||
"WARNING: The size of the profile GAME_SETTINGS struct has "
|
||||
@@ -113,7 +129,7 @@ Game::Game() {
|
||||
"%d\n",
|
||||
sizeof(GAME_SETTINGS), GAME_SETTINGS_PROFILE_DATA_BYTES);
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
assert(0);
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -144,17 +160,19 @@ Game::Game() {
|
||||
}
|
||||
|
||||
void Game::DebugPrintf(const char* szFormat, ...) {
|
||||
ZoneScopedN("Game::DebugPrintf");
|
||||
#if !defined(_FINAL_BUILD)
|
||||
char buf[1024];
|
||||
va_list ap;
|
||||
va_start(ap, szFormat);
|
||||
vsnprintf(buf, sizeof(buf), szFormat, ap);
|
||||
va_end(ap);
|
||||
fputs(buf, stderr);
|
||||
OutputDebugStringA(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Game::DebugPrintf(int user, const char* szFormat, ...) {
|
||||
ZoneScopedN("Game::DebugPrintf");
|
||||
#if !defined(_FINAL_BUILD)
|
||||
if (user == USER_NONE) return;
|
||||
char buf[1024];
|
||||
@@ -162,16 +180,17 @@ void Game::DebugPrintf(int user, const char* szFormat, ...) {
|
||||
va_start(ap, szFormat);
|
||||
vsnprintf(buf, sizeof(buf), szFormat, ap);
|
||||
va_end(ap);
|
||||
fputs(buf, stderr);
|
||||
OutputDebugStringA(buf);
|
||||
if (user == USER_UI) {
|
||||
ui.logDebugString(buf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* Game::GetString(int iID) {
|
||||
// return "Değişiklikler ve Yenilikler";
|
||||
// return "ÕÕÕÕÖÖÖÖ";
|
||||
const wchar_t* Game::GetString(int iID) {
|
||||
ZoneScopedN("Game::GetString");
|
||||
// return L"Değişiklikler ve Yenilikler";
|
||||
// return L"ÕÕÕÕÖÖÖÖ";
|
||||
return app.m_localizationManager.getString(iID);
|
||||
}
|
||||
|
||||
@@ -184,14 +203,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,17 +235,23 @@ 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) {
|
||||
void* pParam, int iPad, const C4JStorage::EMessageResult result) {
|
||||
Game* pApp = (Game*)pParam;
|
||||
|
||||
if (result == IPlatformStorage::EMessage_ResultAccept) {
|
||||
if (result == C4JStorage::EMessage_ResultAccept) {
|
||||
} else {
|
||||
if (iPad == PlatformProfile.GetPrimaryPad()) {
|
||||
if (iPad == ProfileManager.GetPrimaryPad()) {
|
||||
pApp->SetAction(iPad, eAppAction_ExitWorld);
|
||||
} else {
|
||||
pApp->SetAction(iPad, eAppAction_ExitPlayer);
|
||||
@@ -222,12 +264,12 @@ int Game::BannedLevelDialogReturned(
|
||||
#if defined(_DEBUG_MENUS_ENABLED)
|
||||
bool Game::DebugArtToolsOn() {
|
||||
return m_debugOptions.debugArtToolsOn(
|
||||
GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()));
|
||||
GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()));
|
||||
}
|
||||
#endif
|
||||
|
||||
void Game::SetDebugSequence(const char* pchSeq) {
|
||||
PlatformInput.SetDebugSequence(pchSeq, [this]() -> int {
|
||||
InputManager.SetDebugSequence(pchSeq, [this]() -> int {
|
||||
// printf("sequence matched\n");
|
||||
m_debugOptions.setDebugOptions(!m_debugOptions.settingsOn());
|
||||
|
||||
@@ -256,10 +298,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
|
||||
|
||||
@@ -270,7 +319,7 @@ int Game::GetLocalPlayerCount(void) {
|
||||
// // we only attempt to install the cape once per launch of the
|
||||
// game m_bDefaultCapeInstallAttempted=true;
|
||||
//
|
||||
// std::string wTemp="Default_Cape.png";
|
||||
// std::wstring wTemp=L"Default_Cape.png";
|
||||
// bool bRes=app.IsFileInMemoryTextures(wTemp);
|
||||
// // if the file is not already in the memory textures, then read
|
||||
// it from TMS if(!bRes)
|
||||
@@ -279,10 +328,10 @@ int Game::GetLocalPlayerCount(void) {
|
||||
// std::uint32_t dwSize=0;
|
||||
// // 4J-PB - out for now for DaveK so he doesn't get the
|
||||
// birthday cape #ifdef _CONTENT_PACKAGE
|
||||
// IPlatformStorage::ETMSStatus eTMSStatus;
|
||||
// eTMSStatus=PlatformStorage.ReadTMSFile(PlatformProfile.GetPrimaryPad(),IPlatformStorage::eGlobalStorage_Title,IPlatformStorage::eTMS_FileType_Graphic,
|
||||
// "Default_Cape.png",&pBuffer, &dwSize);
|
||||
// if(eTMSStatus==IPlatformStorage::ETMSStatus_Idle)
|
||||
// C4JStorage::ETMSStatus eTMSStatus;
|
||||
// eTMSStatus=StorageManager.ReadTMSFile(ProfileManager.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,
|
||||
// L"Default_Cape.png",&pBuffer, &dwSize);
|
||||
// if(eTMSStatus==C4JStorage::ETMSStatus_Idle)
|
||||
// {
|
||||
// app.AddMemoryTextureFile(wTemp,pBuffer,dwSize);
|
||||
// }
|
||||
@@ -291,8 +340,9 @@ int Game::GetLocalPlayerCount(void) {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// int Game::DLCReadCallback(void*
|
||||
// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData)
|
||||
// pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData)
|
||||
// {
|
||||
//
|
||||
//
|
||||
@@ -329,9 +379,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 +393,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,43 +412,67 @@ 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) {
|
||||
ZoneScopedN("Game::processSchematics");
|
||||
m_gameRules.processSchematics(levelChunk);
|
||||
}
|
||||
|
||||
void Game::processSchematicsLighting(LevelChunk* levelChunk) {
|
||||
ZoneScopedN("Game::processSchematicsLighting");
|
||||
m_gameRules.processSchematicsLighting(levelChunk);
|
||||
}
|
||||
|
||||
void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); }
|
||||
void Game::loadDefaultGameRules() {
|
||||
ZoneScopedN("Game::loadDefaultGameRules");
|
||||
m_gameRules.loadDefaultGameRules();
|
||||
}
|
||||
|
||||
void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
|
||||
void Game::setLevelGenerationOptions(
|
||||
LevelGenerationOptions* levelGen) {
|
||||
ZoneScopedN("Game::setLevelGenerationOptions");
|
||||
m_gameRules.setLevelGenerationOptions(levelGen);
|
||||
}
|
||||
|
||||
const char* Game::GetGameRulesString(const std::string& key) {
|
||||
const wchar_t* Game::GetGameRulesString(const std::wstring& key) {
|
||||
ZoneScopedN("Game::GetGameRulesString");
|
||||
return m_gameRules.GetGameRulesString(key);
|
||||
}
|
||||
|
||||
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to
|
||||
// MenuController
|
||||
|
||||
std::string Game::getEntityName(eINSTANCEOF type) {
|
||||
|
||||
// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::wstring Game::getEntityName(eINSTANCEOF type) {
|
||||
ZoneScopedN("Game::getEntityName");
|
||||
switch (type) {
|
||||
case eTYPE_WOLF:
|
||||
return app.GetString(IDS_WOLF);
|
||||
@@ -445,23 +521,27 @@ std::string Game::getEntityName(eINSTANCEOF type) {
|
||||
break;
|
||||
};
|
||||
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
|
||||
// m_dwContentTypeA moved to DLCController
|
||||
|
||||
int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin,
|
||||
char* pCape) {
|
||||
|
||||
|
||||
|
||||
|
||||
int32_t Game::RegisterMojangData(wchar_t* pXuidName, PlayerUID xuid,
|
||||
wchar_t* pSkin, wchar_t* pCape) {
|
||||
int32_t hr = 0;
|
||||
eXUID eTempXuid = eXUID_Undefined;
|
||||
MOJANG_DATA* pMojangData = nullptr;
|
||||
|
||||
// ignore the names if we don't recognize them
|
||||
if (pXuidName != nullptr) {
|
||||
if (strcmp(pXuidName, "XUID_NOTCH") == 0) {
|
||||
if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) {
|
||||
eTempXuid =
|
||||
eXUID_Notch; // might be needed for the apple at some point
|
||||
} else if (strcmp(pXuidName, "XUID_DEADMAU5") == 0) {
|
||||
} else if (wcscmp(pXuidName, L"XUID_DEADMAU5") == 0) {
|
||||
eTempXuid = eXUID_Deadmau5; // Needed for the deadmau5 ears
|
||||
} else {
|
||||
eTempXuid = eXUID_NoName;
|
||||
@@ -473,8 +553,8 @@ int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin,
|
||||
memset(pMojangData, 0, sizeof(MOJANG_DATA));
|
||||
pMojangData->eXuid = eTempXuid;
|
||||
|
||||
strncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE);
|
||||
strncpy(pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE);
|
||||
wcsncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE);
|
||||
wcsncpy(pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE);
|
||||
DLCController::MojangData[xuid] = pMojangData;
|
||||
}
|
||||
|
||||
@@ -485,13 +565,13 @@ MOJANG_DATA* Game::GetMojangDataForXuid(PlayerUID xuid) {
|
||||
return DLCController::MojangData[xuid];
|
||||
}
|
||||
|
||||
int32_t Game::RegisterConfigValues(char* pType, int iValue) {
|
||||
int32_t Game::RegisterConfigValues(wchar_t* pType, int iValue) {
|
||||
int32_t hr = 0;
|
||||
|
||||
// #ifdef 0
|
||||
// if(pType!=nullptr)
|
||||
// {
|
||||
// if(strcmp(pType,"XboxOneTransfer")==0)
|
||||
// if(wcscmp(pType,L"XboxOneTransfer")==0)
|
||||
// {
|
||||
// if(iValue>0)
|
||||
// {
|
||||
@@ -502,7 +582,7 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) {
|
||||
// app.m_bTransferSavesToXboxOne=false;
|
||||
// }
|
||||
// }
|
||||
// else if(strcmp(pType,"TransferSlotCount")==0)
|
||||
// else if(wcscmp(pType,L"TransferSlotCount")==0)
|
||||
// {
|
||||
// app.m_uiTransferSlotC=iValue;
|
||||
// }
|
||||
@@ -513,50 +593,80 @@ 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);
|
||||
ZoneScopedN("Game::SetAutosaveTimerTime");
|
||||
int settingValue = GetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_Autosave);
|
||||
m_saveManager.setAutosaveTimerTime(settingValue);
|
||||
}
|
||||
|
||||
void Game::SetTrialTimerStart(void) {
|
||||
ZoneScopedN("Game::SetTrialTimerStart");
|
||||
m_fTrialTimerStart = m_Time.fAppTime;
|
||||
mfTrialPausedTime = 0.0f;
|
||||
}
|
||||
|
||||
float Game::getTrialTimer(void) {
|
||||
ZoneScopedN("Game::getTrialTimer");
|
||||
return m_Time.fAppTime - m_fTrialTimerStart - mfTrialPausedTime;
|
||||
}
|
||||
|
||||
bool Game::IsLocalMultiplayerAvailable() {
|
||||
ZoneScopedN("Game::IsLocalMultiplayerAvailable");
|
||||
unsigned int connectedControllers = 0;
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))
|
||||
if (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i))
|
||||
++connectedControllers;
|
||||
}
|
||||
|
||||
bool available = PlatformRenderer.IsHiDef() && connectedControllers > 1;
|
||||
bool available = RenderManager.IsHiDef() && connectedControllers > 1;
|
||||
|
||||
return available;
|
||||
|
||||
// Found this in GameNetworkManager?
|
||||
// #ifdef 0
|
||||
// iOtherConnectedControllers =
|
||||
// PlatformInput.GetConnectedGamepadCount();
|
||||
// if((PlatformInput.IsPadConnected(userIndex) ||
|
||||
// PlatformProfile.IsSignedIn(userIndex)))
|
||||
// InputManager.GetConnectedGamepadCount();
|
||||
// if((InputManager.IsPadConnected(userIndex) ||
|
||||
// ProfileManager.IsSignedIn(userIndex)))
|
||||
// {
|
||||
// --iOtherConnectedControllers;
|
||||
// }
|
||||
// #else
|
||||
// for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
// {
|
||||
// if( (i!=userIndex) && (PlatformInput.IsPadConnected(i)
|
||||
//||
|
||||
// PlatformProfile.IsSignedIn(i)) )
|
||||
// if( (i!=userIndex) && (InputManager.IsPadConnected(i) ||
|
||||
// ProfileManager.IsSignedIn(i)) )
|
||||
// {
|
||||
// iOtherConnectedControllers++;
|
||||
// }
|
||||
@@ -568,9 +678,12 @@ 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 path =
|
||||
std::wstring Game::getFilePath(std::uint32_t packId,
|
||||
std::wstring filename,
|
||||
bool bAddDataFolder,
|
||||
std::wstring mountPoint) {
|
||||
ZoneScopedN("Game::getFilePath");
|
||||
std::wstring path =
|
||||
getRootPath(packId, true, bAddDataFolder, mountPoint) + filename;
|
||||
File f(path);
|
||||
if (f.exists()) {
|
||||
@@ -596,18 +709,20 @@ enum ETitleUpdateTexturePacks {
|
||||
};
|
||||
|
||||
#if defined(_WINDOWS64)
|
||||
std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\";
|
||||
std::wstring titleUpdateTexturePackRoot = L"Windows64\\DLC\\";
|
||||
#else
|
||||
std::string titleUpdateTexturePackRoot = "CU\\DLC\\";
|
||||
std::wstring titleUpdateTexturePackRoot = L"CU\\DLC\\";
|
||||
#endif
|
||||
|
||||
std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
|
||||
bool bAddDataFolder, std::string mountPoint) {
|
||||
std::string path = mountPoint;
|
||||
std::wstring Game::getRootPath(std::uint32_t packId,
|
||||
bool allowOverride, bool bAddDataFolder,
|
||||
std::wstring mountPoint) {
|
||||
ZoneScopedN("Game::getRootPath");
|
||||
std::wstring path = mountPoint;
|
||||
if (allowOverride) {
|
||||
switch (packId) {
|
||||
case eTUTP_Halloween:
|
||||
path = titleUpdateTexturePackRoot + "Halloween Texture Pack";
|
||||
path = titleUpdateTexturePackRoot + L"Halloween Texture Pack";
|
||||
break;
|
||||
};
|
||||
File folder(path);
|
||||
@@ -617,10 +732,8 @@ std::string Game::getRootPath(std::uint32_t packId, bool allowOverride,
|
||||
}
|
||||
|
||||
if (bAddDataFolder) {
|
||||
return path + "\\Data\\";
|
||||
return path + L"\\Data\\";
|
||||
} else {
|
||||
return path + "\\";
|
||||
return path + L"\\";
|
||||
}
|
||||
}
|
||||
|
||||
Game app;
|
||||
|
||||
@@ -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/sdl2/Profile.h"
|
||||
#include "platform/sdl2/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();
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
typedef std::vector<PNOTIFICATION> VNOTIFICATIONS;
|
||||
|
||||
// storing skin files - delegated to SkinManager
|
||||
std::vector<std::string>& vSkinNames = m_skinManager.vSkinNames;
|
||||
std::vector<std::wstring>& vSkinNames = m_skinManager.vSkinNames;
|
||||
DLCManager m_dlcManager;
|
||||
SaveManager m_saveManager;
|
||||
BannedListManager m_bannedListManager;
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
MenuController m_menuController;
|
||||
|
||||
// storing credits text from the DLC - delegated to DLCController
|
||||
std::vector<std::string>& m_vCreditText = m_dlcController.m_vCreditText;
|
||||
std::vector<std::wstring>& m_vCreditText = m_dlcController.m_vCreditText;
|
||||
|
||||
// In builds prior to TU5, the size of the GAME_SETTINGS struct was 204
|
||||
// bytes. We added a few new values to the internal struct in TU5, and even
|
||||
@@ -145,8 +145,7 @@ public:
|
||||
|
||||
bool IsAppPaused();
|
||||
void SetAppPaused(bool val);
|
||||
int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg,
|
||||
int iPad) {
|
||||
int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad) {
|
||||
return m_gameSettingsManager.displaySavingMessage(eMsg, iPad);
|
||||
}
|
||||
bool GetGameStarted() { return m_bGameStarted; }
|
||||
@@ -169,9 +168,8 @@ public:
|
||||
}
|
||||
bool LoadEnchantingMenu(int iPad, std::shared_ptr<Inventory> inventory,
|
||||
int x, int y, int z, Level* level,
|
||||
const std::string& name) {
|
||||
return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z,
|
||||
level, name);
|
||||
const std::wstring& 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);
|
||||
const std::wstring& 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) {
|
||||
@@ -247,32 +241,39 @@ public:
|
||||
m_gameSettingsManager.setSpecialTutorialCompletionFlag(iPad, index);
|
||||
}
|
||||
|
||||
static const char* GetString(int iID);
|
||||
StringTable* getStringTable() const {
|
||||
return m_localizationManager.getStringTable();
|
||||
}
|
||||
static const wchar_t* GetString(int iID);
|
||||
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,
|
||||
C_4JProfile::PROFILESETTINGS* pSettings,
|
||||
const int iPad) {
|
||||
return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad);
|
||||
}
|
||||
int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings,
|
||||
int SetDefaultOptions(C_4JProfile::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);
|
||||
@@ -369,21 +363,20 @@ public:
|
||||
unsigned char GetGameSettings(eGameSetting eVal) {
|
||||
return m_gameSettingsManager.getGameSettings(eVal);
|
||||
}
|
||||
void SetPlayerSkin(int iPad, const std::string& name) {
|
||||
void SetPlayerSkin(int iPad, const std::wstring& name) {
|
||||
m_skinManager.setPlayerSkin(iPad, name, GameSettingsA);
|
||||
}
|
||||
void SetPlayerSkin(int iPad, std::uint32_t dwSkinId) {
|
||||
m_skinManager.setPlayerSkin(iPad, dwSkinId, GameSettingsA);
|
||||
}
|
||||
void SetPlayerCape(int iPad, const std::string& name) {
|
||||
void SetPlayerCape(int iPad, const std::wstring& name) {
|
||||
m_skinManager.setPlayerCape(iPad, name, GameSettingsA);
|
||||
}
|
||||
void SetPlayerCape(int iPad, std::uint32_t dwCapeId) {
|
||||
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,16 +427,18 @@ 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) {
|
||||
std::wstring GetPlayerSkinName(int iPad) {
|
||||
return m_skinManager.getPlayerSkinName(iPad, GameSettingsA);
|
||||
}
|
||||
std::uint32_t GetPlayerSkinId(int iPad) {
|
||||
return m_skinManager.getPlayerSkinId(iPad, GameSettingsA, m_dlcManager);
|
||||
}
|
||||
std::string GetPlayerCapeName(int iPad) {
|
||||
std::wstring GetPlayerCapeName(int iPad) {
|
||||
return m_skinManager.getPlayerCapeName(iPad, GameSettingsA);
|
||||
}
|
||||
std::uint32_t GetPlayerCapeId(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 C4JStorage::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 C4JStorage::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 );
|
||||
// C4JStorage::eGlobalStorage eStorageFacility, std::wstring *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,16 +536,15 @@ 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,
|
||||
C4JStorage::DLC_TMS_DETAILS* details,
|
||||
int iPad) {
|
||||
return DLCController::marketplaceCountsCallback(pParam, details, iPad);
|
||||
}
|
||||
|
||||
bool AlreadySeenCreditText(const std::string& wstemp) {
|
||||
bool AlreadySeenCreditText(const std::wstring& wstemp) {
|
||||
return m_dlcController.alreadySeenCreditText(wstemp);
|
||||
}
|
||||
|
||||
@@ -577,21 +558,23 @@ 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,
|
||||
void AddMemoryTextureFile(const std::wstring& wName, std::uint8_t* pbData,
|
||||
unsigned int byteCount) {
|
||||
m_skinManager.addMemoryTextureFile(wName, pbData, byteCount);
|
||||
}
|
||||
void RemoveMemoryTextureFile(const std::string& wName) {
|
||||
void RemoveMemoryTextureFile(const std::wstring& wName) {
|
||||
m_skinManager.removeMemoryTextureFile(wName);
|
||||
}
|
||||
void GetMemFileDetails(const std::string& wName, std::uint8_t** ppbData,
|
||||
void GetMemFileDetails(const std::wstring& wName, std::uint8_t** ppbData,
|
||||
unsigned int* pByteCount) {
|
||||
m_skinManager.getMemFileDetails(wName, ppbData, pByteCount);
|
||||
}
|
||||
bool IsFileInMemoryTextures(const std::string& wName) {
|
||||
bool IsFileInMemoryTextures(const std::wstring& wName) {
|
||||
return m_skinManager.isFileInMemoryTextures(wName);
|
||||
}
|
||||
|
||||
@@ -610,11 +593,13 @@ public:
|
||||
m_archiveManager.getTPD(iConfig, ppbData, pByteCount);
|
||||
}
|
||||
int GetTPDSize() { return m_archiveManager.getTPDSize(); }
|
||||
int GetTPConfigVal(char* pwchDataFile) {
|
||||
int GetTPConfigVal(wchar_t* pwchDataFile) {
|
||||
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 wchar_t* lpStr) { m_dlcController.addCreditText(lpStr); }
|
||||
|
||||
private:
|
||||
std::unordered_map<PlayerUID, std::uint8_t*> m_GTS_Files;
|
||||
@@ -672,34 +654,32 @@ 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:
|
||||
int getArchiveFileSize(const std::string& filename) {
|
||||
int getArchiveFileSize(const std::wstring& filename) {
|
||||
return m_archiveManager.getArchiveFileSize(filename);
|
||||
}
|
||||
bool hasArchiveFile(const std::string& filename) {
|
||||
bool hasArchiveFile(const std::wstring& filename) {
|
||||
return m_archiveManager.hasArchiveFile(filename);
|
||||
}
|
||||
std::vector<uint8_t> getArchiveFile(const std::string& filename) {
|
||||
std::vector<uint8_t> getArchiveFile(const std::wstring& filename) {
|
||||
return m_archiveManager.getArchiveFile(filename);
|
||||
}
|
||||
|
||||
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 C4JStorage::EMessageResult);
|
||||
static int TexturePackDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::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,47 +728,44 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static int UnlockFullExitReturned(void* pParam, int iPad,
|
||||
IPlatformStorage::EMessageResult result) {
|
||||
C4JStorage::EMessageResult result) {
|
||||
return MenuController::unlockFullExitReturned(pParam, iPad, result);
|
||||
}
|
||||
static int UnlockFullSaveReturned(void* pParam, int iPad,
|
||||
IPlatformStorage::EMessageResult result) {
|
||||
C4JStorage::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,
|
||||
C4JStorage::EMessageResult result) {
|
||||
return MenuController::unlockFullInviteReturned(pParam, iPad, result);
|
||||
}
|
||||
static int TrialOverReturned(void* pParam, int iPad,
|
||||
IPlatformStorage::EMessageResult result) {
|
||||
C4JStorage::EMessageResult result) {
|
||||
return MenuController::trialOverReturned(pParam, iPad, result);
|
||||
}
|
||||
static int ExitAndJoinFromInvite(void* pParam, int iPad,
|
||||
IPlatformStorage::EMessageResult result) {
|
||||
C4JStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInvite(pParam, iPad, result);
|
||||
}
|
||||
static int ExitAndJoinFromInviteSaveDialogReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(
|
||||
pParam, iPad, result);
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result);
|
||||
}
|
||||
static int ExitAndJoinFromInviteAndSaveReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteAndSaveReturned(
|
||||
pParam, iPad, result);
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result);
|
||||
}
|
||||
static int ExitAndJoinFromInviteDeclineSaveReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(
|
||||
pParam, iPad, result);
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result);
|
||||
}
|
||||
static int FatalErrorDialogReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result);
|
||||
static int FatalErrorDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int WarningTrialTexturePackReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
|
||||
return NetworkController::warningTrialTexturePackReturned(pParam, iPad,
|
||||
result);
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result);
|
||||
}
|
||||
|
||||
JoinFromInviteData& m_InviteData = m_networkController.m_InviteData;
|
||||
@@ -817,17 +793,17 @@ public:
|
||||
int GetHTMLFontSize(EHTMLFontSize size) {
|
||||
return m_localizationManager.getHTMLFontSize(size);
|
||||
}
|
||||
std::string FormatHTMLString(int iPad, const std::string& desc,
|
||||
int shadowColour = 0xFFFFFFFF) {
|
||||
std::wstring FormatHTMLString(int iPad, const std::wstring& desc,
|
||||
int shadowColour = 0xFFFFFFFF) {
|
||||
return m_localizationManager.formatHTMLString(iPad, desc, shadowColour);
|
||||
}
|
||||
std::string GetActionReplacement(int iPad, unsigned char ucAction) {
|
||||
std::wstring GetActionReplacement(int iPad, unsigned char ucAction) {
|
||||
return m_localizationManager.getActionReplacement(iPad, ucAction);
|
||||
}
|
||||
std::string GetVKReplacement(unsigned int uiVKey) {
|
||||
std::wstring GetVKReplacement(unsigned int uiVKey) {
|
||||
return m_localizationManager.getVKReplacement(uiVKey);
|
||||
}
|
||||
std::string GetIconReplacement(unsigned int uiIcon) {
|
||||
std::wstring GetIconReplacement(unsigned int uiIcon) {
|
||||
return m_localizationManager.getIconReplacement(uiIcon);
|
||||
}
|
||||
|
||||
@@ -841,9 +817,8 @@ public:
|
||||
MenuController::exitGameFromRemoteSave(lpParameter);
|
||||
}
|
||||
static int ExitGameFromRemoteSaveDialogReturned(
|
||||
void* pParam, int iPad, IPlatformStorage::EMessageResult result) {
|
||||
return MenuController::exitGameFromRemoteSaveDialogReturned(
|
||||
pParam, iPad, result);
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result);
|
||||
}
|
||||
|
||||
// XML
|
||||
@@ -861,17 +836,16 @@ public:
|
||||
return m_terrainFeatureManager.getPosition(eType, pX, pZ);
|
||||
}
|
||||
|
||||
static int32_t RegisterMojangData(char*, PlayerUID, char*, char*);
|
||||
static int32_t RegisterMojangData(wchar_t*, PlayerUID, wchar_t*, wchar_t*);
|
||||
MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid);
|
||||
static int32_t RegisterConfigValues(char* pType, int iValue);
|
||||
static int32_t RegisterConfigValues(wchar_t* 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,
|
||||
char* pDataFile) {
|
||||
return DLCController::registerDLCData(a, b, c, d, e, f, g, h,
|
||||
pDataFile);
|
||||
static int32_t RegisterDLCData(wchar_t* a, wchar_t* b, int c, uint64_t d, uint64_t e,
|
||||
wchar_t* f, unsigned int g, int h,
|
||||
wchar_t* pDataFile) {
|
||||
return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile);
|
||||
}
|
||||
bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin,
|
||||
bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin,
|
||||
uint64_t* pullVal) {
|
||||
return m_dlcController.getDLCFullOfferIDForSkinID(FirstSkin, 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
|
||||
@@ -995,7 +971,7 @@ public:
|
||||
LevelGenerationOptions* getLevelGenerationOptions() {
|
||||
return m_gameRules.getLevelGenerationOptions();
|
||||
}
|
||||
const char* GetGameRulesString(const std::string& key);
|
||||
const wchar_t* GetGameRulesString(const std::wstring& key);
|
||||
|
||||
// m_playerColours and m_playerGamePrivileges moved to NetworkController
|
||||
|
||||
@@ -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);
|
||||
@@ -1013,15 +988,13 @@ public:
|
||||
return m_networkController.getPlayerPrivileges(networkSmallId);
|
||||
}
|
||||
|
||||
std::string getEntityName(eINSTANCEOF type);
|
||||
std::wstring getEntityName(eINSTANCEOF type);
|
||||
|
||||
unsigned int AddDLCRequest(eDLCMarketplaceType eContentType,
|
||||
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,
|
||||
C4JStorage::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,20 +1046,18 @@ 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;
|
||||
std::uint8_t*& m_pDLCFileBuffer = m_dlcController.m_pDLCFileBuffer;
|
||||
|
||||
// static int CallbackReadXuidsFileFromTMS(void* lpParam, char
|
||||
// static int CallbackReadXuidsFileFromTMS(void* lpParam, wchar_t
|
||||
// *wchFilename, int iPad, bool bResult, int iAction); static int
|
||||
// CallbackDLCFileFromTMS(void* lpParam, char *wchFilename, int iPad,
|
||||
// CallbackDLCFileFromTMS(void* lpParam, wchar_t *wchFilename, int iPad,
|
||||
// bool bResult, int iAction); static int
|
||||
// CallbackBannedListFileFromTMS(void* lpParam, char *wchFilename, int
|
||||
// CallbackBannedListFileFromTMS(void* lpParam, wchar_t *wchFilename, int
|
||||
// iPad, bool bResult, int iAction);
|
||||
|
||||
// Storing additional model parts per skin texture
|
||||
@@ -1131,13 +1083,21 @@ public:
|
||||
return m_skinManager.getAnimOverrideBitmask(dwSkinID);
|
||||
}
|
||||
|
||||
static std::uint32_t getSkinIdFromPath(const std::string& skin) {
|
||||
static std::uint32_t getSkinIdFromPath(const std::wstring& skin) {
|
||||
return SkinManager::getSkinIdFromPath(skin);
|
||||
}
|
||||
static std::string getSkinPathFromId(std::uint32_t skinId) {
|
||||
static std::wstring getSkinPathFromId(std::uint32_t skinId) {
|
||||
return SkinManager::getSkinPathFromId(skinId);
|
||||
}
|
||||
|
||||
int LoadLocalTMSFile(wchar_t* wchTMSFile) override = 0;
|
||||
int LoadLocalTMSFile(wchar_t* wchTMSFile,
|
||||
eFileExtensionType eExt) override = 0;
|
||||
void FreeLocalTMSFiles(eTMSFileType eType) override = 0;
|
||||
int GetLocalTMSFileIndex(wchar_t* wchTMSFile,
|
||||
bool bFilenameIncludesExtension,
|
||||
eFileExtensionType eEXT) override = 0;
|
||||
|
||||
virtual bool GetTMSGlobalFileListRead() { return true; }
|
||||
virtual bool GetTMSDLCInfoRead() { return true; }
|
||||
virtual bool GetTMSXUIDsFileRead() { return true; }
|
||||
@@ -1172,36 +1132,35 @@ private:
|
||||
|
||||
// 4J-PB - language and locale functions
|
||||
public:
|
||||
void LocaleAndLanguageInit() {
|
||||
m_localizationManager.localeAndLanguageInit();
|
||||
}
|
||||
void getLocale(std::vector<std::string>& vecWstrLocales) {
|
||||
void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); }
|
||||
void getLocale(std::vector<std::wstring>& vecWstrLocales) {
|
||||
m_localizationManager.getLocale(vecWstrLocales);
|
||||
}
|
||||
[[nodiscard]] std::vector<std::string> getLocale() {
|
||||
std::vector<std::string> v;
|
||||
m_localizationManager.getLocale(v);
|
||||
return v;
|
||||
}
|
||||
int get_eMCLang(char* pwchLocale) {
|
||||
int get_eMCLang(wchar_t* pwchLocale) {
|
||||
return m_localizationManager.get_eMCLang(pwchLocale);
|
||||
}
|
||||
int get_xcLang(char* pwchLocale) {
|
||||
int get_xcLang(wchar_t* pwchLocale) {
|
||||
return m_localizationManager.get_xcLang(pwchLocale);
|
||||
}
|
||||
|
||||
void SetTickTMSDLCFiles(bool bVal) {
|
||||
m_dlcController.setTickTMSDLCFiles(bVal);
|
||||
}
|
||||
void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); }
|
||||
|
||||
std::string getFilePath(std::uint32_t packId, std::string filename,
|
||||
bool bAddDataFolder,
|
||||
std::string mountPoint = "TPACK:");
|
||||
std::wstring getFilePath(std::uint32_t packId, std::wstring filename,
|
||||
bool bAddDataFolder,
|
||||
std::wstring mountPoint = L"TPACK:");
|
||||
|
||||
private:
|
||||
std::string getRootPath(std::uint32_t packId, bool allowOverride,
|
||||
bool bAddDataFolder, std::string mountPoint);
|
||||
std::wstring getRootPath(std::uint32_t packId, bool allowOverride,
|
||||
bool bAddDataFolder, std::wstring mountPoint);
|
||||
|
||||
public:
|
||||
#if defined(_WINDOWS64)
|
||||
// CMinecraftAudio audio;
|
||||
#else
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
extern Game app;
|
||||
|
||||
// singleton
|
||||
// extern CMinecraftApp app;
|
||||
@@ -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::wstring& 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::wstring& 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);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
int y, int z) override;
|
||||
bool openEnchanting(int iPad, std::shared_ptr<Inventory> inventory, int x,
|
||||
int y, int z, Level* level,
|
||||
const std::string& name) override;
|
||||
const std::wstring& name) override;
|
||||
bool openFurnace(int iPad, std::shared_ptr<Inventory> inventory,
|
||||
std::shared_ptr<FurnaceTileEntity> furnace) override;
|
||||
bool openBrewingStand(
|
||||
@@ -35,13 +35,14 @@ public:
|
||||
Level* level, int x, int y, int z) override;
|
||||
bool openTrading(int iPad, std::shared_ptr<Inventory> inventory,
|
||||
std::shared_ptr<Merchant> trader, Level* level,
|
||||
const std::string& name) override;
|
||||
const std::wstring& name) override;
|
||||
bool openCommandBlock(
|
||||
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,90 +12,90 @@
|
||||
#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[] = {
|
||||
"", // eGameRuleType_Root
|
||||
"MapOptions", // eGameRuleType_LevelGenerationOptions
|
||||
"ApplySchematic", // eGameRuleType_ApplySchematic
|
||||
"GenerateStructure", // eGameRuleType_GenerateStructure
|
||||
"GenerateBox", // eGameRuleType_GenerateBox
|
||||
"PlaceBlock", // eGameRuleType_PlaceBlock
|
||||
"PlaceContainer", // eGameRuleType_PlaceContainer
|
||||
"PlaceSpawner", // eGameRuleType_PlaceSpawner
|
||||
"BiomeOverride", // eGameRuleType_BiomeOverride
|
||||
"StartFeature", // eGameRuleType_StartFeature
|
||||
"AddItem", // eGameRuleType_AddItem
|
||||
"AddEnchantment", // eGameRuleType_AddEnchantment
|
||||
"LevelRules", // eGameRuleType_LevelRules
|
||||
"NamedArea", // eGameRuleType_NamedArea
|
||||
"UseTile", // eGameRuleType_UseTileRule
|
||||
"CollectItem", // eGameRuleType_CollectItemRule
|
||||
"CompleteAll", // eGameRuleType_CompleteAllRule
|
||||
"UpdatePlayer", // eGameRuleType_UpdatePlayerRule
|
||||
const wchar_t* GameRuleManager::wchTagNameA[] = {
|
||||
L"", // eGameRuleType_Root
|
||||
L"MapOptions", // eGameRuleType_LevelGenerationOptions
|
||||
L"ApplySchematic", // eGameRuleType_ApplySchematic
|
||||
L"GenerateStructure", // eGameRuleType_GenerateStructure
|
||||
L"GenerateBox", // eGameRuleType_GenerateBox
|
||||
L"PlaceBlock", // eGameRuleType_PlaceBlock
|
||||
L"PlaceContainer", // eGameRuleType_PlaceContainer
|
||||
L"PlaceSpawner", // eGameRuleType_PlaceSpawner
|
||||
L"BiomeOverride", // eGameRuleType_BiomeOverride
|
||||
L"StartFeature", // eGameRuleType_StartFeature
|
||||
L"AddItem", // eGameRuleType_AddItem
|
||||
L"AddEnchantment", // eGameRuleType_AddEnchantment
|
||||
L"LevelRules", // eGameRuleType_LevelRules
|
||||
L"NamedArea", // eGameRuleType_NamedArea
|
||||
L"UseTile", // eGameRuleType_UseTileRule
|
||||
L"CollectItem", // eGameRuleType_CollectItemRule
|
||||
L"CompleteAll", // eGameRuleType_CompleteAllRule
|
||||
L"UpdatePlayer", // eGameRuleType_UpdatePlayerRule
|
||||
};
|
||||
|
||||
const char* GameRuleManager::wchAttrNameA[] = {
|
||||
"descriptionName", // eGameRuleAttr_descriptionName
|
||||
"promptName", // eGameRuleAttr_promptName
|
||||
"dataTag", // eGameRuleAttr_dataTag
|
||||
"enchantmentId", // eGameRuleAttr_enchantmentId
|
||||
"enchantmentLevel", // eGameRuleAttr_enchantmentLevel
|
||||
"itemId", // eGameRuleAttr_itemId
|
||||
"quantity", // eGameRuleAttr_quantity
|
||||
"auxValue", // eGameRuleAttr_auxValue
|
||||
"slot", // eGameRuleAttr_slot
|
||||
"name", // eGameRuleAttr_name
|
||||
"food", // eGameRuleAttr_food
|
||||
"health", // eGameRuleAttr_health
|
||||
"tileId", // eGameRuleAttr_tileId
|
||||
"useCoords", // eGameRuleAttr_useCoords
|
||||
"seed", // eGameRuleAttr_seed
|
||||
"flatworld", // eGameRuleAttr_flatworld
|
||||
"filename", // eGameRuleAttr_filename
|
||||
"rot", // eGameRuleAttr_rot
|
||||
"data", // eGameRuleAttr_data
|
||||
"block", // eGameRuleAttr_block
|
||||
"entity", // eGameRuleAttr_entity
|
||||
"facing", // eGameRuleAttr_facing
|
||||
"edgeTile", // eGameRuleAttr_edgeTile
|
||||
"fillTile", // eGameRuleAttr_fillTile
|
||||
"skipAir", // eGameRuleAttr_skipAir
|
||||
"x", // eGameRuleAttr_x
|
||||
"x0", // eGameRuleAttr_x0
|
||||
"x1", // eGameRuleAttr_x1
|
||||
"y", // eGameRuleAttr_y
|
||||
"y0", // eGameRuleAttr_y0
|
||||
"y1", // eGameRuleAttr_y1
|
||||
"z", // eGameRuleAttr_z
|
||||
"z0", // eGameRuleAttr_z0
|
||||
"z1", // eGameRuleAttr_z1
|
||||
"chunkX", // eGameRuleAttr_chunkX
|
||||
"chunkZ", // eGameRuleAttr_chunkZ
|
||||
"yRot", // eGameRuleAttr_yRot
|
||||
"spawnX", // eGameRuleAttr_spawnX
|
||||
"spawnY", // eGameRuleAttr_spawnY
|
||||
"spawnZ", // eGameRuleAttr_spawnZ
|
||||
"orientation",
|
||||
"dimension",
|
||||
"topTileId", // eGameRuleAttr_topTileId
|
||||
"biomeId", // eGameRuleAttr_biomeId
|
||||
"feature", // eGameRuleAttr_feature
|
||||
const wchar_t* GameRuleManager::wchAttrNameA[] = {
|
||||
L"descriptionName", // eGameRuleAttr_descriptionName
|
||||
L"promptName", // eGameRuleAttr_promptName
|
||||
L"dataTag", // eGameRuleAttr_dataTag
|
||||
L"enchantmentId", // eGameRuleAttr_enchantmentId
|
||||
L"enchantmentLevel", // eGameRuleAttr_enchantmentLevel
|
||||
L"itemId", // eGameRuleAttr_itemId
|
||||
L"quantity", // eGameRuleAttr_quantity
|
||||
L"auxValue", // eGameRuleAttr_auxValue
|
||||
L"slot", // eGameRuleAttr_slot
|
||||
L"name", // eGameRuleAttr_name
|
||||
L"food", // eGameRuleAttr_food
|
||||
L"health", // eGameRuleAttr_health
|
||||
L"tileId", // eGameRuleAttr_tileId
|
||||
L"useCoords", // eGameRuleAttr_useCoords
|
||||
L"seed", // eGameRuleAttr_seed
|
||||
L"flatworld", // eGameRuleAttr_flatworld
|
||||
L"filename", // eGameRuleAttr_filename
|
||||
L"rot", // eGameRuleAttr_rot
|
||||
L"data", // eGameRuleAttr_data
|
||||
L"block", // eGameRuleAttr_block
|
||||
L"entity", // eGameRuleAttr_entity
|
||||
L"facing", // eGameRuleAttr_facing
|
||||
L"edgeTile", // eGameRuleAttr_edgeTile
|
||||
L"fillTile", // eGameRuleAttr_fillTile
|
||||
L"skipAir", // eGameRuleAttr_skipAir
|
||||
L"x", // eGameRuleAttr_x
|
||||
L"x0", // eGameRuleAttr_x0
|
||||
L"x1", // eGameRuleAttr_x1
|
||||
L"y", // eGameRuleAttr_y
|
||||
L"y0", // eGameRuleAttr_y0
|
||||
L"y1", // eGameRuleAttr_y1
|
||||
L"z", // eGameRuleAttr_z
|
||||
L"z0", // eGameRuleAttr_z0
|
||||
L"z1", // eGameRuleAttr_z1
|
||||
L"chunkX", // eGameRuleAttr_chunkX
|
||||
L"chunkZ", // eGameRuleAttr_chunkZ
|
||||
L"yRot", // eGameRuleAttr_yRot
|
||||
L"spawnX", // eGameRuleAttr_spawnX
|
||||
L"spawnY", // eGameRuleAttr_spawnY
|
||||
L"spawnZ", // eGameRuleAttr_spawnZ
|
||||
L"orientation",
|
||||
L"dimension",
|
||||
L"topTileId", // eGameRuleAttr_topTileId
|
||||
L"biomeId", // eGameRuleAttr_biomeId
|
||||
L"feature", // eGameRuleAttr_feature
|
||||
};
|
||||
|
||||
GameRuleManager::GameRuleManager() {
|
||||
@@ -107,10 +107,10 @@ void GameRuleManager::loadGameRules(DLCPack* pack) {
|
||||
StringTable* strings = nullptr;
|
||||
|
||||
if (pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,
|
||||
"languages.loc")) {
|
||||
L"languages.loc")) {
|
||||
DLCLocalisationFile* localisationFile =
|
||||
(DLCLocalisationFile*)pack->getFile(
|
||||
DLCManager::e_DLCType_LocalisationData, "languages.loc");
|
||||
DLCManager::e_DLCType_LocalisationData, L"languages.loc");
|
||||
strings = localisationFile->getStringTable();
|
||||
}
|
||||
|
||||
@@ -223,14 +223,15 @@ 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());
|
||||
dis2.read(bRuleFile);
|
||||
|
||||
// 4J-JEV: I don't believe that the path-name is ever used.
|
||||
// DLCGameRulesFile *dlcgr = new DLCGameRulesFile("__PLACEHOLDER__");
|
||||
// DLCGameRulesFile *dlcgr = new DLCGameRulesFile(L"__PLACEHOLDER__");
|
||||
// dlcgr->addData(bRuleFile.data(),bRuleFile.size());
|
||||
|
||||
if (readRuleFile(lgo, bRuleFile.data(), bRuleFile.size(), strings)) {
|
||||
@@ -357,11 +358,11 @@ void GameRuleManager::writeRuleFile(DataOutputStream* dos) {
|
||||
dos->writeUTF(wchAttrNameA[i]);
|
||||
|
||||
// Write schematic files.
|
||||
std::unordered_map<std::string, ConsoleSchematicFile*>* files;
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile*>* files;
|
||||
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
|
||||
dos->writeInt(files->size());
|
||||
for (auto it = files->begin(); it != files->end(); it++) {
|
||||
std::string filename = it->first;
|
||||
std::wstring filename = it->first;
|
||||
ConsoleSchematicFile* file = it->second;
|
||||
|
||||
ByteArrayOutputStream fileBaos;
|
||||
@@ -472,7 +473,7 @@ bool GameRuleManager::readRuleFile(
|
||||
compressedBuffer.data(), compressedSize); break; default:
|
||||
app.DebugPrintf("Invalid compression
|
||||
type %d found\n", compressionType);
|
||||
assert(0);
|
||||
__debugbreak();
|
||||
|
||||
[] decompressedBuffer.data(); dis.close(); bais.reset();
|
||||
|
||||
@@ -487,7 +488,7 @@ bool GameRuleManager::readRuleFile(
|
||||
|
||||
// string lookup.
|
||||
unsigned int numStrings = contentDis->readInt();
|
||||
std::vector<std::string> tagsAndAtts;
|
||||
std::vector<std::wstring> tagsAndAtts;
|
||||
for (unsigned int i = 0; i < numStrings; i++)
|
||||
tagsAndAtts.push_back(contentDis->readUTF());
|
||||
|
||||
@@ -524,7 +525,7 @@ bool GameRuleManager::readRuleFile(
|
||||
// subfile
|
||||
unsigned int numFiles = contentDis->readInt();
|
||||
for (unsigned int i = 0; i < numFiles; i++) {
|
||||
std::string sFilename = contentDis->readUTF();
|
||||
std::wstring sFilename = contentDis->readUTF();
|
||||
int length = contentDis->readInt();
|
||||
std::vector<uint8_t> ba(length);
|
||||
|
||||
@@ -549,13 +550,13 @@ bool GameRuleManager::readRuleFile(
|
||||
if (tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) {
|
||||
rule = levelGenerator;
|
||||
levelGenAdded = true;
|
||||
// m_levelGenerators.addLevelGenerator("",levelGenerator);
|
||||
// m_levelGenerators.addLevelGenerator(L"",levelGenerator);
|
||||
lgoID = addLevelGenerationOptions(levelGenerator);
|
||||
levelGenerator->loadStringTable(strings);
|
||||
} else if (tagVal == ConsoleGameRules::eGameRuleType_LevelRules) {
|
||||
rule = gameRules;
|
||||
gameRulesAdded = true;
|
||||
m_levelRules.addLevelRule("", gameRules);
|
||||
m_levelRules.addLevelRule(L"", gameRules);
|
||||
levelGenerator->setRequiredGameRules(gameRules);
|
||||
gameRules->loadStringTable(strings);
|
||||
}
|
||||
@@ -592,20 +593,20 @@ LevelGenerationOptions* GameRuleManager::readHeader(DLCGameRulesHeader* grh) {
|
||||
}
|
||||
|
||||
void GameRuleManager::readAttributes(DataInputStream* dis,
|
||||
std::vector<std::string>* tagsAndAtts,
|
||||
std::vector<std::wstring>* tagsAndAtts,
|
||||
GameRuleDefinition* rule) {
|
||||
int numAttrs = dis->readInt();
|
||||
for (unsigned int att = 0; att < static_cast<unsigned int>(numAttrs);
|
||||
++att) {
|
||||
int attID = dis->readInt();
|
||||
std::string value = dis->readUTF();
|
||||
std::wstring value = dis->readUTF();
|
||||
|
||||
if (rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID), value);
|
||||
}
|
||||
}
|
||||
|
||||
void GameRuleManager::readChildren(
|
||||
DataInputStream* dis, std::vector<std::string>* tagsAndAtts,
|
||||
DataInputStream* dis, std::vector<std::wstring>* tagsAndAtts,
|
||||
std::unordered_map<int, ConsoleGameRules::EGameRuleType>* tagIdMap,
|
||||
GameRuleDefinition* rule) {
|
||||
int numChildren = dis->readInt();
|
||||
@@ -640,27 +641,25 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
|
||||
}
|
||||
|
||||
void GameRuleManager::loadDefaultGameRules() {
|
||||
#if 0
|
||||
#if !defined(__linux__)
|
||||
#if defined(_WINDOWS64)
|
||||
File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck");
|
||||
File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck");
|
||||
if (!packedTutorialFile.exists())
|
||||
packedTutorialFile = File("Windows64\\Tutorial\\Tutorial.pck");
|
||||
packedTutorialFile = File(L"Windows64\\Tutorial\\Tutorial.pck");
|
||||
#else
|
||||
File packedTutorialFile("Tutorial\\Tutorial.pck");
|
||||
File packedTutorialFile(L"Tutorial\\Tutorial.pck");
|
||||
#endif
|
||||
if (loadGameRulesPack(&packedTutorialFile)) {
|
||||
m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(
|
||||
app.GetString(IDS_PLAY_TUTORIAL));
|
||||
// m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName("Tutorial");
|
||||
// m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial");
|
||||
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(
|
||||
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";
|
||||
std::wstring fpTutorial = L"Tutorial.pck";
|
||||
if (app.getArchiveFileSize(fpTutorial) >= 0) {
|
||||
DLCPack* pack = new DLCPack("", 0xffffffff);
|
||||
DLCPack* pack = new DLCPack(L"", 0xffffffff);
|
||||
uint32_t dwFilesProcessed = 0;
|
||||
if (app.m_dlcManager.readDLCDataFile(dwFilesProcessed, fpTutorial, pack,
|
||||
true)) {
|
||||
@@ -678,7 +677,7 @@ void GameRuleManager::loadDefaultGameRules() {
|
||||
bool GameRuleManager::loadGameRulesPack(File* path) {
|
||||
bool success = false;
|
||||
if (path->exists()) {
|
||||
DLCPack* pack = new DLCPack("", 0xffffffff);
|
||||
DLCPack* pack = new DLCPack(L"", 0xffffffff);
|
||||
unsigned int dwFilesProcessed = 0;
|
||||
if (app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),
|
||||
pack)) {
|
||||
@@ -708,11 +707,11 @@ void GameRuleManager::setLevelGenerationOptions(
|
||||
m_currentLevelGenerationOptions->reset_start();
|
||||
}
|
||||
|
||||
const char* GameRuleManager::GetGameRulesString(const std::string& key) {
|
||||
const wchar_t* GameRuleManager::GetGameRulesString(const std::wstring& key) {
|
||||
if (m_currentGameRuleDefinitions != nullptr && !key.empty()) {
|
||||
return m_currentGameRuleDefinitions->getString(key);
|
||||
} else {
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,14 +27,16 @@ class DLCGameRulesHeader;
|
||||
class File;
|
||||
class LevelRuleset;
|
||||
|
||||
#define GAME_RULE_SAVENAME L"requiredGameRules.grf"
|
||||
|
||||
// 4J-JEV:
|
||||
#define LEVEL_GEN_ID int
|
||||
#define LEVEL_GEN_ID_NULL 0
|
||||
|
||||
class GameRuleManager {
|
||||
public:
|
||||
static const char* wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
|
||||
static const char* wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count];
|
||||
static const wchar_t* wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
|
||||
static const wchar_t* wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count];
|
||||
|
||||
static const short version_number = 2;
|
||||
|
||||
@@ -68,10 +70,10 @@ public:
|
||||
|
||||
private:
|
||||
void readAttributes(DataInputStream* dis,
|
||||
std::vector<std::string>* tagsAndAtts,
|
||||
std::vector<std::wstring>* tagsAndAtts,
|
||||
GameRuleDefinition* rule);
|
||||
void readChildren(
|
||||
DataInputStream* dis, std::vector<std::string>* tagsAndAtts,
|
||||
DataInputStream* dis, std::vector<std::wstring>* tagsAndAtts,
|
||||
std::unordered_map<int, ConsoleGameRules::EGameRuleType>* tagIdMap,
|
||||
GameRuleDefinition* rule);
|
||||
|
||||
@@ -96,7 +98,7 @@ public:
|
||||
LevelGenerationOptions* getLevelGenerationOptions() {
|
||||
return m_currentLevelGenerationOptions;
|
||||
}
|
||||
const char* GetGameRulesString(const std::string& key);
|
||||
const wchar_t* GetGameRulesString(const std::wstring& key);
|
||||
|
||||
// 4J-JEV:
|
||||
// Properly cleans-up and unloads the current set of gameRules.
|
||||
|
||||
@@ -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) {
|
||||
@@ -65,8 +65,8 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos,
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::addAttribute(
|
||||
const std::string& attributeName, const std::string& attributeValue) {
|
||||
if (attributeName.compare("filename") == 0) {
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"filename") == 0) {
|
||||
m_schematicName = attributeValue;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// filename=%s\n",m_schematicName.c_str());
|
||||
@@ -75,28 +75,28 @@ void ApplySchematicRuleDefinition::addAttribute(
|
||||
if (m_schematicName
|
||||
.substr(m_schematicName.length() - 4,
|
||||
m_schematicName.length())
|
||||
.compare(".sch") != 0) {
|
||||
m_schematicName.append(".sch");
|
||||
.compare(L".sch") != 0) {
|
||||
m_schematicName.append(L".sch");
|
||||
}
|
||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
}
|
||||
} else if (attributeName.compare("x") == 0) {
|
||||
} else if (attributeName.compare(L"x") == 0) {
|
||||
m_location.x = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.x)) % 2 != 0) m_location.x -= 1;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// x=%f\n",m_location->x);
|
||||
} else if (attributeName.compare("y") == 0) {
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
m_location.y = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.y)) % 2 != 0) m_location.y -= 1;
|
||||
if (m_location.y < 0) m_location.y = 0;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// y=%f\n",m_location->y);
|
||||
} else if (attributeName.compare("z") == 0) {
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
m_location.z = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.z)) % 2 != 0) m_location.z -= 1;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// z=%f\n",m_location->z);
|
||||
} else if (attributeName.compare("rot") == 0) {
|
||||
} else if (attributeName.compare(L"rot") == 0) {
|
||||
int degrees = fromWString<int>(attributeValue);
|
||||
|
||||
while (degrees < 0) degrees += 360;
|
||||
@@ -122,7 +122,7 @@ void ApplySchematicRuleDefinition::addAttribute(
|
||||
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// rot=%d\n",m_rotation);
|
||||
} else if (attributeName.compare("dim") == 0) {
|
||||
} else if (attributeName.compare(L"dim") == 0) {
|
||||
m_dimension = fromWString<int>(attributeValue);
|
||||
if (m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
@@ -173,7 +173,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
||||
std::min((double)Level::maxBuildHeight, m_locationBox->y1);
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Applying schematic %s to chunk (%d,%d)\n",
|
||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
||||
m_schematicName.c_str(), chunk->x, chunk->z);
|
||||
#endif
|
||||
m_totalBlocksChanged += m_schematic->applyBlocksAndData(
|
||||
@@ -211,7 +211,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||
std::min((double)Level::maxBuildHeight, m_locationBox->y1);
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Applying schematic %s to chunk (%d,%d)\n",
|
||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
||||
m_schematicName.c_str(), chunk->x, chunk->z);
|
||||
#endif
|
||||
m_totalBlocksChangedLighting += m_schematic->applyLighting(
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -19,7 +19,7 @@ class GRFObject;
|
||||
class ApplySchematicRuleDefinition : public GameRuleDefinition {
|
||||
private:
|
||||
LevelGenerationOptions* m_levelGenOptions;
|
||||
std::string m_schematicName;
|
||||
std::wstring m_schematicName;
|
||||
ConsoleSchematicFile* m_schematic;
|
||||
Vec3 m_location;
|
||||
std::optional<AABB> m_locationBox;
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
}
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
void processSchematic(AABB* chunkBox, LevelChunk* chunk);
|
||||
void processSchematicLighting(AABB* chunkBox, LevelChunk* chunk);
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
bool isComplete() { return m_completed; }
|
||||
|
||||
std::string getSchematicName() { return m_schematicName; }
|
||||
std::wstring getSchematicName() { return m_schematicName; }
|
||||
|
||||
/** 4J-JEV:
|
||||
* This GameRuleDefinition contains limited game state.
|
||||
|
||||
@@ -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;
|
||||
@@ -24,18 +24,18 @@ void BiomeOverride::writeAttributes(DataOutputStream* dos,
|
||||
dos->writeUTF(toWString(m_topTile));
|
||||
}
|
||||
|
||||
void BiomeOverride::addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue) {
|
||||
if (attributeName.compare("tileId") == 0) {
|
||||
void BiomeOverride::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"tileId") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_tile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n", m_tile);
|
||||
} else if (attributeName.compare("topTileId") == 0) {
|
||||
} else if (attributeName.compare(L"topTileId") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_topTile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n",
|
||||
m_topTile);
|
||||
} else if (attributeName.compare("biomeId") == 0) {
|
||||
} else if (attributeName.compare(L"biomeId") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_biomeId = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n",
|
||||
|
||||
@@ -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:
|
||||
@@ -21,8 +21,8 @@ public:
|
||||
}
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
bool isBiome(int id);
|
||||
void getTileValues(std::uint8_t& tile, std::uint8_t& topTile);
|
||||
|
||||
@@ -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;
|
||||
@@ -51,9 +51,9 @@ GameRuleDefinition* ConsoleGenerateStructure::addChild(
|
||||
m_actions.push_back((XboxStructureActionPlaceSpawner*)rule);
|
||||
} else {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
printf(
|
||||
"ConsoleGenerateStructure: Attempted to add invalid child rule - "
|
||||
"%d\n",
|
||||
wprintf(
|
||||
L"ConsoleGenerateStructure: Attempted to add invalid child rule - "
|
||||
L"%d\n",
|
||||
ruleType);
|
||||
#endif
|
||||
}
|
||||
@@ -77,30 +77,30 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos,
|
||||
dos->writeUTF(toWString(m_dimension));
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue) {
|
||||
if (attributeName.compare("x") == 0) {
|
||||
void ConsoleGenerateStructure::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"x") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n",
|
||||
m_x);
|
||||
} else if (attributeName.compare("y") == 0) {
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n",
|
||||
m_y);
|
||||
} else if (attributeName.compare("z") == 0) {
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n",
|
||||
m_z);
|
||||
} else if (attributeName.compare("orientation") == 0) {
|
||||
} else if (attributeName.compare(L"orientation") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
orientation = value;
|
||||
app.DebugPrintf(
|
||||
"ConsoleGenerateStructure: Adding parameter orientation=%d\n",
|
||||
orientation);
|
||||
} else if (attributeName.compare("dim") == 0) {
|
||||
} else if (attributeName.compare(L"dim") == 0) {
|
||||
m_dimension = fromWString<int>(attributeValue);
|
||||
if (m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
app.DebugPrintf(
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
// StructurePiece
|
||||
virtual BoundingBox* getBoundingBox();
|
||||
|
||||
@@ -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);
|
||||
@@ -130,7 +131,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||
// 4jcraft, fixed cast of templated List to get the tag list
|
||||
// and cast it to CompoundTag inside the loop
|
||||
CompoundTag* tag = NbtIo::read(dis);
|
||||
ListTag<Tag>* tileEntityTags = tag->getList("TileEntities");
|
||||
ListTag<Tag>* tileEntityTags = tag->getList(L"TileEntities");
|
||||
if (tileEntityTags != nullptr) {
|
||||
for (int i = 0; i < tileEntityTags->size(); i++) {
|
||||
CompoundTag* teTag = (CompoundTag*)tileEntityTags->get(i);
|
||||
@@ -138,10 +139,10 @@ 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);
|
||||
__debugbreak();
|
||||
#endif
|
||||
} else {
|
||||
m_tileEntities.push_back(te);
|
||||
@@ -151,23 +152,23 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||
|
||||
// 4jcraft, fixed cast of templated List to get the tag list
|
||||
// and cast it to CompoundTag inside the loop
|
||||
ListTag<Tag>* entityTags = tag->getList("Entities");
|
||||
ListTag<Tag>* entityTags = tag->getList(L"Entities");
|
||||
if (entityTags != nullptr) {
|
||||
for (int i = 0; i < entityTags->size(); i++) {
|
||||
CompoundTag* eTag = (CompoundTag*)entityTags->get(i);
|
||||
eINSTANCEOF type = EntityIO::getType(eTag->getString("id"));
|
||||
eINSTANCEOF type = EntityIO::getType(eTag->getString(L"id"));
|
||||
|
||||
// 4jcraft, same here
|
||||
ListTag<Tag>* pos = eTag->getList("Pos");
|
||||
ListTag<Tag>* pos = eTag->getList(L"Pos");
|
||||
|
||||
double x = ((DoubleTag*)pos->get(0))->data;
|
||||
double y = ((DoubleTag*)pos->get(1))->data;
|
||||
double z = ((DoubleTag*)pos->get(2))->data;
|
||||
|
||||
if (type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME) {
|
||||
x = ((IntTag*)eTag->get("TileX"))->data;
|
||||
y = ((IntTag*)eTag->get("TileY"))->data;
|
||||
z = ((IntTag*)eTag->get("TileZ"))->data;
|
||||
x = ((IntTag*)eTag->get(L"TileX"))->data;
|
||||
y = ((IntTag*)eTag->get(L"TileY"))->data;
|
||||
z = ((IntTag*)eTag->get(L"TileZ"))->data;
|
||||
}
|
||||
m_entities.push_back(std::pair<Vec3, CompoundTag*>(
|
||||
Vec3(x, y, z), (CompoundTag*)eTag->copy()));
|
||||
@@ -181,7 +182,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) {
|
||||
CompoundTag* tag = new CompoundTag();
|
||||
|
||||
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
||||
tag->put("TileEntities", tileEntityTags);
|
||||
tag->put(L"TileEntities", tileEntityTags);
|
||||
|
||||
for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); it++) {
|
||||
CompoundTag* cTag = new CompoundTag();
|
||||
@@ -190,7 +191,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) {
|
||||
}
|
||||
|
||||
ListTag<CompoundTag>* entityTags = new ListTag<CompoundTag>();
|
||||
tag->put("Entities", entityTags);
|
||||
tag->put(L"Entities", entityTags);
|
||||
|
||||
for (auto it = m_entities.begin(); it != m_entities.end(); it++)
|
||||
entityTags->add((CompoundTag*)(*it).second->copy());
|
||||
@@ -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);
|
||||
@@ -673,7 +675,7 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (p != blockCount) assert(0);
|
||||
if (p != blockCount) __debugbreak();
|
||||
#endif
|
||||
|
||||
// We don't know how this will compress - just make a fixed length buffer to
|
||||
@@ -706,7 +708,7 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||
|
||||
CompoundTag tag;
|
||||
ListTag<CompoundTag>* tileEntitiesTag =
|
||||
new ListTag<CompoundTag>("tileEntities");
|
||||
new ListTag<CompoundTag>(L"tileEntities");
|
||||
|
||||
int xc0 = xStart >> 4;
|
||||
int zc0 = zStart >> 4;
|
||||
@@ -736,12 +738,12 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||
delete tileEntities;
|
||||
}
|
||||
}
|
||||
tag.put("TileEntities", tileEntitiesTag);
|
||||
tag.put(L"TileEntities", tileEntitiesTag);
|
||||
|
||||
AABB bb(xStart, yStart, zStart, xEnd, yEnd, zEnd);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntities(nullptr, &bb);
|
||||
ListTag<CompoundTag>* entitiesTag = new ListTag<CompoundTag>("entities");
|
||||
ListTag<CompoundTag>* entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||
|
||||
for (auto it = entities->begin(); it != entities->end(); ++it) {
|
||||
std::shared_ptr<Entity> e = *it;
|
||||
@@ -769,16 +771,16 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||
CompoundTag* eTag = new CompoundTag();
|
||||
if (e->save(eTag)) {
|
||||
ListTag<DoubleTag>* pos =
|
||||
(ListTag<DoubleTag>*)eTag->getList("Pos");
|
||||
(ListTag<DoubleTag>*)eTag->getList(L"Pos");
|
||||
|
||||
pos->get(0)->data -= xStart;
|
||||
pos->get(1)->data -= yStart;
|
||||
pos->get(2)->data -= zStart;
|
||||
|
||||
if (e->instanceof(eTYPE_HANGING_ENTITY)) {
|
||||
((IntTag*)eTag->get("TileX"))->data -= xStart;
|
||||
((IntTag*)eTag->get("TileY"))->data -= yStart;
|
||||
((IntTag*)eTag->get("TileZ"))->data -= zStart;
|
||||
((IntTag*)eTag->get(L"TileX"))->data -= xStart;
|
||||
((IntTag*)eTag->get(L"TileY"))->data -= yStart;
|
||||
((IntTag*)eTag->get(L"TileZ"))->data -= zStart;
|
||||
}
|
||||
|
||||
entitiesTag->add(eTag);
|
||||
@@ -786,7 +788,7 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||
}
|
||||
}
|
||||
|
||||
tag.put("Entities", entitiesTag);
|
||||
tag.put(L"Entities", entitiesTag);
|
||||
|
||||
if (dos != nullptr) NbtIo::write(&tag, dos);
|
||||
}
|
||||
@@ -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 {
|
||||
wchar_t 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(wchar_t)));
|
||||
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,42 +6,43 @@
|
||||
#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"
|
||||
#include "platform/profile/profile.h"
|
||||
#include "platform/storage/storage.h"
|
||||
#include "platform/PlatformServices.h"
|
||||
#include "platform/sdl2/Profile.h"
|
||||
#include "platform/sdl2/Storage.h"
|
||||
#include "strings.h"
|
||||
#include "util/StringHelpers.h"
|
||||
|
||||
JustGrSource::JustGrSource() {
|
||||
m_displayName = "Default_DisplayName";
|
||||
m_worldName = "Default_WorldName";
|
||||
m_defaultSaveName = "Default_DefaultSaveName";
|
||||
m_displayName = L"Default_DisplayName";
|
||||
m_worldName = L"Default_WorldName";
|
||||
m_defaultSaveName = L"Default_DefaultSaveName";
|
||||
m_bRequiresTexturePack = false;
|
||||
m_requiredTexturePackId = 0;
|
||||
m_grfPath = "__NO_GRF_PATH__";
|
||||
m_grfPath = L"__NO_GRF_PATH__";
|
||||
m_bRequiresBaseSave = false;
|
||||
}
|
||||
|
||||
@@ -49,12 +50,12 @@ bool JustGrSource::requiresTexturePack() { return m_bRequiresTexturePack; }
|
||||
std::uint32_t JustGrSource::getRequiredTexturePackId() {
|
||||
return m_requiredTexturePackId;
|
||||
}
|
||||
std::string JustGrSource::getDefaultSaveName() { return m_defaultSaveName; }
|
||||
const char* JustGrSource::getWorldName() { return m_worldName.c_str(); }
|
||||
const char* JustGrSource::getDisplayName() { return m_displayName.c_str(); }
|
||||
std::string JustGrSource::getGrfPath() { return m_grfPath; }
|
||||
std::wstring JustGrSource::getDefaultSaveName() { return m_defaultSaveName; }
|
||||
const wchar_t* JustGrSource::getWorldName() { return m_worldName.c_str(); }
|
||||
const wchar_t* JustGrSource::getDisplayName() { return m_displayName.c_str(); }
|
||||
std::wstring JustGrSource::getGrfPath() { return m_grfPath; }
|
||||
bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; };
|
||||
std::string JustGrSource::getBaseSavePath() { return m_baseSavePath; };
|
||||
std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; };
|
||||
|
||||
void JustGrSource::setRequiresTexturePack(bool x) {
|
||||
m_bRequiresTexturePack = x;
|
||||
@@ -62,13 +63,13 @@ void JustGrSource::setRequiresTexturePack(bool x) {
|
||||
void JustGrSource::setRequiredTexturePackId(std::uint32_t x) {
|
||||
m_requiredTexturePackId = x;
|
||||
}
|
||||
void JustGrSource::setDefaultSaveName(const std::string& x) {
|
||||
void JustGrSource::setDefaultSaveName(const std::wstring& x) {
|
||||
m_defaultSaveName = x;
|
||||
}
|
||||
void JustGrSource::setWorldName(const std::string& x) { m_worldName = x; }
|
||||
void JustGrSource::setDisplayName(const std::string& x) { m_displayName = x; }
|
||||
void JustGrSource::setGrfPath(const std::string& x) { m_grfPath = x; }
|
||||
void JustGrSource::setBaseSavePath(const std::string& x) {
|
||||
void JustGrSource::setWorldName(const std::wstring& x) { m_worldName = x; }
|
||||
void JustGrSource::setDisplayName(const std::wstring& x) { m_displayName = x; }
|
||||
void JustGrSource::setGrfPath(const std::wstring& x) { m_grfPath = x; }
|
||||
void JustGrSource::setBaseSavePath(const std::wstring& x) {
|
||||
m_baseSavePath = x;
|
||||
m_bRequiresBaseSave = true;
|
||||
}
|
||||
@@ -178,88 +179,88 @@ GameRuleDefinition* LevelGenerationOptions::addChild(
|
||||
m_features.push_back((StartFeature*)rule);
|
||||
} else {
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
printf(
|
||||
"LevelGenerationOptions: Attempted to add invalid child rule - "
|
||||
"%d\n",
|
||||
wprintf(
|
||||
L"LevelGenerationOptions: Attempted to add invalid child rule - "
|
||||
L"%d\n",
|
||||
ruleType);
|
||||
#endif
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue) {
|
||||
if (attributeName.compare("seed") == 0) {
|
||||
void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"seed") == 0) {
|
||||
m_seed = fromWString<int64_t>(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed);
|
||||
} else if (attributeName.compare("spawnX") == 0) {
|
||||
} else if (attributeName.compare(L"spawnX") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->x = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",
|
||||
value);
|
||||
} else if (attributeName.compare("spawnY") == 0) {
|
||||
} else if (attributeName.compare(L"spawnY") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->y = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",
|
||||
value);
|
||||
} else if (attributeName.compare("spawnZ") == 0) {
|
||||
} else if (attributeName.compare(L"spawnZ") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->z = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",
|
||||
value);
|
||||
} else if (attributeName.compare("flatworld") == 0) {
|
||||
if (attributeValue.compare("true") == 0) m_useFlatWorld = true;
|
||||
} else if (attributeName.compare(L"flatworld") == 0) {
|
||||
if (attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter flatworld=%s\n",
|
||||
m_useFlatWorld ? "true" : "false");
|
||||
} else if (attributeName.compare("saveName") == 0) {
|
||||
std::string string(getString(attributeValue));
|
||||
} else if (attributeName.compare(L"saveName") == 0) {
|
||||
std::wstring string(getString(attributeValue));
|
||||
if (!string.empty())
|
||||
setDefaultSaveName(string);
|
||||
else
|
||||
setDefaultSaveName(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter saveName=%s\n",
|
||||
"LevelGenerationOptions: Adding parameter saveName=%ls\n",
|
||||
getDefaultSaveName().c_str());
|
||||
} else if (attributeName.compare("worldName") == 0) {
|
||||
std::string string(getString(attributeValue));
|
||||
} else if (attributeName.compare(L"worldName") == 0) {
|
||||
std::wstring string(getString(attributeValue));
|
||||
if (!string.empty())
|
||||
setWorldName(string);
|
||||
else
|
||||
setWorldName(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter worldName=%s\n",
|
||||
"LevelGenerationOptions: Adding parameter worldName=%ls\n",
|
||||
getWorldName());
|
||||
} else if (attributeName.compare("displayName") == 0) {
|
||||
std::string string(getString(attributeValue));
|
||||
} else if (attributeName.compare(L"displayName") == 0) {
|
||||
std::wstring string(getString(attributeValue));
|
||||
if (!string.empty())
|
||||
setDisplayName(string);
|
||||
else
|
||||
setDisplayName(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter displayName=%s\n",
|
||||
"LevelGenerationOptions: Adding parameter displayName=%ls\n",
|
||||
getDisplayName());
|
||||
} else if (attributeName.compare("texturePackId") == 0) {
|
||||
} else if (attributeName.compare(L"texturePackId") == 0) {
|
||||
setRequiredTexturePackId(fromWString<unsigned int>(attributeValue));
|
||||
setRequiresTexturePack(true);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter texturePackId=%0x\n",
|
||||
getRequiredTexturePackId());
|
||||
} else if (attributeName.compare("isTutorial") == 0) {
|
||||
if (attributeValue.compare("true") == 0) setSrc(eSrc_tutorial);
|
||||
} else if (attributeName.compare(L"isTutorial") == 0) {
|
||||
if (attributeValue.compare(L"true") == 0) setSrc(eSrc_tutorial);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter isTutorial=%s\n",
|
||||
isTutorial() ? "true" : "false");
|
||||
} else if (attributeName.compare("baseSaveName") == 0) {
|
||||
} else if (attributeName.compare(L"baseSaveName") == 0) {
|
||||
setBaseSavePath(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter baseSaveName=%s\n",
|
||||
"LevelGenerationOptions: Adding parameter baseSaveName=%ls\n",
|
||||
getBaseSavePath().c_str());
|
||||
} else if (attributeName.compare("hasBeenInCreative") == 0) {
|
||||
} else if (attributeName.compare(L"hasBeenInCreative") == 0) {
|
||||
bool value = fromWString<bool>(attributeValue);
|
||||
m_bHasBeenInCreative = value;
|
||||
app.DebugPrintf(
|
||||
@@ -434,13 +435,14 @@ void LevelGenerationOptions::clearSchematics() {
|
||||
void LevelGenerationOptions::clearChunkRuleCache() { m_chunkRuleCache.clear(); }
|
||||
|
||||
ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
|
||||
const std::string& filename, std::uint8_t* pbData,
|
||||
const std::wstring& filename, std::uint8_t* pbData,
|
||||
unsigned int dataLength) {
|
||||
// If we have already loaded this, just return
|
||||
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());
|
||||
wprintf(L"We have already loaded schematic file %ls\n",
|
||||
filename.c_str());
|
||||
#endif
|
||||
it->second->incrementRefCount();
|
||||
return it->second;
|
||||
@@ -459,7 +461,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
|
||||
}
|
||||
|
||||
ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
|
||||
const std::string& filename) {
|
||||
const std::wstring& filename) {
|
||||
ConsoleSchematicFile* schematic = nullptr;
|
||||
// If we have already loaded this, just return
|
||||
auto it = m_schematics.find(filename);
|
||||
@@ -469,7 +471,8 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
|
||||
return schematic;
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) {
|
||||
void LevelGenerationOptions::releaseSchematicFile(
|
||||
const std::wstring& 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);
|
||||
@@ -489,9 +492,9 @@ void LevelGenerationOptions::loadStringTable(StringTable* table) {
|
||||
m_stringTable = table;
|
||||
}
|
||||
|
||||
const char* LevelGenerationOptions::getString(const std::string& key) {
|
||||
const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) {
|
||||
if (m_stringTable == nullptr) {
|
||||
return "";
|
||||
return L"";
|
||||
} else {
|
||||
return m_stringTable->getString(key);
|
||||
}
|
||||
@@ -524,19 +527,19 @@ bool LevelGenerationOptions::isFeatureChunk(
|
||||
return isFeature;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, ConsoleSchematicFile*>*
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile*>*
|
||||
LevelGenerationOptions::getUnfinishedSchematicFiles() {
|
||||
// Clean schematic rules.
|
||||
std::unordered_set<std::string> usedFiles =
|
||||
std::unordered_set<std::string>();
|
||||
std::unordered_set<std::wstring> usedFiles =
|
||||
std::unordered_set<std::wstring>();
|
||||
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++)
|
||||
if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName());
|
||||
|
||||
// Clean schematic files.
|
||||
std::unordered_map<std::string, ConsoleSchematicFile*>* out =
|
||||
new std::unordered_map<std::string, ConsoleSchematicFile*>();
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile*>* out =
|
||||
new std::unordered_map<std::wstring, ConsoleSchematicFile*>();
|
||||
for (auto it = usedFiles.begin(); it != usedFiles.end(); it++)
|
||||
out->insert(std::pair<std::string, ConsoleSchematicFile*>(
|
||||
out->insert(std::pair<std::wstring, ConsoleSchematicFile*>(
|
||||
*it, getSchematicFile(*it)));
|
||||
|
||||
return out;
|
||||
@@ -548,16 +551,16 @@ void LevelGenerationOptions::loadBaseSaveData() {
|
||||
mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||
|
||||
if (mountIndex > -1) {
|
||||
if (PlatformStorage.MountInstalledDLC(
|
||||
PlatformProfile.GetPrimaryPad(), mountIndex,
|
||||
if (StorageManager.MountInstalledDLC(
|
||||
ProfileManager.GetPrimaryPad(), mountIndex,
|
||||
[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",
|
||||
mountIndex, PlatformProfile.GetPrimaryPad());
|
||||
mountIndex, ProfileManager.GetPrimaryPad());
|
||||
} else {
|
||||
m_bLoadingData = true;
|
||||
app.DebugPrintf("Attempted to mount DLC data for LGO %d\n",
|
||||
@@ -565,7 +568,7 @@ void LevelGenerationOptions::loadBaseSaveData() {
|
||||
}
|
||||
} else {
|
||||
setLoadedData();
|
||||
app.SetAction(PlatformProfile.GetPrimaryPad(),
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(),
|
||||
eAppAction_ReloadTexturePack);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
@@ -591,15 +594,15 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
|
||||
if (!dlcFile->getGrfPath().empty()) {
|
||||
File grf(app.getFilePath(lgo->m_parentDLCPack->GetPackID(),
|
||||
dlcFile->getGrfPath(), true,
|
||||
"WPACK:"));
|
||||
L"WPACK:"));
|
||||
if (grf.exists()) {
|
||||
uint32_t dwFileSize = grf.length();
|
||||
if (dwFileSize > 0) {
|
||||
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
|
||||
auto readResult = PlatformFilesystem.readFile(
|
||||
auto readResult = PlatformFileIO.readFile(
|
||||
grf.getPath(), pbData, dwFileSize);
|
||||
if (readResult.status !=
|
||||
IPlatformFilesystem::ReadStatus::Ok) {
|
||||
IPlatformFileIO::ReadStatus::Ok) {
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
@@ -617,16 +620,15 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
|
||||
}
|
||||
if (lgo->requiresBaseSave() && !lgo->getBaseSavePath().empty()) {
|
||||
File save(app.getFilePath(lgo->m_parentDLCPack->GetPackID(),
|
||||
lgo->getBaseSavePath(), true, "WPACK:"));
|
||||
lgo->getBaseSavePath(), true, L"WPACK:"));
|
||||
if (save.exists()) {
|
||||
std::size_t dwFileSize =
|
||||
PlatformFilesystem.fileSize(save.getPath());
|
||||
PlatformFileIO.fileSize(save.getPath());
|
||||
if (dwFileSize > 0) {
|
||||
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
|
||||
auto readResult = PlatformFilesystem.readFile(
|
||||
auto readResult = PlatformFileIO.readFile(
|
||||
save.getPath(), pbData, dwFileSize);
|
||||
if (readResult.status !=
|
||||
IPlatformFilesystem::ReadStatus::Ok) {
|
||||
if (readResult.status != IPlatformFileIO::ReadStatus::Ok) {
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
@@ -636,7 +638,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr,
|
||||
}
|
||||
}
|
||||
}
|
||||
uint32_t result = PlatformStorage.UnmountInstalledDLC("WPACK");
|
||||
uint32_t result = StorageManager.UnmountInstalledDLC("WPACK");
|
||||
}
|
||||
|
||||
lgo->setLoadedData();
|
||||
@@ -677,7 +679,7 @@ bool LevelGenerationOptions::requiresTexturePack() {
|
||||
std::uint32_t LevelGenerationOptions::getRequiredTexturePackId() {
|
||||
return info()->getRequiredTexturePackId();
|
||||
}
|
||||
std::string LevelGenerationOptions::getDefaultSaveName() {
|
||||
std::wstring LevelGenerationOptions::getDefaultSaveName() {
|
||||
switch (getSrc()) {
|
||||
case eSrc_fromSave:
|
||||
return getString(info()->getDefaultSaveName());
|
||||
@@ -688,9 +690,9 @@ std::string LevelGenerationOptions::getDefaultSaveName() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
const char* LevelGenerationOptions::getWorldName() {
|
||||
const wchar_t* LevelGenerationOptions::getWorldName() {
|
||||
switch (getSrc()) {
|
||||
case eSrc_fromSave:
|
||||
return getString(info()->getWorldName());
|
||||
@@ -701,28 +703,28 @@ const char* LevelGenerationOptions::getWorldName() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
const char* LevelGenerationOptions::getDisplayName() {
|
||||
const wchar_t* LevelGenerationOptions::getDisplayName() {
|
||||
switch (getSrc()) {
|
||||
case eSrc_fromSave:
|
||||
return getString(info()->getDisplayName());
|
||||
case eSrc_fromDLC:
|
||||
return getString(info()->getDisplayName());
|
||||
case eSrc_tutorial:
|
||||
return "";
|
||||
return L"";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
return L"";
|
||||
}
|
||||
std::string LevelGenerationOptions::getGrfPath() {
|
||||
std::wstring LevelGenerationOptions::getGrfPath() {
|
||||
return info()->getGrfPath();
|
||||
}
|
||||
bool LevelGenerationOptions::requiresBaseSave() {
|
||||
return info()->requiresBaseSave();
|
||||
}
|
||||
std::string LevelGenerationOptions::getBaseSavePath() {
|
||||
std::wstring LevelGenerationOptions::getBaseSavePath() {
|
||||
return info()->getBaseSavePath();
|
||||
}
|
||||
|
||||
@@ -734,19 +736,19 @@ void LevelGenerationOptions::setRequiresTexturePack(bool x) {
|
||||
void LevelGenerationOptions::setRequiredTexturePackId(std::uint32_t x) {
|
||||
info()->setRequiredTexturePackId(x);
|
||||
}
|
||||
void LevelGenerationOptions::setDefaultSaveName(const std::string& x) {
|
||||
void LevelGenerationOptions::setDefaultSaveName(const std::wstring& x) {
|
||||
info()->setDefaultSaveName(x);
|
||||
}
|
||||
void LevelGenerationOptions::setWorldName(const std::string& x) {
|
||||
void LevelGenerationOptions::setWorldName(const std::wstring& x) {
|
||||
info()->setWorldName(x);
|
||||
}
|
||||
void LevelGenerationOptions::setDisplayName(const std::string& x) {
|
||||
void LevelGenerationOptions::setDisplayName(const std::wstring& x) {
|
||||
info()->setDisplayName(x);
|
||||
}
|
||||
void LevelGenerationOptions::setGrfPath(const std::string& x) {
|
||||
void LevelGenerationOptions::setGrfPath(const std::wstring& x) {
|
||||
info()->setGrfPath(x);
|
||||
}
|
||||
void LevelGenerationOptions::setBaseSavePath(const std::string& x) {
|
||||
void LevelGenerationOptions::setBaseSavePath(const std::wstring& x) {
|
||||
info()->setBaseSavePath(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -34,20 +35,20 @@ public:
|
||||
virtual ~GrSource() {}
|
||||
virtual bool requiresTexturePack() = 0;
|
||||
virtual std::uint32_t getRequiredTexturePackId() = 0;
|
||||
virtual std::string getDefaultSaveName() = 0;
|
||||
virtual const char* getWorldName() = 0;
|
||||
virtual const char* getDisplayName() = 0;
|
||||
virtual std::string getGrfPath() = 0;
|
||||
virtual std::wstring getDefaultSaveName() = 0;
|
||||
virtual const wchar_t* getWorldName() = 0;
|
||||
virtual const wchar_t* getDisplayName() = 0;
|
||||
virtual std::wstring getGrfPath() = 0;
|
||||
virtual bool requiresBaseSave() = 0;
|
||||
virtual std::string getBaseSavePath() = 0;
|
||||
virtual std::wstring getBaseSavePath() = 0;
|
||||
|
||||
virtual void setRequiresTexturePack(bool) = 0;
|
||||
virtual void setRequiredTexturePackId(std::uint32_t) = 0;
|
||||
virtual void setDefaultSaveName(const std::string&) = 0;
|
||||
virtual void setWorldName(const std::string&) = 0;
|
||||
virtual void setDisplayName(const std::string&) = 0;
|
||||
virtual void setGrfPath(const std::string&) = 0;
|
||||
virtual void setBaseSavePath(const std::string&) = 0;
|
||||
virtual void setDefaultSaveName(const std::wstring&) = 0;
|
||||
virtual void setWorldName(const std::wstring&) = 0;
|
||||
virtual void setDisplayName(const std::wstring&) = 0;
|
||||
virtual void setGrfPath(const std::wstring&) = 0;
|
||||
virtual void setBaseSavePath(const std::wstring&) = 0;
|
||||
|
||||
virtual bool ready() = 0;
|
||||
|
||||
@@ -56,32 +57,32 @@ public:
|
||||
|
||||
class JustGrSource : public GrSource {
|
||||
protected:
|
||||
std::string m_worldName;
|
||||
std::string m_displayName;
|
||||
std::string m_defaultSaveName;
|
||||
std::wstring m_worldName;
|
||||
std::wstring m_displayName;
|
||||
std::wstring m_defaultSaveName;
|
||||
bool m_bRequiresTexturePack;
|
||||
std::uint32_t m_requiredTexturePackId;
|
||||
std::string m_grfPath;
|
||||
std::string m_baseSavePath;
|
||||
std::wstring m_grfPath;
|
||||
std::wstring m_baseSavePath;
|
||||
bool m_bRequiresBaseSave;
|
||||
|
||||
public:
|
||||
virtual bool requiresTexturePack();
|
||||
virtual std::uint32_t getRequiredTexturePackId();
|
||||
virtual std::string getDefaultSaveName();
|
||||
virtual const char* getWorldName();
|
||||
virtual const char* getDisplayName();
|
||||
virtual std::string getGrfPath();
|
||||
virtual std::wstring getDefaultSaveName();
|
||||
virtual const wchar_t* getWorldName();
|
||||
virtual const wchar_t* getDisplayName();
|
||||
virtual std::wstring getGrfPath();
|
||||
virtual bool requiresBaseSave();
|
||||
virtual std::string getBaseSavePath();
|
||||
virtual std::wstring getBaseSavePath();
|
||||
|
||||
virtual void setRequiresTexturePack(bool x);
|
||||
virtual void setRequiredTexturePackId(std::uint32_t x);
|
||||
virtual void setDefaultSaveName(const std::string& x);
|
||||
virtual void setWorldName(const std::string& x);
|
||||
virtual void setDisplayName(const std::string& x);
|
||||
virtual void setGrfPath(const std::string& x);
|
||||
virtual void setBaseSavePath(const std::string& x);
|
||||
virtual void setDefaultSaveName(const std::wstring& x);
|
||||
virtual void setWorldName(const std::wstring& x);
|
||||
virtual void setDisplayName(const std::wstring& x);
|
||||
virtual void setGrfPath(const std::wstring& x);
|
||||
virtual void setBaseSavePath(const std::wstring& x);
|
||||
|
||||
virtual bool ready();
|
||||
|
||||
@@ -150,22 +151,22 @@ public:
|
||||
|
||||
bool requiresTexturePack();
|
||||
std::uint32_t getRequiredTexturePackId();
|
||||
std::string getDefaultSaveName();
|
||||
const char* getWorldName();
|
||||
const char* getDisplayName();
|
||||
std::string getGrfPath();
|
||||
std::wstring getDefaultSaveName();
|
||||
const wchar_t* getWorldName();
|
||||
const wchar_t* getDisplayName();
|
||||
std::wstring getGrfPath();
|
||||
bool requiresBaseSave();
|
||||
std::string getBaseSavePath();
|
||||
std::wstring getBaseSavePath();
|
||||
|
||||
void setGrSource(GrSource* grs);
|
||||
|
||||
void setRequiresTexturePack(bool x);
|
||||
void setRequiredTexturePackId(std::uint32_t x);
|
||||
void setDefaultSaveName(const std::string& x);
|
||||
void setWorldName(const std::string& x);
|
||||
void setDisplayName(const std::string& x);
|
||||
void setGrfPath(const std::string& x);
|
||||
void setBaseSavePath(const std::string& x);
|
||||
void setDefaultSaveName(const std::wstring& x);
|
||||
void setWorldName(const std::wstring& x);
|
||||
void setDisplayName(const std::wstring& x);
|
||||
void setGrfPath(const std::wstring& x);
|
||||
void setBaseSavePath(const std::wstring& x);
|
||||
|
||||
bool ready();
|
||||
|
||||
@@ -187,9 +188,8 @@ private:
|
||||
std::vector<ConsoleGenerateStructure*> m_structureRules;
|
||||
bool m_bHaveMinY;
|
||||
int m_minY;
|
||||
std::unordered_map<std::string, ConsoleSchematicFile*> m_schematics;
|
||||
std::unordered_map<ChunkRuleCacheKey, ChunkRuleCacheEntry,
|
||||
ChunkRuleCacheKeyHash>
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile*> m_schematics;
|
||||
std::unordered_map<ChunkRuleCacheKey, ChunkRuleCacheEntry, ChunkRuleCacheKeyHash>
|
||||
m_chunkRuleCache;
|
||||
std::vector<BiomeOverride*> m_biomeOverrides;
|
||||
std::vector<StartFeature*> m_features;
|
||||
@@ -213,8 +213,8 @@ public:
|
||||
virtual void getChildren(std::vector<GameRuleDefinition*>* children);
|
||||
virtual GameRuleDefinition* addChild(
|
||||
ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
int64_t getLevelSeed();
|
||||
int getLevelHasBeenInCreative();
|
||||
@@ -231,13 +231,13 @@ private:
|
||||
void clearSchematics();
|
||||
|
||||
public:
|
||||
ConsoleSchematicFile* loadSchematicFile(const std::string& filename,
|
||||
ConsoleSchematicFile* loadSchematicFile(const std::wstring& filename,
|
||||
std::uint8_t* pbData,
|
||||
unsigned int dataLength);
|
||||
|
||||
public:
|
||||
ConsoleSchematicFile* getSchematicFile(const std::string& filename);
|
||||
void releaseSchematicFile(const std::string& filename);
|
||||
ConsoleSchematicFile* getSchematicFile(const std::wstring& filename);
|
||||
void releaseSchematicFile(const std::wstring& filename);
|
||||
|
||||
bool requiresGameRules();
|
||||
void setRequiredGameRules(LevelRuleset* rules);
|
||||
@@ -250,9 +250,9 @@ public:
|
||||
int* orientation = nullptr);
|
||||
|
||||
void loadStringTable(StringTable* table);
|
||||
const char* getString(const std::string& key);
|
||||
const wchar_t* getString(const std::wstring& key);
|
||||
|
||||
std::unordered_map<std::string, ConsoleSchematicFile*>*
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile*>*
|
||||
getUnfinishedSchematicFiles();
|
||||
|
||||
void loadBaseSaveData();
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
|
||||
#include "LevelGenerationOptions.h"
|
||||
|
||||
LevelGenerators::LevelGenerators() {}
|
||||
|
||||
void LevelGenerators::addLevelGenerator(const std::string& displayName,
|
||||
void LevelGenerators::addLevelGenerator(const std::wstring& displayName,
|
||||
LevelGenerationOptions* generator) {
|
||||
if (!displayName.empty()) generator->setDisplayName(displayName);
|
||||
m_levelGenerators.push_back(generator);
|
||||
|
||||
@@ -14,7 +14,7 @@ private:
|
||||
public:
|
||||
LevelGenerators();
|
||||
|
||||
void addLevelGenerator(const std::string& displayName,
|
||||
void addLevelGenerator(const std::wstring& displayName,
|
||||
LevelGenerationOptions* generator);
|
||||
void removeLevelGenerator(LevelGenerationOptions* generator);
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -27,22 +27,22 @@ void StartFeature::writeAttributes(DataOutputStream* dos,
|
||||
dos->writeUTF(toWString(m_orientation));
|
||||
}
|
||||
|
||||
void StartFeature::addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue) {
|
||||
if (attributeName.compare("chunkX") == 0) {
|
||||
void StartFeature::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"chunkX") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_chunkX = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n", m_chunkX);
|
||||
} else if (attributeName.compare("chunkZ") == 0) {
|
||||
} else if (attributeName.compare(L"chunkZ") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_chunkZ = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n", m_chunkZ);
|
||||
} else if (attributeName.compare("orientation") == 0) {
|
||||
} else if (attributeName.compare(L"orientation") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_orientation = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n",
|
||||
m_orientation);
|
||||
} else if (attributeName.compare("feature") == 0) {
|
||||
} else if (attributeName.compare(L"feature") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_feature = (StructureFeature::EFeatureTypes)value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",
|
||||
|
||||
@@ -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 {
|
||||
@@ -20,8 +20,8 @@ public:
|
||||
}
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
bool isFeatureChunk(int chunkX, int chunkZ,
|
||||
StructureFeature::EFeatureTypes feature,
|
||||
|
||||
@@ -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;
|
||||
@@ -40,51 +40,51 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream* dos,
|
||||
}
|
||||
|
||||
void XboxStructureActionGenerateBox::addAttribute(
|
||||
const std::string& attributeName, const std::string& attributeValue) {
|
||||
if (attributeName.compare("x0") == 0) {
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"x0") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter x0=%d\n", m_x0);
|
||||
} else if (attributeName.compare("y0") == 0) {
|
||||
} else if (attributeName.compare(L"y0") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter y0=%d\n", m_y0);
|
||||
} else if (attributeName.compare("z0") == 0) {
|
||||
} else if (attributeName.compare(L"z0") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter z0=%d\n", m_z0);
|
||||
} else if (attributeName.compare("x1") == 0) {
|
||||
} else if (attributeName.compare(L"x1") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter x1=%d\n", m_x1);
|
||||
} else if (attributeName.compare("y1") == 0) {
|
||||
} else if (attributeName.compare(L"y1") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter y1=%d\n", m_y1);
|
||||
} else if (attributeName.compare("z1") == 0) {
|
||||
} else if (attributeName.compare(L"z1") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter z1=%d\n", m_z1);
|
||||
} else if (attributeName.compare("edgeTile") == 0) {
|
||||
} else if (attributeName.compare(L"edgeTile") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_edgeTile = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n",
|
||||
m_edgeTile);
|
||||
} else if (attributeName.compare("fillTile") == 0) {
|
||||
} else if (attributeName.compare(L"fillTile") == 0) {
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_fillTile = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n",
|
||||
m_fillTile);
|
||||
} else if (attributeName.compare("skipAir") == 0) {
|
||||
if (attributeValue.compare("true") == 0) m_skipAir = true;
|
||||
} else if (attributeName.compare(L"skipAir") == 0) {
|
||||
if (attributeValue.compare(L"true") == 0) m_skipAir = true;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter skipAir=%s\n",
|
||||
m_skipAir ? "true" : "false");
|
||||
|
||||
@@ -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;
|
||||
@@ -25,8 +25,8 @@ public:
|
||||
virtual int getEndZ() { return m_z1; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::string& attributeName,
|
||||
const std::string& attributeValue);
|
||||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
bool generateBoxInLevel(StructurePiece* structure, Level* level,
|
||||
BoundingBox* chunkBB);
|
||||
|
||||