Switch to "west const" instead of "east const"

This commit is contained in:
ISSOtm
2024-07-05 22:27:30 +02:00
parent 6e1112157c
commit 366c374461
3 changed files with 11 additions and 11 deletions

View File

@@ -58,12 +58,12 @@ static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
return rgba;
}
uint8_t emulate(char const *path, uint32_t screen[static GB_SCREEN_WIDTH * GB_SCREEN_HEIGHT])
uint8_t emulate(const char *path, uint32_t screen[static GB_SCREEN_WIDTH * GB_SCREEN_HEIGHT])
{
GB_gameboy_t gb;
GB_init(&gb, GB_MODEL_CGB_E);
char const *last_dot = strrchr(path, '.');
const char *last_dot = strrchr(path, '.');
bool is_isx = last_dot && strcmp(last_dot + 1, "isx") == 0;
if (is_isx ? GB_load_isx(&gb, path) : GB_load_rom(&gb, path)) {
exit(EXIT_FAILURE);
@@ -74,7 +74,7 @@ uint8_t emulate(char const *path, uint32_t screen[static GB_SCREEN_WIDTH * GB_SC
G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
g_assert_no_error(error); // This shouldn't be able to fail.
size_t boot_rom_size;
uint8_t const *boot_rom_data = g_bytes_get_data(boot_rom, &boot_rom_size);
const uint8_t *boot_rom_data = g_bytes_get_data(boot_rom, &boot_rom_size);
g_assert_cmpuint(boot_rom_size, ==, BOOT_ROM_SIZE);
GB_load_boot_rom_from_buffer(&gb, boot_rom_data, boot_rom_size);
g_bytes_unref(boot_rom);

View File

@@ -5,4 +5,4 @@
#define GB_SCREEN_WIDTH 160
#define GB_SCREEN_HEIGHT 144
uint8_t emulate(char const *path, uint32_t screen[static GB_SCREEN_WIDTH * GB_SCREEN_HEIGHT]);
uint8_t emulate(const char *path, uint32_t screen[static GB_SCREEN_WIDTH * GB_SCREEN_HEIGHT]);

View File

@@ -9,11 +9,11 @@
#include "emulate.h"
static char const dmg_only_resource_path[] = "/thumbnailer/CartridgeTemplate.png";
static char const dual_resource_path[] = "/thumbnailer/UniversalCartridgeTemplate.png";
static char const cgb_only_resource_path[] = "/thumbnailer/ColorCartridgeTemplate.png";
static const char dmg_only_resource_path[] = "/thumbnailer/CartridgeTemplate.png";
static const char dual_resource_path[] = "/thumbnailer/UniversalCartridgeTemplate.png";
static const char cgb_only_resource_path[] = "/thumbnailer/ColorCartridgeTemplate.png";
static GdkPixbuf *generate_thumbnail(char const *input_path)
static GdkPixbuf *generate_thumbnail(const char *input_path)
{
uint32_t screen_raw[GB_SCREEN_WIDTH * GB_SCREEN_HEIGHT];
uint8_t cgb_flag = emulate(input_path, screen_raw);
@@ -80,7 +80,7 @@ static GdkPixbuf *enforce_max_size(GdkPixbuf *thumbnail, unsigned max_size)
return scaled;
}
static void write_thumbnail(GdkPixbuf *thumbnail, char const *output_path)
static void write_thumbnail(GdkPixbuf *thumbnail, const char *output_path)
{
GError *error = NULL;
// Intentionally be "not a good citizen":
@@ -103,9 +103,9 @@ int main(int argc, char *argv[])
g_error("Usage: %s <input path> <output path> [<size>]", argv[0] ? argv[0] : "sameboy-thumbnailer");
// NOTREACHED
}
char const *input_path = argv[1];
const char *input_path = argv[1];
char *output_path = argv[2]; // Gets mutated in-place.
char const *max_size = argv[3]; // May be NULL.
const char *max_size = argv[3]; // May be NULL.
g_debug("%s -> %s [%s]", input_path, output_path, max_size ? max_size : "(none)");