2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Merge remote-tracking branch 'origin/trim'

This commit is contained in:
2020-04-24 02:43:56 -04:00
5 changed files with 46 additions and 12 deletions

View File

@@ -1,10 +1,13 @@
#include "AssetNameMap.hpp"
#include "athena/Compression.hpp"
#include "athena/MemoryReader.hpp"
extern "C" const uint8_t ASSET_NAME_MP32[];
extern "C" const size_t ASSET_NAME_MP32_SZ;
extern "C" const size_t ASSET_NAME_MP32_DECOMPRESSED_SZ;
extern "C" const uint8_t ASSET_NAME_MP64[];
extern "C" const size_t ASSET_NAME_MP64_SZ;
extern "C" const size_t ASSET_NAME_MP64_DECOMPRESSED_SZ;
namespace DataSpec::AssetNameMap {
logvisor::Module Log("AssetNameMap");
@@ -53,14 +56,28 @@ void InitAssetNameMap() {
Log.report(logvisor::Info, FMT_STRING("Initializing asset name database..."));
/* First load the 32bit map for MP1/2 */
{
athena::io::MemoryReader ar(ASSET_NAME_MP32, ASSET_NAME_MP32_SZ);
if (ASSET_NAME_MP32_DECOMPRESSED_SZ) {
auto decompressed = new uint8_t[ASSET_NAME_MP32_DECOMPRESSED_SZ];
athena::io::Compression::decompressZlib(ASSET_NAME_MP32, ASSET_NAME_MP32_SZ, decompressed,
ASSET_NAME_MP32_DECOMPRESSED_SZ);
athena::io::MemoryReader ar(decompressed, ASSET_NAME_MP32_DECOMPRESSED_SZ);
LoadAssetMap(ar);
delete[](decompressed);
} else {
Log.report(logvisor::Warning,
fmt(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files.")));
}
/* Now load the 64bit map for MP3 */
{
athena::io::MemoryReader ar(ASSET_NAME_MP64, ASSET_NAME_MP64_SZ);
if (ASSET_NAME_MP64_DECOMPRESSED_SZ) {
auto decompressed = new uint8_t[ASSET_NAME_MP64_DECOMPRESSED_SZ];
athena::io::Compression::decompressZlib(ASSET_NAME_MP64, ASSET_NAME_MP64_SZ, decompressed,
ASSET_NAME_MP64_DECOMPRESSED_SZ);
athena::io::MemoryReader ar(decompressed, ASSET_NAME_MP64_DECOMPRESSED_SZ);
LoadAssetMap(ar);
delete[](decompressed);
} else {
Log.report(logvisor::Warning,
fmt(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files.")));
}
g_AssetNameMapInit = true;
}

View File

@@ -0,0 +1,9 @@
#include <cstddef>
#include <cstdint>
extern "C" const uint8_t ASSET_NAME_MP32[] = {};
extern "C" const size_t ASSET_NAME_MP32_SZ = 0;
extern "C" const size_t ASSET_NAME_MP32_DECOMPRESSED_SZ = 0;
extern "C" const uint8_t ASSET_NAME_MP64[] = {};
extern "C" const size_t ASSET_NAME_MP64_SZ = 0;
extern "C" const size_t ASSET_NAME_MP64_DECOMPRESSED_SZ = 0;

View File

@@ -42,11 +42,11 @@ bintoc(RetroMasterShader.cpp Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
# Download asset name databases
add_custom_command(OUTPUT AssetNameMap32.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake)
bintoc(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
bintoc_compress(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
add_custom_command(OUTPUT AssetNameMap64.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake)
bintoc(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
bintoc_compress(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
# Each game's DataSpec implementation
add_library(RetroDataSpec
@@ -65,9 +65,12 @@ add_library(RetroDataSpec
Blender/RetroMasterShader.py
AssetNameMap.hpp
AssetNameMap.cpp
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp
RetroMasterShader.cpp)
add_library(AssetNameMap
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp)
add_library(AssetNameMapNull
AssetNameMapNull.cpp)
get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES)
target_include_directories(RetroDataSpec PUBLIC ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
@@ -86,4 +89,4 @@ foreach(i RANGE ${count})
target_atdna(RetroDataSpec ${src} ${header})
endforeach()
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")