Separate core globals from callbacks

pull/575/head
ggdrt 2019-12-08 09:26:41 -08:00
parent 8ad1e5711e
commit 4e1c6f1c41
8 changed files with 51 additions and 24 deletions

View File

@ -170,7 +170,8 @@ ifneq ($(HAVE_GRIFFIN), 1)
SOURCES_CXX += $(CORE_EMU_DIR)/decomp.cpp
endif
SOURCES_C += $(CORE_DIR)/libretro_cbs.c
SOURCES_C += $(CORE_DIR)/libretro_cbs.c \
$(CORE_DIR)/beetle_psx_globals.c
ifeq ($(NEED_TREMOR), 1)
SOURCES_C += $(sort $(wildcard $(MEDNAFEN_DIR)/tremor/*.c))

10
beetle_psx_globals.c Normal file
View File

@ -0,0 +1,10 @@
#include <boolean.h>
#include <stdint.h>
bool content_is_pal = false;
uint8_t widescreen_hack;
uint8_t psx_gpu_upscale_shift;
int line_render_mode;
int filter_mode;
bool opaque_check;
bool semitrans_check;

29
beetle_psx_globals.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef BEETLE_PSX_GLOBALS_H__
#define BEETLE_PSX_GLOBALS_H__
#include <boolean.h>
#include <stdint.h>
/* Global state variables used by the Beetle PSX Core.
* These are typically set by core options and are used
* by methods in the Mednafen PSX module that have been
* modified for Beetle PSX.
*/
#ifdef __cplusplus
extern "C" {
#endif
extern bool content_is_pal;
extern uint8_t widescreen_hack;
extern uint8_t psx_gpu_upscale_shift;
extern int line_render_mode;
extern int filter_mode;
extern bool opaque_check;
extern bool semitrans_check;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -16,6 +16,7 @@
#include "ugui_tools.h"
#include "rsx/rsx_intf.h"
#include "libretro_cbs.h"
#include "beetle_psx_globals.h"
#include "libretro_options.h"
#include "input.h"
@ -2911,11 +2912,11 @@ static void check_variables(bool startup)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "disabled") == 0)
lineRenderMode = 0;
line_render_mode = 0;
else if (strcmp(var.value, "default") == 0)
lineRenderMode = 1;
line_render_mode = 1;
else if (strcmp(var.value, "aggressive") == 0)
lineRenderMode = 2;
line_render_mode = 2;
}
var.key = BEETLE_OPT(filter);

View File

@ -1,12 +1,4 @@
#include <boolean.h>
#include "libretro.h"
bool content_is_pal = false;
retro_video_refresh_t video_cb;
retro_environment_t environ_cb;
uint8_t widescreen_hack;
uint8_t psx_gpu_upscale_shift;
int lineRenderMode;
int filter_mode;
bool opaque_check;
bool semitrans_check;

View File

@ -1,21 +1,14 @@
#ifndef __LIBRETRO_CBS_H
#define __LIBRETRO_CBS_H
#include <boolean.h>
#include "libretro.h"
#ifdef __cplusplus
extern "C" {
#endif
extern bool content_is_pal;
extern retro_video_refresh_t video_cb;
extern retro_environment_t environ_cb;
extern uint8_t widescreen_hack;
extern uint8_t psx_gpu_upscale_shift;
extern int lineRenderMode;
extern int filter_mode;
extern bool opaque_check;
extern bool semitrans_check;
#ifdef __cplusplus
}

View File

@ -1,6 +1,6 @@
#include <math.h>
#include <algorithm>
#include "libretro_cbs.h"
#include "beetle_psx_globals.h"
#define COORD_FBS 12
#define COORD_MF_INT(n) ((n) << COORD_FBS)
@ -1037,11 +1037,11 @@ static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb)
}
// Line Renderer: Detect triangles that would resolve as lines at x1 scale and create second triangle to make quad
if ((lineRenderMode != 0) && (!lineFound) && (numvertices == 3) && (textured))
if ((line_render_mode != 0) && (!lineFound) && (numvertices == 3) && (textured))
{
if(lineRenderMode == 1)
if(line_render_mode == 1)
lineFound = Hack_FindLine(gpu, vertices, lineVertices); // Default enabled
else if (lineRenderMode == 2)
else if (line_render_mode == 2)
lineFound = Hack_ForceLine(gpu, vertices, lineVertices); // Aggressive mode enabled (causes more artifacts)
else
lineFound = false;

View File

@ -19,6 +19,7 @@
#include "rsx_intf.h"
#include "rsx.h"
#include "../libretro_cbs.h"
#include "../beetle_psx_globals.h"
#ifdef RSX_DUMP