Beispiel #1
0
/**
 * Check an image file in the archive, return the uncompressed length
 */
static long ZIP_CheckImageFile(unzFile uf, char *filename, int namelen, int *pImageType)
{
	unz_file_info file_info;

	if (unzLocateFile(uf,filename, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error: File \"%s\" not found in the archive!\n", filename);
		return -1;
	}

	if (unzGetCurrentFileInfo(uf, &file_info, filename, namelen, NULL, 0, NULL, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error with zipfile in unzGetCurrentFileInfo\n");
		return -1;
	}

	/* check for .stx, .ipf, .msa, .dim or .st extension */
	if (STX_FileNameIsSTX(filename, false))
	{
		*pImageType = FLOPPY_IMAGE_TYPE_STX;
		return file_info.uncompressed_size;
	}

	if (IPF_FileNameIsIPF(filename, false))
	{
		*pImageType = FLOPPY_IMAGE_TYPE_IPF;
		return file_info.uncompressed_size;
	}

	if (MSA_FileNameIsMSA(filename, false))
	{
		*pImageType = FLOPPY_IMAGE_TYPE_MSA;
		return file_info.uncompressed_size;
	}

	if (ST_FileNameIsST(filename, false))
	{
		*pImageType = FLOPPY_IMAGE_TYPE_ST;
		return file_info.uncompressed_size;
	}

	if (DIM_FileNameIsDIM(filename, false))
	{
		*pImageType = FLOPPY_IMAGE_TYPE_DIM;
		return file_info.uncompressed_size;
	}

	Log_Printf(LOG_ERROR, "Not an .ST, .MSA, .DIM, .IPF or .STX file.\n");
	return 0;
}
Beispiel #2
0
/**
 * Load keyboard remap file
 */
void Keymap_LoadRemapFile(char *pszFileName)
{
	char szString[1024];
	int STScanCode, PCKeyCode;
	FILE *in;

	/* Initialize table with default values */
	memcpy(LoadedKeyToSTScanCode, SymbolicKeyToSTScanCode, sizeof(LoadedKeyToSTScanCode));

	if (!*pszFileName)
		return;
	
	/* Attempt to load file */
	if (!File_Exists(pszFileName))
	{
		Log_Printf(LOG_DEBUG, "Keymap_LoadRemapFile: '%s' not a file\n", pszFileName);
		return;
	}
	in = fopen(pszFileName, "r");
	if (!in)
	{
		Log_Printf(LOG_DEBUG, "Keymap_LoadRemapFile: failed to "
			   " open keymap file '%s'\n", pszFileName);
		return;
	}
	
	while (!feof(in))
	{
		/* Read line from file */
		if (fgets(szString, sizeof(szString), in) == NULL)
			break;
		/* Remove white-space from start of line */
		Str_Trim(szString);
		if (strlen(szString)>0)
		{
			/* Is a comment? */
			if ( (szString[0]==';') || (szString[0]=='#') )
				continue;
			/* Read values */
			sscanf(szString, "%d,%d", &PCKeyCode, &STScanCode);
			/* Store into remap table, check both value within range */
			if ( (PCKeyCode>=0) && (PCKeyCode<SDLK_LAST) &&
			     (STScanCode>=0) && (STScanCode<256) )
				LoadedKeyToSTScanCode[PCKeyCode] = STScanCode;
		}
	}
	
	fclose(in);
}
Beispiel #3
0
void goToURL(char* url){

	Log_Printf("url=%s\n",url);

	if (!goToWebsite){
		Log_Printf("No Java VM method defined. Cannot invocate !\n");
		return;
	}
	jstring jstr = (*env)->NewStringUTF(env,url);



	(*env)->CallVoidMethod(env,activityInstance,goToWebsite,jstr);


}
Beispiel #4
0
/*
==================
SV_Kick_f

Kick a user off of the server
==================
*/
void SV_Kick_f( void )
{
	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: kick <userid> | <name>\n" );
		return;
	}

	if( !SV_SetPlayer( )) return;

	if( NET_IsLocalAddress( svs.currentPlayer->netchan.remote_address ))
	{
		Msg( "The local player cannot be kicked!\n" );
		return;
	}

	SV_BroadcastPrintf( PRINT_HIGH, "%s was kicked\n", svs.currentPlayer->name );
	SV_ClientPrintf( svs.currentPlayer, PRINT_HIGH, "You were kicked from the game\n" );
	SV_DropClient( svs.currentPlayer );

	Log_Printf( "Kick: \"%s<%i><%s><>\" was kicked by \"Console\"\n", svs.currentPlayer->name,
				svs.currentPlayer->userid, SV_GetClientIDString ( svs.currentPlayer ) );

	// min case there is a funny zombie
	svs.currentPlayer->lastmessage = host.realtime;
}
Beispiel #5
0
int VertexServer_api_log(VertexServer *self)
{
	Log_Printf("LOG -----------------------------\n\n");
	printf("%s\n", Datum_data(HttpRequest_postData(self->httpRequest)));
	printf("\n---------------------------------\n");
	return 0;
}
Beispiel #6
0
/*****************************************************************************
 * ContentDir_GetSearchCapabilities
 *****************************************************************************/
const char*
ContentDir_GetSearchCapabilities (ContentDir* self, void* unused)
{
	if (self == NULL)
		return NULL; // ---------->
	
	// Send Action if result not already cached
	if (self->search_caps == NULL) {

		IXML_Document* doc = NULL;
		int rc = Service_SendActionVa
			(OBJECT_SUPER_CAST(self), &doc,
			 "GetSearchCapabilities",
			 NULL, NULL);
		if (rc == UPNP_E_SUCCESS && doc != NULL) {
			self->search_caps = talloc_strdup 
				(self, XMLUtil_FindFirstElementValue
				 (XML_D2N (doc), "SearchCaps", true, true));
			
			Log_Printf (LOG_DEBUG, 
				    "ContentDir_GetSearchCapabilities = '%s'",
				    NN(self->search_caps));
		}
		ixmlDocument_free (doc);
	}
	
	return self->search_caps;
}
Beispiel #7
0
void TurboSCR1_Reset(void) {
	Uint8 memory_speed;
	Uint8 cpu_speed = 0x07; // 33 MHz
	
	if (ConfigureParams.System.nCpuFreq<20) {
		cpu_speed = 4;
	} else if (ConfigureParams.System.nCpuFreq<25) {
		cpu_speed = 5;
	} else if (ConfigureParams.System.nCpuFreq<33) {
		cpu_speed = 6;
	} else {
		cpu_speed = 7;
	}
	
	switch (ConfigureParams.Memory.nMemorySpeed) {
		case MEMORY_120NS: memory_speed = 0x00; break;
		case MEMORY_100NS: memory_speed = 0x50; break;
		case MEMORY_80NS: memory_speed = 0xA0; break;
		case MEMORY_60NS: memory_speed = 0xF0; break;
		default: Log_Printf(LOG_WARN, "Turbo SCR1 error: unknown memory speed\n"); break;
	}
	tmc.scr1 = ((memory_speed&0xF0)|(cpu_speed&0x07));
	if (ConfigureParams.System.nMachineType == NEXT_CUBE040)
		tmc.scr1 |= 0x8000;
	else if (ConfigureParams.System.bColor) {
		tmc.scr1 |= 0x5000;
	} else {
		tmc.scr1 |= 0x4000;
	}
	tmc.scr1 |= TURBOSCR_FMASK;
}
Beispiel #8
0
/**
 * Load program setting from configuration file. If psFileName is NULL, use
 * the configuration file given in configuration / last selected by user.
 */
void Configuration_Load(const char *psFileName)
{
	if (psFileName == NULL)
		psFileName = sConfigFileName;

	if (!File_Exists(psFileName))
	{
		Log_Printf(LOG_DEBUG, "Configuration file %s not found.\n", psFileName);
		return;
	}

	Configuration_LoadSection(psFileName, configs_Log, "[Log]");
    Configuration_LoadSection(psFileName, configs_ConfigDialog, "[ConfigDialog]");
	Configuration_LoadSection(psFileName, configs_Debugger, "[Debugger]");
	Configuration_LoadSection(psFileName, configs_Screen, "[Screen]");
	Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]");
	Configuration_LoadSection(psFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
	Configuration_LoadSection(psFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
    Configuration_LoadSection(psFileName, configs_Mouse, "[Mouse]");
	Configuration_LoadSection(psFileName, configs_Sound, "[Sound]");
	Configuration_LoadSection(psFileName, configs_Memory, "[Memory]");
    Configuration_LoadSection(psFileName, configs_Boot, "[Boot]");
	Configuration_LoadSection(psFileName, configs_SCSI, "[HardDisk]");
    Configuration_LoadSection(psFileName, configs_MO, "[MagnetoOptical]");
    Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]");
    Configuration_LoadSection(psFileName, configs_Ethernet, "[Ethernet]");
	Configuration_LoadSection(psFileName, configs_Rom, "[ROM]");
	Configuration_LoadSection(psFileName, configs_Printer, "[Printer]");
	Configuration_LoadSection(psFileName, configs_System, "[System]");
    Configuration_LoadSection(psFileName, configs_Dimension, "[Dimension]");
}
Beispiel #9
0
/* <ee430> ../engine/sv_steam3.cpp:290 */
void CSteam3Server::OnGSClientApprove(GSClientApprove_t *pGSClientSteam2Accept)
{
    client_t* cl = ClientFindFromSteamID(pGSClientSteam2Accept->m_SteamID);
    if (!cl)
        return;


    if (SV_FilterUser(&cl->network_userid))
    {
        char msg[256];
        Q_sprintf(msg, "You have been banned from this server\n");
        SV_RejectConnection(&cl->netchan.remote_address, msg);
        SV_DropClient(cl, 0, "STEAM UserID %s is in server ban list\n", SV_GetClientIDString(cl));
    }
    else if (SV_CheckForDuplicateSteamID(cl) != -1)
    {
        char msg[256];
        Q_sprintf(msg, "Your UserID is already in use on this server.\n");
        SV_RejectConnection(&cl->netchan.remote_address, msg);
        SV_DropClient(cl, 0, "STEAM UserID %s is already\nin use on this server\n", SV_GetClientIDString(cl));
    }
    else
    {
        char msg[512];
        Q_snprintf(msg, ARRAYSIZE(msg), "\"%s<%i><%s><>\" STEAM USERID validated\n", cl->name, cl->userid, SV_GetClientIDString(cl));
#ifdef REHLDS_CHECKS
        msg[ARRAYSIZE(msg) - 1] = 0;
#endif
        Con_DPrintf("%s", msg);
        Log_Printf("%s", msg);
    }
}
Beispiel #10
0
static void
cache_expire_entries (Cache* cache, time_t const now)
{	
	if (cache->max_age > 0 && now > cache->next_clean) {
		int i;
#if CACHE_FIXED_SIZE
		for (i = 0; i < cache->size; i++) {
			Entry* const ce = cache->table + i;
			if (ce->key && now > ce->rip) {
				Log_Printf (LOG_DEBUG, 
					    "CACHE_CLEAN (key='%s')", ce->key);
				if (cache->free_expired_data)
					cache->free_expired_data (ce->key, 
								  ce->data);
				ce->data = NULL;
				talloc_free (ce->key);
				ce->key = NULL;
				cache->nr_entries--;
			}
	
		}
#else
		size_t const n = hash_get_n_entries (cache->table);
		// Pb with "Hash_table" API : it is not allowed to modify 
		// the hash table when walking it. Therefore we have to get 
		// the entries first, then delete the expired ones.
		void* entries [n];
		size_t const nn = hash_get_entries (cache->table, entries, n);
		for (i = 0; i < nn; i++) {
			Entry* ce = (Entry*) entries[i];
			if (now > ce->rip) {
				Log_Printf (LOG_DEBUG, 
					    "CACHE_CLEAN (key='%s')", ce->key);
				ce = hash_delete (cache->table, ce);
				if (ce) {
					if (cache->free_expired_data)
						cache->free_expired_data 
							(ce->key, ce->data);
					ce->data = NULL;
					talloc_free (ce);
				}
			}
		}
#endif
		cache->next_clean = now + CACHE_CLEAN_PERIOD;
	}
}
Beispiel #11
0
/**
 * Copy ST GEMDOS intercept program image into cartridge memory space
 * or load an external cartridge file.
 * The intercept program is part of Hatari and used as an interface to the host
 * file system through GemDOS. It is also needed for Line-A-Init when using
 * extended VDI resolutions.
 */
void Cart_ResetImage(void)
{
    int PatchIllegal = FALSE;

    /* "Clear" cartridge ROM space */
    memset(&RomMem[0xfa0000], 0xff, 0x20000);

    /* Print a warning if user tries to use an external cartridge file
     * together with GEMDOS HD emulation or extended VDI resolution: */
    if (strlen(ConfigureParams.Rom.szCartridgeImageFileName) > 0)
    {
        if (bUseVDIRes)
            Log_Printf(LOG_WARN, "Cartridge can't be used together with extended VDI resolution!\n");
        if (ConfigureParams.HardDisk.bUseHardDiskDirectories)
            Log_Printf(LOG_WARN, "Cartridge can't be used together with GEMDOS hard disk emulation!\n");
    }

    /* Use internal cartridge when user wants extended VDI resolution or GEMDOS HD. */
    if (bUseVDIRes || ConfigureParams.HardDisk.bUseHardDiskDirectories)
    {
        /* Copy built-in cartrige data into the cartridge memory of the ST */
        memcpy(&RomMem[0xfa0000], Cart_data, sizeof(Cart_data));
        PatchIllegal = TRUE;
    }
    else if (strlen(ConfigureParams.Rom.szCartridgeImageFileName) > 0)
    {
        /* Load external image file: */
        Cart_LoadImage();
    }

    if (PatchIllegal == TRUE)
    {
        //fprintf ( stderr ," Cart_ResetImage patch\n" );
        /* Hatari's specific illegal opcodes for HD emulation */
        cpufunctbl[GEMDOS_OPCODE] = OpCode_GemDos;	/* 0x0008 */
        cpufunctbl[SYSINIT_OPCODE] = OpCode_SysInit;	/* 0x000a */
        cpufunctbl[VDI_OPCODE] = OpCode_VDI;		/* 0x000c */
    }
    else
    {
        //fprintf ( stderr ," Cart_ResetImage no patch\n" );
        /* No built-in cartridge loaded : set same handler as 0x4afc (illegal) */
        cpufunctbl[GEMDOS_OPCODE] = cpufunctbl[ 0x4afc ];	/* 0x0008 */
        cpufunctbl[SYSINIT_OPCODE] = cpufunctbl[ 0x4afc ];	/* 0x000a */
        cpufunctbl[VDI_OPCODE] = cpufunctbl[ 0x4afc ];		/* 0x000c */
    }
}
Beispiel #12
0
material_t* MATLIB_Create(char* materialName)
{
	material_t* material;
	
	int i;
	
	if (strlen(materialName) > MAX_MATERIAL_NAME_LENGTH-1)
	{
		Log_Printf("Material name '%s' is too long (> %d).\n",materialName,MAX_MATERIAL_NAME_LENGTH-1);
		return NULL;
	}
	
	//printf("[MATLIB]: Creating '%s' \n",materialName);
	material = calloc(1, sizeof(material_t));
	
	
	material->shininess = 40 ;  //10
	
	for (i=0; i<3; i++) 
		material->specularColor[i] = 1;
	
	material->prop = 0;
	//By default, all material respond to FOG and SHADOW
	material->prop |= PROP_SHADOW;
	material->prop |= PROP_FOG;
	
	material->textures[TEXTURE_DIFFUSE].cachable = 1;
	material->textures[PROP_BUMP].cachable = 1;
	material->textures[PROP_SPEC].cachable = 1;
	

	//strcpy(material->name, materialName);
	
	strcpy(material->name,materialName);
	LE_cleanUpDoubleQuotes(material->name);
	/*
	newMaterialName = material->name;
	while(*materialName != '\0')
	{
		if (*materialName != '"')
		{
		//	Log_Printf("material->name = '%s'\n",  material->name);
			//printf("'%c'\n",*materialName);
			*newMaterialName++ = *materialName++;
		}
		else
			materialName++;
	}
	*/
	//*newMaterialName = '\0';
	
	//printf("Null termination char= '%d'\n",'\0');
	
	MAT_Put(material);
	
	//printf("[MATLIB]: Created and cached '%s' \n",material->name);
	
	return material;
}
Beispiel #13
0
/**
 * Check Bios call and see if we need to re-direct to our own routines.
 * Return true if we've handled the exception, else return false to let
 * TOS attempt it
 */
bool Bios(void)
{
	Uint32 Params;
	Uint16 BiosCall;

	/* Get call */
	Params = Regs[REG_A7];
	BiosCall = STMemory_ReadWord(Params);
	Params += SIZE_WORD;

	/* Intercept? */
	switch(BiosCall)
	{
	case 0x0:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x00 Getmpb(0x%X)\n",
			  STMemory_ReadLong(Params));
		break;

	case 0x3:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x03 Bconout(%i, 0x%02hhX)\n",
			  STMemory_ReadWord(Params),
			  STMemory_ReadWord(Params)+SIZE_WORD);
		break;

	case 0x4:
		Bios_RWabs(Params);
		break;

	case 0x5:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x05 Setexc(0x%hX, 0x%X)\n",
			  STMemory_ReadWord(Params),
			  STMemory_ReadLong(Params)+SIZE_WORD);
		break;

	case 0x1:
	case 0x2:
	case 0x7:
	case 0x8:
	case 0x9:
	case 0xB:
		/* commands taking a single word */
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x%02hX %s(0x%hX)\n",
			  BiosCall, Bios_Call2Name(BiosCall),
			  STMemory_ReadWord(Params));
		break;

	case 0x6:
	case 0xA:
		/* commands taking no args */
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x%02hX %s()\n",
			  BiosCall, Bios_Call2Name(BiosCall));
		break;

	default:
		Log_Printf(LOG_WARN, "Unknown BIOS call 0x%x!\n", BiosCall);
		break;
	}
	return false;
}
Beispiel #14
0
void SND_InitSoundTrack(char* filename)
{
	char command[256];
	int cmdResult;

	Log_Printf("[SND_InitSoundTrack] start '%s'.\n",filename);

	sprintf(command,format,filename);

	Log_Printf(command);
	Log_Printf("\n");

	cmdResult = mciSendStringA(command, NULL, 0, 0);

	if (cmdResult)
		SND_LogMCI_Error(command,cmdResult);
}
Beispiel #15
0
void enet_slirp_input(Uint8 *pkt, int pkt_len) {
    if (slirp_inited) {
        Log_Printf(LOG_WARN, "[SLIRP] Input packet with %i bytes",enet_tx_buffer.size);
        SDL_LockMutex(slirp_mutex);
        slirp_input(pkt,pkt_len);
        SDL_UnlockMutex(slirp_mutex);
    }
}
Beispiel #16
0
void EN_RX_Mask_Write(void) {
    enet.rx_mask=IoMem[IoAccessCurrentAddress & IO_SEG_MASK];
 	Log_Printf(LOG_EN_REG_LEVEL,"[EN] Receiver masks write at $%08x val=$%02x PC=$%08x\n", IoAccessCurrentAddress, IoMem[IoAccessCurrentAddress & IO_SEG_MASK], m68k_getpc());
    
    if ((enet.rx_status&enet.rx_mask&0x8F)==0) {
        set_interrupt(INT_EN_RX, RELEASE_INT);
    }
}
Beispiel #17
0
void SND_LogMCI_Error(char* commmand,int cmdResult)
{
	wchar_t errorMessage[128];

	mciGetErrorString(cmdResult,errorMessage,sizeof(errorMessage));

	Log_Printf("MCI Error '%ls' reason: '%s'\n",errorMessage,commmand);
}
Beispiel #18
0
void SCR_BindMethods(int rendererType)
{
	if (rendererType == GL_11_RENDERER)
	{
		Log_Printf("[Renderer] Running in mode OpenGL ES 1.1\n");
		initFixedRenderer(&renderer);
	}
	
	if (rendererType == GL_20_RENDERER)
	{
		Log_Printf("[Renderer] Running in mode OpenGL ES 2.0\n"); 
		initProgrRenderer(&renderer);
	}
	
	strcpy(scrFont.path,STATS_FONT_PATH);
	TEX_MakeStaticAvailable(&scrFont);
}
Beispiel #19
0
Datei: zip.c Projekt: engur/PUAE
/**
 * Check an image file in the archive, return the uncompressed length
 */
static long ZIP_CheckImageFile(unzFile uf, char *filename, int namelen, int *pDiskType)
{
	unz_file_info file_info;

	if (unzLocateFile(uf,filename, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error: File \"%s\" not found in the archive!\n", filename);
		return -1;
	}

	if (unzGetCurrentFileInfo(uf, &file_info, filename, namelen, NULL, 0, NULL, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error with zipfile in unzGetCurrentFileInfo\n");
		return -1;
	}

	/* check for a .msa or .st extension */

/*
	if (MSA_FileNameIsMSA(filename, false))
	{
		*pDiskType = ZIP_FILE_MSA;
		return file_info.uncompressed_size;
	}

	if (ST_FileNameIsST(filename, false))
	{
		*pDiskType = ZIP_FILE_ST;
		return file_info.uncompressed_size;
	}

	if (DIM_FileNameIsDIM(filename, false))
	{
		*pDiskType = ZIP_FILE_DIM;
		return file_info.uncompressed_size;
	}

*/
	*pDiskType = -1;
	return file_info.uncompressed_size;

	/*
	Log_Printf(LOG_ERROR, "Not an .ST, .MSA or .DIM file.\n");
	return 0;
	*/
}
Beispiel #20
0
void EN_TX_Mask_Write(void) {
    enet.tx_mask=IoMem[IoAccessCurrentAddress & IO_SEG_MASK];
 	Log_Printf(LOG_EN_REG_LEVEL,"[EN] Transmitter masks write at $%08x val=$%02x PC=$%08x\n", IoAccessCurrentAddress, IoMem[IoAccessCurrentAddress & IO_SEG_MASK], m68k_getpc());
    
    if ((enet.tx_status&enet.tx_mask&0x0F)==0 || (enet.tx_status&enet.tx_mask&0x0F)==TXSTAT_READY) {
        set_interrupt(INT_EN_TX, RELEASE_INT);
    }
}
Beispiel #21
0
void i860_cpu_device::handle_trap(UINT32 savepc) {
    static char buffer[256];
    buffer[0] = 0;
    strcat(buffer, "TRAP");
    if(m_flow & TRAP_NORMAL)        strcat(buffer, " [Normal]");
    if(m_flow & TRAP_IN_DELAY_SLOT) strcat(buffer, " [Delay Slot]");
    if(m_flow & TRAP_WAS_EXTERNAL)  strcat(buffer, " [External]");
    if(!(GET_PSR_IT() || GET_PSR_FT() || GET_PSR_IAT() || GET_PSR_DAT() || GET_PSR_IN()))
        strcat(buffer, " >Reset<");
    else {
        if(GET_PSR_IT())  strcat(buffer, " >Instruction Fault<");
        if(GET_PSR_FT())  strcat(buffer, " >Floating Point Fault<");
        if(GET_PSR_IAT()) strcat(buffer, " >Instruction Access Fault<");
        if(GET_PSR_DAT()) strcat(buffer, " >Data Access Fault<");
        if(GET_PSR_IN())  strcat(buffer, " >Interrupt<");
    }
    
    if(!(m_single_stepping) && !((GET_PSR_IAT() || GET_PSR_DAT() || GET_PSR_IN())))
        debugger('d', buffer);
    
    if(m_dim)
        Log_Printf(LOG_WARN, "[i860] Trap while DIM %s pc=%08X m_flow=%08X", buffer, savepc, m_flow);

    /* If we need to trap, change PC to trap address.
     Also set supervisor mode, copy U and IM to their
     previous versions, clear IM.  */
    if(m_flow & TRAP_WAS_EXTERNAL) {
        if (GET_PC_UPDATED()) {
            m_cregs[CR_FIR] = m_pc;
        } else {
            m_cregs[CR_FIR] = savepc + 4;
        }
    }
    else if (m_flow & TRAP_IN_DELAY_SLOT) {
        m_cregs[CR_FIR] = savepc + 4;
    }
    else
        m_cregs[CR_FIR] = savepc;
    
    m_flow |= FIR_GETS_TRAP;
    SET_PSR_PU (GET_PSR_U ());
    SET_PSR_PIM (GET_PSR_IM ());
    SET_PSR_U (0);
    SET_PSR_IM (0);
    SET_PSR_DIM (0);
    SET_PSR_DS (0);
    
    m_save_flow     = m_flow & DIM_OP;
    m_save_dim      = m_dim;
    m_save_cc       = m_dim_cc;
    m_save_cc_valid = m_dim_cc_valid;
    
    m_dim           = DIM_NONE;
    m_dim_cc        = false;
    m_dim_cc_valid  = false;
    
    m_pc = 0xffffff00;
}
Beispiel #22
0
/*****************************************************************************
 * ContentDir_Search
 *****************************************************************************/
const ContentDir_BrowseResult*
ContentDir_Search (ContentDir* cds, void* result_context, 
		   const char* objectId, const char* criteria)
{
	Log_Printf (LOG_DEBUG, "ContentDir_Search objectId='%s' criteria='%s'",
		    NN(objectId), NN(criteria));
	return BrowseOrSearchWithCache (cds, result_context, 
					objectId, criteria);
}
Beispiel #23
0
/* <9a18e> ../engine/sv_log.c:145 */
void Log_Close(void)
{
	if (g_psvs.log.file)
	{
		Log_Printf("Log file closed\n");
		FS_Close((FileHandle_t)g_psvs.log.file);
	}
	g_psvs.log.file = NULL;
}
Beispiel #24
0
/*****************************************************************************
 * Cache_Create
 *****************************************************************************/
Cache* 
Cache_Create (void* talloc_context, size_t size, time_t max_age,
	      Cache_FreeExpiredData free_expired_data)
{
	if (size < 1) {
		Log_Printf (LOG_ERROR, "Cache: invalid size : %ld\n", 
			    (long) size);
		return NULL; // ---------->
	}
	Cache* cache = talloc (talloc_context, Cache);
	if (cache == NULL)
		return NULL; // ---------->
	*cache = (Cache) { 
		.size    	   = size,
		.max_age 	   = max_age,
		.next_clean	   = 0,
		.free_expired_data = free_expired_data,
		// other data initialized to 0
	};  
#if CACHE_FIXED_SIZE
	cache->table = talloc_array (cache, Entry, size);
	if (cache->table) {
		int i;
		for (i = 0; i < size; i++)
			cache->table[i] = (Entry) { 
				.key  = NULL, 
				.rip  = 0,
				.data = NULL
			};
	}
#else
	cache->table = hash_initialize (size, NULL,
					cache_hasher, cache_comparator,
					NULL);
#endif
	if (cache->table == NULL) {
		Log_Printf (LOG_ERROR, "Cache: can't create table");
		talloc_free (cache);
		return NULL; // ---------->
	}
	
	talloc_set_destructor (cache, cache_destroy);
	return cache;
}
Beispiel #25
0
void MATLIB_PrintCache()
{
	int i;
	mat_bucket_t* curr;
	
	Log_Printf("	--Material cache--\n");
	
	for (i=0; i< SIZE_MAT_HASHTABLE; i++) 
	{
		curr = mat_hashtable[i];
		while (curr != NULL) 
		{
			Log_Printf("	Mat (%d) = '%s' loaded=%d\n",i,curr->material->name,curr->material->textures[TEXTURE_DIFFUSE].memLocation == TEXT_MEM_LOC_VRAM);
			curr=curr->next;
		}
	}
	
	Log_Printf("	--END Material cache END --\n");
}
Beispiel #26
0
/**
 * Since SDL_Delay and friends are very inaccurate on some systems, we have
 * to check if we can rely on this delay function.
 */
static void Main_CheckForAccurateDelays(void)
{
	int nStartTicks, nEndTicks;

	/* Force a task switch now, so we have a longer timeslice afterwards */
	SDL_Delay(10);

	nStartTicks = SDL_GetTicks();
	SDL_Delay(1);
	nEndTicks = SDL_GetTicks();

	/* If the delay took longer than 10ms, we are on an inaccurate system! */
	bAccurateDelays = ((nEndTicks - nStartTicks) < 9);

	if (bAccurateDelays)
		Log_Printf(LOG_WARN, "Host system has accurate delays. (%d)\n", nEndTicks - nStartTicks);
	else
		Log_Printf(LOG_WARN, "Host system does not have accurate delays. (%d)\n", nEndTicks - nStartTicks);
}
Beispiel #27
0
void VertexServer_removePidFile(VertexServer *self)
{
	if (self->pidPath)
	{
		if (unlink(self->pidPath))
		{
			Log_Printf("Error removing pid file\n");
		}
	}
}
Beispiel #28
0
/**
 * Check an image file in the archive, return the uncompressed length
 */
static long ZIP_CheckImageFile(unzFile uf, char *filename, int namelen, int *pDiskType)
{
	unz_file_info file_info;

	if (unzLocateFile(uf,filename, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error: File \"%s\" not found in the archive!\n", filename);
		return -1;
	}

	if (unzGetCurrentFileInfo(uf, &file_info, filename, namelen, NULL, 0, NULL, 0) != UNZ_OK)
	{
		Log_Printf(LOG_ERROR, "Error with zipfile in unzGetCurrentFileInfo\n");
		return -1;
	}

	Log_Printf(LOG_ERROR, "Not an .ST, .MSA or .DIM file.\n");
	return 0;
}
Beispiel #29
0
void Host_ShutdownServer( void )
{
	if( !SV_Active()) return;
	Q_strncpy( host.finalmsg, "Server was killed", MAX_STRING );

	Log_Printf( "Server shutdown\n" );
	Log_Close();

	SV_Shutdown( false );
}
Beispiel #30
0
void dEngine_Init(void) 
{
	FS_InitFilesystem();
    Log_Printf("dEngine Initialization...\n");
    
	ENT_InitCacheSystem();
	TEXT_InitCacheSystem();
	MAT_InitCacheSystem();

#ifdef GENERATE_VIDEO	
	dEngine_INIT_ScreenshotBuffer();
#endif
	
	engine.sceneId = -1;
	dEngine_RequireSceneId(0);
	
	//engine.recordVideo = 0;
	
	engine.musicFilename[0] = '\0';
	engine.musicStartAt = 0;
	engine.playback.filename[0] = '\0';
	
	// Enable/disable sounds here
	engine.soundEnabled = 0;
	engine.musicEnabled = 0;

	engine.gameCenterEnabled = 0;
	
	ENPAR_Init();
	
	

	dEngine_ReadConfig();

	SCR_Init();
	
	
	
	
	MATLIB_LoadLibraries();
	

	
	COLL_InitUnitCube();
	
	
	ENE_Mem_Init();
	
	//SND_Init();
	
	
	MENU_Init();
	
	
}