Skip to content

Commit

Permalink
Add failing test for issue raised in chrismaltby/gb-studio#1646
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaltby committed Nov 15, 2024
1 parent 73d8f07 commit 140f013
Show file tree
Hide file tree
Showing 86 changed files with 1,815 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test:
@for test in $(TESTS) ; do \
set -e; \
echo "# $$test"; \
$(MAKE) -C $$test settings test; \
$(MAKE) -C $$test clean settings test; \
echo ""; \
done

Expand Down
5 changes: 5 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ EMUFLAGS = \
-screenonexit ./capture.bmp

EMU_FORCE_DMG = -set "SystemMode=0"
EMU_FORCE_CGB = -set "SystemMode=1"
EMU_FORCE_SGB = -set "SystemMode=2"

TARGET = $(ROM_BUILD_DIR)/rom.gb

Expand Down Expand Up @@ -83,15 +85,18 @@ profile:

DMG:
@echo "DMG mode ON"
$(eval EMUFLAGS += $(EMU_FORCE_DMG))

CGB:
$(eval CFLAGS += -DCGB)
$(eval LFLAGS += -Wm-yC)
$(eval EMUFLAGS += $(EMU_FORCE_CGB))
@echo "CGB mode ON"

SGB:
$(eval CFLAGS += -DSGB)
$(eval LFLAGS += -Wm-ys)
$(eval EMUFLAGS += $(EMU_FORCE_SGB))
@echo "SGB mode ON"

batteryless:
Expand Down
1 change: 0 additions & 1 deletion test/Makefile.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ REL_OBJS_LOCAL = $(OBJS:$(OBJDIR)/%.o=$(REL_OBJDIR)/%.rel)
REL_OBJS = $(REL_OBJS_LOCAL:$(TOP)$(OBJDIR)/%.o=$(REL_OBJDIR)/%.rel)

CFLAGS += -Idata/include -Wa-Idata/include -I..
EMUFLAGS += $(EMU_FORCE_DMG)

$(TOP)$(OBJDIR)/test_main.o: $(TOP)test/framework/test_main.c
$(CC) $(CFLAGS) -Wf-MMD -c -o $@ $<
Expand Down
3 changes: 3 additions & 0 deletions test/actor-under-menu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include ../../Makefile.common
include ../Makefile.test
include ./Makefile.build
1 change: 1 addition & 0 deletions test/actor-under-menu/Makefile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
settings: CGB hUGE MBC5
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/bg_placeholder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BG_PLACEHOLDER_H
#define BG_PLACEHOLDER_H

// Background: placeholder

#include "gbs_types.h"

BANKREF_EXTERN(bg_placeholder)
extern const struct background_t bg_placeholder;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/bg_placeholder_tilemap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BG_PLACEHOLDER_TILEMAP_H
#define BG_PLACEHOLDER_TILEMAP_H

// Tilemap bg_placeholder_tilemap

#include "gbs_types.h"

BANKREF_EXTERN(bg_placeholder_tilemap)
extern const unsigned char bg_placeholder_tilemap[];

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BG_PLACEHOLDER_TILEMAP_ATTR_H
#define BG_PLACEHOLDER_TILEMAP_ATTR_H

// Tilemap Attr bg_placeholder_tilemap_attr

#include "gbs_types.h"

BANKREF_EXTERN(bg_placeholder_tilemap_attr)
extern const unsigned char bg_placeholder_tilemap_attr[];

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/bg_placeholder_tileset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BG_PLACEHOLDER_TILESET_H
#define BG_PLACEHOLDER_TILESET_H

// Tileset: bg_placeholder_tileset

#include "gbs_types.h"

BANKREF_EXTERN(bg_placeholder_tileset)
extern const struct tileset_t bg_placeholder_tileset;

#endif
16 changes: 16 additions & 0 deletions test/actor-under-menu/data/include/data/border.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __BORDER_H_INCLUDE
#define __BORDER_H_INCLUDE

BANKREF_EXTERN(SGB_border_chr)
BANKREF_EXTERN(SGB_border_map)
BANKREF_EXTERN(SGB_border_pal)

SIZEREF_EXTERN(SGB_border_chr)
SIZEREF_EXTERN(SGB_border_map)
SIZEREF_EXTERN(SGB_border_pal)

extern const unsigned char SGB_border_chr[];
extern const unsigned char SGB_border_map[];
extern const unsigned char SGB_border_pal[];

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/cursor_image.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CURSOR_IMAGE_H
#define CURSOR_IMAGE_H

// Cursor

#include "gbs_types.h"

BANKREF_EXTERN(cursor_image)
extern const unsigned char cursor_image[];

#endif
18 changes: 18 additions & 0 deletions test/actor-under-menu/data/include/data/data_bootstrap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef DATA_PTRS_H
#define DATA_PTRS_H

#include "bankdata.h"
#include "gbs_types.h"

extern const INT16 start_scene_x;
extern const INT16 start_scene_y;
extern const direction_e start_scene_dir;
extern const far_ptr_t start_scene;
extern const UBYTE start_player_move_speed;
extern const UBYTE start_player_anim_tick;

extern const far_ptr_t ui_fonts[];

void bootstrap_init(void) BANKED;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/font_gbs_mono.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef FONT_GBS_MONO_H
#define FONT_GBS_MONO_H

// Font gbs-mono.png

#include "gbs_types.h"

BANKREF_EXTERN(font_gbs_mono)
extern const unsigned char font_gbs_mono[];

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/frame_image.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef FRAME_IMAGE_H
#define FRAME_IMAGE_H

// Frame

#include "gbs_types.h"

BANKREF_EXTERN(frame_image)
extern const unsigned char frame_image[];

#endif
7 changes: 7 additions & 0 deletions test/actor-under-menu/data/include/data/game_globals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef GAME_GLOBALS_H
#define GAME_GLOBALS_H

#define MAX_GLOBAL_VARS 0
#define STATE_DEFAULT 0

#endif
2 changes: 2 additions & 0 deletions test/actor-under-menu/data/include/data/game_globals.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MAX_GLOBAL_VARS = 0
STATE_DEFAULT = 0
6 changes: 6 additions & 0 deletions test/actor-under-menu/data/include/data/music_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef MUSIC_DATA_H
#define MUSIC_DATA_H



#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/palette_0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef PALETTE_0_H
#define PALETTE_0_H

// Palette: 0

#include "gbs_types.h"

BANKREF_EXTERN(palette_0)
extern const struct palette_t palette_0;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/palette_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef PALETTE_1_H
#define PALETTE_1_H

// Palette: 1

#include "gbs_types.h"

BANKREF_EXTERN(palette_1)
extern const struct palette_t palette_1;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/scene_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCENE_1_H
#define SCENE_1_H

// Scene: Scene 1

#include "gbs_types.h"

BANKREF_EXTERN(scene_1)
extern const struct scene_t scene_1;

#endif
12 changes: 12 additions & 0 deletions test/actor-under-menu/data/include/data/scene_1_actors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef SCENE_1_ACTORS_H
#define SCENE_1_ACTORS_H

// Scene: Scene 1
// Actors

#include "gbs_types.h"

BANKREF_EXTERN(scene_1_actors)
extern const struct actor_t scene_1_actors[];

#endif
12 changes: 12 additions & 0 deletions test/actor-under-menu/data/include/data/scene_1_collisions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef SCENE_1_COLLISIONS_H
#define SCENE_1_COLLISIONS_H

// Scene: Scene 1
// Collisions

#include "gbs_types.h"

BANKREF_EXTERN(scene_1_collisions)
extern const unsigned char scene_1_collisions[];

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/scene_1_init.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCENE_1_INIT_H
#define SCENE_1_INIT_H

// Script scene_1_init

#include "gbs_types.h"

BANKREF_EXTERN(scene_1_init)
extern const unsigned char scene_1_init[];

#endif
12 changes: 12 additions & 0 deletions test/actor-under-menu/data/include/data/scene_1_sprites.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef SCENE_1_SPRITES_H
#define SCENE_1_SPRITES_H

// Scene: Scene 1
// Sprites

#include "gbs_types.h"

BANKREF_EXTERN(scene_1_sprites)
extern const far_ptr_t scene_1_sprites[];

#endif
8 changes: 8 additions & 0 deletions test/actor-under-menu/data/include/data/scene_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef SCENE_TYPES_H
#define SCENE_TYPES_H

typedef enum {
SCENE_TYPE_TOPDOWN = 0,
SCENE_TYPE_LOGO
} scene_type_e;
#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/sprite_static.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SPRITE_STATIC_H
#define SPRITE_STATIC_H

// SpriteSheet: static

#include "gbs_types.h"

BANKREF_EXTERN(sprite_static)
extern const struct spritesheet_t sprite_static;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/sprite_static_tileset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SPRITE_STATIC_TILESET_H
#define SPRITE_STATIC_TILESET_H

// Tileset: sprite_static_tileset

#include "gbs_types.h"

BANKREF_EXTERN(sprite_static_tileset)
extern const struct tileset_t sprite_static_tileset;

#endif
11 changes: 11 additions & 0 deletions test/actor-under-menu/data/include/data/spritesheet_none.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SPRITESHEET_NONE_H
#define SPRITESHEET_NONE_H

// SpriteSheet: None

#include "gbs_types.h"

extern const void __bank_spritesheet_none;
extern const struct spritesheet_t spritesheet_none;

#endif
6 changes: 6 additions & 0 deletions test/actor-under-menu/data/include/data/states_defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef STATES_DEFINES_H
#define STATES_DEFINES_H

#define INPUT_TOPDOWN_INTERACT INPUT_A

#endif
19 changes: 19 additions & 0 deletions test/actor-under-menu/data/src/data/bg_placeholder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma bank 255

// Background: placeholder

#include "gbs_types.h"
#include "data/bg_placeholder_tileset.h"
#include "data/bg_placeholder_tilemap.h"
#include "data/bg_placeholder_tilemap_attr.h"

BANKREF(bg_placeholder)

const struct background_t bg_placeholder = {
.width = 20,
.height = 18,
.tileset = TO_FAR_PTR_T(bg_placeholder_tileset),
.cgb_tileset = { NULL, NULL },
.tilemap = TO_FAR_PTR_T(bg_placeholder_tilemap),
.cgb_tilemap_attr = TO_FAR_PTR_T(bg_placeholder_tilemap_attr)
};
33 changes: 33 additions & 0 deletions test/actor-under-menu/data/src/data/bg_placeholder_tilemap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma bank 255

// Tilemap bg_placeholder_tilemap

#include "gbs_types.h"

BANKREF(bg_placeholder_tilemap)

const unsigned char bg_placeholder_tilemap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03
};
Loading

0 comments on commit 140f013

Please sign in to comment.