Skip to content

Commit

Permalink
bg_window stuff + update nitrogfx
Browse files Browse the repository at this point in the history
  • Loading branch information
red031000 committed Jul 3, 2023
1 parent 5058226 commit 3a571c9
Show file tree
Hide file tree
Showing 43 changed files with 4,847 additions and 352 deletions.
2 changes: 1 addition & 1 deletion include/battle_arcade_game_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "player_data.h"
#include "save.h"
#include "save_frontier.h"
#include "window.h"
#include "bg_window.h"
#include "unk_02009D48.h"
#include "unk_02023694.h"

Expand Down
2 changes: 1 addition & 1 deletion include/battle_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "battle_system.h"
#include "battle_cursor.h"
#include "battle_finger.h"
#include "window.h"
#include "bg_window.h"
#include "unk_0200E320.h"

typedef struct BattleInputMainScreen {
Expand Down
7 changes: 4 additions & 3 deletions include/window.h → include/bg_window.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef POKEHEARTGOLD_WINDOW_H
#define POKEHEARTGOLD_WINDOW_H
#ifndef POKEHEARTGOLD_BG_WINDOW_H
#define POKEHEARTGOLD_BG_WINDOW_H

#include "global.h"
#include "heap.h"
#include "gx_layers.h"

Expand Down Expand Up @@ -232,4 +233,4 @@ void ScheduleSetBgPosText(BgConfig *bgConfig, u8 layer, enum BgPosAdjustOp op, f
void ScheduleSetBgAffineScale(BgConfig *bgConfig, u8 layer, enum BgPosAdjustOp op, fx32 value);
BOOL DoesPixelAtScreenXYMatchPtrVal(BgConfig *bgConfig, u8 layer, u8 x, u8 y, u16 *src);

#endif //POKEHEARTGOLD_WINDOW_H
#endif //POKEHEARTGOLD_BG_WINDOW_H
2 changes: 1 addition & 1 deletion include/credits/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_CREDITS_DATA_H

#include "gx_layers.h"
#include "window.h"
#include "bg_window.h"
#include "credits/credits.h"

typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion include/field_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "save_pokegear.h"
#include "unk_0200E320.h"
#include "unk_02022D74.h"
#include "window.h"
#include "bg_window.h"

typedef struct FieldSystem FieldSystem;
typedef struct TaskManager TaskManager;
Expand Down
2 changes: 1 addition & 1 deletion include/font_types_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_FONT_TYPES_DEF_H

#include "pm_string.h"
#include "window.h"
#include "bg_window.h"

typedef u8 FontID;
struct FontData;
Expand Down
2 changes: 1 addition & 1 deletion include/gf_gfx_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_GF_GFX_LOADER_H

#include "filesystem.h"
#include "window.h"
#include "bg_window.h"

// These functions load (perhap-compressed) graphics resources to VRAM.
// A temporary file handle is used to read the data from the card.
Expand Down
2 changes: 1 addition & 1 deletion include/list_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "list_menu_cursor.h"
#include "list_menu_items.h"
#include "window.h"
#include "bg_window.h"

struct ListMenu;

Expand Down
2 changes: 1 addition & 1 deletion include/list_menu_cursor.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_LIST_MENU_CURSOR_H
#define POKEHEARTGOLD_LIST_MENU_CURSOR_H

#include "window.h"
#include "bg_window.h"

struct ListMenuCursor;

Expand Down
2 changes: 1 addition & 1 deletion include/overlay_01_021EDAFC.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_OVERLAY_01_021EDAFC_H

#include "field_system.h"
#include "window.h"
#include "bg_window.h"

void ov01_021EEC68(Window *window);
void ov01_021EEC7C(FieldSystem *fsys, Window *window, u8 type);
Expand Down
2 changes: 1 addition & 1 deletion include/render_window.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_RENDER_WINDOW_H
#define POKEHEARTGOLD_RENDER_WINDOW_H

#include "window.h"
#include "bg_window.h"

typedef struct WaitingIcon WaitingIcon; //todo: copy from pokediamond
struct PokepicManager;
Expand Down
2 changes: 1 addition & 1 deletion include/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "map_events_internal.h"
#include "msgdata.h"
#include "window.h"
#include "bg_window.h"
#include "field_player_avatar.h"
#include "gear_phone.h"
#include "save_pokegear.h"
Expand Down
2 changes: 1 addition & 1 deletion include/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_TEXT_H

#include "font_types_def.h"
#include "window.h"
#include "bg_window.h"
#include "options.h"
#include "text_0205B4EC.h"

Expand Down
2 changes: 1 addition & 1 deletion include/text_0205B4EC.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "options.h"
#include "pm_string.h"
#include "window.h"
#include "bg_window.h"

void sub_0205B514(BgConfig *bgConfig, Window *window, int a2);
void sub_0205B564(Window *window, OPTIONS *options);
Expand Down
2 changes: 1 addition & 1 deletion include/unk_0201660C.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEHEARTGOLD_UNK_0201660C_H

#include "heap.h"
#include "window.h"
#include "bg_window.h"

typedef struct Unk122_021E6900 {
BgConfig *unk0;
Expand Down
2 changes: 1 addition & 1 deletion include/unk_020183F0.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "heap.h"
#include "list_menu_items.h"
#include "window.h"
#include "bg_window.h"

typedef struct Ov122_021E9282 {
u16 unk0;
Expand Down
2 changes: 1 addition & 1 deletion include/voltorb_flip/voltorb_flip_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "unk_0200CF18.h"
#include "unk_020183F0.h"
#include "window.h"
#include "bg_window.h"

typedef struct Ov122_021E9278 {
u8 unk0[5][2];
Expand Down
2 changes: 1 addition & 1 deletion include/voltorb_flip/voltorb_flip_work.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "options.h"
#include "player_data.h"
#include "unk_0200CF18.h"
#include "window.h"
#include "bg_window.h"
#include "voltorb_flip/voltorb_flip_game.h"
#include "voltorb_flip/voltorb_flip_input.h"

Expand Down
14 changes: 7 additions & 7 deletions src/bg_window.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "window.h"
#include "bg_window.h"
#include "global.h"
#include "math_util.h"

Expand Down Expand Up @@ -43,12 +43,12 @@ static void Bg_SetAffineScale(BG *bg, enum BgPosAdjustOp op, fx32 value);
static void ApplyFlipFlagsToTile(BgConfig *bgConfig, u8 flags, u8 *tile);

static const u8 sTilemapWidthByBufferSize[] = {
16, // GF_BG_SCR_SIZE_128x128
32, // GF_BG_SCR_SIZE_256x256
32, // GF_BG_SCR_SIZE_256x512
32, // GF_BG_SCR_SIZE_512x256
32, // GF_BG_SCR_SIZE_512x512
32, // GF_BG_SCR_SIZE_1024x1024
[GF_BG_SCR_SIZE_128x128] = 0x10,
[GF_BG_SCR_SIZE_256x256] = 0x20,
[GF_BG_SCR_SIZE_256x512] = 0x20,
[GF_BG_SCR_SIZE_512x256] = 0x20,
[GF_BG_SCR_SIZE_512x512] = 0x20,
[GF_BG_SCR_SIZE_1024x1024] = 0x20,
};

static void (*const sScheduleWindowCopyToVramFuncs[GF_BG_TYPE_MAX])(Window *window) = {
Expand Down
2 changes: 1 addition & 1 deletion src/communication_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "pm_string.h"
#include "system.h"
#include "unk_0200FA24.h"
#include "window.h"
#include "bg_window.h"
#include "font.h"
#include "text.h"
#include "render_window.h"
Expand Down
2 changes: 1 addition & 1 deletion src/credits/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "unk_020215A0.h"
#include "unk_02022588.h"
#include "unk_02023694.h"
#include "window.h"
#include "bg_window.h"
#include "constants/rgb.h"
#include "constants/sndseq.h"
#include "credits/credits.h"
Expand Down
2 changes: 1 addition & 1 deletion src/error_message_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "unk_0200B380.h"
#include "text.h"
#include "font.h"
#include "window.h"
#include "bg_window.h"

static const GF_GXBanksConfig sErrorMessageBanksConfig = {
.bg = GX_VRAM_BG_256_AB,
Expand Down
2 changes: 1 addition & 1 deletion src/field/scrcmd_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "script.h"
#include "text.h"
#include "text_0205B4EC.h"
#include "window.h"
#include "bg_window.h"

typedef struct MessageBox {
String *message;
Expand Down
2 changes: 1 addition & 1 deletion src/game_clear.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "unk_0206793C.h"
#include "unk_0206D494.h"
#include "use_item_on_mon.h"
#include "window.h"
#include "bg_window.h"
#include "constants/sndseq.h"
#include "credits/credits.h"
#include "msgdata/msg/msg_0040.h"
Expand Down
2 changes: 1 addition & 1 deletion src/gf_gfx_loader.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "gf_gfx_loader.h"
#include "window.h"
#include "bg_window.h"
#include "nnsys.h"

static u32 GfGfxLoader_LoadCharDataInternal(void *data, BgConfig *bgConfig, enum GFBgLayer layer, u32 tileStart, u32 szByte);
Expand Down
2 changes: 1 addition & 1 deletion src/save_data_read_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "save_data_read_error.h"
#include "system.h"
#include "unk_0200FA24.h"
#include "window.h"
#include "bg_window.h"
#include "text.h"
#include "font.h"
#include "render_window.h"
Expand Down
2 changes: 1 addition & 1 deletion src/save_data_write_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "save_data_write_error.h"
#include "system.h"
#include "unk_0200FA24.h"
#include "window.h"
#include "bg_window.h"
#include "font.h"
#include "render_window.h"
#include "unk_0200B380.h"
Expand Down
2 changes: 1 addition & 1 deletion src/scrcmd_c.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define _IN_SCRCMD_C

#include "scrcmd.h"
#include "window.h"
#include "bg_window.h"
#include "overlay_01.h"
#include "overlay_26.h"
#include "overlay_03.h"
Expand Down
2 changes: 1 addition & 1 deletion src/voltorb_flip/voltorb_flip.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "unk_020183F0.h"
#include "unk_02023694.h"
#include "unk_02025154.h"
#include "window.h"
#include "bg_window.h"
#include "constants/sndseq.h"
#include "msgdata/msg/msg_0039.h"
#include "voltorb_flip/voltorb_flip.h"
Expand Down
2 changes: 1 addition & 1 deletion src/voltorb_flip/voltorb_flip_data2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "gx_layers.h"
#include "window.h"
#include "bg_window.h"
#include "voltorb_flip/voltorb_flip.h"
#include "voltorb_flip/voltorb_flip_data.h"

Expand Down
2 changes: 1 addition & 1 deletion src/wfc_user_info_warning.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "system.h"
#include "unk_0200FA24.h"
#include "wfc_user_info_warning.h"
#include "window.h"
#include "bg_window.h"
#include "render_window.h"
#include "unk_0200B380.h"
#include "text.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/nitrogfx/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 YamaArashi
Copyright (c) 2015 YamaArashi, 2021-2023 red031000

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 14 additions & 27 deletions tools/nitrogfx/Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
CC = gcc
LD = gcc

CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK $(shell pkg-config --cflags libpng)
HAVE_LIBPNG := $(shell pkg-config libpng; echo $?)

LIBS = $(shell pkg-config --libs libpng)
ifeq ($(HAVE_LIBPNG),1)
$(error No package 'libpng' found)
endif

SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c
OBJS = $(SRCS:%.c=%.o)
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK $(shell pkg-config --cflags libpng zlib)

.PHONY: all clean
LIBS = $(shell pkg-config --libs libpng zlib)

DEPDIR := .deps
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d
SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c json.c cJSON.c
OBJS = $(SRCS:%.c=%.o)

ifneq ($(DEBUG),)
CFLAGS += -DDEBUG
endif
.PHONY: all clean

all: nitrogfx
@:

nitrogfx-debug: DEBUG = 1
nitrogfx-debug: nitrogfx

nitrogfx: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
nitrogfx-debug: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h json.h cJSON.h
$(CC) $(CFLAGS) -g -DDEBUG $(SRCS) -o $@ $(LDFLAGS) $(LIBS)

%.o: %.c
%.o: %.c $(DEPDIR)/%.d | $(DEPDIR)
$(CC) $(CFLAGS) $(DEPFLAGS) -c -o $@ $<
nitrogfx: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h json.h cJSON.h
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)

clean:
$(RM) -r nitrogfx nitrogfx.exe $(OBJS) $(DEPDIR)

$(DEPDIR): ; @mkdir -p $@

DEPFILES := $(SRCS:%.c=$(DEPDIR)/%.d)
$(DEPFILES):

include $(wildcard $(DEPFILES))
$(RM) -r nitrogfx nitrogfx.exe $(OBJS)
Loading

0 comments on commit 3a571c9

Please sign in to comment.