diff options
author | Bad Diode <bd@badd10de.dev> | 2021-05-23 23:59:43 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-05-23 23:59:43 +0200 |
commit | f4d0f4f9e3563644129e672081c97c589103cf5a (patch) | |
tree | 3ee06a137b33e7f0e346271a5e38ed097e915c02 | |
parent | 596ef772d75b6ec50f196c1f9288d3dc5391b8d6 (diff) | |
download | uxngba-f4d0f4f9e3563644129e672081c97c589103cf5a.tar.gz uxngba-f4d0f4f9e3563644129e672081c97c589103cf5a.zip |
Fix warnings and compilation issues on macOS
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | src/filesystem.c | 2 | ||||
-rw-r--r-- | src/uxn/devices/ppu.c | 10 |
3 files changed, 13 insertions, 10 deletions
@@ -18,7 +18,7 @@ SRC_MAIN := $(SRC_DIR)/main.c | |||
18 | ROM := $(BUILD_DIR)/rom.c | 18 | ROM := $(BUILD_DIR)/rom.c |
19 | ROM_SRC := roms/dvd.rom | 19 | ROM_SRC := roms/dvd.rom |
20 | ASM_FILES := $(wildcard $(SRC_DIR)/*.s) | 20 | ASM_FILES := $(wildcard $(SRC_DIR)/*.s) |
21 | WATCH_SRC := $(shell find $(SRC_DIRS) -name *.c -or -name *.s -or -name *.h) | 21 | WATCH_SRC := $(shell find $(SRC_DIR) -name *.c -or -name *.s -or -name *.h) |
22 | INC_DIRS := $(shell find $(SRC_DIR) -type d) | 22 | INC_DIRS := $(shell find $(SRC_DIR) -type d) |
23 | INC_DIRS += $(BUILD_DIR) | 23 | INC_DIRS += $(BUILD_DIR) |
24 | INC_FLAGS := $(addprefix -I,$(INC_DIRS)) | 24 | INC_FLAGS := $(addprefix -I,$(INC_DIRS)) |
@@ -29,6 +29,9 @@ TARGET := uxngba | |||
29 | ELF := $(BUILD_DIR)/$(TARGET).elf | 29 | ELF := $(BUILD_DIR)/$(TARGET).elf |
30 | BIN := $(BUILD_DIR)/$(TARGET).gba | 30 | BIN := $(BUILD_DIR)/$(TARGET).gba |
31 | 31 | ||
32 | # Target tools. | ||
33 | TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr | ||
34 | |||
32 | # Compiler and linker configuration. | 35 | # Compiler and linker configuration. |
33 | CC := $(DEVKITBIN)/arm-none-eabi-gcc | 36 | CC := $(DEVKITBIN)/arm-none-eabi-gcc |
34 | OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy | 37 | OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy |
@@ -57,9 +60,9 @@ else | |||
57 | CFLAGS += $(RELEASE_CFLAGS) | 60 | CFLAGS += $(RELEASE_CFLAGS) |
58 | endif | 61 | endif |
59 | 62 | ||
60 | main: tools $(BUILD_DIR) $(ROM) $(BIN) | 63 | main: $(BUILD_DIR) $(ROM) $(BIN) |
61 | 64 | ||
62 | $(ROM): | 65 | $(ROM): $(TOOLS_BIN2CARR) |
63 | ./tools/bin2carr/build/bin2carr -n uxn_rom -e u16 -o $(ROM) $(ROM_SRC) | 66 | ./tools/bin2carr/build/bin2carr -n uxn_rom -e u16 -o $(ROM) $(ROM_SRC) |
64 | 67 | ||
65 | # Strip and fix header to create final .gba file. | 68 | # Strip and fix header to create final .gba file. |
@@ -83,5 +86,5 @@ run: main | |||
83 | clean: | 86 | clean: |
84 | rm -rf $(BUILD_DIR) | 87 | rm -rf $(BUILD_DIR) |
85 | 88 | ||
86 | tools: | 89 | $(TOOLS_BIN2CARR): |
87 | make -C tools/bin2carr | 90 | make -C tools/bin2carr |
diff --git a/src/filesystem.c b/src/filesystem.c index 5732e40..6737386 100644 --- a/src/filesystem.c +++ b/src/filesystem.c | |||
@@ -55,7 +55,7 @@ fs_init() { | |||
55 | // Initialize filesystem. | 55 | // Initialize filesystem. |
56 | filesystem.num_files = 0; | 56 | filesystem.num_files = 0; |
57 | filesystem.data_size = 0; | 57 | filesystem.data_size = 0; |
58 | filesystem.data_capacity = 27 * FILE_MAX_SIZE; | 58 | filesystem.data_capacity = (u16)(FILE_CAPACITY * FILE_MAX_SIZE); |
59 | memset(&filesystem.files, 0, FILE_CAPACITY * sizeof(File)); | 59 | memset(&filesystem.files, 0, FILE_CAPACITY * sizeof(File)); |
60 | _fs_write(&filesystem, FILE_HEADER_OFFSET, offsetof(FileSystem, files)); | 60 | _fs_write(&filesystem, FILE_HEADER_OFFSET, offsetof(FileSystem, files)); |
61 | } else { | 61 | } else { |
diff --git a/src/uxn/devices/ppu.c b/src/uxn/devices/ppu.c index e453726..7a4429c 100644 --- a/src/uxn/devices/ppu.c +++ b/src/uxn/devices/ppu.c | |||
@@ -329,11 +329,11 @@ toggle_keyboard(void) { | |||
329 | } | 329 | } |
330 | 330 | ||
331 | void | 331 | void |
332 | update_cursor(int pos) { | 332 | update_cursor(u8 pos) { |
333 | cursor_position = CLAMP(pos, 0, LEN(keyboard) - 1); | 333 | cursor_position = CLAMP(pos, 0, LEN(keyboard) - 1); |
334 | OBJ_ATTR_0(127) = OBJ_ATTR_0(127) & ~0xFF | 334 | OBJ_ATTR_0(127) = (OBJ_ATTR_0(127) & ~0xFF) |
335 | | OBJ_Y_COORD(keyboard[cursor_position].y); | 335 | | OBJ_Y_COORD(keyboard[cursor_position].y); |
336 | OBJ_ATTR_1(127) = OBJ_ATTR_0(127) & ~0x1FF | 336 | OBJ_ATTR_1(127) = (OBJ_ATTR_0(127) & ~0x1FF) |
337 | | OBJ_X_COORD(keyboard[cursor_position].x); | 337 | | OBJ_X_COORD(keyboard[cursor_position].x); |
338 | } | 338 | } |
339 | 339 | ||
@@ -403,7 +403,7 @@ initppu(Ppu *p, u8 hor, u8 ver, u8 pad) { | |||
403 | keyboard[i].y = tile_y * 8; | 403 | keyboard[i].y = tile_y * 8; |
404 | OBJ_ATTR_0(i) = OBJ_SHAPE_SQUARE | OBJ_Y_COORD(keyboard[i].y); | 404 | OBJ_ATTR_0(i) = OBJ_SHAPE_SQUARE | OBJ_Y_COORD(keyboard[i].y); |
405 | OBJ_ATTR_1(i) = OBJ_SIZE_SMALL | OBJ_X_COORD(keyboard[i].x); | 405 | OBJ_ATTR_1(i) = OBJ_SIZE_SMALL | OBJ_X_COORD(keyboard[i].x); |
406 | OBJ_ATTR_2(i) = SPRITE_START_IDX + keyboard[i].symbol | OBJ_PAL_BANK(0); | 406 | OBJ_ATTR_2(i) = (SPRITE_START_IDX + keyboard[i].symbol) | OBJ_PAL_BANK(0); |
407 | tile_x++; | 407 | tile_x++; |
408 | if (tile_x - KEYBOARD_START_TILE_X >= KEYBOARD_ROW_SIZE) { | 408 | if (tile_x - KEYBOARD_START_TILE_X >= KEYBOARD_ROW_SIZE) { |
409 | tile_x = KEYBOARD_START_TILE_X; | 409 | tile_x = KEYBOARD_START_TILE_X; |
@@ -412,7 +412,7 @@ initppu(Ppu *p, u8 hor, u8 ver, u8 pad) { | |||
412 | } | 412 | } |
413 | OBJ_ATTR_0(127) = OBJ_SHAPE_SQUARE | OBJ_Y_COORD(keyboard[cursor_position].y); | 413 | OBJ_ATTR_0(127) = OBJ_SHAPE_SQUARE | OBJ_Y_COORD(keyboard[cursor_position].y); |
414 | OBJ_ATTR_1(127) = OBJ_SIZE_SMALL | OBJ_X_COORD(keyboard[cursor_position].x); | 414 | OBJ_ATTR_1(127) = OBJ_SIZE_SMALL | OBJ_X_COORD(keyboard[cursor_position].x); |
415 | OBJ_ATTR_2(127) = SPRITE_START_IDX + 0xdb | OBJ_PAL_BANK(3); | 415 | OBJ_ATTR_2(127) = (SPRITE_START_IDX + 0xdb) | OBJ_PAL_BANK(3); |
416 | 416 | ||
417 | return 1; | 417 | return 1; |
418 | } | 418 | } |