This commit is contained in:
Jean-André Santoni 2014-05-09 16:24:36 +02:00
commit 22a5e07ead
36 changed files with 742 additions and 427 deletions

View File

@ -6,6 +6,7 @@ OBJDIR := obj-unix
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
frontend/platform/platform_null.o \
retroarch.o \
file.o \
file_path.o \
@ -30,6 +31,7 @@ OBJ = frontend/frontend.o \
conf/config_file.o \
screenshot.o \
gfx/scaler/scaler.o \
gfx/shader_common.o \
gfx/shader_parse.o \
gfx/scaler/pixconv.o \
gfx/scaler/scaler_int.o \

View File

@ -1,6 +1,7 @@
TARGET = retroarch.js
OBJ = frontend/platform/platform_emscripten.o \
frontend/platform/platform_null.o \
frontend/frontend.o \
retroarch.o \
file.o \
@ -29,6 +30,7 @@ OBJ = frontend/platform/platform_emscripten.o \
input/overlay.o \
fifo_buffer.o \
gfx/scaler/scaler.o \
gfx/shader_common.o \
gfx/scaler/pixconv.o \
gfx/scaler/scaler_int.o \
gfx/scaler/scaler_filter.o \

View File

@ -19,7 +19,7 @@ endif
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
PPU_CFLAGS += -I. -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC -DRARCH_INTERNAL
PPU_SRCS = frontend/frontend_salamander.c frontend/frontend_context.c file_path.c compat/compat.c conf/config_file.c
PPU_SRCS = frontend/frontend_salamander.c frontend/frontend_context.c frontend/platform/platform_null.c file_path.c compat/compat.c conf/config_file.c
ifeq ($(HAVE_LOGGER), 1)
PPU_CFLAGS += -DHAVE_LOGGER -Iconsole/logger

View File

@ -39,7 +39,7 @@ LIBS := -lfat -lwiiuse -logc -lbte
APP_BOOTER_DIR = wii/app_booter
OBJ = frontend/frontend_salamander.o frontend/frontend_context.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
OBJ = frontend/frontend_salamander.o frontend/frontend_context.o frontend/platform/platform_null.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER

View File

@ -5,6 +5,7 @@ OBJDIR := obj-w32
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
frontend/platform/platform_null.o \
retroarch.o \
file.o \
file_path.o \
@ -34,6 +35,7 @@ OBJ = frontend/frontend.o \
media/rarch.o \
gfx/context/win32_common.o \
gfx/scaler/scaler.o \
gfx/shader_common.o \
gfx/scaler/pixconv.o \
gfx/scaler/scaler_int.o \
gfx/scaler/scaler_filter.o \

View File

@ -22,7 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#ifndef RESAMPLER_TEST
#if !defined(RESAMPLER_TEST) && defined(RARCH_INTERNAL)
#include "../general.h"
#else
#define RARCH_LOG(...) fprintf(stderr, __VA_ARGS__)
@ -230,9 +230,9 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
float b, ratio;
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
audio_frame_float_t *inp_max = inp + data->input_frames;
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
audio_frame_float_t *inp_max = (audio_frame_float_t*)(inp + data->input_frames);
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
b = min(data->ratio, 1.00); // cutoff frequency
ratio = 1.0 / data->ratio;
@ -320,4 +320,3 @@ const rarch_resampler_t CC_resampler = {
resampler_CC_free,
"CC",
};

View File

@ -713,18 +713,6 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info)
return true;
}
// Only called once on init and deinit.
// Video and input drivers need to be active (owned)
// before retroarch core starts.
// Core handles audio.
void global_init_drivers(void)
{
find_audio_driver();
find_input_driver();
init_video_input();
}
void global_uninit_drivers(void)
{
if (driver.video && driver.video_data)

View File

@ -466,6 +466,7 @@ typedef struct driver
void *video_data;
void *input_data;
#ifdef HAVE_MENU
void *menu;
const menu_ctx_driver_t *menu_ctx;
#endif
@ -538,7 +539,6 @@ void init_drivers(void);
void init_drivers_pre(void);
void uninit_drivers(void);
void global_init_drivers(void);
void global_uninit_drivers(void);
void init_video_input(void);

View File

@ -32,23 +32,7 @@ frontend_ctx_driver_t *frontend_ctx;
#ifdef RARCH_CONSOLE
#include "../config.def.h"
default_paths_t default_paths;
static void rarch_get_environment_console(void)
{
path_mkdir(default_paths.port_dir);
path_mkdir(default_paths.system_dir);
path_mkdir(default_paths.savestate_dir);
path_mkdir(default_paths.sram_dir);
config_load();
init_libretro_sym(false);
rarch_init_system_info();
global_init_drivers();
}
#endif
#if defined(ANDROID)
@ -89,27 +73,24 @@ static void rarch_get_environment_console(void)
#define ra_preinited false
#endif
#if defined(HAVE_BB10) || defined(RARCH_CONSOLE)
#if defined(HAVE_BB10)
#define attempt_load_game false
#else
#define attempt_load_game true
#endif
#if defined(RARCH_CONSOLE) || defined(HAVE_BB10) || defined(ANDROID)
#if defined(HAVE_BB10) || defined(ANDROID)
#define initial_menu_lifecycle_state (1ULL << MODE_LOAD_GAME)
#else
#define initial_menu_lifecycle_state (1ULL << MODE_GAME)
#endif
#if !defined(RARCH_CONSOLE) && !defined(HAVE_BB10) && !defined(ANDROID)
#if !defined(HAVE_BB10) && !defined(ANDROID)
#define attempt_load_game_push_history true
#else
#define attempt_load_game_push_history false
#endif
#ifndef RARCH_CONSOLE
#define rarch_get_environment_console() (void)0
#endif
#if defined(RARCH_CONSOLE) || defined(__QNX__) || defined(ANDROID)
#define attempt_load_game_fails (1ULL << MODE_MENU_PREINIT)
@ -117,17 +98,25 @@ static void rarch_get_environment_console(void)
#define attempt_load_game_fails (1ULL << MODE_EXIT)
#endif
#define frontend_init_enable true
#define menu_init_enable true
#define initial_lifecycle_state_preinit false
static retro_keyboard_event_t key_event;
static void rarch_get_environment_console(void)
{
#ifdef RARCH_CONSOLE
path_mkdir(default_paths.port_dir);
path_mkdir(default_paths.system_dir);
path_mkdir(default_paths.savestate_dir);
path_mkdir(default_paths.sram_dir);
config_load();
#endif
}
#ifdef HAVE_MENU
static int main_entry_iterate_clear_input(args_type() args)
{
rarch_input_poll();
if (!menu_input())
if (!menu_input(driver.menu))
{
// Restore libretro keyboard callback.
g_extern.system.key_event = key_event;
@ -143,7 +132,7 @@ static int main_entry_iterate_shutdown(args_type() args)
#ifdef HAVE_MENU
// Load dummy core instead of exiting RetroArch completely.
if (g_settings.load_dummy_on_core_shutdown)
load_menu_game_prepare_dummy();
load_menu_game_prepare_dummy(driver.menu);
else
#endif
return 1;
@ -173,9 +162,9 @@ static int main_entry_iterate_content(args_type() args)
static int main_entry_iterate_load_content(args_type() args)
{
load_menu_game_prepare();
load_menu_game_prepare(driver.menu);
if (load_menu_game())
if (load_menu_game(driver.menu))
{
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
if (driver.video_data && driver.video_poke && driver.video_poke->set_aspect_ratio)
@ -203,6 +192,7 @@ static int main_entry_iterate_load_content(args_type() args)
static int main_entry_iterate_menu_preinit(args_type() args)
{
int i;
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
// Menu should always run with vsync on.
video_set_nonblock_state_func(false);
@ -222,6 +212,12 @@ static int main_entry_iterate_menu_preinit(args_type() args)
if (driver.audio_data)
audio_stop_func();
if (!rgui)
{
driver.menu = (rgui_handle_t*)menu_init();
rgui = (rgui_handle_t*)driver.menu;
}
rgui->need_refresh = true;
rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
@ -233,7 +229,7 @@ static int main_entry_iterate_menu_preinit(args_type() args)
static int main_entry_iterate_menu(args_type() args)
{
if (menu_iterate())
if (menu_iterate(driver.menu))
{
if (frontend_ctx && frontend_ctx->process_events)
frontend_ctx->process_events(args);
@ -288,7 +284,7 @@ void main_exit(args_type() args)
#ifdef HAVE_MENU
g_extern.system.shutdown = false;
menu_free();
menu_free(driver.menu);
if (g_extern.config_save_on_exit && *g_extern.config_path)
{
@ -338,14 +334,16 @@ returntype main_entry(signature())
declare_argv();
args_type() args = (args_type())args_initial_ptr();
if (frontend_init_enable)
{
frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
if (frontend_ctx && frontend_ctx->init)
frontend_ctx->init(args);
if (!frontend_ctx)
{
RARCH_WARN("Frontend context could not be initialized.\n");
}
if (frontend_ctx && frontend_ctx->init)
frontend_ctx->init(args);
if (!ra_preinited)
{
rarch_main_clear_state();
@ -365,21 +363,25 @@ returntype main_entry(signature())
}
#if defined(HAVE_MENU)
if (menu_init_enable)
menu_init();
driver.menu = (rgui_handle_t*)menu_init();
if (!driver.menu)
{
RARCH_ERR("Couldn't initialize menu, exiting...\n");
returnfunc();
}
if (frontend_ctx && frontend_ctx->process_args)
frontend_ctx->process_args(argc, argv, args);
if (!initial_lifecycle_state_preinit)
g_extern.lifecycle_state |= initial_menu_lifecycle_state;
g_extern.lifecycle_state |= initial_menu_lifecycle_state;
if (attempt_load_game_push_history)
{
// If we started a ROM directly from command line,
// push it to ROM history.
if (!g_extern.libretro_dummy)
menu_rom_history_push_current();
menu_rom_history_push_current(driver.menu);
}
while (!main_entry_iterate(signature_expand(), args));

View File

@ -42,6 +42,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
#if defined(PSP)
&frontend_ctx_psp,
#endif
&frontend_ctx_null,
NULL // zero length array is not valid
};

View File

@ -51,6 +51,7 @@ extern const frontend_ctx_driver_t frontend_ctx_qnx;
extern const frontend_ctx_driver_t frontend_ctx_apple;
extern const frontend_ctx_driver_t frontend_ctx_android;
extern const frontend_ctx_driver_t frontend_ctx_psp;
extern const frontend_ctx_driver_t frontend_ctx_null;
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.

View File

@ -1340,7 +1340,7 @@ static int menu_common_iterate(void *data, unsigned action)
// FIXME: Add for consoles.
strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
strlcpy(g_extern.fullpath, rgui->deferred_path, sizeof(g_extern.fullpath));
load_menu_game_new_core();
load_menu_game_new_core(rgui);
rgui->msg_force = true;
ret = -1;
menu_flush_stack_type(rgui, RGUI_SETTINGS);
@ -1384,7 +1384,7 @@ static int menu_common_iterate(void *data, unsigned action)
fill_pathname_join(config, dir, path, sizeof(config));
menu_flush_stack_type(rgui, RGUI_SETTINGS);
rgui->msg_force = true;
if (menu_replace_config(config))
if (menu_replace_config(rgui, config))
{
menu_clear_navigation(rgui);
ret = -1;
@ -1417,7 +1417,7 @@ static int menu_common_iterate(void *data, unsigned action)
}
else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY)
{
load_menu_game_history(rgui->selection_ptr);
load_menu_game_history(rgui, rgui->selection_ptr);
menu_flush_stack_type(rgui, RGUI_SETTINGS);
ret = -1;
}
@ -1688,6 +1688,7 @@ static void menu_common_shader_manager_set_preset(void *data, unsigned type, con
if (path && shader)
{
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
// Load stored CGP into RGUI menu on success.
// Used when a preset is directly loaded.
// No point in updating when the CGP was created from RGUI itself.
@ -2141,7 +2142,9 @@ static bool osk_callback_enter_audio_device_init(void *data)
static bool osk_callback_enter_filename(void *data)
{
if (!driver.osk)
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
if (!driver.osk || !rgui)
return false;
if (g_extern.lifecycle_state & (1ULL << MODE_OSK_ENTRY_SUCCESS))
@ -3778,6 +3781,8 @@ static int menu_common_setting_set(void *data, unsigned setting, unsigned action
static void menu_common_setting_set_label(char *type_str, size_t type_str_size, unsigned *w, unsigned type)
{
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
switch (type)
{
case RGUI_SETTINGS_VIDEO_ROTATION:

View File

@ -595,9 +595,11 @@ static void rgui_free(void *data)
static int rgui_input_postprocess(void *data, uint64_t old_state)
{
(void)data;
int ret = 0;
int ret;
rgui_handle_t *rgui;
rgui = (rgui_handle_t*)data;
ret = 0;
if ((rgui->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&

View File

@ -464,9 +464,10 @@ static void rmenu_free(void *data)
static int rmenu_input_postprocess(void *data, uint64_t old_state)
{
(void)data;
int ret;
rgui_handle_t *rgui = (rgui_handle_t*)data;
int ret = 0;
ret = 0;
if ((rgui->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&

View File

@ -33,8 +33,6 @@
#include "../../compat/posix_string.h"
rgui_handle_t *rgui;
void menu_update_system_info(void *data, bool *load_no_rom)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
@ -68,20 +66,22 @@ void menu_update_system_info(void *data, bool *load_no_rom)
#endif
}
void menu_rom_history_push(const char *path,
void menu_rom_history_push(void *data, const char *path,
const char *core_path,
const char *core_name)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (rgui->history)
rom_history_push(rgui->history, path, core_path, core_name);
}
void menu_rom_history_push_current(void)
void menu_rom_history_push_current(void *data)
{
// g_extern.fullpath can be relative here.
// Ensure we're pushing absolute path.
char tmp[PATH_MAX];
rgui_handle_t *rgui = (rgui_handle_t*)data;
strlcpy(tmp, g_extern.fullpath, sizeof(tmp));
@ -89,14 +89,16 @@ void menu_rom_history_push_current(void)
path_resolve_realpath(tmp, sizeof(tmp));
if (g_extern.system.no_game || *tmp)
menu_rom_history_push(*tmp ? tmp : NULL,
menu_rom_history_push(rgui, *tmp ? tmp : NULL,
g_settings.libretro,
g_extern.system.info.library_name);
}
void load_menu_game_prepare(void)
void load_menu_game_prepare(void *data)
{
if (*g_extern.fullpath || rgui->load_no_rom)
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (*g_extern.fullpath || (rgui && rgui->load_no_rom))
{
if (*g_extern.fullpath)
{
@ -111,7 +113,7 @@ void load_menu_game_prepare(void)
#ifdef RARCH_CONSOLE
if (g_extern.system.no_game || *g_extern.fullpath)
#endif
menu_rom_history_push(*g_extern.fullpath ? g_extern.fullpath : NULL,
menu_rom_history_push(rgui, *g_extern.fullpath ? g_extern.fullpath : NULL,
g_settings.libretro,
rgui->info.library_name ? rgui->info.library_name : "");
}
@ -138,12 +140,18 @@ void load_menu_game_prepare(void)
MENU_TEXTURE_FULLSCREEN);
}
void load_menu_game_history(unsigned game_index)
void load_menu_game_history(void *data, unsigned game_index)
{
rgui_handle_t *rgui;
const char *path = NULL;
const char *core_path = NULL;
const char *core_name = NULL;
rgui = (rgui_handle_t*)data;
if (!rgui)
return;
rom_history_get_index(rgui->history,
game_index, &path, &core_path, &core_name);
@ -163,9 +171,11 @@ void load_menu_game_history(unsigned game_index)
#endif
}
static void menu_init_history(void)
static void menu_init_history(void *data)
{
if (rgui->history)
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (rgui && rgui->history)
{
rom_history_free(rgui->history);
rgui->history = NULL;
@ -187,8 +197,13 @@ static void menu_init_history(void)
}
}
static void menu_update_libretro_info(void)
static void menu_update_libretro_info(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (!rgui)
return;
*rgui->libretro_dir = '\0';
#if defined(RARCH_CONSOLE)
@ -213,8 +228,13 @@ static void menu_update_libretro_info(void)
menu_update_system_info(rgui, NULL);
}
void load_menu_game_prepare_dummy(void)
void load_menu_game_prepare_dummy(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (!rgui)
return;
// Starts dummy core.
*g_extern.fullpath = '\0';
rgui->load_no_rom = false;
@ -224,13 +244,14 @@ void load_menu_game_prepare_dummy(void)
g_extern.system.shutdown = false;
}
bool load_menu_game(void)
bool load_menu_game(void *data)
{
struct rarch_main_wrap args = {0};
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (g_extern.main_is_init)
rarch_main_deinit();
struct rarch_main_wrap args = {0};
args.verbose = g_extern.verbose;
args.config_path = *g_extern.config_path ? g_extern.config_path : NULL;
args.sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
@ -238,33 +259,44 @@ bool load_menu_game(void)
args.rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
args.libretro_path = *g_settings.libretro ? g_settings.libretro : NULL;
args.no_rom = rgui->load_no_rom;
rgui->load_no_rom = false;
if (rarch_main_init_wrap(&args) == 0)
if (rgui)
rgui->load_no_rom = false;
if (rarch_main_init_wrap(&args) != 0)
{
RARCH_LOG("rarch_main_init_wrap() succeeded.\n");
// Update menu state which depends on config.
menu_update_libretro_info();
menu_init_history();
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init)
driver.menu_ctx->backend->shader_manager_init(rgui);
return true;
}
else
{
char name[PATH_MAX];
char msg[PATH_MAX];
char name[PATH_MAX], msg[PATH_MAX];
fill_pathname_base(name, g_extern.fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
msg_queue_push(g_extern.msg_queue, msg, 1, 90);
rgui->msg_force = true;
if (rgui)
rgui->msg_force = true;
RARCH_ERR("rarch_main_init_wrap() failed.\n");
return false;
}
RARCH_LOG("rarch_main_init_wrap() succeeded.\n");
if (rgui)
{
// Update menu state which depends on config.
menu_update_libretro_info(rgui);
menu_init_history(rgui);
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init)
driver.menu_ctx->backend->shader_manager_init(rgui);
}
return true;
}
void menu_init(void)
void *menu_init(void)
{
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(rgui));
if (!rgui)
return NULL;
if (!menu_ctx_init_first(&driver.menu_ctx, (void**)&rgui))
{
RARCH_ERR("Could not initialize menu.\n");
@ -287,17 +319,24 @@ void menu_init(void)
rgui->frame_buf_show = true;
rgui->current_pad = 0;
menu_update_libretro_info();
menu_update_libretro_info(rgui);
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init)
driver.menu_ctx->backend->shader_manager_init(rgui);
menu_init_history();
menu_init_history(rgui);
rgui->last_time = rarch_get_time_usec();
return rgui;
}
void menu_free(void)
void menu_free(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (!rgui)
return;
if (driver.menu_ctx && driver.menu_ctx->free)
driver.menu_ctx->free(rgui);
@ -354,17 +393,23 @@ void menu_ticker_line(char *buf, size_t len, unsigned index, const char *str, bo
}
#ifdef HAVE_MENU
uint64_t menu_input(void)
uint64_t menu_input(void *data)
{
unsigned i;
uint64_t input_state = 0;
uint64_t input_state;
rgui_handle_t *rgui;
#ifdef RARCH_CONSOLE
static const struct retro_keybind *binds[] = { g_settings.input.menu_binds };
#else
static const struct retro_keybind *binds[] = { g_settings.input.binds[0] };
#endif
rgui = (rgui_handle_t*)data;
input_state = 0;
if (!rgui)
return 0;
input_push_analog_dpad((struct retro_keybind*)binds[0], g_settings.input.analog_dpad_mode[0]);
for (i = 0; i < MAX_PLAYERS; i++)
input_push_analog_dpad(g_settings.input.autoconf_binds[i], g_settings.input.analog_dpad_mode[i]);
@ -422,8 +467,13 @@ void menu_flush_stack_type(void *data, unsigned final_type)
}
}
void load_menu_game_new_core(void)
void load_menu_game_new_core(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (!rgui)
return;
#ifdef HAVE_DYNAMIC
menu_update_system_info(rgui, &rgui->load_no_rom);
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
@ -433,17 +483,23 @@ void load_menu_game_new_core(void)
#endif
}
bool menu_iterate(void)
bool menu_iterate(void *data)
{
retro_time_t time, delta, target_msec, sleep_msec;
unsigned action;
static bool initial_held = true;
static bool first_held = false;
uint64_t input_state = 0;
uint64_t input_state;
int32_t input_entry_ret, ret;
rgui_handle_t *rgui;
input_state = 0;
input_entry_ret = 0;
ret = 0;
rgui = (rgui_handle_t*)data;
if (!rgui)
return false;
if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
{
@ -465,7 +521,7 @@ bool menu_iterate(void)
return false;
}
input_state = menu_input();
input_state = menu_input(rgui);
if (rgui->do_held)
{
@ -566,9 +622,13 @@ bool menu_iterate(void)
// Likely to have lots of small bugs.
// Cleanly exit the main loop to ensure that all the tiny details get set properly.
// This should mitigate most of the smaller bugs.
bool menu_replace_config(const char *path)
bool menu_replace_config(void *data, const char *path)
{
if (strcmp(path, g_extern.config_path) == 0)
rgui_handle_t *rgui;
rgui = (rgui_handle_t*)data;
if (strcmp(path, g_extern.config_path) == 0 || !rgui)
return false;
if (g_extern.config_save_on_exit && *g_extern.config_path)
@ -851,6 +911,7 @@ void menu_build_scroll_indices(void *data, file_list_t *buf)
void menu_init_core_info(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
if (*rgui->libretro_dir)

View File

@ -182,30 +182,28 @@ typedef struct
bool bind_mode_keyboard;
} rgui_handle_t;
extern rgui_handle_t *rgui;
void menu_init(void);
bool menu_iterate(void);
void menu_free(void);
void *menu_init(void);
bool menu_iterate(void *data);
void menu_free(void *data);
void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, bool selected);
void menu_init_core_info(void *data);
void load_menu_game_prepare(void);
void load_menu_game_prepare_dummy(void);
bool load_menu_game(void);
void load_menu_game_history(unsigned game_index);
extern void load_menu_game_new_core(void);
void menu_rom_history_push(const char *path, const char *core_path,
void load_menu_game_prepare(void *data);
void load_menu_game_prepare_dummy(void *data);
bool load_menu_game(void *data);
void load_menu_game_history(void *data, unsigned game_index);
extern void load_menu_game_new_core(void *data);
void menu_rom_history_push(void *data, const char *path, const char *core_path,
const char *core_name);
void menu_rom_history_push_current(void);
void menu_rom_history_push_current(void *data);
bool menu_replace_config(const char *path);
bool menu_replace_config(void *data, const char *path);
bool menu_save_new_config(void);
uint64_t menu_input(void);
uint64_t menu_input(void *data);
void menu_flush_stack_type(void *data, unsigned final_type);
void menu_update_system_info(void *data, bool *load_no_rom);

View File

@ -112,6 +112,7 @@ void preset_filename_callback(void *userdata, const char *str)
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod)
{
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
(void)down;
(void)keycode;
(void)mod;

View File

@ -103,16 +103,19 @@ void apple_refresh_config(void)
int apple_rarch_load_content(int argc, char* argv[])
{
rgui_handle_t *rgui;
rarch_main_clear_state();
rarch_init_msg_queue();
if (rarch_main_init(argc, argv))
return 1;
menu_init();
driver.menu = (rgui_handle_t*)menu_init();
rgui = (rgui_handle_t*)driver.menu;
if (!g_extern.libretro_dummy)
menu_rom_history_push_current();
if (!g_extern.libretro_dummy && rgui)
menu_rom_history_push_current(rgui);
g_extern.lifecycle_state |= 1ULL << MODE_GAME;

View File

@ -45,13 +45,13 @@ int main(int argc, char *argv[])
if ((init_ret = rarch_main_init(argc, argv))) return init_ret;
#ifdef HAVE_MENU
menu_init();
menu_init(driver.menu);
g_extern.lifecycle_state |= 1ULL << MODE_GAME;
// If we started a ROM directly from command line,
// push it to ROM history.
if (!g_extern.libretro_dummy)
menu_rom_history_push_current();
menu_rom_history_push_current(driver.menu);
#endif
emscripten_set_main_loop(emscripten_mainloop, g_settings.video.vsync ? 0 : INT_MAX, 1);

View File

@ -0,0 +1,34 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2012-2014 - Jason Fetters
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
* * You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../frontend_context.h"
#include <stdint.h>
#include "../../boolean.h"
#include <stddef.h>
#include <string.h>
const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* environment_get */
NULL, /* init */
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* process_events */
NULL, /* exec */
NULL, /* shutdown */
"null",
};

View File

@ -36,14 +36,38 @@
// Compile: gcc -o twoxbr.so -shared twoxbr.c -std=c99 -O3 -Wall -pedantic -fPIC
#include "softfilter.h"
#include "softfilter_prototypes.h"
#include <stdlib.h>
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation twoxbr_get_implementation
#define softfilter_thread_data twoxbr_softfilter_thread_data
#define filter_data twoxbr_filter_data
#endif
#define TWOXBR_SCALE 2
struct softfilter_thread_data
{
void *out_data;
const void *in_data;
size_t out_pitch;
size_t in_pitch;
unsigned colfmt;
unsigned width;
unsigned height;
int first;
int last;
};
struct filter_data
{
unsigned threads;
struct softfilter_thread_data *workers;
unsigned in_fmt;
uint16_t RGBtoYUV[65536];
uint16_t tbl_5_to_8[32];
uint16_t tbl_6_to_8[64];
};
static unsigned twoxbr_generic_input_fmts(void)
{
@ -60,6 +84,141 @@ static unsigned twoxbr_generic_threads(void *data)
struct filter_data *filt = (struct filter_data*)data;
return filt->threads;
}
#define RED_MASK565 0xF800
#define GREEN_MASK565 0x07E0
#define BLUE_MASK565 0x001F
#define PG_LBMASK565 0xF7DE
#ifdef MSB_FIRST
#define RED_MASK8888 0xFF000000
#define GREEN_MASK8888 0x00FF0000
#define BLUE_MASK8888 0x0000FF00
#define PG_LBMASK8888 0xFEFEFEFE
#define ALPHA_MASK8888 0x000000FF
#else
#define RED_MASK8888 0x000000FF
#define GREEN_MASK8888 0x0000FF00
#define BLUE_MASK8888 0x00FF0000
#define PG_LBMASK8888 0xFEFEFEFE
#define ALPHA_MASK8888 0xFF000000
#endif
static void SetupFormat(void * data)
{
uint16_t r, g, b, y, u, v;
uint32_t c;
struct filter_data *filt = (struct filter_data*)data;
filt->tbl_5_to_8[0] = 0;
filt->tbl_5_to_8[1] = 8;
filt->tbl_5_to_8[2] = 16;
filt->tbl_5_to_8[3] = 25;
filt->tbl_5_to_8[4] = 33;
filt->tbl_5_to_8[5] = 41;
filt->tbl_5_to_8[6] = 49;
filt->tbl_5_to_8[7] = 58;
filt->tbl_5_to_8[8] = 66;
filt->tbl_5_to_8[9] = 74;
filt->tbl_5_to_8[10] = 82;
filt->tbl_5_to_8[11] = 90;
filt->tbl_5_to_8[12] = 99;
filt->tbl_5_to_8[13] = 107;
filt->tbl_5_to_8[14] = 115;
filt->tbl_5_to_8[15] = 123;
filt->tbl_5_to_8[16] = 132;
filt->tbl_5_to_8[17] = 140;
filt->tbl_5_to_8[18] = 148;
filt->tbl_5_to_8[19] = 156;
filt->tbl_5_to_8[20] = 165;
filt->tbl_5_to_8[21] = 173;
filt->tbl_5_to_8[22] = 181;
filt->tbl_5_to_8[23] = 189;
filt->tbl_5_to_8[24] = 197;
filt->tbl_5_to_8[25] = 206;
filt->tbl_5_to_8[26] = 214;
filt->tbl_5_to_8[27] = 222;
filt->tbl_5_to_8[28] = 230;
filt->tbl_5_to_8[29] = 239;
filt->tbl_5_to_8[30] = 247;
filt->tbl_5_to_8[31] = 255;
filt->tbl_6_to_8[0] = 0;
filt->tbl_6_to_8[1] = 4;
filt->tbl_6_to_8[2] = 8;
filt->tbl_6_to_8[3] = 12;
filt->tbl_6_to_8[4] = 16;
filt->tbl_6_to_8[5] = 20;
filt->tbl_6_to_8[6] = 24;
filt->tbl_6_to_8[7] = 28;
filt->tbl_6_to_8[8] = 32;
filt->tbl_6_to_8[9] = 36;
filt->tbl_6_to_8[10] = 40;
filt->tbl_6_to_8[11] = 45;
filt->tbl_6_to_8[12] = 49;
filt->tbl_6_to_8[13] = 53;
filt->tbl_6_to_8[14] = 57;
filt->tbl_6_to_8[15] = 61;
filt->tbl_6_to_8[16] = 65;
filt->tbl_6_to_8[17] = 69;
filt->tbl_6_to_8[18] = 73;
filt->tbl_6_to_8[19] = 77;
filt->tbl_6_to_8[20] = 81;
filt->tbl_6_to_8[21] = 85;
filt->tbl_6_to_8[22] = 89;
filt->tbl_6_to_8[23] = 93;
filt->tbl_6_to_8[24] = 97;
filt->tbl_6_to_8[25] = 101;
filt->tbl_6_to_8[26] = 105;
filt->tbl_6_to_8[27] = 109;
filt->tbl_6_to_8[28] = 113;
filt->tbl_6_to_8[29] = 117;
filt->tbl_6_to_8[30] = 121;
filt->tbl_6_to_8[31] = 125;
filt->tbl_6_to_8[32] = 130;
filt->tbl_6_to_8[33] = 134;
filt->tbl_6_to_8[34] = 138;
filt->tbl_6_to_8[35] = 142;
filt->tbl_6_to_8[36] = 146;
filt->tbl_6_to_8[37] = 150;
filt->tbl_6_to_8[38] = 154;
filt->tbl_6_to_8[39] = 158;
filt->tbl_6_to_8[40] = 162;
filt->tbl_6_to_8[41] = 166;
filt->tbl_6_to_8[42] = 170;
filt->tbl_6_to_8[43] = 174;
filt->tbl_6_to_8[44] = 178;
filt->tbl_6_to_8[45] = 182;
filt->tbl_6_to_8[46] = 186;
filt->tbl_6_to_8[47] = 190;
filt->tbl_6_to_8[48] = 194;
filt->tbl_6_to_8[49] = 198;
filt->tbl_6_to_8[50] = 202;
filt->tbl_6_to_8[51] = 206;
filt->tbl_6_to_8[52] = 210;
filt->tbl_6_to_8[53] = 215;
filt->tbl_6_to_8[54] = 219;
filt->tbl_6_to_8[55] = 223;
filt->tbl_6_to_8[56] = 227;
filt->tbl_6_to_8[57] = 231;
filt->tbl_6_to_8[58] = 235;
filt->tbl_6_to_8[59] = 239;
filt->tbl_6_to_8[60] = 243;
filt->tbl_6_to_8[61] = 247;
filt->tbl_6_to_8[62] = 251;
filt->tbl_6_to_8[63] = 255;
for (c = 0; c < 65536; c++)
{
r = filt->tbl_5_to_8[(c & RED_MASK565) >> 11];
g = filt->tbl_6_to_8[(c & GREEN_MASK565) >> 5];
b = filt->tbl_5_to_8[(c & BLUE_MASK565) ];
y = ((r << 4) + (g << 5) + (b << 2));
u = ( -r - (g << 1) + (b << 2));
v = ((r << 1) - (g << 1) - (b >> 1));
filt->RGBtoYUV[c] = y + u + v;
}
}
static void *twoxbr_generic_create(unsigned in_fmt, unsigned out_fmt,
unsigned max_width, unsigned max_height,
@ -78,6 +237,9 @@ static void *twoxbr_generic_create(unsigned in_fmt, unsigned out_fmt,
free(filt);
return NULL;
}
SetupFormat(filt);
return filt;
}
@ -95,32 +257,10 @@ static void twoxbr_generic_destroy(void *data)
free(filt);
}
static uint8_t initialized = 0;
uint16_t RGBtoYUV[65536];
const static uint16_t tbl_5_to_8[32]={0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99, 107, 115, 123, 132, 140, 148, 156, 165, 173, 181, 189, 197, 206, 214, 222, 230, 239, 247, 255};
const static uint16_t tbl_6_to_8[64]={0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255};
//---------------------------------------------------------------------------------------------------------------------------
#define RED_MASK565 0xF800
#define GREEN_MASK565 0x07E0
#define BLUE_MASK565 0x001F
#define PG_LBMASK565 0xF7DE
#ifdef MSB_FIRST
#define RED_MASK8888 0xFF000000
#define GREEN_MASK8888 0x00FF0000
#define BLUE_MASK8888 0x0000FF00
#define PG_LBMASK8888 0xFEFEFEFE
#define ALPHA_MASK8888 0x000000FF
#else
#define RED_MASK8888 0x000000FF
#define GREEN_MASK8888 0x0000FF00
#define BLUE_MASK8888 0x00FF0000
#define PG_LBMASK8888 0xFEFEFEFE
#define ALPHA_MASK8888 0xFF000000
#endif
#define ALPHA_BLEND_128_W(dst, src) dst = ((src & pg_lbmask) >> 1) + ((dst & pg_lbmask) >> 1)
@ -266,11 +406,11 @@ const static uint16_t tbl_6_to_8[64]={0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40,
ALPHA_BLEND_128_W(E[N3], PIXEL); \
#define df(A, B)\
abs(RGBtoYUV[A] - RGBtoYUV[B])\
#define df(Z, A, B)\
abs(Z->RGBtoYUV[A] - Z->RGBtoYUV[B])\
#define eq(A, B)\
(df(A, B) < 155)\
#define eq(Z, A, B)\
(df(Z, A, B) < 155)\
@ -319,16 +459,17 @@ int eq8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, ui
}
#define FILTRO_RGB565(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask) \
#define FILTRO_RGB565(Z, PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask) \
ex = (PE!=PH && PE!=PF); \
if ( ex )\
{\
e = (df(PE,PC)+df(PE,PG)+df(PI,H5)+df(PI,F4))+(df(PH,PF)<<2); \
i = (df(PH,PD)+df(PH,I5)+df(PF,I4)+df(PF,PB))+(df(PE,PI)<<2); \
if ((e<i) && ( (!eq(PF,PB) && !eq(PF,PC)) || (!eq(PH,PD) && !eq(PH,PG)) || (eq(PE,PI) && ((!eq(PF,F4) && !eq(PF,I4)) || (!eq(PH,H5) && !eq(PH,I5)))) || eq(PE,PG) || eq(PE,PC)) )\
e = (df(Z, PE,PC)+df(Z, PE,PG)+df(Z, PI,H5)+df(Z, PI,F4))+(df(Z, PH,PF)<<2); \
i = (df(Z, PH,PD)+df(Z, PH,I5)+df(Z, PF,I4)+df(Z, PF,PB))+(df(Z, PE,PI)<<2); \
if ((e<i) && ( (!eq(Z, PF,PB) && !eq(Z, PF,PC)) || (!eq(Z, PH,PD) && !eq(Z, PH,PG)) || (eq(Z, PE,PI) && ((!eq(Z, PF,F4) && !eq(Z, PF,I4)) || (!eq(Z, PH,H5) && !eq(Z, PH,I5)))) || eq(Z, PE,PG) || eq(Z, PE,PC)) )\
{\
ke=df(PF,PG); ki=df(PH,PC); \
ex2 = (PE!=PC && PB!=PC); ex3 = (PE!=PG && PD!=PG); px = (df(PE,PF) <= df(PE,PH)) ? PF : PH; \
ke=df(Z, PF,PG); \
ki=df(Z, PH,PC); \
ex2 = (PE!=PC && PB!=PC); ex3 = (PE!=PG && PD!=PG); px = (df(Z, PE,PF) <= df(Z, PE,PH)) ? PF : PH; \
if ( ((ke<<1)<=ki) && ex3 && (ke>=(ki<<1)) && ex2 ) \
{\
LEFT_UP_2_2X(N3, N2, N1, px)\
@ -348,11 +489,11 @@ int eq8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, ui
}\
else if (e<=i)\
{\
ALPHA_BLEND_128_W( E[N3], ((df(PE,PF) <= df(PE,PH)) ? PF : PH)); \
ALPHA_BLEND_128_W( E[N3], ((df(Z, PE,PF) <= df(Z, PE,PH)) ? PF : PH)); \
}\
}\
#define FILTRO_RGB8888(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask) \
#define FILTRO_RGB8888(Z, PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask) \
ex = (PE!=PH && PE!=PF); \
if ( ex )\
{\
@ -415,12 +556,12 @@ int eq8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, ui
typename_t I5 = *(in + nextline + nextline + 1); \
#ifndef twoxbr_function
#define twoxbr_function(FILTRO) \
#define twoxbr_function(FILTRO, Z) \
E[0] = E[1] = E[2] = E[3] = PE;\
FILTRO(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, 2, 3, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 2, 0, 3, 1, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 3, 2, 1, 0, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 1, 3, 0, 2, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, 2, 3, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 2, 0, 3, 1, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 3, 2, 1, 0, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 1, 3, 0, 2, pg_red_mask, pg_green_mask, pg_blue_mask);\
out[0] = E[0]; \
out[1] = E[1]; \
out[dst_stride] = E[2]; \
@ -429,42 +570,21 @@ int eq8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, ui
out += 2
#endif
static void SetupFormat(void)
{
uint16_t r, g, b, y, u, v;
uint32_t c;
for (c = 0; c < 65536; c++)
{
r = tbl_5_to_8[(c & RED_MASK565) >> 11];
g = tbl_6_to_8[(c & GREEN_MASK565) >> 5];
b = tbl_5_to_8[(c & BLUE_MASK565) ];
y = ((r<<4) + (g<<5) + (b<<2));
u = ( -r - (g<<1) + (b<<2));
v = ((r<<1) - (g<<1) - (b>>1));
RGBtoYUV[c] = y + u + v;
}
}
static void twoxbr_generic_xrgb8888(unsigned width, unsigned height,
static void twoxbr_generic_xrgb8888(void *data, unsigned width, unsigned height,
int first, int last, uint32_t *src,
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
{
unsigned nextline, finish;
struct filter_data *filt = (struct filter_data*)data;
uint32_t pg_red_mask = RED_MASK8888;
uint32_t pg_green_mask = GREEN_MASK8888;
uint32_t pg_blue_mask = BLUE_MASK8888;
uint32_t pg_lbmask = PG_LBMASK8888;
uint32_t pg_alpha_mask = ALPHA_MASK8888;
unsigned nextline, finish;
nextline = (last) ? 0 : src_stride;
if (!initialized)
{
initialized = 1;
}
for (; height; height--)
{
uint32_t *in = (uint32_t*)src;
@ -481,7 +601,7 @@ static void twoxbr_generic_xrgb8888(unsigned width, unsigned height,
// G0 PG PH PI I4
// G5 H5 I5
twoxbr_function(FILTRO_RGB8888);
twoxbr_function(FILTRO_RGB8888, filt);
}
src += src_stride;
@ -489,12 +609,13 @@ static void twoxbr_generic_xrgb8888(unsigned width, unsigned height,
}
}
static void twoxbr_generic_rgb565(unsigned width, unsigned height,
static void twoxbr_generic_rgb565(void *data, unsigned width, unsigned height,
int first, int last, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
uint16_t pg_red_mask, pg_green_mask, pg_blue_mask, pg_lbmask;
unsigned nextline, finish;
struct filter_data *filt = (struct filter_data*)data;
pg_red_mask = RED_MASK565;
pg_green_mask = GREEN_MASK565;
@ -502,11 +623,6 @@ static void twoxbr_generic_rgb565(unsigned width, unsigned height,
pg_lbmask = PG_LBMASK565;
nextline = (last) ? 0 : src_stride;
if (!initialized)
{
SetupFormat();
initialized = 1;
}
for (; height; height--)
{
@ -524,7 +640,7 @@ static void twoxbr_generic_rgb565(unsigned width, unsigned height,
// G0 PG PH PI I4
// G5 H5 I5
twoxbr_function(FILTRO_RGB565);
twoxbr_function(FILTRO_RGB565, filt);
}
src += src_stride;
@ -540,7 +656,7 @@ static void twoxbr_work_cb_rgb565(void *data, void *thread_data)
unsigned width = thr->width;
unsigned height = thr->height;
twoxbr_generic_rgb565(width, height,
twoxbr_generic_rgb565(data, width, height,
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565);
}
@ -552,7 +668,7 @@ static void twoxbr_work_cb_xrgb8888(void *data, void *thread_data)
unsigned width = thr->width;
unsigned height = thr->height;
twoxbr_generic_xrgb8888(width, height,
twoxbr_generic_xrgb8888(data, width, height,
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_XRGB8888, output, thr->out_pitch / SOFTFILTER_BPP_XRGB8888);
}
@ -612,4 +728,6 @@ const struct softfilter_implementation *softfilter_get_implementation(softfilter
#ifdef RARCH_INTERNAL
#undef softfilter_get_implementation
#undef softfilter_thread_data
#undef filter_data
#endif

View File

@ -17,15 +17,36 @@
// Compile: gcc -o twoxsai.so -shared twoxsai.c -std=c99 -O3 -Wall -pedantic -fPIC
#include "softfilter.h"
#include "softfilter_prototypes.h"
#include <stdlib.h>
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation twoxsai_get_implementation
#define softfilter_thread_data twoxsai_softfilter_thread_data
#define filter_data twoxsai_filter_data
#endif
#define TWOXSAI_SCALE 2
struct softfilter_thread_data
{
void *out_data;
const void *in_data;
size_t out_pitch;
size_t in_pitch;
unsigned colfmt;
unsigned width;
unsigned height;
int first;
int last;
};
struct filter_data
{
unsigned threads;
struct softfilter_thread_data *workers;
unsigned in_fmt;
};
static unsigned twoxsai_generic_input_fmts(void)
{
return SOFTFILTER_FMT_RGB565 | SOFTFILTER_FMT_XRGB8888;
@ -336,4 +357,6 @@ const struct softfilter_implementation *softfilter_get_implementation(softfilter
#ifdef RARCH_INTERNAL
#undef softfilter_get_implementation
#undef softfilter_thread_data
#undef filter_data
#endif

View File

@ -15,20 +15,40 @@
*/
#include "softfilter.h"
#include "softfilter_prototypes.h"
#include <stdlib.h>
#include "boolean.h"
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation blargg_ntsc_snes_composite_get_implementation
#endif
#include "snes_ntsc/snes_ntsc.h"
#include "snes_ntsc/snes_ntsc.c"
static struct snes_ntsc_t *ntsc_composite;
static int burst_composite;
static int burst_toggle_composite;
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation blargg_ntsc_snes_composite_get_implementation
#define softfilter_thread_data blargg_ntsc_snes_composite_softfilter_thread_data
#define filter_data blargg_ntsc_snes_composite_filter_data
#endif
struct softfilter_thread_data
{
void *out_data;
const void *in_data;
size_t out_pitch;
size_t in_pitch;
unsigned colfmt;
unsigned width;
unsigned height;
int first;
int last;
};
struct filter_data
{
unsigned threads;
struct softfilter_thread_data *workers;
unsigned in_fmt;
struct snes_ntsc_t *ntsc;
int burst;
int burst_toggle;
};
static unsigned blargg_ntsc_snes_composite_generic_input_fmts(void)
{
@ -46,6 +66,20 @@ static unsigned blargg_ntsc_snes_composite_generic_threads(void *data)
return filt->threads;
}
static void blargg_ntsc_snes_composite_initialize(void *data)
{
snes_ntsc_setup_t setup;
struct filter_data *filt = (struct filter_data*)data;
filt->ntsc = (snes_ntsc_t*)calloc(1, sizeof(*filt->ntsc));
setup = snes_ntsc_composite;
setup.merge_fields = 1;
snes_ntsc_init(filt->ntsc, &setup);
filt->burst = 0;
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
}
static void *blargg_ntsc_snes_composite_generic_create(unsigned in_fmt, unsigned out_fmt,
unsigned max_width, unsigned max_height,
unsigned threads, softfilter_simd_mask_t simd)
@ -63,30 +97,15 @@ static void *blargg_ntsc_snes_composite_generic_create(unsigned in_fmt, unsigned
free(filt);
return NULL;
}
blargg_ntsc_snes_composite_initialize(filt);
return filt;
}
static void blargg_ntsc_snes_composite_initialize(void)
{
snes_ntsc_setup_t setup;
static bool initialized = false;
if(initialized == true)
return;
initialized = true;
ntsc_composite = (snes_ntsc_t*)malloc(sizeof(*ntsc_composite));
setup = snes_ntsc_composite;
setup.merge_fields = 1;
snes_ntsc_init(ntsc_composite, &setup);
burst_composite = 0;
burst_toggle_composite = (setup.merge_fields ? 0 : 1);
}
static void blargg_ntsc_snes_composite_generic_output(void *data, unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height)
{
blargg_ntsc_snes_composite_initialize();
*out_width = SNES_NTSC_OUT_WIDTH(256);
*out_height = height;
}
@ -95,34 +114,31 @@ static void blargg_ntsc_snes_composite_generic_destroy(void *data)
{
struct filter_data *filt = (struct filter_data*)data;
if(ntsc_composite)
free(ntsc_composite);
if(filt->ntsc)
free(filt->ntsc);
free(filt->workers);
free(filt);
}
static void blargg_ntsc_snes_composite_render_rgb565(int width, int height,
static void blargg_ntsc_snes_composite_render_rgb565(void *data, int width, int height,
int first, int last,
uint16_t *input, int pitch, uint16_t *output, int outpitch)
{
blargg_ntsc_snes_composite_initialize();
if(!ntsc_composite)
return;
struct filter_data *filt = (struct filter_data*)data;
if(width <= 256)
snes_ntsc_blit(ntsc_composite, input, pitch, burst_composite, width, height, output, outpitch * 2, first, last);
snes_ntsc_blit(filt->ntsc, input, pitch, filt->burst, width, height, output, outpitch * 2, first, last);
else
snes_ntsc_blit_hires(ntsc_composite, input, pitch, burst_composite, width, height, output, outpitch * 2, first, last);
snes_ntsc_blit_hires(filt->ntsc, input, pitch, filt->burst, width, height, output, outpitch * 2, first, last);
burst_composite ^= burst_toggle_composite;
filt->burst ^= filt->burst_toggle;
}
static void blargg_ntsc_snes_composite_rgb565(unsigned width, unsigned height,
static void blargg_ntsc_snes_composite_rgb565(void *data, unsigned width, unsigned height,
int first, int last, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
blargg_ntsc_snes_composite_render_rgb565(width, height,
blargg_ntsc_snes_composite_render_rgb565(data, width, height,
first, last,
src, src_stride,
dst, dst_stride);
@ -137,7 +153,7 @@ static void blargg_ntsc_snes_composite_work_cb_rgb565(void *data, void *thread_d
unsigned width = thr->width;
unsigned height = thr->height;
blargg_ntsc_snes_composite_rgb565(width, height,
blargg_ntsc_snes_composite_rgb565(data, width, height,
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565);
}
@ -193,4 +209,6 @@ const struct softfilter_implementation *softfilter_get_implementation(softfilter
#ifdef RARCH_INTERNAL
#undef softfilter_get_implementation
#undef softfilter_thread_data
#undef filter_data
#endif

View File

@ -15,20 +15,39 @@
*/
#include "softfilter.h"
#include "softfilter_prototypes.h"
#include <stdlib.h>
#include "boolean.h"
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation blargg_ntsc_snes_rgb_get_implementation
#endif
#include "snes_ntsc/snes_ntsc.h"
#include "snes_ntsc/snes_ntsc.c"
static struct snes_ntsc_t *ntsc_rgb;
static int burst_rgb;
static int burst_toggle_rgb;
#ifdef RARCH_INTERNAL
#define softfilter_get_implementation blargg_ntsc_snes_rgb_get_implementation
#define softfilter_thread_data blargg_ntsc_snes_rgb_softfilter_thread_data
#define filter_data blargg_ntsc_snes_rgb_filter_data
#endif
struct softfilter_thread_data
{
void *out_data;
const void *in_data;
size_t out_pitch;
size_t in_pitch;
unsigned colfmt;
unsigned width;
unsigned height;
int first;
int last;
};
struct filter_data
{
unsigned threads;
struct softfilter_thread_data *workers;
unsigned in_fmt;
struct snes_ntsc_t *ntsc;
int burst;
int burst_toggle;
};
static unsigned blargg_ntsc_snes_rgb_generic_input_fmts(void)
{
@ -46,6 +65,20 @@ static unsigned blargg_ntsc_snes_rgb_generic_threads(void *data)
return filt->threads;
}
static void blargg_ntsc_snes_rgb_initialize(void *data)
{
snes_ntsc_setup_t setup;
struct filter_data *filt = (struct filter_data*)data;
filt->ntsc = (snes_ntsc_t*)calloc(1, sizeof(*filt->ntsc));
setup = snes_ntsc_rgb;
setup.merge_fields = 1;
snes_ntsc_init(filt->ntsc, &setup);
filt->burst = 0;
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
}
static void *blargg_ntsc_snes_rgb_generic_create(unsigned in_fmt, unsigned out_fmt,
unsigned max_width, unsigned max_height,
unsigned threads, softfilter_simd_mask_t simd)
@ -63,30 +96,14 @@ static void *blargg_ntsc_snes_rgb_generic_create(unsigned in_fmt, unsigned out_f
free(filt);
return NULL;
}
blargg_ntsc_snes_rgb_initialize(filt);
return filt;
}
static void blargg_ntsc_snes_rgb_initialize(void)
{
snes_ntsc_setup_t setup;
static bool initialized = false;
if(initialized == true)
return;
initialized = true;
ntsc_rgb = (snes_ntsc_t*)malloc(sizeof(*ntsc_rgb));
setup = snes_ntsc_rgb;
setup.merge_fields = 1;
snes_ntsc_init(ntsc_rgb, &setup);
burst_rgb = 0;
burst_toggle_rgb = (setup.merge_fields ? 0 : 1);
}
static void blargg_ntsc_snes_rgb_generic_output(void *data, unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height)
{
blargg_ntsc_snes_rgb_initialize();
*out_width = SNES_NTSC_OUT_WIDTH(256);
*out_height = height;
}
@ -95,34 +112,32 @@ static void blargg_ntsc_snes_rgb_generic_destroy(void *data)
{
struct filter_data *filt = (struct filter_data*)data;
if(ntsc_rgb)
free(ntsc_rgb);
if(filt->ntsc)
free(filt->ntsc);
free(filt->workers);
free(filt);
}
static void blargg_ntsc_snes_rgb_render_rgb565(int width, int height,
static void blargg_ntsc_snes_rgb_render_rgb565(void *data, int width, int height,
int first, int last,
uint16_t *input, int pitch, uint16_t *output, int outpitch)
{
blargg_ntsc_snes_rgb_initialize();
if(!ntsc_rgb)
return;
struct filter_data *filt = (struct filter_data*)data;
if(width <= 256)
snes_ntsc_blit(ntsc_rgb, input, pitch, burst_rgb, width, height, output, outpitch * 2, first, last);
snes_ntsc_blit(filt->ntsc, input, pitch, filt->burst, width, height, output, outpitch * 2, first, last);
else
snes_ntsc_blit_hires(ntsc_rgb, input, pitch, burst_rgb, width, height, output, outpitch * 2, first, last);
snes_ntsc_blit_hires(filt->ntsc, input, pitch, filt->burst, width, height, output, outpitch * 2, first, last);
burst_rgb ^= burst_toggle_rgb;
filt->burst ^= filt->burst_toggle;
}
static void blargg_ntsc_snes_rgb_rgb565(unsigned width, unsigned height,
static void blargg_ntsc_snes_rgb_rgb565(void *data, unsigned width, unsigned height,
int first, int last, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
blargg_ntsc_snes_rgb_render_rgb565(width, height,
blargg_ntsc_snes_rgb_render_rgb565(data, width, height,
first, last,
src, src_stride,
dst, dst_stride);
@ -137,7 +152,7 @@ static void blargg_ntsc_snes_rgb_work_cb_rgb565(void *data, void *thread_data)
unsigned width = thr->width;
unsigned height = thr->height;
blargg_ntsc_snes_rgb_rgb565(width, height,
blargg_ntsc_snes_rgb_rgb565(data, width, height,
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565);
}

View File

@ -5,40 +5,7 @@
#include "config.h"
#endif
#ifdef HAVE_EGL
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif
#if defined(IOS)
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#elif defined(HAVE_PSGL)
#include <PSGL/psgl.h>
#include <GLES/glext.h>
#elif defined(HAVE_OPENGL_MODERN)
#include <GL3/gl3.h>
#include <GL3/gl3ext.h>
#elif defined(HAVE_OPENGLES3)
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h> // There are no GLES3 extensions yet.
#elif defined(HAVE_OPENGLES2)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif defined(HAVE_OPENGLES1)
#include <GLES/gl.h>
#include <GLES/glext.h>
#else
#if defined(_WIN32) && !defined(_XBOX)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glext.h>
#endif
#include "rglgen_headers.h"
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,39 @@
#ifndef RGLGEN_HEADERS_H__
#define RGLGEN_HEADERS_H__
#ifdef HAVE_EGL
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif
#if defined(IOS)
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#elif defined(HAVE_PSGL)
#include <PSGL/psgl.h>
#include <GLES/glext.h>
#elif defined(HAVE_OPENGL_MODERN)
#include <GL3/gl3.h>
#include <GL3/gl3ext.h>
#elif defined(HAVE_OPENGLES3)
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h> // There are no GLES3 extensions yet.
#elif defined(HAVE_OPENGLES2)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif defined(HAVE_OPENGLES1)
#include <GLES/gl.h>
#include <GLES/glext.h>
#else
#if defined(_WIN32) && !defined(_XBOX)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glext.h>
#endif
#endif

View File

@ -102,7 +102,6 @@ struct cg_fbo_params
CGparameter coord;
};
#define MAX_LUT_TEXTURES 8
#define MAX_VARIABLES 64
#define PREV_TEXTURES (MAX_TEXTURES - 1)
@ -142,7 +141,7 @@ static unsigned active_index;
static struct gfx_shader *cg_shader;
static state_tracker_t *state_tracker;
static GLuint lut_textures[MAX_LUT_TEXTURES];
static GLuint lut_textures[GFX_MAX_TEXTURES];
static CGparameter cg_attribs[PREV_TEXTURES + 1 + 4 + GFX_MAX_SHADERS];
static unsigned cg_attrib_index;
@ -496,53 +495,6 @@ static bool load_plain(const char *path)
#define print_buf(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__)
static void load_texture_data(GLuint obj, const struct texture_image *img, bool smooth, GLenum wrap)
{
glBindTexture(GL_TEXTURE_2D, obj);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, smooth ? GL_LINEAR : GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, smooth ? GL_LINEAR : GL_NEAREST);
#ifndef HAVE_PSGL
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#endif
glTexImage2D(GL_TEXTURE_2D,
0, driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32, img->width, img->height,
0, driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, img->pixels);
}
static bool load_textures(void)
{
unsigned i;
if (!cg_shader->luts)
return true;
glGenTextures(cg_shader->luts, lut_textures);
for (i = 0; i < cg_shader->luts; i++)
{
RARCH_LOG("Loading image from: \"%s\".\n",
cg_shader->lut[i].path);
struct texture_image img = {0};
if (!texture_image_load(cg_shader->lut[i].path, &img))
{
RARCH_ERR("Failed to load picture ...\n");
return false;
}
load_texture_data(lut_textures[i], &img,
cg_shader->lut[i].filter != RARCH_FILTER_NEAREST,
gl_wrap_type_to_enum(cg_shader->lut[i].wrap));
texture_image_free(&img);
}
glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
static bool load_imports(void)
{
unsigned i;
@ -646,7 +598,7 @@ static bool load_preset(const char *path)
}
}
if (!load_textures())
if (!gl_load_luts(cg_shader, lut_textures))
{
RARCH_ERR("Failed to load lookup textures ...\n");
return false;

87
gfx/shader_common.c Normal file
View File

@ -0,0 +1,87 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "shader_common.h"
#include "../retroarch_logger.h"
#ifdef HAVE_OPENGL
// gl_common.c may or may not be a better location for these functions.
void gl_load_texture_data(GLuint obj, const struct texture_image *img,
GLenum wrap, bool linear, bool mipmap)
{
glBindTexture(GL_TEXTURE_2D, obj);
#ifdef HAVE_PSGL
mipmap = false;
#endif
#ifdef HAVE_OPENGLES2
wrap = GL_CLAMP_TO_EDGE;
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
GLint filter = linear ? (mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR) :
(mipmap ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
#ifndef HAVE_PSGL
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#endif
glTexImage2D(GL_TEXTURE_2D,
0, driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32, img->width, img->height,
0, driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, img->pixels);
#ifndef HAVE_PSGL
if (mipmap)
glGenerateMipmap(GL_TEXTURE_2D);
#endif
}
bool gl_load_luts(const struct gfx_shader *generic_shader, GLuint *lut_textures)
{
unsigned i, num_luts;
num_luts = min(generic_shader->luts, GFX_MAX_TEXTURES);
if (!generic_shader->luts)
return true;
// Original shader_glsl.c code only generated one texture handle. I assume
// it was a bug, but if not, replace num_luts with 1 when GLSL is used.
glGenTextures(num_luts, lut_textures);
for (i = 0; i < num_luts; i++)
{
struct texture_image img = {0};
RARCH_LOG("Loading texture image from: \"%s\" ...\n",
generic_shader->lut[i].path);
if (!texture_image_load(generic_shader->lut[i].path, &img))
{
RARCH_ERR("Failed to load texture image from: \"%s\"\n", generic_shader->lut[i].path);
return false;
}
gl_load_texture_data(lut_textures[i], &img,
gl_wrap_type_to_enum(generic_shader->lut[i].wrap),
generic_shader->lut[i].filter != RARCH_FILTER_NEAREST,
generic_shader->lut[i].mipmap);
texture_image_free(&img);
}
glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
#endif // HAVE_OPENGL

View File

@ -56,5 +56,12 @@ struct gl_shader_backend
enum rarch_shader_type type;
};
#ifdef HAVE_OPENGL
void gl_load_texture_data(GLuint obj, const struct texture_image *img,
GLenum wrap, bool linear, bool mipmap);
bool gl_load_luts(const struct gfx_shader *generic_shader, GLuint *lut_textures);
#endif
#endif

View File

@ -263,50 +263,6 @@ static GLint get_attrib(GLuint prog, const char *base)
return -1;
}
static bool load_luts(void)
{
unsigned i;
if (!glsl_shader->luts)
return true;
glGenTextures(1, gl_teximage);
for (i = 0; i < glsl_shader->luts; i++)
{
RARCH_LOG("Loading texture image from: \"%s\" ...\n",
glsl_shader->lut[i].path);
struct texture_image img = {0};
if (!texture_image_load(glsl_shader->lut[i].path, &img))
{
RARCH_ERR("Failed to load texture image from: \"%s\"\n", glsl_shader->lut[i].path);
return false;
}
glBindTexture(GL_TEXTURE_2D, gl_teximage[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, BORDER_FUNC);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, BORDER_FUNC);
GLenum filter = glsl_shader->lut[i].filter == RARCH_FILTER_NEAREST ?
GL_NEAREST : GL_LINEAR;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glTexImage2D(GL_TEXTURE_2D,
0, driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32,
img.width, img.height, 0,
driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_TEXTURE_TYPE32,
RARCH_GL_FORMAT32, img.pixels);
glBindTexture(GL_TEXTURE_2D, 0);
texture_image_free(&img);
}
return true;
}
static void print_shader_log(GLuint obj)
{
GLint info_len = 0;
@ -786,7 +742,7 @@ static bool gl_glsl_init(void *data, const char *path)
if (!compile_programs(&gl_program[1]))
goto error;
if (!load_luts())
if (!gl_load_luts(glsl_shader, gl_teximage))
{
RARCH_ERR("[GL]: Failed to load LUTs.\n");
goto error;

View File

@ -80,7 +80,6 @@ static bool shader_parse_pass(config_file_t *conf, struct gfx_shader_pass *pass,
// Smooth
char filter_name_buf[64];
print_buf(filter_name_buf, "filter_linear%u", i);
bool smooth = false;
if (config_get_bool(conf, filter_name_buf, &smooth))
pass->filter = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
@ -244,7 +243,6 @@ static bool shader_parse_textures(config_file_t *conf, struct gfx_shader *shader
char id_filter[64];
print_buf(id_filter, "%s_linear", id);
bool smooth = false;
if (config_get_bool(conf, id_filter, &smooth))
shader->lut[shader->luts].filter = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
@ -256,6 +254,14 @@ static bool shader_parse_textures(config_file_t *conf, struct gfx_shader *shader
char wrap_mode[64];
if (config_get_array(conf, id_wrap, wrap_mode, sizeof(wrap_mode)))
shader->lut[shader->luts].wrap = wrap_str_to_mode(wrap_mode);
char id_mipmap[64];
print_buf(id_mipmap, "%s_mipmap", id);
bool mipmap = false;
if (config_get_bool(conf, id_mipmap, &mipmap))
shader->lut[shader->luts].mipmap = mipmap;
else
shader->lut[shader->luts].mipmap = false;
}
return true;
@ -1084,11 +1090,14 @@ void gfx_shader_write_conf_cgp(config_file_t *conf, const struct gfx_shader *sha
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{
print_buf(key, "%s_linear", shader->lut[i].id);
config_set_bool(conf, key, shader->lut[i].filter != RARCH_FILTER_LINEAR);
config_set_bool(conf, key, shader->lut[i].filter == RARCH_FILTER_LINEAR);
}
print_buf(key, "%s_wrap_mode", shader->lut[i].id);
config_set_string(conf, key, wrap_mode_to_str(shader->lut[i].wrap));
print_buf(key, "%s_mipmap", shader->lut[i].id);
config_set_bool(conf, key, shader->lut[i].mipmap);
}
}

View File

@ -88,6 +88,7 @@ struct gfx_shader_lut
char path[PATH_MAX];
enum gfx_filter_type filter;
enum gfx_wrap_type wrap;
bool mipmap;
};
// This is pretty big, shouldn't be put on the stack.

View File

@ -18,6 +18,10 @@
#define HAVE_FILTERS_BUILTIN
#endif
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
#define HAVE_SHADERS
#endif
#if defined(_XBOX)
#include "../msvc/msvc_compat.h"
#endif
@ -141,9 +145,10 @@ VIDEO CONTEXT
/*============================================================
VIDEO SHADERS
============================================================ */
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
#include "../gfx/shader_common.c"
#ifdef HAVE_SHADERS
#include "../gfx/shader_parse.c"
#endif
#ifdef HAVE_CG
#include "../gfx/shader_cg.c"
@ -157,6 +162,8 @@ VIDEO SHADERS
#include "../gfx/shader_glsl.c"
#endif
#endif
/*============================================================
VIDEO IMAGE
============================================================ */
@ -553,6 +560,7 @@ FRONTEND
#elif defined(ANDROID)
#include "../frontend/platform/platform_android.c"
#endif
#include "../frontend/platform/platform_null.c"
#include "../frontend/info/core_info.c"

View File

@ -224,6 +224,7 @@
<ClCompile Include="..\..\frontend\menu\menu_input_line_cb.c" />
<ClCompile Include="..\..\frontend\menu\menu_navigation.c" />
<ClCompile Include="..\..\frontend\info\core_info.c" />
<ClCompile Include="..\..\frontend\platform\platform_null.c" />
<ClCompile Include="..\..\gfx\d3d9\d3d.cpp" />
<ClCompile Include="..\..\gfx\context\d3d_ctx.cpp" />
<ClCompile Include="..\..\gfx\d3d9\render_chain.cpp" />
@ -288,6 +289,8 @@
</ClCompile>
<ClCompile Include="..\..\gfx\scaler\scaler.c">
</ClCompile>
<ClCompile Include="..\..\gfx\shader_common.c">
</ClCompile>
<ClCompile Include="..\..\gfx\scaler\scaler_int.c">
</ClCompile>
<ClCompile Include="..\..\gfx\state_tracker.c">
@ -336,4 +339,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -234,6 +234,13 @@
<ClCompile Include="..\..\frontend\menu\backend\menu_common_backend.c">
<Filter>frontend\menu\backend</Filter>
</ClCompile>
<ClCompile Include="..\..\settings_data.c" />
<ClCompile Include="..\..\gfx\shader_common.c">
<Filter>gfx</Filter>
</ClCompile>
<ClCompile Include="..\..\frontend\platform\platform_null.c">
<Filter>frontend\platform</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
@ -302,5 +309,8 @@
<Filter Include="frontend\menu\backend">
<UniqueIdentifier>{dd1ca879-56f4-43f6-8bd8-ae50222061e8}</UniqueIdentifier>
</Filter>
<Filter Include="frontend\platform">
<UniqueIdentifier>{09d78055-1c93-4f12-ae3e-97aaa90cf78f}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>

View File

@ -498,7 +498,7 @@ const rarch_setting_t* setting_data_get_list(void)
CONFIG_PATH(g_settings.game_history_path, "game_history_path", "Content History Path", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
CONFIG_UINT(g_settings.game_history_size, "game_history_size", "Content History Size", game_history_size)
#ifdef HAVE_RGUI
#ifdef HAVE_MENU
CONFIG_PATH(g_settings.rgui_content_directory, "rgui_browser_directory", "Content Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_PATH(g_settings.rgui_config_directory, "rgui_config_directory", "Config Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_BOOL(g_settings.rgui_show_start_screen, "rgui_show_start_screen", "Show Start Screen", rgui_show_start_screen)