Пример #1
0
bool Windows::LoadProfile()
{
#ifdef WIN32
	char szPath[MAX_PATH];
	ALLEGRO_PATH* alPath;
	bool res;

	if( al_filename_exists( "c4a-prof" ) )
		return ParseProfileFile( "c4a-prof" );

	if( SHGetFolderPathA( 0, CSIDL_PERSONAL, 0, 0, (char*)&szPath ) == S_OK )
	{
		alPath = al_create_path( (char*)&szPath );
		al_append_path_component( alPath, "c4a-prof" );

		if( al_filename_exists( al_path_cstr( alPath, '/' ) ) )
			res = ParseProfileFile( (char*)al_path_cstr( alPath, '/' ) );

		al_destroy_path( alPath );
		return res;
	}
	return false;

#else
	return false;
#endif
}
Пример #2
0
char* GetDataFilePath(char* filename) {

	char *result = 0;

	if (al_filename_exists(filename)) {
		return strdup(filename);
	}

	char origfn[255] = "data/";
	strcat(origfn, filename);

	if (al_filename_exists(origfn)) {
		return strdup(origfn);
	}

	void TestPath(char* subpath) {
		ALLEGRO_PATH *tail = al_create_path(filename);
		ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
		ALLEGRO_PATH *data = al_create_path(subpath);
		al_join_paths(path, data);
		al_join_paths(path, tail);
		//printf("Testing for %s\n", al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP));
		if (al_filename_exists(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP))) {
			result = strdup(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP));
		}
		al_destroy_path(tail);
		al_destroy_path(data);
		al_destroy_path(path);
	}
Пример #3
0
static void next_screenshot(SCREENSHOT * ss)
{
   char buf[64];

   ss->counter++;
   if (ss->counter >= 10000) {
      ss->counter = 0;
      return;
   }

   snprintf(buf, sizeof(buf), "%s%04d.%s", ss->name, ss->counter, ss->ext);
   if (al_filename_exists(buf)) {
      next_screenshot(ss);
   }
}
Пример #4
0
char * pp2_find_music(char * fn)
{
	int i;
	
	strcpy(pp2_music_fncopy, fn);
	for(i = 0; i < pp2_music_types; i++)
	{
		pp2_replace_extension(pp2_music_fncopy, pp2_music_type[i]);
//		printf("music - %s\n", pp2_music_fncopy);
		if(al_filename_exists(pp2_music_fncopy))
		{
			return pp2_music_fncopy;
		}
	}
	return NULL;
}
Пример #5
0
void BannerBox::Render( bool Selected )
{
  ALLEGRO_COLOR backColour;
  ALLEGRO_COLOR textColour;
  ALLEGRO_COLOR selectorColour;

  if( CurrentPosition->Y > Tab::CanvasHeight )
  {
    return;
  }

  if( Framework::SystemFramework->Settings->GetQuickBooleanValue( "Application.BrightTheme" ) )
  {
    backColour = al_map_rgb( 255,255, 255 );
    textColour = al_map_rgb( 0, 0, 0 );
    selectorColour = al_map_rgb( 192, 192, 192 );
  } else {
    backColour = al_map_rgb( 0, 0, 0 );
    textColour = al_map_rgb( 255, 255, 255 );
    selectorColour = al_map_rgb( 128, 128, 128 );
  }

  al_set_target_bitmap( boxImage );

  al_clear_to_color( (Selected ? selectorColour : backColour) );

  std::string* imgFile = gameData->GetQuickStringValue( "BannerImage" );
  if( !al_filename_exists( imgFile->c_str() ) )
  {
    imgFile->clear();
    imgFile->append( "resource/missing.png" );
  }
  ALLEGRO_BITMAP* bannerImg = Framework::SystemFramework->GetImageManager()->GetImage( *imgFile );
  if( bannerImg == 0 )
  {
    bannerImg = Framework::SystemFramework->GetImageManager()->GetImage( "resource/missing.png" );
  }
  al_draw_bitmap( bannerImg, 0, 0, 0 );

  al_draw_rectangle( 0, 0, boxSize->X, boxSize->Y, textColour, 5 );

  Framework::SystemFramework->RestoreDisplayTarget();
  al_draw_bitmap( boxImage, CurrentPosition->X, CurrentPosition->Y, 0 );

}
Пример #6
0
void        BMemory_Save (void)
{
    FILE *  f;

    BMemory_Verify_Usage();
    switch (g_machine.mapper)
    {
    case MAPPER_Standard:       if (sms.SRAM_Pages == 0) return; break;
    case MAPPER_93c46:          break;
    default:                    return;
    }
    if (!al_filename_exists(g_env.Paths.SavegameDirectory))
        al_make_directory(g_env.Paths.SavegameDirectory);
    f = fopen(g_env.Paths.BatteryBackedMemoryFile, "wb");
    switch (g_machine.mapper)
    {
    case MAPPER_Standard:       BMemory_SRAM_Save (f); break;
    case MAPPER_93c46:          BMemory_93c46_Save (f); break;
    }
    if (f)
        fclose (f);
}
Пример #7
0
/* Function: al_is_path_present
 */
bool al_is_path_present(const ALLEGRO_PATH *path)
{
   ALLEGRO_USTR *ustr;
   bool rc;
   ASSERT(path);

   ustr = al_ustr_new("");
   path_to_ustr(path, ALLEGRO_NATIVE_PATH_SEP, ustr);

   /* Windows' stat() doesn't like the slash at the end of the path when
    * the path is pointing to a directory. There are other places which
    * might require the same fix.
    */
#ifdef ALLEGRO_WINDOWS
   if (al_ustr_has_suffix_cstr(ustr, "\\")) {
      al_ustr_truncate(ustr, al_ustr_size(ustr) - 1);
   }
#endif

   rc = al_filename_exists(al_cstr(ustr));
   al_ustr_free(ustr);

   return rc;
}
Пример #8
0
static bool t3f_is_path_present(ALLEGRO_PATH * pp)
{
	return al_filename_exists(al_path_cstr(pp, '/'));
}
Пример #9
0
static int allua_filename_exists(lua_State * L)
{
   const char *path = luaL_checkstring(L, 1);
   lua_pushboolean(L, al_filename_exists(path));
   return 1;
}