2020-12-06 23:47:26 +00:00
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
2021-01-27 18:20:47 +00:00
|
|
|
use std::process::exit;
|
|
|
|
|
2020-10-07 14:08:12 +00:00
|
|
|
fn main() {
|
2021-01-27 18:20:47 +00:00
|
|
|
let result = doukutsu_rs::init();
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
unsafe {
|
|
|
|
use winapi::_core::ptr::null_mut;
|
|
|
|
use winapi::um::winuser::MessageBoxW;
|
|
|
|
use winapi::um::winuser::MB_OK;
|
|
|
|
use winapi::shared::ntdef::LPCWSTR;
|
|
|
|
use std::ffi::OsStr;
|
|
|
|
use std::os::windows::prelude::*;
|
|
|
|
|
|
|
|
if let Err(e) = result {
|
|
|
|
let title: LPCWSTR = OsStr::new("Error!")
|
|
|
|
.encode_wide().chain(Some(0)).collect::<Vec<u16>>().as_ptr();
|
2021-03-31 23:15:03 +00:00
|
|
|
let message: LPCWSTR = OsStr::new(format!("Whoops, nxengine-rs crashed: {}", e).as_str())
|
2021-01-27 18:20:47 +00:00
|
|
|
.encode_wide().chain(Some(0)).collect::<Vec<u16>>().as_ptr();
|
|
|
|
MessageBoxW(null_mut(),
|
|
|
|
message,
|
|
|
|
title,
|
|
|
|
MB_OK);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Err(e) = result {
|
|
|
|
println!("Initialization error: {}", e);
|
|
|
|
exit(1);
|
|
|
|
}
|
2020-08-18 16:46:07 +00:00
|
|
|
}
|