Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
716 | lvd | 1 | #include "std.h" |
2 | #pragma hdrstop |
||
3 | |||
4 | #define SND_TEST_FAILURES |
||
5 | //#define SND_TEST_SHOWSTAT |
||
6 | #include "mods.h" |
||
7 | |||
8 | //#include "9x.h" |
||
9 | #include "resource.h" |
||
10 | |||
11 | //------- Alone Coder --------- |
||
12 | #include <winioctl.h> |
||
13 | |||
14 | #ifndef INVALID_SET_FILE_POINTER |
||
15 | #define INVALID_SET_FILE_POINTER (DWORD)-1 |
||
16 | #endif |
||
17 | |||
18 | typedef unsigned int UINT32; |
||
19 | typedef signed int INT32; |
||
20 | typedef unsigned short UINT16; |
||
21 | typedef signed short INT16; |
||
22 | typedef unsigned char UINT8; |
||
23 | typedef signed char INT8; |
||
24 | unsigned frametime = 111111; //Alone Coder (GUI value for conf.frame) |
||
25 | //~------- Alone Coder --------- |
||
26 | |||
27 | int nmi_pending = 0; |
||
28 | |||
29 | bool ConfirmExit(); |
||
30 | BOOL WINAPI ConsoleHandler(DWORD CtrlType); |
||
31 | |||
32 | #include "emul_2203.h" //Dexus |
||
33 | #include "sndrender/sndrender.h" |
||
34 | #include "emul.h" |
||
35 | #include "sndrender/sndchip.h" |
||
36 | #include "sndrender/sndcounter.h" |
||
37 | #include "init.h" |
||
38 | #include "funcs.h" |
||
39 | #include "debug.h" |
||
40 | #include "vars.h" |
||
41 | #include "dx.h" |
||
42 | #include "draw.h" |
||
43 | #include "mainloop.h" |
||
44 | #include "iehelp.h" |
||
45 | #include "util.h" |
||
46 | |||
47 | void m_nmi(ROM_MODE page); |
||
48 | void showhelp(const char *anchor) |
||
49 | { |
||
50 | OnEnterGui(); //Alone Coder 0.36.6 |
||
51 | showhelppp(anchor); //Alone Coder 0.36.6 |
||
52 | OnExitGui(); //Alone Coder 0.36.6 |
||
53 | } |
||
54 | |||
55 | LONG __stdcall filter(EXCEPTION_POINTERS *pp) |
||
56 | { |
||
57 | color(CONSCLR_ERROR); |
||
58 | printf("\nexception %08lX at eip=%p\n", |
||
59 | pp->ExceptionRecord->ExceptionCode, |
||
60 | pp->ExceptionRecord->ExceptionAddress); |
||
61 | #if _M_IX86 |
||
62 | printf("eax=%08lX ebx=%08lX ecx=%08lX edx=%08lX\n" |
||
63 | "esi=%08lX edi=%08lX ebp=%08lX esp=%08lX\n", |
||
64 | pp->ContextRecord->Eax, pp->ContextRecord->Ebx, |
||
65 | pp->ContextRecord->Ecx, pp->ContextRecord->Edx, |
||
66 | pp->ContextRecord->Esi, pp->ContextRecord->Edi, |
||
67 | pp->ContextRecord->Ebp, pp->ContextRecord->Esp); |
||
68 | #endif |
||
69 | #if _M_IX64 |
||
70 | printf("rax=%016I64X rbx=%016I64X rcx=%016I64X rdx=%016I64X\n" |
||
71 | "rsi=%016I64X rdi=%016I64X rbp=%016I64X rsp=%016I64X\n", |
||
72 | pp->ContextRecord->Rax, pp->ContextRecord->Rbx, |
||
73 | pp->ContextRecord->Rcx, pp->ContextRecord->Rdx, |
||
74 | pp->ContextRecord->Rsi, pp->ContextRecord->Rdi, |
||
75 | pp->ContextRecord->Rbp, pp->ContextRecord->Rsp); |
||
76 | #endif |
||
77 | color(); |
||
78 | return EXCEPTION_CONTINUE_SEARCH; |
||
79 | } |
||
80 | |||
81 | static bool Exit = false; |
||
82 | |||
83 | bool ConfirmExit() |
||
84 | { |
||
85 | if(!conf.ConfirmExit) |
||
86 | return true; |
||
87 | |||
88 | return MessageBox(wnd, "Exit ?", "Unreal", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES; |
||
89 | } |
||
90 | |||
91 | BOOL WINAPI ConsoleHandler(DWORD CtrlType) |
||
92 | { |
||
93 | switch(CtrlType) |
||
94 | { |
||
95 | case CTRL_C_EVENT: |
||
96 | case CTRL_BREAK_EVENT: |
||
97 | if(ConfirmExit()) |
||
98 | Exit = true; |
||
99 | return TRUE; |
||
100 | } |
||
101 | return FALSE; |
||
102 | } |
||
103 | |||
104 | int __cdecl main(int argc, char **argv) |
||
105 | { |
||
106 | |||
107 | DWORD Ver = GetVersion(); |
||
108 | |||
109 | WinVerMajor = (DWORD)(LOBYTE(LOWORD(Ver))); |
||
110 | WinVerMinor = (DWORD)(HIBYTE(LOWORD(Ver))); |
||
111 | |||
112 | CONSOLE_SCREEN_BUFFER_INFO csbi; |
||
113 | GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); |
||
114 | nowait = *(unsigned*)&csbi.dwCursorPosition; |
||
115 | |||
116 | SetThreadAffinityMask(GetCurrentThread(), 1); |
||
117 | |||
118 | SetConsoleCtrlHandler(ConsoleHandler, TRUE); |
||
119 | |||
120 | color(CONSCLR_TITLE); |
||
121 | printf("UnrealSpeccy %s by SMT, %s\n", VERS_STRING_, __DATE__); |
||
122 | printf("Integrated YM2203 version 1.4A by Tatsuyuki Satoh, Jarek Burczynski, Alone Coder\n"); //Dexus |
||
123 | #ifdef __ICL |
||
124 | printf("Intel C++ Compiler: %d.%02d\n", __ICL/100, __ICL % 100); |
||
125 | #endif |
||
126 | color(); |
||
127 | // http://sourceforge.net/projects/unrealspeccy/ |
||
128 | // http://alonecoder.narod.ru/ |
||
129 | // http://dlcorp.ucoz.ru/forum/22 |
||
130 | printf(" *** new versions & sources -> http://dlcorp.nedopc.com/viewforum.php?f=8 ***\n"); |
||
131 | |||
132 | #ifndef DEBUG |
||
133 | SetUnhandledExceptionFilter(filter); |
||
134 | #endif |
||
135 | |||
136 | SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); |
||
137 | load_spec_colors(); |
||
138 | init_all(argc-1, argv+1); |
||
139 | // applyconfig(); |
||
140 | sound_play(); |
||
141 | color(); |
||
142 | |||
143 | mainloop(Exit); |
||
144 | return 0; |
||
145 | } |