Skip to content

Commit

Permalink
renamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai committed Apr 26, 2024
1 parent 54a387a commit 30044d6
Show file tree
Hide file tree
Showing 234 changed files with 1,666 additions and 1,656 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ file(GLOB_RECURSE Source_Files__Controller RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
if (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/controldevice/controller/mapping/keyboard/*")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/controldevice/controller/mapping/sdl/*")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/deviceindex/LUSDeviceIndexToSDLDeviceIndexMapping.*")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/deviceindex/ShipDKDeviceIndexToSDLDeviceIndexMapping.*")
else()
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/controldevice/controller/mapping/wiiu/*")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/deviceindex/LUSDeviceIndexToWiiUDeviceIndexMapping.*")
list(FILTER Source_Files__Controller EXCLUDE REGEX "controller/deviceindex/ShipDKDeviceIndexToWiiUDeviceIndexMapping.*")
endif()

source_group("controller" FILES ${Source_Files__Controller})
Expand Down
12 changes: 6 additions & 6 deletions src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "port/wiiu/WiiUImpl.h"
#endif

namespace LUS {
namespace ShipDK {
std::weak_ptr<Context> Context::mContext;

std::shared_ptr<Context> Context::GetInstance() {
Expand Down Expand Up @@ -211,7 +211,7 @@ void Context::InitResourceManager(const std::vector<std::string>& otrFiles,
#if defined(__SWITCH__)
printf("Main OTR file not found!\n");
#elif defined(__WIIU__)
LUS::WiiU::ThrowMissingOTR(mMainPath.c_str());
ShipDK::WiiU::ThrowMissingOTR(mMainPath.c_str());
#else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OTR file not found",
"Main OTR file not found. Please generate one", nullptr);
Expand All @@ -220,7 +220,7 @@ void Context::InitResourceManager(const std::vector<std::string>& otrFiles,
return;
}
#ifdef __SWITCH__
LUS::Switch::Init(PostInitPhase);
ShipDK::Switch::Init(PostInitPhase);
#endif
}

Expand Down Expand Up @@ -254,7 +254,7 @@ void Context::InitGfxDebugger() {
return;
}

mGfxDebugger = std::make_shared<GfxDebugger>();
mGfxDebugger = std::make_shared<LUS::GfxDebugger>();
}

void Context::InitConsole() {
Expand Down Expand Up @@ -311,7 +311,7 @@ std::shared_ptr<Audio> Context::GetAudio() {
return mAudio;
}

std::shared_ptr<GfxDebugger> Context::GetGfxDebugger() {
std::shared_ptr<LUS::GfxDebugger> Context::GetGfxDebugger() {
return mGfxDebugger;
}

Expand Down Expand Up @@ -417,4 +417,4 @@ std::string Context::LocateFileAcrossAppDirs(const std::string path, std::string
return "./" + std::string(path);
}

} // namespace LUS
} // namespace ShipDK
10 changes: 5 additions & 5 deletions src/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "window/Window.h"
#include "config/ConsoleVariable.h"
#include "debug/Console.h"
#include "debug/GfxDebugger.h"

namespace LUS {
class GfxDebugger;
namespace ShipDK {

class Context {
public:
Expand Down Expand Up @@ -48,7 +48,7 @@ class Context {
std::shared_ptr<Window> GetWindow();
std::shared_ptr<Console> GetConsole();
std::shared_ptr<Audio> GetAudio();
std::shared_ptr<GfxDebugger> GetGfxDebugger();
std::shared_ptr<LUS::GfxDebugger> GetGfxDebugger();

std::string GetConfigFilePath();
std::string GetName();
Expand Down Expand Up @@ -81,7 +81,7 @@ class Context {
std::shared_ptr<Window> mWindow;
std::shared_ptr<Console> mConsole;
std::shared_ptr<Audio> mAudio;
std::shared_ptr<GfxDebugger> mGfxDebugger;
std::shared_ptr<LUS::GfxDebugger> mGfxDebugger;

std::string mConfigFilePath;
std::string mMainPath;
Expand All @@ -90,4 +90,4 @@ class Context {
std::string mName;
std::string mShortName;
};
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Context.h"

namespace LUS {
namespace ShipDK {
Audio::Audio() {
}

Expand Down Expand Up @@ -62,4 +62,4 @@ std::shared_ptr<std::vector<AudioBackend>> Audio::GetAvailableAudioBackends() {
return mAvailableAudioBackends;
}

} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <vector>
#include "audio/AudioPlayer.h"

namespace LUS {
namespace ShipDK {
enum class AudioBackend { WASAPI, SDL };

class Audio {
Expand All @@ -27,4 +27,4 @@ class Audio {
AudioBackend mAudioBackend;
std::shared_ptr<std::vector<AudioBackend>> mAvailableAudioBackends;
};
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/AudioPlayer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "AudioPlayer.h"
#include "spdlog/spdlog.h"

namespace LUS {
namespace ShipDK {
AudioPlayer::AudioPlayer() : mInitialized(false){};

AudioPlayer::~AudioPlayer() {
Expand All @@ -16,4 +16,4 @@ bool AudioPlayer::Init(void) {
bool AudioPlayer::IsInitialized(void) {
return mInitialized;
}
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/AudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "stddef.h"
#include <string>

namespace LUS {
namespace ShipDK {
class AudioPlayer {

public:
Expand All @@ -27,7 +27,7 @@ class AudioPlayer {
private:
bool mInitialized;
};
} // namespace LUS
} // namespace ShipDK

#ifdef _WIN32
#include "WasapiAudioPlayer.h"
Expand Down
4 changes: 2 additions & 2 deletions src/audio/SDLAudioPlayer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "SDLAudioPlayer.h"
#include <spdlog/spdlog.h>

namespace LUS {
namespace ShipDK {
SDLAudioPlayer::SDLAudioPlayer() : AudioPlayer() {
}

Expand Down Expand Up @@ -46,4 +46,4 @@ void SDLAudioPlayer::Play(const uint8_t* buf, size_t len) {
SDL_QueueAudio(mDevice, buf, len);
}
}
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/SDLAudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "AudioPlayer.h"
#include <SDL2/SDL.h>

namespace LUS {
namespace ShipDK {
class SDLAudioPlayer : public AudioPlayer {
public:
SDLAudioPlayer();
Expand All @@ -18,4 +18,4 @@ class SDLAudioPlayer : public AudioPlayer {
private:
SDL_AudioDeviceID mDevice;
};
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/audio/WasapiAudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);

namespace LUS {
namespace ShipDK {
WasapiAudioPlayer::WasapiAudioPlayer()
: mRefCount(1), mBufferFrameCount(0), mInitialized(false), mStarted(false), AudioPlayer(){};

Expand Down Expand Up @@ -164,5 +164,5 @@ HRESULT STDMETHODCALLTYPE WasapiAudioPlayer::QueryInterface(REFIID riid, VOID**
}
return S_OK;
}
} // namespace LUS
} // namespace ShipDK
#endif
4 changes: 2 additions & 2 deletions src/audio/WasapiAudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace Microsoft::WRL;

namespace LUS {
namespace ShipDK {
class WasapiAudioPlayer : public AudioPlayer, public IMMNotificationClient {
public:
WasapiAudioPlayer();
Expand Down Expand Up @@ -41,5 +41,5 @@ class WasapiAudioPlayer : public AudioPlayer, public IMMNotificationClient {
bool mInitialized;
bool mStarted;
};
} // namespace LUS
} // namespace ShipDK
#endif
4 changes: 2 additions & 2 deletions src/config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace fs = std::filesystem;

namespace LUS {
namespace ShipDK {
Config::Config(std::string path) : mPath(std::move(path)), mIsNewInstance(false) {
Reload();
}
Expand Down Expand Up @@ -284,4 +284,4 @@ uint32_t ConfigVersionUpdater::GetVersion() {
return mVersion;
}

} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "audio/Audio.h"
#include "window/Window.h"

namespace LUS {
namespace ShipDK {

/**
* @brief Abstract class representing a Config Version Updater, intended to express how to
Expand Down Expand Up @@ -98,4 +98,4 @@ class Config {
bool mIsNewInstance;
std::map<uint32_t, std::shared_ptr<ConfigVersionUpdater>> mVersionUpdaters;
};
} // namespace LUS
} // namespace ShipDK
12 changes: 6 additions & 6 deletions src/config/ConsoleVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "config/Config.h"
#include "Context.h"

namespace LUS {
namespace ShipDK {

ConsoleVariable::ConsoleVariable() {
Load();
Expand Down Expand Up @@ -165,13 +165,13 @@ void ConsoleVariable::RegisterColor24(const char* name, Color_RGB8 defaultValue)
}

void ConsoleVariable::ClearVariable(const char* name) {
std::shared_ptr<Config> conf = LUS::Context::GetInstance()->GetConfig();
std::shared_ptr<Config> conf = ShipDK::Context::GetInstance()->GetConfig();
mVariables.erase(name);
conf->Erase(StringHelper::Sprintf("CVars.%s", name));
}

void ConsoleVariable::Save() {
std::shared_ptr<Config> conf = LUS::Context::GetInstance()->GetConfig();
std::shared_ptr<Config> conf = ShipDK::Context::GetInstance()->GetConfig();

for (const auto& variable : mVariables) {
const std::string key = StringHelper::Sprintf("CVars.%s", variable.first.c_str());
Expand Down Expand Up @@ -208,7 +208,7 @@ void ConsoleVariable::Save() {
}

void ConsoleVariable::Load() {
std::shared_ptr<Config> conf = LUS::Context::GetInstance()->GetConfig();
std::shared_ptr<Config> conf = ShipDK::Context::GetInstance()->GetConfig();
conf->Reload();

LoadFromPath("", conf->GetNestedJson()["CVars"].items());
Expand Down Expand Up @@ -265,7 +265,7 @@ void ConsoleVariable::LoadFromPath(
}
}
void ConsoleVariable::LoadLegacy() {
auto conf = LUS::Context::GetPathRelativeToAppDirectory("cvars.cfg");
auto conf = ShipDK::Context::GetPathRelativeToAppDirectory("cvars.cfg");
if (DiskFile::Exists(conf)) {
const auto lines = DiskFile::ReadAllLines(conf);

Expand Down Expand Up @@ -312,4 +312,4 @@ void ConsoleVariable::LoadLegacy() {
fs::remove(conf);
}
}
} // namespace LUS
} // namespace ShipDK
4 changes: 2 additions & 2 deletions src/config/ConsoleVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <unordered_map>
#include <string>

namespace LUS {
namespace ShipDK {
typedef enum class ConsoleVariableType { Integer, Float, String, Color, Color24 } ConsoleVariableType;

typedef struct CVar {
Expand Down Expand Up @@ -58,4 +58,4 @@ class ConsoleVariable {
private:
std::unordered_map<std::string, std::shared_ptr<CVar>> mVariables;
};
} // namespace LUS
} // namespace ShipDK
12 changes: 6 additions & 6 deletions src/controller/controldeck/ControlDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include "controller/deviceindex/LUSDeviceIndexMappingManager.h"
#include "controller/deviceindex/ShipDKDeviceIndexMappingManager.h"

namespace LUS {
namespace ShipDK {

ControlDeck::ControlDeck(std::vector<CONTROLLERBUTTONS_T> additionalBitmasks)
: mPads(nullptr), mSinglePlayerMappingMode(false) {
for (int32_t i = 0; i < MAXCONTROLLERS; i++) {
mPorts.push_back(std::make_shared<ControlPort>(i, std::make_shared<Controller>(i, additionalBitmasks)));
}

mDeviceIndexMappingManager = std::make_shared<LUSDeviceIndexMappingManager>();
mDeviceIndexMappingManager = std::make_shared<ShipDKDeviceIndexMappingManager>();
}

ControlDeck::ControlDeck() : ControlDeck(std::vector<CONTROLLERBUTTONS_T>()) {
Expand All @@ -41,7 +41,7 @@ void ControlDeck::Init(uint8_t* controllerBits) {
#ifndef __WIIU__
// if we don't have a config for controller 1, set default keyboard bindings
if (!mPorts[0]->GetConnectedController()->HasConfig()) {
mPorts[0]->GetConnectedController()->AddDefaultMappings(LUSDeviceIndex::Keyboard);
mPorts[0]->GetConnectedController()->AddDefaultMappings(ShipDKDeviceIndex::Keyboard);
}
#endif

Expand Down Expand Up @@ -113,7 +113,7 @@ void ControlDeck::UnblockGameInput(int32_t blockId) {
mGameInputBlockers.erase(blockId);
}

std::shared_ptr<LUSDeviceIndexMappingManager> ControlDeck::GetDeviceIndexMappingManager() {
std::shared_ptr<ShipDKDeviceIndexMappingManager> ControlDeck::GetDeviceIndexMappingManager() {
return mDeviceIndexMappingManager;
}

Expand All @@ -124,4 +124,4 @@ void ControlDeck::SetSinglePlayerMappingMode(bool singlePlayer) {
bool ControlDeck::IsSinglePlayerMappingMode() {
return mSinglePlayerMappingMode;
}
} // namespace LUS
} // namespace ShipDK
12 changes: 6 additions & 6 deletions src/controller/controldeck/ControlDeck.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <vector>
#include <config/Config.h>
#include "controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h"
#include "controller/deviceindex/LUSDeviceIndexMappingManager.h"
#include "controller/deviceindex/ShipDKDeviceIndexMappingManager.h"

namespace LUS {
namespace ShipDK {

class ControlDeck {
public:
Expand All @@ -27,10 +27,10 @@ class ControlDeck {
bool IsSinglePlayerMappingMode();

#ifndef __WIIU__
bool ProcessKeyboardEvent(LUS::KbEventType eventType, LUS::KbScancode scancode);
bool ProcessKeyboardEvent(ShipDK::KbEventType eventType, ShipDK::KbScancode scancode);
#endif

std::shared_ptr<LUSDeviceIndexMappingManager> GetDeviceIndexMappingManager();
std::shared_ptr<ShipDKDeviceIndexMappingManager> GetDeviceIndexMappingManager();

private:
std::vector<std::shared_ptr<ControlPort>> mPorts = {};
Expand All @@ -40,6 +40,6 @@ class ControlDeck {

bool AllGameInputBlocked();
std::unordered_map<int32_t, bool> mGameInputBlockers;
std::shared_ptr<LUSDeviceIndexMappingManager> mDeviceIndexMappingManager;
std::shared_ptr<ShipDKDeviceIndexMappingManager> mDeviceIndexMappingManager;
};
} // namespace LUS
} // namespace ShipDK
Loading

0 comments on commit 30044d6

Please sign in to comment.