Skip to content

Commit

Permalink
update for phosg namespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzziqersoftware committed Aug 18, 2024
1 parent c423174 commit 486cef4
Show file tree
Hide file tree
Showing 24 changed files with 596 additions and 621 deletions.
30 changes: 13 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.27)



Expand All @@ -14,51 +14,47 @@ else()
add_compile_options(-Wall -Wextra -Werror -Wno-strict-aliasing)
endif()

set(LOCAL_INCLUDE_DIR "/usr/local/include")
set(LOCAL_LIB_DIR "/usr/local/lib")
list(APPEND CMAKE_PREFIX_PATH ${LOCAL_LIB_DIR})
include_directories(${LOCAL_INCLUDE_DIR})
link_directories(${LOCAL_LIB_DIR})

find_path(SAMPLERATE_INCLUDE_DIR NAMES samplerate.h)
find_library(SAMPLERATE_LIBRARY NAMES samplerate)
find_package(phosg REQUIRED)
find_package(phosg-audio REQUIRED)



# Library definitions

add_library(prs src/prs/PRSDataLog.cc src/prs/PRS.cc src/prs/Yay0.cc src/prs/Yaz0.cc)
target_link_libraries(prs phosg::phosg)



# Executable definitions

find_package(OpenAL REQUIRED)

set(SimpleExecutableNames afsdump gcmasm gcmdump gsldump gvmdump rcfdump)
set(AllExecutableNames ${SimpleExecutableNames} pae2gvm prsd smsdumpbanks smssynth modsynth)

foreach(ExecutableName IN ITEMS ${SimpleExecutableNames})
add_executable(${ExecutableName} src/${ExecutableName}.cc)
target_link_libraries(${ExecutableName} phosg)
target_link_libraries(${ExecutableName} phosg::phosg)
endforeach()

add_executable(pae2gvm src/pae2gvm.cc)
target_link_libraries(pae2gvm phosg prs)
target_link_libraries(pae2gvm prs)

add_executable(prsd src/prs/main.cc)
target_link_libraries(prsd phosg prs)
target_link_libraries(prsd prs)

add_executable(smsdumpbanks src/sms/smsdumpbanks.cc src/sms/aaf.cc src/sms/afc.cc src/sms/instrument.cc)
target_include_directories(smsdumpbanks PUBLIC ${OPENAL_INCLUDE_DIR})
target_link_libraries(smsdumpbanks phosg phosg-audio ${OPENAL_LIBRARY})
target_link_libraries(smsdumpbanks phosg-audio::phosg-audio ${OPENAL_LIBRARY})

add_executable(smssynth src/sms/smssynth.cc src/sms/SampleCache.cc src/sms/aaf.cc src/sms/afc.cc src/sms/instrument.cc)
target_include_directories(smssynth PUBLIC ${OPENAL_INCLUDE_DIR})
target_link_libraries(smssynth phosg phosg-audio samplerate ${OPENAL_LIBRARY})
target_include_directories(smssynth PUBLIC ${OPENAL_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIR})
target_link_libraries(smssynth phosg-audio::phosg-audio ${SAMPLERATE_LIBRARY} ${OPENAL_LIBRARY})

add_executable(modsynth src/sms/modsynth.cc src/sms/SampleCache.cc)
target_include_directories(modsynth PUBLIC ${OPENAL_INCLUDE_DIR})
target_link_libraries(modsynth phosg phosg-audio samplerate ${OPENAL_LIBRARY})
target_include_directories(modsynth PUBLIC ${OPENAL_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIR})
target_link_libraries(modsynth phosg-audio::phosg-audio ${SAMPLERATE_LIBRARY} ${OPENAL_LIBRARY})



Expand Down
12 changes: 6 additions & 6 deletions src/afsdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
using namespace std;

struct AFSHeader {
uint32_t magic;
uint32_t num_files;
phosg::le_uint32_t magic;
phosg::le_uint32_t num_files;
struct {
uint32_t offset;
uint32_t size;
phosg::le_uint32_t offset;
phosg::le_uint32_t size;
} entries[0];
};

Expand All @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) {
return 1;
}

string data = load_file(argv[1]);
string data = phosg::load_file(argv[1]);

const AFSHeader* header = reinterpret_cast<const AFSHeader*>(data.data());
if (header->magic != 0x00534641) {
Expand All @@ -34,7 +34,7 @@ int main(int argc, char* argv[]) {
throw runtime_error("file size exceeds archive boundary");
}

string output_filename = string_printf("%s-%zu", argv[1], x);
string output_filename = phosg::string_printf("%s-%zu", argv[1], x);
save_file(
output_filename,
data.data() + header->entries[x].offset,
Expand Down
Loading

0 comments on commit 486cef4

Please sign in to comment.