aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2011-01-02 00:34:26 +0200
committernotaz2011-01-02 00:34:26 +0200
commit201c21e2ad6be25a4b843d1434eabb432ce72884 (patch)
treec72e885c1fa6f0525d353496fb3a6c247ec61582
parentf932e54bc49d2b211a9100f8b6f5385e0eafe64c (diff)
downloadpcsx_rearmed-201c21e2ad6be25a4b843d1434eabb432ce72884.tar.gz
pcsx_rearmed-201c21e2ad6be25a4b843d1434eabb432ce72884.tar.bz2
pcsx_rearmed-201c21e2ad6be25a4b843d1434eabb432ce72884.zip
add a way for GPU plugin to get layer config
-rw-r--r--frontend/main.c4
-rw-r--r--frontend/menu.c22
-rw-r--r--frontend/menu.h1
-rw-r--r--frontend/plugin.c17
-rw-r--r--frontend/plugin.h1
-rw-r--r--frontend/plugin_lib.c12
-rw-r--r--frontend/plugin_lib.h8
-rw-r--r--plugins/gpu-gles/gpuPlugin.c18
8 files changed, 66 insertions, 17 deletions
diff --git a/frontend/main.c b/frontend/main.c
index 643d6fe..0427ce4 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1,5 +1,5 @@
/*
- * (C) notaz, 2010
+ * (C) notaz, 2010-2011
*
* This work is licensed under the terms of the GNU GPLv2 or later.
* See the COPYING file in the top-level directory.
@@ -207,6 +207,7 @@ int main(int argc, char *argv[])
if (OpenPlugins() == -1) {
return 1;
}
+ plugin_call_rearmed_cbs();
CheckCdrom();
SysReset();
@@ -297,6 +298,7 @@ void UpdateMenuSlots() {
void OnFile_Exit() {
printf("OnFile_Exit\n");
+ menu_finish();
plat_finish();
SysClose();
exit(0);
diff --git a/frontend/menu.c b/frontend/menu.c
index 0469868..19ad86f 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -1,5 +1,5 @@
/*
- * (C) Gražvydas "notaz" Ignotas, 2010
+ * (C) Gražvydas "notaz" Ignotas, 2010-2011
*
* This work is licensed under the terms of any of these licenses
* (at your option):
@@ -15,6 +15,7 @@
#include "menu.h"
#include "config.h"
+#include "plugin.h"
#include "plugin_lib.h"
#include "omap.h"
#include "common/plat.h"
@@ -58,7 +59,7 @@ enum {
extern int ready_to_go;
static int last_psx_w, last_psx_h, last_psx_bpp;
-static int scaling, filter, state_slot, cpu_clock;
+static int scaling, filter, state_slot, cpu_clock, cpu_clock_st;
static char rom_fname_reload[MAXPATHLEN];
static char last_selected_fname[MAXPATHLEN];
int g_opts;
@@ -455,7 +456,7 @@ static void pnd_menu_init(void)
char buff[64], *p;
DIR *dir;
- cpu_clock = get_cpu_clock();
+ cpu_clock_st = cpu_clock = get_cpu_clock();
dir = opendir("/etc/pandora/conf/dss_fir");
if (dir == NULL) {
@@ -508,6 +509,12 @@ static void pnd_menu_init(void)
pnd_filter_list = mfilters;
}
+void menu_finish(void)
+{
+ cpu_clock = cpu_clock_st;
+ apply_cpu_clock();
+}
+
// -------------- key config --------------
me_bind_action me_ctrl_actions[] =
@@ -634,13 +641,13 @@ static int menu_loop_cscaler(int id, int keys)
scaling = SCALE_CUSTOM;
omap_enable_layer(1);
- //pnd_restore_layer_data();
for (;;)
{
menu_draw_begin(0);
- memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
- text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_w, g_layer_h);
+ memset(g_menuscreen_ptr, 4, g_menuscreen_w * g_menuscreen_h * 2);
+ text_out16(2, 2, "%d,%d", g_layer_x, g_layer_y);
+ text_out16(2, 480 - 18, "%dx%d | d-pad: resize, R+d-pad: move", g_layer_w, g_layer_h);
menu_draw_end();
inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_R|PBTN_MOK|PBTN_MBACK, 40);
@@ -897,7 +904,7 @@ const char *plat_get_credits(void)
" and the P.E.Op.S. team\n"
"ARM recompiler (C) 2009-2010 Ari64\n\n"
"integration, optimization and\n"
- " frontend (C) 2010 notaz\n";
+ " frontend (C) 2010-2011 notaz\n";
}
static int run_cd_image(const char *fname)
@@ -914,6 +921,7 @@ static int run_cd_image(const char *fname)
me_update_msg("failed to open plugins");
return -1;
}
+ plugin_call_rearmed_cbs();
if (CheckCdrom() == -1) {
// Only check the CD if we are starting the console with a CD
diff --git a/frontend/menu.h b/frontend/menu.h
index e7e0aa8..7fb85b3 100644
--- a/frontend/menu.h
+++ b/frontend/menu.h
@@ -1,6 +1,7 @@
void menu_init(void);
void menu_prepare_emu(void);
void menu_loop(void);
+void menu_finish(void);
void menu_notify_mode_change(int w, int h, int bpp);
diff --git a/frontend/plugin.c b/frontend/plugin.c
index 83eb140..6c83a44 100644
--- a/frontend/plugin.c
+++ b/frontend/plugin.c
@@ -12,17 +12,13 @@
#include "plugin_lib.h"
#include "plugin.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
+#include "../libpcsxcore/system.h"
#include "../plugins/cdrcimg/cdrcimg.h"
static int dummy_func() {
return 0;
}
-static long CDRreadTrack(unsigned char *time) {
- fprintf(stderr, "CDRreadTrack\n");
- return -1;
-}
-
/* SPU */
extern long SPUopen(void);
extern long SPUinit(void);
@@ -122,7 +118,6 @@ static const struct {
DUMMY_CDR(CDRsetfilename),
DUMMY_CDR(CDRreadCDDA),
DUMMY_CDR(CDRgetTE),
- DIRECT(PLUGIN_CDR, CDRreadTrack),
/* SPU */
DIRECT_SPU(SPUconfigure),
DIRECT_SPU(SPUabout),
@@ -207,6 +202,16 @@ void *plugin_link(enum builtint_plugins_e id, const char *sym)
return NULL;
}
+void plugin_call_rearmed_cbs(void)
+{
+ extern void *hGPUDriver;
+ void (*rearmed_set_cbs)(const struct rearmed_cbs *cbs);
+
+ rearmed_set_cbs = SysLoadSym(hGPUDriver, "GPUrearmedCallbacks");
+ if (rearmed_set_cbs != NULL)
+ rearmed_set_cbs(&pl_rearmed_cbs);
+}
+
#ifdef PCNT
/* basic profile stuff */
diff --git a/frontend/plugin.h b/frontend/plugin.h
index 76cab25..e7a5645 100644
--- a/frontend/plugin.h
+++ b/frontend/plugin.h
@@ -11,3 +11,4 @@ enum builtint_plugins_e {
};
void *plugin_link(enum builtint_plugins_e id, const char *sym);
+void plugin_call_rearmed_cbs(void);
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index 0ca45ce..9f9e958 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -189,3 +189,15 @@ void pl_text_out16(int x, int y, const char *texto, ...)
pl_text_out16_(x, y, buffer);
}
+static void pl_get_layer_pos(int *x, int *y, int *w, int *h)
+{
+ *x = g_layer_x;
+ *y = g_layer_y;
+ *w = g_layer_w;
+ *h = g_layer_h;
+}
+
+const struct rearmed_cbs pl_rearmed_cbs = {
+ pl_get_layer_pos,
+};
+
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index 81999a3..6049f96 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -26,7 +26,13 @@ int pl_fbdev_set_mode(int w, int h, int bpp);
void pl_fbdev_flip(void);
void pl_fbdev_close(void);
-void pl_text_out16(int x, int y, const char *texto, ...);
+void pl_text_out16(int x, int y, const char *texto, ...);
+
+struct rearmed_cbs {
+ void (*pl_get_layer_pos)(int *x, int *y, int *w, int *h);
+};
+
+extern const struct rearmed_cbs pl_rearmed_cbs;
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
diff --git a/plugins/gpu-gles/gpuPlugin.c b/plugins/gpu-gles/gpuPlugin.c
index d6e6fbb..897c942 100644
--- a/plugins/gpu-gles/gpuPlugin.c
+++ b/plugins/gpu-gles/gpuPlugin.c
@@ -154,6 +154,8 @@ int iFakePrimBusy = 0;
int iRumbleVal = 0;
int iRumbleTime = 0;
+static void (*rearmed_get_layer_pos)(int *x, int *y, int *w, int *h);
+
////////////////////////////////////////////////////////////////////////
// stuff to make this a true PDK module
////////////////////////////////////////////////////////////////////////
@@ -559,7 +561,7 @@ long CALLBACK GPUopen(int hwndGPU)
iResX=240;iResY=320;
#endif
#ifdef MAEMO_CHANGES
- iResX=640;iResY=480;
+ iResX=800;iResY=480;
#endif
iColDepth=8;
bChangeRes=FALSE;
@@ -1119,6 +1121,7 @@ float xs,ys,s;RECT r;
if(!PSXDisplay.DisplayModeNew.x) return;
if(!PSXDisplay.DisplayModeNew.y) return;
+#if 0
xs=(float)iResX/(float)PSXDisplay.DisplayModeNew.x;
ys=(float)iResY/(float)PSXDisplay.DisplayModeNew.y;
@@ -1170,7 +1173,11 @@ if(r.bottom<rRatioRect.bottom ||
}
rRatioRect=r;
-
+#else
+ // pcsx-rearmed hack
+ if (rearmed_get_layer_pos != NULL)
+ rearmed_get_layer_pos(&rRatioRect.left, &rRatioRect.top, &rRatioRect.right, &rRatioRect.bottom);
+#endif
glViewport(rRatioRect.left,
iResY-(rRatioRect.top+rRatioRect.bottom),
@@ -2959,3 +2966,10 @@ void CALLBACK GPUdisplayFlags(unsigned long dwFlags)
{
// dwCoreFlags=dwFlags;
}
+
+// pcsx-rearmed callbacks
+void CALLBACK GPUrearmedCallbacks(const void **cbs)
+{
+ rearmed_get_layer_pos = cbs[0];
+}
+