⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wince_util.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
字号:
/* PocketCultMAME - MAME Emulator for PocketPC
   (c) Copyright 2006 Manuel Castrillo Mart韓ez

   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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <aygshell.h>
#include <winbase.h>
#include <string.h>
#include <stdio.h>

#include "wince_util.h"
#include "wince_initWnd.h"

#define MENU_HEIGHT 26

extern int initWndActive;

int clock_cpu=80; 			/* Clock option for CPU's */
int clock_sound=80; 		/* Clock option for Audio CPU's */

FILE * stdout_file;
FILE * stderr_file;

char path_mame[MAX_PATH];


void getMAMEPath(void)
{
	char fullName[MAX_PATH+1];
	char programName[MAX_PATH+1];
	TCHAR initialPath[MAX_PATH + 1];

	GetModuleFileName(NULL, initialPath, MAX_PATH);
	wcstombs( fullName, initialPath, MAX_PATH );
	splitPathFileName( fullName, path_mame, programName );
}


void initLog(void)
{
    char chFileName[MAX_PATH + 1];
    
    strncpy(chFileName, path_mame, sizeof(chFileName)-10);
    strcat(chFileName, "\\log.txt");

	stdout_file = fopen( chFileName, "wt" );
}


void writeLog(char *logText)
{
	if( initWndActive )
	{
		sendInitializationText( logText );
	}
	fputs( logText, stdout_file );
	fputs( "\n", stdout_file );
}


void closeLog(void)
{
	fclose(stdout_file);
}

long getTickts(void)
{
	return(GetTickCount());
}

void setFullScreenWindow( HWND hWnd )
{

      RECT rc;

      GetWindowRect(hWnd, &rc);
      SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
      //ShowWindow(hWnd, SW_HIDE);

      MoveWindow(hWnd,
		  rc.left,
		  rc.top-MENU_HEIGHT,
		  rc.right,
		  rc.bottom+MENU_HEIGHT,
		  TRUE);
				
}

void setFullScreenDialog( HWND hDlg )
{
	
	RECT rect;

	GetWindowRect(hDlg, &rect);
	MoveWindow(hDlg,
	 rect.left,
	 rect.top-MENU_HEIGHT,
	 rect.right,
	 rect.bottom,
	TRUE);

	SetForegroundWindow(hDlg);
	SHFullScreen(hDlg, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);

}


void splitPathFileName(char *pchCombined, char *pchPath, char *pchFile)
{
   char *pchPtr;
   char chOld;

   pchPtr = strrchr(pchCombined, '/'); // start from the end and find the first path delimiter
   if (!pchPtr) {
      pchPtr = strrchr(pchCombined, '\\'); // try again with the alternate form
   }
   if (pchPtr) {
      pchPtr++; // advance the pointer to the next character
      if (pchFile) {
         strcpy(pchFile, pchPtr); // copy the filename
      }
      chOld = *pchPtr;
      *pchPtr = 0; // cut off the filename part
      if (pchPath != pchCombined) {
         if (pchPath) {
            strcpy(pchPath, pchCombined); // copy the path
         }
         *pchPtr = chOld; // restore original string
      }
   } else {
      if (pchFile) {
         *pchFile = 0; // no filename found
      }
      if (pchPath != pchCombined) {
         if (pchPath) {
            strcpy(pchPath, pchCombined); // copy the path
         }
      }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -