/**
 * 
 *  rct2: 0x0066C9EA
 */
static void window_game_top_toolbar_dropdown()
{
	short widgetIndex, dropdownIndex;

	__asm mov widgetIndex, dx
	__asm mov dropdownIndex, ax

	if (widgetIndex == WIDX_FILE_MENU) {
		switch (dropdownIndex) {
		case 0:		// load game
			game_do_command(0, 1, 0, 0, 5, 0, 0);
			break;
		case 1:		// save game
			tool_cancel();
			{
				int eax, ebx, ecx, edx, esi, edi, ebp;
				RCT2_CALLFUNC_X(0x006750E9, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
				if (eax == 0) {
					gfx_invalidate_screen();
					break;
				}

				char *src = (char*)0x0141EF67;
				do {
					src++;
				} while (*src != '.' && *src != '\0');
				strcpy(src, ".SV6");
				strcpy(RCT2_ADDRESS_SAVED_GAMES_PATH_2, 0x0141EF68);

				eax = 0;
				if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
					eax |= 1;
				RCT2_CALLPROC_X(0x006754F5, eax, 0, 0, 0, 0, 0, 0);
				// check success?

				game_do_command(0, 1047, 0, -1, 0, 0, 0);
				gfx_invalidate_screen();
			}
			break;
		case 3:		// about
			window_about_open();
			break;
		case 4:		// options
			window_options_open();
			//RCT2_CALLPROC_EBPSAFE(0x006BAC5B);
			break;
		case 5:		// screenshot
			RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			break;
		case 7:		// quit game
			game_do_command(0, 1, 0, 0, 5, 1, 0);
			break;
		}
	} else if (widgetIndex == WIDX_VIEW_MENU) {
		RCT2_CALLPROC_X(0x0066CF8A, dropdownIndex, 0, 0, 0, 0, 0, 0);
	}
}
/**
*
*  rct2: 0x0066FA38
*/
void window_editor_top_toolbar_dropdown() {
	short widgetIndex, dropdownIndex;
	rct_window* w;

	window_dropdown_get_registers(w, widgetIndex, dropdownIndex);

	if (widgetIndex == WIDX_FILE_MENU) {
		if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
			if (dropdownIndex == DDIDX_TD_ABOUT) {
				window_about_open();
			} else if (dropdownIndex == DDIDX_TD_OPTIONS) {
				window_options_open();
			} else if (dropdownIndex == DDIDX_TD_SCREENSHOT) {
				RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			} else if (dropdownIndex == DDIDX_TD_QUIT_GAME) {
				window_close_by_number(WC_47, w->number);
				window_close_by_number(WC_48, w->number);
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
			}
		} else {
			if (dropdownIndex == DDIDX_SE_LOAD_LANDSCAPE) {
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
			} else if (dropdownIndex == DDIDX_SE_SAVE_LANDSCAPE) {
				RCT2_CALLPROC(0x0066FE2A);
			} else if (dropdownIndex == DDIDX_SE_ABOUT) {
				window_about_open();
			} else if (dropdownIndex == DDIDX_SE_OPTIONS) {
				window_options_open();
			} else if (dropdownIndex == DDIDX_SE_SCREENSHOT) {
				RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			} else if (dropdownIndex == DDIDX_SE_QUIT_GAME) {
				window_close_by_number(WC_47, w->number);
				window_close_by_number(WC_48, w->number);
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
			}
		}
	} else if (widgetIndex == WIDX_VIEW_MENU) {
		top_toolbar_view_menu_dropdown(dropdownIndex);
	}
}