-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
4,347 additions
and
3,366 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CLion | ||
.idea/ | ||
cmake-build-dbg/ | ||
cmake-build-release/ | ||
*.iml | ||
|
||
# General | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
project(alicia_modder) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) | ||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) | ||
|
||
if (NOT EXISTS "${CMAKE_BINARY_DIR}/cmake/conan.cmake") | ||
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") | ||
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake" | ||
"${CMAKE_BINARY_DIR}/cmake/conan.cmake" | ||
TLS_VERIFY ON) | ||
endif () | ||
|
||
include(${CMAKE_BINARY_DIR}/cmake/conan.cmake) | ||
conan_cmake_configure(REQUIRES spdlog/1.8.5 ctre/3.4.1 cxxopts/2.2.1 imgui/1.83 zlib/1.2.11 | ||
GENERATORS cmake_find_package) | ||
conan_cmake_autodetect(settings) | ||
conan_cmake_install(PATH_OR_REFERENCE . | ||
BUILD missing | ||
REMOTE conan-center | ||
SETTINGS ${settings}) | ||
|
||
find_package(spdlog) | ||
find_package(imgui) | ||
find_package(ctre) | ||
find_package(cxxopts) | ||
find_package(ZLIB) | ||
link_libraries(spdlog::spdlog ctre::ctre cxxopts::cxxopts imgui::imgui d3d9 ZLIB::ZLIB) | ||
|
||
set(AM_VENDOR_SOURCES | ||
vendor/imgui/imgui_impl_win32.h | ||
vendor/imgui/imgui_impl_win32.cpp | ||
vendor/imgui/imgui_impl_dx9.h | ||
vendor/imgui/imgui_impl_dx9.cpp | ||
) | ||
|
||
set(AM_SOURCES | ||
source/main/buffer/buffer.cpp | ||
source/main/buffer/buffer.hpp | ||
source/main/main.cpp | ||
|
||
source/main/mod/alicia/game/alicia_modder.cpp | ||
source/main/mod/alicia/game/alicia_modder.hpp | ||
|
||
source/main/interface/interface.hpp | ||
source/main/interface/interface.cpp | ||
|
||
source/main/tools/dbg/debugger.hpp | ||
source/main/tools/dbg/debugger.cpp | ||
|
||
source/main/mod/alicia/launcher/launcher_modder.cpp | ||
source/main/mod/alicia/launcher/launcher_modder.hpp | ||
|
||
source/main/interface/views/data_view.cpp | ||
source/main/interface/views/data_view.hpp | ||
|
||
source/main/tools/assets/defs.hpp | ||
|
||
source/main/tools/rw/defs.hpp source/main/tools/assets/assets.cpp source/main/tools/assets/assets.hpp source/main/helpers/filesystem.cpp source/main/helpers/filesystem.hpp source/main/mod/alicia/assets/assets_modder.cpp source/main/mod/alicia/assets/assets_modder.hpp) | ||
|
||
include_directories(vendor/) | ||
include_directories(source/) | ||
|
||
add_executable(alicia_modder ${AM_VENDOR_SOURCES} ${AM_SOURCES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// | ||
// Created by maros on 31/05/2021. | ||
// | ||
|
||
#include "buffer.hpp" | ||
#include "cstdio" | ||
#include "string.h" | ||
|
||
buffer::stack_buffer::stack_buffer(const void *dataPtr, size_t dataLen) : | ||
m_buffer((uint8_t *) dataPtr), m_bufferLength(dataLen), m_bufferCursor(0) { | ||
} | ||
|
||
|
||
|
||
|
||
void buffer::stack_buffer::setCursor(size_t pos) { | ||
this->m_bufferCursor = pos; | ||
} | ||
|
||
void buffer::stack_buffer::resetCursor() { | ||
this->m_bufferCursor = 0; | ||
} | ||
|
||
size_t buffer::stack_buffer::getCursor() const { | ||
return this->m_bufferCursor; | ||
} | ||
|
||
uint8_t *buffer::stack_buffer::dataPtr() const { | ||
return this->m_buffer; | ||
} | ||
|
||
size_t buffer::stack_buffer::getLength() const { | ||
return this->m_bufferLength; | ||
} | ||
|
||
size_t buffer::stack_buffer::getSize() const { | ||
return this->m_bufferLength; | ||
} | ||
|
||
uint8_t buffer::stack_buffer::readUnsignedByte() { | ||
if (m_bufferCursor > m_bufferLength) | ||
return 0; | ||
const auto result = m_buffer[m_bufferCursor++]; | ||
return result; | ||
} | ||
|
||
void buffer::stack_buffer::writeUnsignedByte(uint8_t byte) { | ||
m_buffer[m_bufferCursor++] = byte; | ||
} | ||
|
||
uint8_t buffer::stack_buffer::peekUnsignedByte() const { | ||
return m_buffer[m_bufferCursor]; | ||
} | ||
|
||
int8_t buffer::stack_buffer::readByte() { | ||
return (int8_t) readUnsignedByte(); | ||
} | ||
|
||
void buffer::stack_buffer::writeByte(int8_t byte) { | ||
writeUnsignedByte((uint8_t) byte); | ||
} | ||
|
||
int8_t buffer::stack_buffer::peekByte() const { | ||
return (int8_t) peekUnsignedByte(); | ||
} | ||
|
||
|
||
|
||
uint16_t buffer::stack_buffer::readUnsignedShort() { | ||
return (uint16_t) (readUnsignedByte() + (readUnsignedByte() << 8)); | ||
} | ||
|
||
void buffer::stack_buffer::writeUnsignedShort(uint16_t val) { | ||
writeUnsignedByte(val & 0xFF); | ||
writeUnsignedByte(val >> 8); | ||
} | ||
|
||
uint16_t buffer::stack_buffer::peekUnsignedShort() const { | ||
return (uint16_t) (peekUnsignedByte() + (peekUnsignedByte() << 8)); | ||
} | ||
|
||
int16_t buffer::stack_buffer::readShort() { | ||
return (int16_t) readUnsignedShort(); | ||
} | ||
|
||
void buffer::stack_buffer::writeShort(int16_t val) { | ||
writeUnsignedShort((uint16_t) val); | ||
} | ||
|
||
int16_t buffer::stack_buffer::peekShort() const { | ||
return (int16_t) peekUnsignedShort(); | ||
} | ||
|
||
|
||
uint32_t buffer::stack_buffer::readUnsignedInteger() { | ||
uint16_t least = readUnsignedShort(); | ||
uint32_t most = readUnsignedShort() << 16; | ||
return (uint32_t) (least+most); | ||
} | ||
|
||
void buffer::stack_buffer::writeUnsignedInteger(uint32_t val) { | ||
writeUnsignedShort(val & 0xFFFF); | ||
writeUnsignedShort(val << 16); | ||
} | ||
|
||
uint32_t buffer::stack_buffer::peekUnsignedInteger() const { | ||
return (uint32_t) (peekUnsignedShort() + (peekUnsignedShort() << 16)); | ||
} | ||
|
||
int32_t buffer::stack_buffer::readInteger() { | ||
return (int32_t) readUnsignedInteger(); | ||
} | ||
|
||
void buffer::stack_buffer::writeInteger(int32_t val) { | ||
writeUnsignedInteger((uint16_t) val); | ||
} | ||
|
||
int32_t buffer::stack_buffer::peekInteger() const { | ||
return (int32_t) peekUnsignedInteger(); | ||
} | ||
|
Oops, something went wrong.