Skip to content

Commit

Permalink
Restructure APU
Browse files Browse the repository at this point in the history
It now passes Test ROM 1
  • Loading branch information
Demigod345 committed Apr 4, 2024
1 parent b014358 commit f0c5df0
Show file tree
Hide file tree
Showing 11 changed files with 790 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"files.associations": {
"chrono": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdlib": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"functional": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"string_view": "cpp",
"type_traits": "cpp",
"algorithm": "cpp",
"numeric": "cpp",
"random": "cpp",
"iosfwd": "cpp",
"limits": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"cctype": "cpp",
"cerrno": "cpp",
"cfloat": "cpp",
"climits": "cpp",
"clocale": "cpp",
"cstdarg": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwctype": "cpp",
"iterator": "cpp",
"initializer_list": "cpp",
"ios": "cpp",
"queue": "cpp",
"semaphore": "cpp",
"cinttypes": "cpp"
}
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")

find_package(SDL2 REQUIRED)

if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
endif()

add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2 SDL2::SDL2main)
add_subdirectory(src)
41 changes: 41 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

current_directory=$(pwd)
last_keyword=$(basename "$current_directory")

if [[ $last_keyword == "build" ]]; then
# Execute commands for the specified directory
echo "Executing commands for build"
echo "removing build directory"
cd ..
rm -r build
cd ..

# Add your commands here
elif [[ $last_keyword == "gbemu" ]]; then
# Execute commands for another directory
echo "Executing commands for gbemu"

if [[ -d "$current_directory/build" ]]; then
rm -r build
echo "removing build directory"
echo "making new build directory"
mkdir build
cd build
cmake ..
cmake --build . -j8
./gbemu
else
echo "making new build directory"
mkdir build
cd build
cmake ..
cmake --build . -j8
./gbemu
fi

# Add your commands here
else
# Default case if no match is found
echo "No matching directory found."
fi
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ set(SOURCES
gameBoy.cpp
mmap.cpp
graphics.cpp
audio.cpp
# -------
# Header Files
cpu.h
gameBoy.h
mmap.h
types.h
graphics.h
audio.h
)

target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
Expand Down
Loading

0 comments on commit f0c5df0

Please sign in to comment.