mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Added flag to work as a library
This commit is contained in:
+7
-1
@@ -13,12 +13,18 @@ file(GLOB C_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c ${CMAKE_CURRENT_SOURCE_DIR
|
||||
set(SRC_DIR ${CXX_FILES} ${C_FILES})
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
|
||||
set(USE_STANDALONE ON)
|
||||
set(VPKTOOL_BUILD_GUI OFF)
|
||||
set(VPKTOOL_BUILD_TESTS OFF)
|
||||
set(VPKTOOL_BUILD_INSTALLER OFF)
|
||||
|
||||
# Build
|
||||
add_executable(${PROJECT_NAME} ${SRC_DIR})
|
||||
if (USE_STANDALONE)
|
||||
add_definitions(-DSTANDALONE)
|
||||
add_executable(${PROJECT_NAME} ${SRC_DIR})
|
||||
else()
|
||||
add_library(${PROJECT_NAME} SHARED ${SRC_DIR})
|
||||
endif()
|
||||
|
||||
# Fetch Dependencies
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/binarytools)
|
||||
|
||||
@@ -97,6 +97,7 @@ void Companion::Process() {
|
||||
|
||||
LUS::BinaryWriter write = LUS::BinaryWriter();
|
||||
RawFactory* factory = this->GetFactory(type);
|
||||
factory->SetCartridge(cartridge);
|
||||
|
||||
spdlog::set_pattern(regular);
|
||||
SPDLOG_INFO("------------------------------------------------");
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
#include "audio/AudioManager.h"
|
||||
#include "audio/samples_table.h"
|
||||
#include "binarytools/BinaryReader.h"
|
||||
#include "Companion.h"
|
||||
|
||||
bool BankFactory::process(LUS::BinaryWriter* writer, YAML::Node& data, std::vector<uint8_t>& buffer) {
|
||||
auto banks = AudioManager::Instance->get_banks();
|
||||
auto bankId = data["id"].as<uint32_t>();
|
||||
auto bank = banks[bankId];
|
||||
|
||||
auto gSampleTable = Companion::Instance->GetCartridge()->GetCountry() == N64::CountryCode::Japan ? gJPSampleTable : gUSSampleTable;
|
||||
auto gSampleTable = this->GetCartridge()->GetCountry() == N64::CountryCode::Japan ? gJPSampleTable : gUSSampleTable;
|
||||
|
||||
WRITE_HEADER(LUS::ResourceType::Bank, 0);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ResourceType.h"
|
||||
#include "n64/Cartridge.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
@@ -27,4 +28,12 @@ public:
|
||||
RawFactory() = default;
|
||||
virtual bool process(LUS::BinaryWriter* write, YAML::Node& data, std::vector<uint8_t>& buffer) = 0;
|
||||
void WriteHeader(LUS::BinaryWriter* write, LUS::ResourceType resType, int32_t version);
|
||||
inline void SetCartridge(N64::Cartridge* cart) {
|
||||
this->cartdrige = cart;
|
||||
}
|
||||
inline N64::Cartridge* GetCartridge() {
|
||||
return this->cartdrige;
|
||||
}
|
||||
private:
|
||||
N64::Cartridge* cartdrige;
|
||||
};
|
||||
+3
-1
@@ -2,6 +2,7 @@
|
||||
#include "CLI11.hpp"
|
||||
#include "Companion.h"
|
||||
|
||||
#ifdef STANDALONE
|
||||
Companion* Companion::Instance;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@@ -19,4 +20,5 @@ int main(int argc, char *argv[]) {
|
||||
Companion::Instance = new Companion(filename);
|
||||
Companion::Instance->Init();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user