OSDN Git Service

[VM][General] Apply Upstream 2018-10-07.Still WIP.
[csp-qt/common_source_project-fm7.git] / source / src / win32 / osd.h
index 5e8d711..21c8581 100644 (file)
 #ifndef _WIN32_OSD_H_
 #define _WIN32_OSD_H_
 
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT           0x500
+#endif
 #define DIRECTSOUND_VERSION    0x900
 #define DIRECT3D_VERSION       0x900
 // XXX: if your DirectX 9.0 SDK is newer and does not contain dinput.lib,
 // please change the definition of DIRECTINPUT_VERSION from 0x500 to 0x800
-#define DIRECTINPUT_VERSION    0x500
-//#define DIRECTINPUT_VERSION  0x800
+//#define DIRECTINPUT_VERSION  0x500
+#define DIRECTINPUT_VERSION    0x800
 
 #include <windows.h>
 #include <windowsx.h>
 #include <mmsystem.h>
 #include <process.h>
+#include <commctrl.h>
+#include <wingdi.h>
 #include <gdiplus.h>
 #include <d3d9.h>
 #include <d3dx9.h>
 #include <dinput.h>
 #include "../vm/vm.h"
 //#include "../emu.h"
+#include "../common.h"
 #include "../config.h"
 
+#ifdef USE_ZLIB
+// relative path from *.vcproj/*.vcxproj, not from this directory :-(
+       #if defined(_MSC_VER) && (_MSC_VER >= 1800)
+               #ifdef _DEBUG
+                       #pragma comment(lib, "../src/zlib-1.2.11/vc++2013/debug/zlibstat.lib")
+               #else
+                       #pragma comment(lib, "../src/zlib-1.2.11/vc++2013/release/zlibstat.lib")
+               #endif
+       #else
+               #ifdef _DEBUG
+                       #pragma comment(lib, "../src/zlib-1.2.11/vc++2008/debug/zlibstat.lib")
+               #else
+                       #pragma comment(lib, "../src/zlib-1.2.11/vc++2008/release/zlibstat.lib")
+               #endif
+       #endif
+#endif
+
 #ifdef USE_SOCKET
 #include <winsock.h>
 #pragma comment(lib, "wsock32.lib")
 #endif
-#pragma comment(lib, "Gdiplus.lib")
+#pragma comment(lib, "comctl32.lib")
+#pragma comment(lib, "msimg32.lib")
+#pragma comment(lib, "gdiplus.lib")
 using namespace Gdiplus;
 #pragma comment(lib, "d3d9.lib")
 #pragma comment(lib, "d3dx9.lib")
@@ -78,9 +103,9 @@ public:
 #ifdef USE_MOVIE_PLAYER
 class CMySampleGrabberCB : public ISampleGrabberCB {
 private:
-       VM *vm;
+       VM_TEMPLATE *vm;
 public:
-       CMySampleGrabberCB(VM *vm_ptr)
+       CMySampleGrabberCB(VM_TEMPLATE *vm_ptr)
        {
                vm = vm_ptr;
        }
@@ -129,8 +154,16 @@ public:
 
 #define SUPPORT_WIN32_DLL
 
+#define SCREEN_FILTER_NONE     0
+#define SCREEN_FILTER_RGB      1
+#define SCREEN_FILTER_RF       2
+
 // check memory leaks
 #ifdef _DEBUG
+// _malloca is defined in typeinfo.h
+#ifdef _malloca
+#undef _malloca
+#endif
 #define _CRTDBG_MAP_ALLOC
 #include <crtdbg.h>
 #define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
@@ -220,11 +253,10 @@ private:
        
        uint8_t keycode_conv[256];
        uint8_t key_status[256];        // windows key code mapping
+       uint8_t key_dik[256];
        uint8_t key_dik_prev[256];
-#ifdef USE_SHIFT_NUMPAD_KEY
-       uint8_t key_converted[256];
        bool key_shift_pressed, key_shift_released;
-#endif
+       bool key_caps_locked;
        bool lost_focus;
        
 #ifdef USE_JOYSTICK
@@ -243,17 +275,17 @@ private:
        void release_screen();
        void initialize_screen_buffer(bitmap_t *buffer, int width, int height, int mode);
        void release_screen_buffer(bitmap_t *buffer);
-#ifdef USE_CRT_FILTER
-       void apply_crt_fileter_to_screen_buffer(bitmap_t *source, bitmap_t *dest);
-       void apply_crt_filter_x3_y3(bitmap_t *source, bitmap_t *dest);
-       void apply_crt_filter_x3_y2(bitmap_t *source, bitmap_t *dest);
-       void apply_crt_filter_x2_y3(bitmap_t *source, bitmap_t *dest);
-       void apply_crt_filter_x2_y2(bitmap_t *source, bitmap_t *dest);
-       void apply_crt_filter_x1_y1(bitmap_t *source, bitmap_t *dest);
+#ifdef USE_SCREEN_FILTER
+       void apply_rgb_filter_to_screen_buffer(bitmap_t *source, bitmap_t *dest);
+       void apply_rgb_filter_x3_y3(bitmap_t *source, bitmap_t *dest);
+       void apply_rgb_filter_x3_y2(bitmap_t *source, bitmap_t *dest);
+       void apply_rgb_filter_x2_y3(bitmap_t *source, bitmap_t *dest);
+       void apply_rgb_filter_x2_y2(bitmap_t *source, bitmap_t *dest);
+       void apply_rgb_filter_x1_y1(bitmap_t *source, bitmap_t *dest);
 #endif
-#ifdef USE_SCREEN_ROTATE
+//#ifdef USE_SCREEN_ROTATE
        void rotate_screen_buffer(bitmap_t *source, bitmap_t *dest);
-#endif
+//#endif
        void stretch_screen_buffer(bitmap_t *source, bitmap_t *dest);
        bool initialize_d3d9();
        bool initialize_d3d9_surface(bitmap_t *buffer);
@@ -263,13 +295,13 @@ private:
        int add_video_frames();
        
        bitmap_t vm_screen_buffer;
-#ifdef USE_CRT_FILTER
+#ifdef USE_SCREEN_FILTER
        bitmap_t filtered_screen_buffer;
        bitmap_t tmp_filtered_screen_buffer;
 #endif
-#ifdef USE_SCREEN_ROTATE
+//#ifdef USE_SCREEN_ROTATE
        bitmap_t rotated_screen_buffer;
-#endif
+//#endif
        bitmap_t stretched_screen_buffer;
        bitmap_t shrinked_screen_buffer;
        bitmap_t video_screen_buffer;
@@ -386,7 +418,7 @@ public:
        ~OSD() {}
        
        // common
-       VM* vm;
+       VM_TEMPLATE* vm;
        
        void initialize(int rate, int samples);
        void release();
@@ -409,14 +441,14 @@ public:
        bool is_console_active();
        void set_console_text_attribute(unsigned short attr);
        void write_console(_TCHAR* buffer, unsigned int length);
-       int read_console_input(_TCHAR* buffer);
+       int read_console_input(_TCHAR* buffer, unsigned int length);
        bool is_console_key_pressed(int vk);
        void close_debugger_console();
        
        // common input
        void update_input();
-       void key_down(int code, bool repeat);
-       void key_up(int code);
+       void key_down(int code, bool extended, bool repeat);
+       void key_up(int code, bool extended);
        void key_down_native(int code, bool repeat);
        void key_up_native(int code);
        void key_lost_focus()
@@ -457,6 +489,7 @@ public:
        int get_window_mode_height(int mode);
        void set_host_window_size(int window_width, int window_height, bool window_mode);
        void set_vm_screen_size(int screen_width, int screen_height, int window_width, int window_height, int window_width_aspect, int window_height_aspect);
+       void set_vm_screen_lines(int lines);
        int get_vm_window_width()
        {
                return vm_window_width;
@@ -487,7 +520,7 @@ public:
        void restart_record_video();
        void add_extra_frames(int extra_frames);
        bool now_record_video;
-#ifdef USE_CRT_FILTER
+#ifdef USE_SCREEN_FILTER
        bool screen_skip_line;
 #endif
        
@@ -583,6 +616,7 @@ public:
 #endif
        
        // win32 dependent
+       void invalidate_screen();
        void update_screen(HDC hdc);
        HWND main_window_handle;
        HINSTANCE instance_handle;