Network code and pc.c are more platform-independent now.
This commit is contained in:
@@ -24,8 +24,7 @@
|
|||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "net_ne2000.h"
|
#include "net_ne2000.h"
|
||||||
#include "../WIN/win.h"
|
#include "../WIN/plat_ui.h"
|
||||||
#include "../WIN/win_language.h"
|
|
||||||
|
|
||||||
|
|
||||||
static netcard_t net_cards[] = {
|
static netcard_t net_cards[] = {
|
||||||
@@ -112,7 +111,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
|
|||||||
case NET_TYPE_PCAP:
|
case NET_TYPE_PCAP:
|
||||||
ret = network_pcap_setup(mac, rx, dev);
|
ret = network_pcap_setup(mac, rx, dev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
msgbox_error(ghwnd, IDS_2219);
|
plat_msgbox_error(IDS_2219);
|
||||||
network_type = NET_TYPE_NONE;
|
network_type = NET_TYPE_NONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
26
src/WIN/plat_ui.h
Normal file
26
src/WIN/plat_ui.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef __unix
|
||||||
|
extern void plat_msgbox_error(int i);
|
||||||
|
extern wchar_t *plat_get_string_from_id(int i);
|
||||||
|
|
||||||
|
#ifndef IDS_2219
|
||||||
|
#define IDS_2219 2219
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IDS_2077
|
||||||
|
#define IDS_2077 2077
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IDS_2078
|
||||||
|
#define IDS_2078 2078
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IDS_2079
|
||||||
|
#define IDS_2079 2079
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void plat_msgbox_fatal(char *string);
|
||||||
|
extern void get_executable_name(wchar_t *s, int size);
|
||||||
|
extern void set_window_title(wchar_t *s);
|
||||||
|
extern void startblit(void);
|
||||||
|
extern void endblit(void);
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
#include "plat_mouse.h"
|
#include "plat_mouse.h"
|
||||||
#include "plat_midi.h"
|
#include "plat_midi.h"
|
||||||
#include "plat_thread.h"
|
#include "plat_thread.h"
|
||||||
|
#include "plat_ui.h"
|
||||||
|
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "win_cgapal.h"
|
#include "win_cgapal.h"
|
||||||
@@ -525,12 +526,12 @@ void create_removable_disk_submenu(HMENU m, int id)
|
|||||||
AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE_WP | id, win_language_get_string_from_id(2220));
|
AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE_WP | id, win_language_get_string_from_id(2220));
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_executable_name(WCHAR *s, int size)
|
void get_executable_name(wchar_t *s, int size)
|
||||||
{
|
{
|
||||||
GetModuleFileName(hinstance, s, size);
|
GetModuleFileName(hinstance, s, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_window_title(WCHAR *s)
|
void set_window_title(wchar_t *s)
|
||||||
{
|
{
|
||||||
if (video_fullscreen)
|
if (video_fullscreen)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ extern void joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
|||||||
extern int getfile(HWND hwnd, char *f, char *fn);
|
extern int getfile(HWND hwnd, char *f, char *fn);
|
||||||
extern int getsfile(HWND hwnd, char *f, char *fn);
|
extern int getsfile(HWND hwnd, char *f, char *fn);
|
||||||
|
|
||||||
extern void get_executable_name(WCHAR *s, int size);
|
extern void get_executable_name(wchar_t *s, int size);
|
||||||
extern void set_window_title(WCHAR *s);
|
extern void set_window_title(wchar_t *s);
|
||||||
|
|
||||||
extern void startblit(void);
|
extern void startblit(void);
|
||||||
extern void endblit(void);
|
extern void endblit(void);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#define BITMAP WINDOWS_BITMAP
|
#define BITMAP WINDOWS_BITMAP
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
#include <shlobj.h>
|
||||||
#undef BITMAP
|
#undef BITMAP
|
||||||
|
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
#include "../ibm.h"
|
#include "../ibm.h"
|
||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../ide.h"
|
#include "../ide.h"
|
||||||
|
#include "plat_ui.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "win_language.h"
|
#include "win_language.h"
|
||||||
|
|
||||||
@@ -82,6 +84,11 @@ LPTSTR win_language_get_string_from_id(int i)
|
|||||||
return lpResourceString[i - 2048];
|
return lpResourceString[i - 2048];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t *plat_get_string_from_id(int i)
|
||||||
|
{
|
||||||
|
return (wchar_t *) win_language_get_string_from_id(i);
|
||||||
|
}
|
||||||
|
|
||||||
LPTSTR win_language_get_string_from_string(char *str)
|
LPTSTR win_language_get_string_from_string(char *str)
|
||||||
{
|
{
|
||||||
return lpResourceString[atoi(str) - 2048];
|
return lpResourceString[atoi(str) - 2048];
|
||||||
@@ -117,6 +124,11 @@ void msgbox_error(HWND hwndParent, int i)
|
|||||||
MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[1], MB_OK | MB_ICONWARNING);
|
MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[1], MB_OK | MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plat_msgbox_error(int i)
|
||||||
|
{
|
||||||
|
msgbox_error(ghwnd, i);
|
||||||
|
}
|
||||||
|
|
||||||
void msgbox_error_wstr(HWND hwndParent, WCHAR *wstr)
|
void msgbox_error_wstr(HWND hwndParent, WCHAR *wstr)
|
||||||
{
|
{
|
||||||
MessageBox(hwndParent, wstr, lpResourceString[1], MB_OK | MB_ICONWARNING);
|
MessageBox(hwndParent, wstr, lpResourceString[1], MB_OK | MB_ICONWARNING);
|
||||||
@@ -139,6 +151,11 @@ void msgbox_fatal(HWND hwndParent, char *string)
|
|||||||
free(lptsTemp);
|
free(lptsTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plat_msgbox_fatal(char *string)
|
||||||
|
{
|
||||||
|
msgbox_fatal(ghwnd, string);
|
||||||
|
}
|
||||||
|
|
||||||
int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
|
int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn; /* common dialog box structure */
|
OPENFILENAME ofn; /* common dialog box structure */
|
||||||
@@ -207,3 +224,47 @@ int file_dlg_st(HWND hwnd, int i, char *fn, int save)
|
|||||||
{
|
{
|
||||||
return file_dlg(hwnd, win_language_get_string_from_id(i), fn, save);
|
return file_dlg(hwnd, win_language_get_string_from_id(i), fn, save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||||
|
{
|
||||||
|
if(uMsg == BFFM_INITIALIZED)
|
||||||
|
{
|
||||||
|
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WCHAR path[MAX_PATH];
|
||||||
|
|
||||||
|
wchar_t *BrowseFolder(wchar_t *saved_path)
|
||||||
|
{
|
||||||
|
BROWSEINFO bi = { 0 };
|
||||||
|
bi.lpszTitle = L"Browse for folder...";
|
||||||
|
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||||
|
bi.lpfn = BrowseCallbackProc;
|
||||||
|
bi.lParam = (LPARAM) saved_path;
|
||||||
|
|
||||||
|
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
|
||||||
|
|
||||||
|
if (pidl != 0)
|
||||||
|
{
|
||||||
|
/* Get the name of the folder and put it in path. */
|
||||||
|
SHGetPathFromIDList(pidl, path);
|
||||||
|
|
||||||
|
/* Free memory used. */
|
||||||
|
#if 0
|
||||||
|
IMalloc *imalloc = 0;
|
||||||
|
if (SUCCEEDED(SHGetMalloc(&imalloc)))
|
||||||
|
{
|
||||||
|
imalloc->Free(pidl);
|
||||||
|
imalloc->Release();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
free(pidl);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
|||||||
11
src/pc.c
11
src/pc.c
@@ -73,8 +73,7 @@
|
|||||||
#include "video/video.h"
|
#include "video/video.h"
|
||||||
#include "video/vid_voodoo.h"
|
#include "video/vid_voodoo.h"
|
||||||
#include "amstrad.h"
|
#include "amstrad.h"
|
||||||
#include "win.h"
|
#include "../WIN/plat_ui.h"
|
||||||
#include "win_language.h"
|
|
||||||
#ifdef WALTJE
|
#ifdef WALTJE
|
||||||
# include "plat_dir.h"
|
# include "plat_dir.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -187,7 +186,7 @@ void fatal(const char *format, ...)
|
|||||||
{
|
{
|
||||||
*newline = 0;
|
*newline = 0;
|
||||||
}
|
}
|
||||||
msgbox_fatal(ghwnd, msg);
|
plat_msgbox_fatal(msg);
|
||||||
#endif
|
#endif
|
||||||
dumppic();
|
dumppic();
|
||||||
dumpregs(1);
|
dumpregs(1);
|
||||||
@@ -577,8 +576,8 @@ int serial_fifo_read, serial_fifo_write;
|
|||||||
|
|
||||||
int emu_fps = 0;
|
int emu_fps = 0;
|
||||||
|
|
||||||
static WCHAR wmodel[2048];
|
static wchar_t wmodel[2048];
|
||||||
static WCHAR wcpu[2048];
|
static wchar_t wcpu[2048];
|
||||||
|
|
||||||
void runpc(void)
|
void runpc(void)
|
||||||
{
|
{
|
||||||
@@ -659,7 +658,7 @@ void runpc(void)
|
|||||||
win_title_update=0;
|
win_title_update=0;
|
||||||
mbstowcs(wmodel, model_getname(), strlen(model_getname()) + 1);
|
mbstowcs(wmodel, model_getname(), strlen(model_getname()) + 1);
|
||||||
mbstowcs(wcpu, models[model].cpu[cpu_manufacturer].cpus[cpu].name, strlen(models[model].cpu[cpu_manufacturer].cpus[cpu].name) + 1);
|
mbstowcs(wcpu, models[model].cpu[cpu_manufacturer].cpus[cpu].name, strlen(models[model].cpu[cpu_manufacturer].cpus[cpu].name) + 1);
|
||||||
_swprintf(s, L"%s v%s - %i%% - %s - %s - %s", EMU_NAME_W, EMU_VERSION_W, fps, wmodel, wcpu, (!mousecapture) ? win_language_get_string_from_id(2077) : ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? win_language_get_string_from_id(2078) : win_language_get_string_from_id(2079)));
|
_swprintf(s, L"%s v%s - %i%% - %s - %s - %s", EMU_NAME_W, EMU_VERSION_W, fps, wmodel, wcpu, (!mousecapture) ? plat_get_string_from_id(IDS_2077) : ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? plat_get_string_from_id(IDS_2078) : plat_get_string_from_id(IDS_2079)));
|
||||||
set_window_title(s);
|
set_window_title(s);
|
||||||
}
|
}
|
||||||
done++;
|
done++;
|
||||||
|
|||||||
Reference in New Issue
Block a user