mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 03:12:40 +02:00
Address review comments
This commit is contained in:
20
Makefile
20
Makefile
@@ -205,19 +205,23 @@ SDL_LDFLAGS += -lopenal
|
||||
endif
|
||||
SDL_AUDIO_DRIVERS += openal
|
||||
endif
|
||||
else
|
||||
else # ifneq ($(PKG_CONFIG),)
|
||||
SDL_CFLAGS := $(shell $(PKG_CONFIG) --cflags sdl2)
|
||||
SDL_LDFLAGS := $(shell $(PKG_CONFIG) --libs sdl2) -lpthread
|
||||
|
||||
# Allow OpenAL to be disabled even if the development libraries are available
|
||||
ifneq ($(ENABLE_OPENAL),0)
|
||||
ifeq ($(shell $(PKG_CONFIG) --exists openal && echo 0),0)
|
||||
ifneq ($(shell $(PKG_CONFIG) --exists openal && echo 0),)
|
||||
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags openal) -DENABLE_OPENAL
|
||||
SDL_LDFLAGS += $(shell $(PKG_CONFIG) --libs openal)
|
||||
SDL_AUDIO_DRIVERS += openal
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(shell pkg-config --exists gio-2.0 || echo 0),)
|
||||
GIO_CFLAGS = $(error The Gio library could not be found)
|
||||
GIO_LDFLAGS = $(error The Gio library could not be found)
|
||||
else
|
||||
GIO_CFLAGS := $(shell $(PKG_CONFIG) --cflags gio-2.0) -DG_LOG_USE_STRUCTURED
|
||||
GIO_LDFLAGS := $(shell $(PKG_CONFIG) --libs gio-2.0)
|
||||
ifeq ($(CONF),debug)
|
||||
@@ -225,10 +229,16 @@ GIO_CFLAGS += -DG_ENABLE_DEBUG
|
||||
else
|
||||
GIO_CFLAGS += -DG_DISABLE_ASSERT
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(shell pkg-config --exists gdk-pixbuf-2.0 || echo 0),)
|
||||
GDK_PIXBUF_CFLAGS = $(error The Gdk-Pixbuf library could not be found)
|
||||
GDK_PIXBUF_LDFLAGS = $(error The Gdk-Pixbuf library could not be found)
|
||||
else
|
||||
GDK_PIXBUF_CFLAGS := $(shell $(PKG_CONFIG) --cflags gdk-pixbuf-2.0)
|
||||
GDK_PIXBUF_LDFLAGS := $(shell $(PKG_CONFIG) --libs gdk-pixbuf-2.0)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (,$(PKG_CONFIG))
|
||||
GL_LDFLAGS := -lGL
|
||||
@@ -656,12 +666,12 @@ $(BIN)/SDL/background.bmp: SDL/background.bmp
|
||||
|
||||
$(BIN)/SDL/Shaders: Shaders
|
||||
-@$(MKDIR) -p $@
|
||||
cp -rf $< $@
|
||||
cp -rfT $< $@
|
||||
touch $@
|
||||
|
||||
$(BIN)/SDL/Palettes: Misc/Palettes
|
||||
-@$(MKDIR) -p $@
|
||||
cp -rf $< $@
|
||||
cp -rfT $< $@
|
||||
touch $@
|
||||
|
||||
# Boot ROMs
|
||||
@@ -698,6 +708,8 @@ libretro:
|
||||
# If you somehow find a reasonable way to make associate an icon with an extension in this dumpster
|
||||
# fire of a desktop environment, open an issue or a pull request
|
||||
ifneq ($(FREEDESKTOP),)
|
||||
all: xdg-thumbnailer
|
||||
|
||||
ICON_NAMES := apps/sameboy mimetypes/x-gameboy-rom mimetypes/x-gameboy-color-rom
|
||||
ICON_SIZES := 16x16 32x32 64x64 128x128 256x256 512x512
|
||||
ICONS := $(foreach name,$(ICON_NAMES), $(foreach size,$(ICON_SIZES),$(DESTDIR)$(PREFIX)/share/icons/hicolor/$(size)/$(name).png))
|
||||
|
@@ -12,28 +12,6 @@
|
||||
#define NB_FRAMES_TO_EMULATE (60 * 10)
|
||||
|
||||
#define BOOT_ROM_SIZE (0x100 + 0x800) // The two "parts" of it, which are stored contiguously.
|
||||
static char *boot_rom;
|
||||
|
||||
void load_boot_rom(void)
|
||||
{
|
||||
static char const *boot_rom_path = DATA_DIR "/cgb_boot_fast.bin";
|
||||
|
||||
size_t length;
|
||||
GError *error = NULL;
|
||||
g_file_get_contents(boot_rom_path, &boot_rom, &length, &error);
|
||||
|
||||
if (error) {
|
||||
g_error("Error loading boot ROM from \"%s\": %s", boot_rom_path, error->message);
|
||||
// NOTREACHED
|
||||
}
|
||||
else if (length != BOOT_ROM_SIZE) {
|
||||
g_error("Error loading boot ROM from \"%s\": expected to read %d bytes, got %zu", boot_rom_path, BOOT_ROM_SIZE,
|
||||
length);
|
||||
// NOTREACHED
|
||||
}
|
||||
}
|
||||
|
||||
void unload_boot_rom(void) { g_free(boot_rom); }
|
||||
|
||||
/* --- */
|
||||
|
||||
|
@@ -9,7 +9,4 @@ enum FileKind {
|
||||
KIND_ISX,
|
||||
};
|
||||
|
||||
void load_boot_rom(void);
|
||||
void unload_boot_rom(void);
|
||||
|
||||
unsigned emulate(enum FileKind kind, unsigned char const *rom, size_t rom_size, uint32_t screen[static 160 * 144]);
|
||||
|
@@ -16,8 +16,8 @@
|
||||
// Auto-generated via `gdbus-codegen` from `interface.xml`.
|
||||
#include "build/obj/XdgThumbnailer/interface.h"
|
||||
|
||||
static char const *const name_on_bus = "com.github.liji32.sameboy.XdgThumbnailer";
|
||||
static char const *const object_path = "/com/github/liji32/sameboy/XdgThumbnailer";
|
||||
static char const name_on_bus[] = "com.github.liji32.sameboy.XdgThumbnailer";
|
||||
static char const object_path[] = "/com/github/liji32/sameboy/XdgThumbnailer";
|
||||
|
||||
ThumbnailerSpecializedThumbnailer1 *thumbnailer_interface = NULL;
|
||||
static unsigned max_nb_worker_threads;
|
||||
@@ -127,7 +127,6 @@ int main(int argc, char const *argv[])
|
||||
g_info("Waiting for outstanding tasks...");
|
||||
cleanup_tasks(); // Also waits for any remaining tasks.
|
||||
// "Pedantic" cleanup for Valgrind et al.
|
||||
unload_boot_rom();
|
||||
g_main_loop_unref(main_loop);
|
||||
g_bus_unown_name(owner_id);
|
||||
if (thumbnailer_interface) {
|
||||
|
@@ -12,12 +12,16 @@
|
||||
#include "main.h"
|
||||
#include "tasks.h"
|
||||
|
||||
#define DMG_ONLY_RESOURCE_PATH "/thumbnailer/CartridgeTemplate.png"
|
||||
#define DUAL_RESOURCE_PATH "/thumbnailer/UniversalCartridgeTemplate.png"
|
||||
#define CGB_ONLY_RESOURCE_PATH "/thumbnailer/ColorCartridgeTemplate.png"
|
||||
|
||||
#define THUMBNAILING_ERROR_DOMAIN (g_quark_from_static_string("thumbnailing"))
|
||||
|
||||
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 char const gb_mime_type[] = "application/x-gameboy-rom";
|
||||
static char const gbc_mime_type[] = "application/x-gameboy-color-rom";
|
||||
static char const isx_mime_type[] = "application/x-gameboy-isx";
|
||||
|
||||
/* --- */
|
||||
|
||||
struct TaskData {
|
||||
@@ -38,11 +42,11 @@ char const *mime_type(enum FileKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case KIND_GB:
|
||||
return "application/x-gameboy-rom";
|
||||
return gb_mime_type;
|
||||
case KIND_GBC:
|
||||
return "application/x-gameboy-color-rom";
|
||||
return gbc_mime_type;
|
||||
case KIND_ISX:
|
||||
return "application/x-gameboy-isx";
|
||||
return isx_mime_type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,13 +86,13 @@ static void generate_thumbnail(GTask *task, void *source_object, void *data, GCa
|
||||
GdkPixbuf *template;
|
||||
switch (cgb_flag) {
|
||||
case 0xC0:
|
||||
template = gdk_pixbuf_new_from_resource(CGB_ONLY_RESOURCE_PATH, &error);
|
||||
template = gdk_pixbuf_new_from_resource(cgb_only_resource_path, &error);
|
||||
break;
|
||||
case 0x80:
|
||||
template = gdk_pixbuf_new_from_resource(DUAL_RESOURCE_PATH, &error);
|
||||
template = gdk_pixbuf_new_from_resource(dual_resource_path, &error);
|
||||
break;
|
||||
default:
|
||||
template = gdk_pixbuf_new_from_resource(DMG_ONLY_RESOURCE_PATH, &error);
|
||||
template = gdk_pixbuf_new_from_resource(dmg_only_resource_path, &error);
|
||||
break;
|
||||
}
|
||||
g_assert_no_error(error);
|
||||
@@ -109,7 +113,7 @@ static void generate_thumbnail(GTask *task, void *source_object, void *data, GCa
|
||||
// TODO: proper file name
|
||||
gdk_pixbuf_save(scaled_screen, "/tmp/output.png", "png", &error, // "Base" parameters.
|
||||
"tEXt::Thumb::URI", g_task_get_name(task), // URI of the file being thumbnailed.
|
||||
"tEXt::Thumb::MTime", "", // TODO
|
||||
// "tEXt::Thumb::MTime", "", // TODO
|
||||
"tEXt::Thumb::Size", file_size, // Size (in bytes) of the file being thumbnailed.
|
||||
"tEXt::Thumb::Mimetype", mime_type(task_data->kind), // MIME type of the file being thumbnailed.
|
||||
NULL);
|
||||
@@ -183,13 +187,13 @@ void start_thumbnailing(unsigned handle, GCancellable *cancellable, gboolean is_
|
||||
g_task_set_name(task, uri);
|
||||
|
||||
enum FileKind kind;
|
||||
if (g_strcmp0(mime_type, "application/x-gameboy-color-rom") == 0) {
|
||||
if (g_strcmp0(mime_type, gbc_mime_type) == 0) {
|
||||
kind = KIND_GBC;
|
||||
}
|
||||
else if (g_strcmp0(mime_type, "application/x-gameboy-rom") == 0) {
|
||||
else if (g_strcmp0(mime_type, gb_mime_type) == 0) {
|
||||
kind = KIND_GB;
|
||||
}
|
||||
else if (g_strcmp0(mime_type, "application/x-gameboy-isx") == 0) {
|
||||
else if (g_strcmp0(mime_type, isx_mime_type) == 0) {
|
||||
kind = KIND_ISX;
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user