-
Notifications
You must be signed in to change notification settings - Fork 8
/
globals.c
96 lines (84 loc) · 3.12 KB
/
globals.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*$T globals.c GC 1.136 02/28/02 08:01:08 */
/*$6
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
/*
* 1964 Copyright (C) 1999-2002 Joel Middendorf, <[email protected]> This
* program is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version. This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
* authors: email: [email protected], [email protected]
*/
#include "1964ini.h"
#include "windows.h"
#include "./win32/wingui.h"
char *CURRENT1964VERSION = "1964_085";
uint32 gAllocationLength;
uint8 HeaderDllPass[0x40];
volatile int Rom_Loaded = 0;
t_rominfo rominfo; /* Rom information */
char generalmessage[256]; /* general purpose buffer to display messages */
int showcursor = 1;
/*
=======================================================================================================================
This function should be called if you want to change the cursor status £
as calling 'ShowCursor' multiple times will glitch and have issues so £
this prevents the multiple call problem
=======================================================================================================================
*/
void HideCursor(int state)
{
if(state == TRUE)
{
if(showcursor)
{
ShowCursor(FALSE);
showcursor = 0;
}
}
else
{
if(!showcursor)
{
ShowCursor(TRUE);
showcursor = 1;
}
}
ShowWindow(gui.hStatusBar, guistatus.IsFullScreen || !guioptions.display_statusbar ? SW_HIDE : SW_SHOW);
}
/*
=======================================================================================================================
MSVC doesn't have strnstr() yet so let's add it here
=======================================================================================================================
*/
__forceinline uint32 strnlen(const char *needle, uint32 len)
{
const char *pStr = needle;
while (((len--) > 0) && (*pStr != '\0'))
{
pStr++;
}
return (pStr-needle);
}
char *strnstr(const char *haystack, const char *needle, uint32 len)
{
int i;
uint32 needle_len;
if ((needle_len = strnlen(needle, len)) == 0)
return (char *)haystack;
for (i=0; i<=(int)(len-needle_len); i++)
{
if ((haystack[0] == needle[0]) &&
(0 == strncmp(haystack, needle, needle_len)))
return (char *)haystack;
haystack++;
}
return NULL;
}