Code cleanup + procedures for cleanup

This commit is contained in:
dingusdev 2020-02-27 21:03:01 -07:00
parent 51739520b5
commit c8611dc293
5 changed files with 28 additions and 6 deletions

View File

@ -5,22 +5,27 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
add_subdirectory("${PROJECT_SOURCE_DIR}/cpu/ppc/")
add_subdirectory("${PROJECT_SOURCE_DIR}/devices/")
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/")
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/devices"
"${PROJECT_SOURCE_DIR}/cpu/ppc"
"${PROJECT_SOURCE_DIR}/debugger")
"${PROJECT_SOURCE_DIR}/debugger"
"${PROJECT_SOURCE_DIR}/thirdparty")
file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/*.cpp"
"${PROJECT_SOURCE_DIR}/debugger/*.cpp")
file(GLOB TEST_SOURCES "${PROJECT_SOURCE_DIR}/cpu/ppc/test/*.cpp")
add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:cpu_ppc> $<TARGET_OBJECTS:devices>)
add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:cpu_ppc> $<TARGET_OBJECTS:devices>
$<TARGET_OBJECTS:loguru>)
add_executable(testppc ${TEST_SOURCES} $<TARGET_OBJECTS:cpu_ppc> $<TARGET_OBJECTS:devices>)
add_executable(testppc ${TEST_SOURCES} $<TARGET_OBJECTS:cpu_ppc> $<TARGET_OBJECTS:devices>
$<TARGET_OBJECTS:loguru>)
add_custom_command(
TARGET testppc POST_BUILD

View File

@ -10,7 +10,18 @@ Code
* Make sure the code can compile for all target systems - Windows, Linux, and macOS/Mac OS X.
* All code must be compatible with at least C++11.
* Minimize the amount of redundant code
* Minimize the amount of redundant code.
* Avoid using absolute paths for the headers.
* Code should maintain vertical alignment. An example of this is provided below:
> one_hundred = 100;
> one_thousand = 1000;
** The following should be avoided:
> one_hundred = 100;
> one_thousand = 1000;
* CamelCase for class names, lowercase for variables, UPPERCASE for enumerations
Issues
=======

View File

@ -5,7 +5,7 @@
//if you want to distribute this.
//(divingkatae#1017 or powermax#2286 on Discord)
#include <thirdparty/loguru.cpp>
#include <thirdparty/loguru.hpp>
#include <stdio.h>
#include <string>
#include <iostream>

View File

@ -131,7 +131,7 @@ int main(int argc, char **argv)
configInfoOffset = (uint32_t)(configGrab & 0xff);
uint32_t configInfoAddr = 0x300000 + (configInfoOffset << 8) + 0x69; //address to check the identifier string
char memPPCBlock[5]; //First four chars are enough to distinguish between codenames
char memPPCBlock[5] = { 0 }; //First four chars are enough to distinguish between codenames
romFile.seekg (configInfoAddr, ios::beg);
romFile.read(memPPCBlock, 4);
memPPCBlock[4] = 0;

6
thirdparty/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
include_directories("${PROJECT_SOURCE_DIR}")
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/loguru.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/loguru.hpp")
add_library(loguru OBJECT ${SOURCES})