Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
libseven 0.14.0: overhaul video header structure
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarLambda committed Jan 21, 2023
1 parent 261594e commit d7bc40f
Show file tree
Hide file tree
Showing 24 changed files with 201 additions and 202 deletions.
2 changes: 1 addition & 1 deletion dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ make_dist() {

[ ! -d "$DIST" ] && mkdir "$DIST" || rm "$DIST"/*

(PROJECT=libseven VERSION=0.13.0 make_dist)
(PROJECT=libseven VERSION=0.14.0 make_dist)
(PROJECT=minrt VERSION=0.5.0 make_dist)
2 changes: 1 addition & 1 deletion libseven/include/seven/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <seven/base.h>

#define LIBSEVEN_VERSION_MAJOR 0
#define LIBSEVEN_VERSION_MINOR 13
#define LIBSEVEN_VERSION_MINOR 14
#define LIBSEVEN_VERSION_PATCH 0

#define LIBSEVEN_VERSION \
Expand Down
15 changes: 0 additions & 15 deletions libseven/include/seven/hw/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define _LIBSEVEN_HW_VIDEO_H

#include <seven/base.h>
#include <seven/hw/memory.h>

_LIBSEVEN_EXTERN_C

Expand Down Expand Up @@ -132,20 +131,6 @@ enum BackgroundControl
BG_AFFINE_SIZE_1024X1024 = BG_AFFINE_SIZE(3),
};

#define GFX_BASE_ADDR(n) (MEM_VRAM + ((n) << 14))
#define MAP_BASE_ADDR(n) (MEM_VRAM + ((n) << 11))

// TODO: Move these?
typedef u16 Color;
typedef Color Palette[256];
typedef Color PaletteBank[16];

#define BG_PALETTE MEMADDR(MEM_PALETTE, Palette)
#define OBJ_PALETTE MEMADDR(MEM_PALETTE + 512, Palette)

#define BG_PALETTE_BANK MEMARRAY(MEM_PALETTE, PaletteBank, 16)
#define OBJ_PALETTE_BANK MEMARRAY(MEM_PALETTE + 512, PaletteBank, 16)

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_H */
19 changes: 0 additions & 19 deletions libseven/include/seven/hw/video/bg_affine.h

This file was deleted.

3 changes: 1 addition & 2 deletions libseven/include/seven/hw/video/bg_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define _LIBSEVEN_HW_VIDEO_BG_BITMAP_H

#include <seven/base.h>
#include <seven/hw/video.h>
#include <seven/hw/video/bg_transform.h>
#include <seven/hw/video/memory.h>

_LIBSEVEN_EXTERN_C

Expand Down
14 changes: 0 additions & 14 deletions libseven/include/seven/hw/video/bg_mixed.h

This file was deleted.

35 changes: 0 additions & 35 deletions libseven/include/seven/hw/video/bg_regular.h

This file was deleted.

1 change: 0 additions & 1 deletion libseven/include/seven/hw/video/bg_scroll.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define _LIBSEVEN_HW_VIDEO_BG_SCROLL_H

#include <seven/base.h>
#include <seven/hw/video.h>

_LIBSEVEN_EXTERN_C

Expand Down
18 changes: 17 additions & 1 deletion libseven/include/seven/hw/video/bg_tiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@
#define _LIBSEVEN_HW_VIDEO_BG_TILED_H

#include <seven/base.h>
#include <seven/hw/video.h>
#include <seven/hw/video/memory.h>

_LIBSEVEN_EXTERN_C

enum Tile
{
#define BF_TILE_NUMBER_OFFSET 0
#define BF_TILE_NUMBER_LENGTH 10

#define TILE_NUMBER(n) BITFIELD(TILE_NUMBER, (n))

TILE_FLIP_H = BIT(10),
TILE_FLIP_V = BIT(11),

#define BF_TILE_PALETTE_OFFSET 12
#define BF_TILE_PALETTE_LENGTH 4

#define TILE_PALETTE(n) BITFIELD(TILE_PALETTE, (n))
};

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_BG_TILED_H */
3 changes: 1 addition & 2 deletions libseven/include/seven/hw/video/bg_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define _LIBSEVEN_HW_VIDEO_BG_TRANSFORM_H

#include <seven/base.h>
#include <seven/hw/video.h>
#include <seven/hw/video/matrix.h>
#include <seven/hw/video/types.h>

_LIBSEVEN_EXTERN_C

Expand Down
1 change: 0 additions & 1 deletion libseven/include/seven/hw/video/blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define _LIBSEVEN_HW_VIDEO_BLEND_H

#include <seven/base.h>
#include <seven/hw/video.h>

_LIBSEVEN_EXTERN_C

Expand Down
52 changes: 1 addition & 51 deletions libseven/include/seven/hw/video/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _LIBSEVEN_HW_VIDEO_COLOR_H

#include <seven/base.h>
#include <seven/hw/video.h>
#include <seven/hw/video/types.h>

_LIBSEVEN_EXTERN_C

Expand All @@ -33,56 +33,6 @@ _LIBSEVEN_EXTERN_C
#define RGB8(r, g, b) \
RGB5((r) >> 3, (g) >> 3, (b) >> 3)

#define COLOR_RED RGB5(31, 0, 0)
#define COLOR_RED_ORANGE RGB5(31, 8, 0)
#define COLOR_ORANGE RGB5(31, 15, 0)
#define COLOR_ORANGE_YELLOW RGB5(31, 23, 0)
#define COLOR_YELLOW RGB5(31, 31, 0)
#define COLOR_YELLOW_LIME RGB5(23, 31, 0)
#define COLOR_LIME RGB5(15, 31, 0)
#define COLOR_LIME_GREEN RGB5( 8, 31, 0)
#define COLOR_GREEN RGB5( 0, 31, 0)
#define COLOR_GREEN_MINT RGB5( 0, 31, 8)
#define COLOR_MINT RGB5( 0, 31, 15)
#define COLOR_MINT_CYAN RGB5( 0, 31, 23)
#define COLOR_CYAN RGB5( 0, 31, 31)
#define COLOR_CYAN_SKYBLUE RGB5( 0, 23, 31)
#define COLOR_SKYBLUE RGB5( 0, 15, 31)
#define COLOR_SKYBLUE_BLUE RGB5( 0, 8, 31)
#define COLOR_BLUE RGB5( 0, 0, 31)
#define COLOR_BLUE_PURPLE RGB5( 8, 0, 31)
#define COLOR_PURPLE RGB5(15, 0, 31)
#define COLOR_PURPLE_MAGENTA RGB5(23, 0, 31)
#define COLOR_MAGENTA RGB5(31, 0, 31)
#define COLOR_MAGENTA_PINK RGB5(31, 0, 23)
#define COLOR_PINK RGB5(31, 0, 15)
#define COLOR_PINK_RED RGB5(31, 0, 8)

#define COLOR_WHITE RGB5(31, 31, 31)
#define COLOR_BLACK RGB5( 0, 0, 0)

#define COLOR_GRAY_100 RGB5(31, 31, 31)
#define COLOR_GRAY_95 RGB5(29, 29, 29)
#define COLOR_GRAY_90 RGB5(28, 28, 28)
#define COLOR_GRAY_85 RGB5(26, 26, 26)
#define COLOR_GRAY_80 RGB5(25, 25, 25)
#define COLOR_GRAY_75 RGB5(23, 23, 23)
#define COLOR_GRAY_70 RGB5(22, 22, 22)
#define COLOR_GRAY_65 RGB5(20, 20, 20)
#define COLOR_GRAY_60 RGB5(19, 19, 19)
#define COLOR_GRAY_55 RGB5(17, 17, 17)
#define COLOR_GRAY_50 RGB5(15, 15, 15)
#define COLOR_GRAY_45 RGB5(14, 14, 14)
#define COLOR_GRAY_40 RGB5(12, 12, 12)
#define COLOR_GRAY_35 RGB5(11, 11, 11)
#define COLOR_GRAY_30 RGB5( 9, 9, 9)
#define COLOR_GRAY_25 RGB5( 8, 8, 8)
#define COLOR_GRAY_20 RGB5( 6, 6, 6)
#define COLOR_GRAY_15 RGB5( 5, 5, 5)
#define COLOR_GRAY_10 RGB5( 3, 3, 3)
#define COLOR_GRAY_5 RGB5( 2, 2, 2)
#define COLOR_GRAY_0 RGB5( 0, 0, 0)

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_COLOR_H */
70 changes: 70 additions & 0 deletions libseven/include/seven/hw/video/color_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#ifndef _LIBSEVEN_HW_VIDEO_COLOR_CONSTANTS_H
#define _LIBSEVEN_HW_VIDEO_COLOR_CONSTANTS_H

#include <seven/base.h>
#include <seven/hw/video/color.h>

_LIBSEVEN_EXTERN_C

enum ColorConstants
{
COLOR_RED = RGB5(31, 0, 0),
COLOR_RED_ORANGE = RGB5(31, 8, 0),
COLOR_ORANGE = RGB5(31, 15, 0),
COLOR_ORANGE_YELLOW = RGB5(31, 23, 0),
COLOR_YELLOW = RGB5(31, 31, 0),
COLOR_YELLOW_LIME = RGB5(23, 31, 0),
COLOR_LIME = RGB5(15, 31, 0),
COLOR_LIME_GREEN = RGB5( 8, 31, 0),
COLOR_GREEN = RGB5( 0, 31, 0),
COLOR_GREEN_MINT = RGB5( 0, 31, 8),
COLOR_MINT = RGB5( 0, 31, 15),
COLOR_MINT_CYAN = RGB5( 0, 31, 23),
COLOR_CYAN = RGB5( 0, 31, 31),
COLOR_CYAN_SKYBLUE = RGB5( 0, 23, 31),
COLOR_SKYBLUE = RGB5( 0, 15, 31),
COLOR_SKYBLUE_BLUE = RGB5( 0, 8, 31),
COLOR_BLUE = RGB5( 0, 0, 31),
COLOR_BLUE_PURPLE = RGB5( 8, 0, 31),
COLOR_PURPLE = RGB5(15, 0, 31),
COLOR_PURPLE_MAGENTA = RGB5(23, 0, 31),
COLOR_MAGENTA = RGB5(31, 0, 31),
COLOR_MAGENTA_PINK = RGB5(31, 0, 23),
COLOR_PINK = RGB5(31, 0, 15),
COLOR_PINK_RED = RGB5(31, 0, 8),

COLOR_BLACK = RGB5( 0, 0, 0),
COLOR_WHITE = RGB5(31, 31, 31),

COLOR_GRAY_0 = RGB5( 0, 0, 0),
COLOR_GRAY_5 = RGB5( 2, 2, 2),
COLOR_GRAY_10 = RGB5( 3, 3, 3),
COLOR_GRAY_15 = RGB5( 5, 5, 5),
COLOR_GRAY_20 = RGB5( 6, 6, 6),
COLOR_GRAY_25 = RGB5( 8, 8, 8),
COLOR_GRAY_30 = RGB5( 9, 9, 9),
COLOR_GRAY_35 = RGB5(11, 11, 11),
COLOR_GRAY_40 = RGB5(12, 12, 12),
COLOR_GRAY_45 = RGB5(14, 14, 14),
COLOR_GRAY_50 = RGB5(15, 15, 15),
COLOR_GRAY_55 = RGB5(17, 17, 17),
COLOR_GRAY_60 = RGB5(19, 19, 19),
COLOR_GRAY_65 = RGB5(20, 20, 20),
COLOR_GRAY_70 = RGB5(22, 22, 22),
COLOR_GRAY_75 = RGB5(23, 23, 23),
COLOR_GRAY_80 = RGB5(25, 25, 25),
COLOR_GRAY_85 = RGB5(26, 26, 26),
COLOR_GRAY_90 = RGB5(28, 28, 28),
COLOR_GRAY_95 = RGB5(29, 29, 29),
COLOR_GRAY_100 = RGB5(31, 31, 31),
};

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_COLOR_CONSTANTS_H */
9 changes: 1 addition & 8 deletions libseven/include/seven/hw/video/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@
#define _LIBSEVEN_HW_VIDEO_MATRIX_H

#include <seven/base.h>
#include <seven/hw/video/types.h>

_LIBSEVEN_EXTERN_C

struct Matrix
{
i16 hdx;
i16 vdx;
i16 hdy;
i16 vdy;
} ALIGN(4);

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_MATRIX_H */
29 changes: 29 additions & 0 deletions libseven/include/seven/hw/video/memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#ifndef _LIBSEVEN_HW_VIDEO_MEMORY_H
#define _LIBSEVEN_HW_VIDEO_MEMORY_H

#include <seven/base.h>
#include <seven/hw/memory.h>
#include <seven/hw/video/types.h>

_LIBSEVEN_EXTERN_C

#define BG_PALETTE MEMADDR(MEM_PALETTE, Palette)
#define OBJ_PALETTE MEMADDR(MEM_PALETTE + 512, Palette)

#define BG_PALETTE_BANK MEMARRAY(MEM_PALETTE, PaletteBank, 16)
#define OBJ_PALETTE_BANK MEMARRAY(MEM_PALETTE + 512, PaletteBank, 16)

#define GFX_BASE_ADDR(n) (MEM_VRAM + ((n) << 14))
#define MAP_BASE_ADDR(n) (MEM_VRAM + ((n) << 11))

#define OAM_OBJS MEMARRAY(MEM_OAM, struct Object, 128)

_LIBSEVEN_EXTERN_C_END

#endif /* !_LIBSEVEN_HW_VIDEO_MEMORY_H */
1 change: 0 additions & 1 deletion libseven/include/seven/hw/video/mosaic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define _LIBSEVEN_HW_VIDEO_MOSAIC_H

#include <seven/base.h>
#include <seven/hw/video.h>

_LIBSEVEN_EXTERN_C

Expand Down
3 changes: 1 addition & 2 deletions libseven/include/seven/hw/video/oam.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define _LIBSEVEN_HW_VIDEO_OAM_H

#include <seven/base.h>
#include <seven/hw/video/matrix.h>
#include <seven/hw/video/object.h>
#include <seven/hw/video/memory.h>

_LIBSEVEN_EXTERN_C

Expand Down
Loading

0 comments on commit d7bc40f

Please sign in to comment.