try to emulate borders properly
[pcsx_rearmed.git] / plugins / gpulib / gpu.h
index 3bab7ff..446a023 100644 (file)
@@ -8,6 +8,9 @@
  * See the COPYING file in the top-level directory.
  */
 
+#ifndef __GPULIB_GPU_H__
+#define __GPULIB_GPU_H__
+
 #include <stdint.h>
 
 #ifdef __cplusplus
@@ -16,9 +19,22 @@ extern "C" {
 
 #define CMD_BUFFER_LEN          1024
 
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define HTOLE32(x) __builtin_bswap32(x)
+#define HTOLE16(x) __builtin_bswap16(x)
+#define LE32TOH(x) __builtin_bswap32(x)
+#define LE16TOH(x) __builtin_bswap16(x)
+#else
+#define HTOLE32(x) (x)
+#define HTOLE16(x) (x)
+#define LE32TOH(x) (x)
+#define LE16TOH(x) (x)
+#endif
+
 #define BIT(x) (1 << (x))
 
 #define PSX_GPU_STATUS_DHEIGHT         BIT(19)
+#define PSX_GPU_STATUS_PAL             BIT(20)
 #define PSX_GPU_STATUS_RGB24           BIT(21)
 #define PSX_GPU_STATUS_INTERLACE       BIT(22)
 #define PSX_GPU_STATUS_BLANKING                BIT(23)
@@ -38,6 +54,7 @@ struct psx_gpu {
     int x, y, w, h;
     int x1, x2;
     int y1, y2;
+    int src_x, src_y;
   } screen;
   struct {
     int x, y, w, h;
@@ -52,6 +69,7 @@ struct psx_gpu {
     uint32_t blanked:1;
     uint32_t enhancement_enable:1;
     uint32_t enhancement_active:1;
+    uint32_t dims_changed:1;
     uint32_t *frame_count;
     uint32_t *hcnt; /* hsync count */
     struct {
@@ -61,6 +79,10 @@ struct psx_gpu {
       uint32_t hcnt;
     } last_list;
     uint32_t last_vram_read_frame;
+    uint32_t w_out_old, h_out_old, status_vo_old;
+    int screen_centering_type; // 0 - auto, 1 - game conrolled, 2 - manual
+    int screen_centering_x;
+    int screen_centering_y;
   } state;
   struct {
     int32_t set:3; /* -1 auto, 0 off, 1-3 fixed */
@@ -72,7 +94,7 @@ struct psx_gpu {
     uint32_t last_flip_frame;
     uint32_t pending_fill[3];
   } frameskip;
-  uint16_t *(*get_enhancement_bufer)
+  void *(*get_enhancement_bufer)
     (int *x, int *y, int *w, int *h, int *vram_h);
   void *(*mmap)(unsigned int size);
   void  (*munmap)(void *ptr, unsigned int size);
@@ -107,7 +129,7 @@ struct GPUFreeze;
 long GPUinit(void);
 long GPUshutdown(void);
 void GPUwriteDataMem(uint32_t *mem, int count);
-long GPUdmaChain(uint32_t *rambase, uint32_t addr);
+long GPUdmaChain(uint32_t *rambase, uint32_t addr, uint32_t *progress_addr);
 void GPUwriteData(uint32_t data);
 void GPUreadDataMem(uint32_t *mem, int count);
 uint32_t GPUreadData(void);
@@ -123,3 +145,5 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_);
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* __GPULIB_GPU_H__ */