Skip to content

Commit c816946

Browse files
committed
SDL: move audio init to main
1 parent ca29ffa commit c816946

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/common/fs_serial.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ uint32_t serial_length(dev_file_t *f) {
7777
}
7878

7979
#elif defined(_Win32)
80-
typedef int FileHand;
8180

8281
int serial_open(dev_file_t *f) {
8382
DCB dcb;
@@ -114,32 +113,32 @@ int serial_open(dev_file_t *f) {
114113
return 0;
115114
}
116115

117-
f->handle = (FileHand) hCom;
116+
f->handle = (intptr_t)hCom;
118117
return 1;
119118
}
120119

121120
int serial_close(dev_file_t *f) {
122-
CloseHandle((HANDLE) f->handle);
121+
CloseHandle((HANDLE) (intptr_t)f->handle);
123122
f->handle = -1;
124123
return 1;
125124
}
126125

127126
int serial_write(dev_file_t *f, byte *data, uint32_t size) {
128127
DWORD bytes;
129-
f->last_error = !WriteFile((HANDLE) f->handle, data, size, &bytes, NULL);
128+
f->last_error = !WriteFile((HANDLE)(intptr_t)f->handle, data, size, &bytes, NULL);
130129
return bytes;
131130
}
132131

133132
int serial_read(dev_file_t *f, byte *data, uint32_t size) {
134133
DWORD bytes;
135-
f->last_error = !ReadFile((HANDLE) f->handle, data, size, &bytes, NULL);
134+
f->last_error = !ReadFile((HANDLE)(intptr_t)f->handle, data, size, &bytes, NULL);
136135
return bytes;
137136
}
138137

139138
uint32_t serial_length(dev_file_t *f) {
140139
COMSTAT cs;
141140
DWORD de = CE_BREAK;
142-
ClearCommError((HANDLE) f->handle, &de, &cs);
141+
ClearCommError((HANDLE)(intptr_t)f->handle, &de, &cs);
143142
return cs.cbInQue;
144143
}
145144

src/platform/sdl/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ int main(int argc, char* argv[]) {
390390
opt_ide = ide_option;
391391
}
392392

393-
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
393+
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_AUDIO);
394394
SDL_Window *window = SDL_CreateWindow("SmallBASIC",
395395
rect.x, rect.y, rect.w, rect.h,
396396
SDL_WINDOW_SHOWN |

src/platform/sdl/runtime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ int Runtime::runShell(const char *startupBas, int fontScale, int debugPort) {
330330
_output->setFontSize(fontSize);
331331
}
332332

333-
SDL_Init(SDL_INIT_AUDIO);
334333
SDL_AudioSpec desiredSpec;
335334
desiredSpec.freq = FREQUENCY;
336335
desiredSpec.format = AUDIO_S16SYS;

0 commit comments

Comments
 (0)