mirror of
https://github.com/n64dev/cen64.git
synced 2025-04-02 10:31:54 -04:00
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
//
|
|
// os/posix/main.c: Entry point for WinAPI backend.
|
|
//
|
|
// CEN64: Cycle-Accurate Nintendo 64 Emulator.
|
|
// Copyright (C) 2015, Tyler J. Stachecki.
|
|
//
|
|
// This file is subject to the terms and conditions defined in
|
|
// 'LICENSE', which is part of this source code package.
|
|
//
|
|
|
|
#include "cen64.h"
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
|
|
// Windows application entry point.
|
|
int WINAPI winapi_main(HINSTANCE hInstance,
|
|
HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
|
|
WSADATA wsa_data = {0};
|
|
WPARAM status = 255;
|
|
|
|
if (WSAStartup(MAKEWORD(2, 2), &wsa_data)) {
|
|
MessageBox(NULL, "Failed to initialize Winsock.", "CEN64",
|
|
MB_OK | MB_ICONEXCLAMATION);
|
|
|
|
return status;
|
|
}
|
|
|
|
status = cen64_main(__argc, (const char **) __argv);
|
|
WSACleanup();
|
|
|
|
return status;
|
|
}
|
|
|
|
// "Hides" the console window (after waiting for input).
|
|
void hide_console(void) {
|
|
printf("\n");
|
|
system("PAUSE");
|
|
|
|
FreeConsole();
|
|
}
|
|
|
|
// "Unhides" the console window.
|
|
void show_console(void) {
|
|
AllocConsole();
|
|
|
|
freopen("CONOUT$", "wb", stdout);
|
|
freopen("CONOUT$", "wb", stderr);
|
|
}
|
|
|