Skip to content

Commit

Permalink
allow vs code debug
Browse files Browse the repository at this point in the history
  • Loading branch information
xesf committed Oct 27, 2024
1 parent 628e9d4 commit 3459cce
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ Module.symvers
Mkfile.old
dkms.conf
.DS_Store
.vscode
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug TimeCo",
"program": "${workspaceFolder}/bin/us/timeco",
"args": [],
"cwd": "${workspaceFolder}/bin/us/",
"preLaunchTask": "build-timeco"
}
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"files.associations": {
"state.h": "c",
"common.h": "c",
"__config": "c",
"__hash_table": "c",
"map": "c",
"optional": "c",
"unordered_map": "c",
"file_reader.h": "c",
"platform_mixer.h": "c"
}
}
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build-timeco",
"type": "shell",
"command": "make && make install",
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GAME := us

CC = $(shell brew --prefix llvm)/bin/clang

CFLAGS = -std=c99 -Wall -Wno-missing-braces -DDEBUG
CFLAGS = -std=c99 -Wall -Wno-missing-braces -g -DDEBUG
LDFLAGS =

ROOT = ./
Expand Down
18 changes: 10 additions & 8 deletions src/acf.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ void rc_motion_4_decode() {

// load one byte, apply it to the entire tile
void single_colour_fill_decode() {
u8 colorTile = *unaligned_stream++;
u8 colour_tile = *unaligned_stream++;
for (i32 y = 0; y < 8; y++) {
memset(current_tile + y * frame_width, colorTile, 8);
memset(current_tile + y * frame_width, colour_tile, 8);
}
}

Expand Down Expand Up @@ -768,11 +768,11 @@ void acf_play(const u8 *filename) {

frclose(&fr);

u8* previous_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
u8* previous_frame_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
u8* previous_tile = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
u8* current_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
u8* current_tile = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
previous_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
previous_frame_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
previous_tile = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
// current_buffer = (u8 *)malloc(frame_width * frame_height * sizeof(u8));
current_tile = (u8 *)malloc(frame_width * frame_height * sizeof(u8));

current_chunk = (chunk_t*)file_ptr;
printf("current_chunk: %p\n", current_chunk);
Expand Down Expand Up @@ -876,7 +876,9 @@ void acf_play(const u8 *filename) {
free(previous_buffer);
free(previous_frame_buffer);
free(previous_tile);
free(current_buffer);
// if (current_buffer) {
// free(current_buffer);
// }
free(current_tile);
free(file_ptr);
}

0 comments on commit 3459cce

Please sign in to comment.