Exemple #1
0
void TB_SaveSelect::SetVisible(bool enable, bool saving)
{
	fVisible = enable;
	if (!enable) return;
    game.showmapnametime = 0;

    fCoords.w = 244;
    fCoords.h = 152;

#ifdef _480X272 // 480x272 widescreen fix
    fCoords.x = (SCREEN_WIDTH / 2) - (fCoords.w / 2);
    fCoords.y = 30;
#else
    fCoords.x = 38;
    fCoords.y = 8;
#endif

	fNumFiles = MAX_SAVE_SLOTS;
	fSaving = saving;
	
	fCurSel = settings->last_save_slot;
	fPicXOffset = -24;
	
	// load all profiles
	memset(fHaveProfile, 0, sizeof(fHaveProfile));
	for(int i=0;i<fNumFiles;i++)
	{
		if (!profile_load(GetProfileName(i), &fProfiles[i]))
			fHaveProfile[i] = true;
	}
	
	textbox.ClearText();
}
Exemple #2
0
ezResult ezShaderCompilerHLSL::Compile(ezShaderProgramData& inout_Data, ezLogInterface* pLog)
{
  for (ezUInt32 stage = 0; stage < ezGALShaderStage::ENUM_COUNT; ++stage)
  {
    // shader already compiled
    if (!inout_Data.m_StageBinary[stage].GetByteCode().IsEmpty())
    {
      ezLog::Debug("Shader for stage '{0}' is already compiled.", ezGALShaderStage::Names[stage]);
      continue;
    }

    const char* szShaderSource = inout_Data.m_szShaderSource[stage];
    const ezUInt32 uiLength = ezStringUtils::GetStringElementCount(szShaderSource);

    if (uiLength > 0 && ezStringUtils::FindSubString(szShaderSource, "main") != nullptr)
    {
      if (CompileDXShader(inout_Data.m_szSourceFile, szShaderSource, inout_Data.m_Flags.IsSet(ezShaderCompilerFlags::Debug),
            GetProfileName(inout_Data.m_szPlatform, (ezGALShaderStage::Enum)stage), "main", inout_Data.m_StageBinary[stage].GetByteCode())
            .Succeeded())
      {
        ReflectShaderStage(inout_Data, (ezGALShaderStage::Enum)stage);
      }
      else
      {
        return EZ_FAILURE;
      }
    }
  }

  return EZ_SUCCESS;
}
Exemple #3
0
void ProfileBox::OnProfileDelete() {
	QString name = GetProfileName();
	if(name.isEmpty())
		return;
	QString filename = GetApplicationUserDir(m_type) + "/" + name + ".conf";
	if(MessageBox(QMessageBox::Warning, this, MainWindow::WINDOW_CAPTION, tr("Are you sure that you want to delete this profile?"), BUTTON_YES | BUTTON_NO, BUTTON_YES) == BUTTON_YES) {
		QFile(filename).remove();
		LoadProfiles();
		UpdateProfileFields();
	}
}
Exemple #4
0
static int CreateMainMenuItems(WPARAM, LPARAM)
{
    char servicename[128];
    int i, count;

    CMenuItem mi;
    mi.position = 2000100000;
    mi.flags = CMIF_TCHAR;
    mcount = 0;
    count = GetProfileCount(0, 0);
    for (i = 0; i < count; i++) {
        TCHAR profilename[128];
        if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename))
            continue;

        if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1))
            mi.root = Menu_CreateRoot(MO_STATUS, LPGENT("Status profiles"), 2000100000);

        mi.name.t = profilename;
        mi.position = 2000100000 + mcount;
        mir_snprintf(servicename, _countof(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
        switch(mcount) {
        case 0:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService0);
            break;
        case 1:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService1);
            break;
        case 2:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService2);
            break;
        case 3:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService3);
            break;
        case 4:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService4);
            break;
        case 5:
            hProfileServices[mcount] = CreateServiceFunction(servicename, profileService5);
            break;
        default:
            MessageBox(NULL, TranslateT("There is a maximum of 6 menu items"), TranslateT("StartupStatus"), MB_OK);
            return 0;
        }
        mi.pszService = servicename;
        if (Menu_AddStatusMenuItem(&mi)) {
            menuprofiles[mcount] = i;
            mcount += 1;
        }
    }

    return 0;
}
Exemple #5
0
void ProfileBox::OnProfileSave() {
	QString name = GetProfileName();
	if(name.isEmpty())
		return;
	QString filename = GetApplicationUserDir(m_type) + "/" + name + ".conf";
	if(MessageBox(QMessageBox::Warning, this, MainWindow::WINDOW_CAPTION, tr("Are you sure that you want to overwrite this profile?"), BUTTON_YES | BUTTON_NO, BUTTON_YES) == BUTTON_YES) {
		{
			QSettings settings(filename, QSettings::IniFormat);
			m_save_callback(&settings, m_userdata);
		}
		LoadProfiles();
		SetProfile(FindProfile(name));
		UpdateProfileFields();
	}
}
void CAudioEncoder::DoStopAudio()
{
  // flush remaining output from audio encoder
  // and forward it to sinks
  
  EncodeSamples(NULL, 0, m_audioSrcChannels);

  ForwardEncodedAudioFrames();

  StopEncoder();

  CHECK_AND_FREE(m_audioPreEncodingBuffer);
  debug_message("Audio profile %s stats", GetProfileName());
  debug_message(" encoded samples: "U64, m_audioDstSampleNumber);
  debug_message(" encoded frames: %u", m_audioDstFrameNumber);
}
Exemple #7
0
void ProfileBox::OnProfileChange() {
	UpdateProfileFields();
	QString name = GetProfileName();
	if(name.isEmpty())
		return;
	QString filename = GetApplicationUserDir(m_type) + "/" + name + ".conf";
	if(QFileInfo(filename).exists()) {
		QSettings settings(filename, QSettings::IniFormat);
		m_load_callback(&settings, m_userdata);
		return;
	}
	filename = GetApplicationSystemDir(m_type) + "/" + name + ".conf";
	if(QFileInfo(filename).exists()) {
		QSettings settings(filename, QSettings::IniFormat);
		m_load_callback(&settings, m_userdata);
		return;
	}
	Logger::LogError("[ProfileBox::OnProfileChange] " + tr("Error: Can't load profile!"));
}
Exemple #8
0
/*----------------------------------------------------------------------
|   AP4_AvccAtom::InspectFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_AvccAtom::InspectFields(AP4_AtomInspector& inspector)
{
    inspector.AddField("Configuration Version", m_ConfigurationVersion);
    const char* profile_name = GetProfileName(m_Profile);
    if (profile_name) {
        inspector.AddField("Profile", profile_name);
    } else {
        inspector.AddField("Profile", m_Profile);
    }
    inspector.AddField("Profile Compatibility", m_ProfileCompatibility, AP4_AtomInspector::HINT_HEX);
    inspector.AddField("Level", m_Level);
    inspector.AddField("NALU Length Size", m_NaluLengthSize);
    for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
        inspector.AddField("Sequence Parameter", m_SequenceParameters[i].GetData(), m_SequenceParameters[i].GetDataSize());
    }
    for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
        inspector.AddField("Picture Parameter", m_PictureParameters[i].GetData(), m_PictureParameters[i].GetDataSize());
    }
    return AP4_SUCCESS;
}
bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
		const char *init_text)
{
	std::string newName;
	std::string newDir;
	ConfigFile config;

	if (!GetProfileName(this, newName, newDir, title, text, init_text))
		return false;

	std::string curDir = config_get_string(App()->GlobalConfig(),
			"Basic", "ProfileDir");

	char newPath[512];
	int ret = GetConfigPath(newPath, 512, "obs-studio/basic/profiles/");
	if (ret <= 0) {
		blog(LOG_WARNING, "Failed to get profiles config path");
		return false;
	}

	strcat(newPath, newDir.c_str());

	if (os_mkdir(newPath) < 0) {
		blog(LOG_WARNING, "Failed to create profile directory '%s'",
				newDir.c_str());
		return false;
	}

	if (!create_new)
		CopyProfile(curDir.c_str(), newPath);

	strcat(newPath, "/basic.ini");

	if (config.Open(newPath, CONFIG_OPEN_ALWAYS) != 0) {
		blog(LOG_ERROR, "Failed to open new config file '%s'",
				newDir.c_str());
		return false;
	}

	config_set_string(App()->GlobalConfig(), "Basic", "Profile",
			newName.c_str());
	config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
			newDir.c_str());

	config_set_string(config, "General", "Name", newName.c_str());
	config.SaveSafe("tmp");
	config.Swap(basicConfig);
	InitBasicConfigDefaults();
	RefreshProfiles();

	if (create_new)
		ResetProfileData();

	blog(LOG_INFO, "Created profile '%s' (%s, %s)", newName.c_str(),
			create_new ? "clean" : "duplicate", newDir.c_str());
	blog(LOG_INFO, "------------------------------------------------");

	config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
	UpdateTitleBar();
	return true;
}
Exemple #10
0
int main(int argc, char *argv[])
{
bool inhibit_loadfade = false;
bool error = false;
bool freshstart;
	
	SetLogFilename("debug.txt");
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
	{
		staterr("ack, sdl_init failed: %s.", SDL_GetError());
		return 1;
	}
	atexit(SDL_Quit);
	
	// start up inputs first thing because settings_load may remap them
	input_init();
	
	// load settings, or at least get the defaults,
	// so we know the initial screen resolution.
	settings_load();
	
	if (Graphics::init(settings->resolution)) { staterr("Failed to initialize graphics."); return 1; }
	if (font_init()) { staterr("Failed to load font."); return 1; }
	
	//speed_test();
	//return 1;
	
	#ifdef CONFIG_DATA_EXTRACTOR
	if (!settings->files_extracted)
	{
		if (extract_main())
		{
			Graphics::close();
			font_close();
			return 0;
		}
		else
		{
			settings->files_extracted = true;
			settings_save();
		}
	}
	#endif
	
	if (check_data_exists())
	{
		return 1;
	}
	
	Graphics::ShowLoadingScreen();
	if (sound_init()) { fatal("Failed to initialize sound."); return 1; }
	if (trig_init()) { fatal("Failed trig module init."); return 1; }
	
	if (tsc_init()) { fatal("Failed to initialize script engine."); return 1; }
	if (textbox.Init()) { fatal("Failed to initialize textboxes."); return 1; }
	if (Carets::init()) { fatal("Failed to initialize carets."); return 1; }
	
	if (game.init()) return 1;
	game.setmode(GM_NORMAL);
	// set null stage just to have something to do while we go to intro
	game.switchstage.mapno = 0;
	
	//#define REPLAY
	#ifdef REPLAY
		game.switchstage.mapno = START_REPLAY;
		//Replay::set_ffwd(6000);
		//Replay::set_stopat(3500);
		game.switchstage.param = 1;
	#else
		//game.switchstage.mapno = LOAD_GAME;
		//game.pause(GP_OPTIONS);
		
		if (settings->skip_intro && file_exists(GetProfileName(settings->last_save_slot)))
			game.switchstage.mapno = LOAD_GAME;
		else
			game.setmode(GM_INTRO);
	#endif
	
	// for debug
	if (game.paused) { game.switchstage.mapno = 0; game.switchstage.eventonentry = 0; }
	if (game.switchstage.mapno == LOAD_GAME) inhibit_loadfade = true;
	
	game.running = true;
	freshstart = true;
	
	stat("Entering main loop...");
	#ifdef __SDLSHIM__
		set_console_visible(false);
	#endif
	
	//speed_test();
	//return 1;
	
	while(game.running)
	{
		// SSS/SPS persists across stage transitions until explicitly
		// stopped, or you die & reload. It seems a bit risky to me,
		// but that's the spec.
		if (game.switchstage.mapno >= MAPNO_SPECIALS)
		{
			StopLoopSounds();
		}
		
		// enter next stage, whatever it may be
		if (game.switchstage.mapno == LOAD_GAME || \
			game.switchstage.mapno == LOAD_GAME_FROM_MENU)
		{
			if (game.switchstage.mapno == LOAD_GAME_FROM_MENU)
				freshstart = true;
			
			stat("= Loading game =");
			if (game_load(settings->last_save_slot))
			{
				fatal("savefile error");
				goto ingame_error;
			}
			
			Replay::OnGameStarting();
			
			if (!inhibit_loadfade) fade.Start(FADE_IN, FADE_CENTER);
			else inhibit_loadfade = false;
		}
		else if (game.switchstage.mapno == START_REPLAY)
		{
			stat(">> beginning replay '%s'", GetReplayName(game.switchstage.param));
			
			StopScripts();
			if (Replay::begin_playback(GetReplayName(game.switchstage.param)))
			{
				fatal("error starting playback");
				goto ingame_error;
			}
		}
		else
		{
			if (game.switchstage.mapno == NEW_GAME || \
				game.switchstage.mapno == NEW_GAME_FROM_MENU)
			{
				bool show_intro = (game.switchstage.mapno == NEW_GAME_FROM_MENU);
				InitNewGame(show_intro);
			}
			
			// slide weapon bar on first intro to Start Point
			if (game.switchstage.mapno == STAGE_START_POINT && \
				game.switchstage.eventonentry == 91)
			{
				freshstart = true;
			}
			
			// switch maps
			if (load_stage(game.switchstage.mapno)) goto ingame_error;
			
			player->x = (game.switchstage.playerx * TILE_W) << CSF;
			player->y = (game.switchstage.playery * TILE_H) << CSF;
		}
		
		// start the level
		if (game.initlevel()) return 1;
		
		if (freshstart)
			weapon_introslide();
		
		gameloop();
		game.stageboss.OnMapExit();
		freshstart = false;
	}
	
shutdown: ;
	Replay::close();
	game.close();
	Carets::close();
	
	Graphics::close();
	input_close();
	font_close();
	sound_close();
	tsc_close();
	textbox.Deinit();
	return error;
	
ingame_error: ;
	stat("");
	stat(" ************************************************");
	stat(" * An in-game error occurred. Game shutting down.");
	stat(" ************************************************");
	error = true;
	goto shutdown;
}
Exemple #11
0
// returns whether the given save file slot exists
bool ProfileExists(int num)
{
	return vmfile_exists(GetProfileName(num));
}
    //
    // Constructor
    //
    CCgShader::CCgShader( 
                         CGenum SourceType, const string& SourceStr, CGprofile Profile, CGGLenum ProfileClass,
                         const string& Entry, const string& Arguments
                         ):
        m_Program( NULL )
    {
        if (SourceType != CG_SOURCE && SourceType != CG_OBJECT)
            throw Sys::CDeveloperException( "GL::CCgShader", "::CCgShader() : Invalid <SourceType> parameter." );
        if (SourceStr.length() == 0)
            throw Sys::CDeveloperException( "GL::CCgShader", "::CCgShader() : Invalid <SourceStr> parameter." );

        CCgContext::AddRef();

        if (Profile == CG_PROFILE_UNKNOWN)
            Profile = cgGLGetLatestProfile( ProfileClass );
        else 
        {
            CheckDomain( Profile, ProfileClass );
            if (cgGLIsProfileSupported( Profile ) == CG_FALSE)
            {
                const char *ProfileName = GetProfileName( Profile );
                if (!ProfileName)
                    throw Sys::CException( 0, "GL::CCgShader", "::CCgShader() : Unknown shader profile." );
                else
                {
                    throw Sys::CException( 0, "GL::CCgShader", "::CCgShader() : Profile %s unsupported.\n"
                        "A profile may not be supported if required OpenGL extension is not available.", ProfileName );
                }
            }
        }

        try
        {
            const char *TypeName = NULL;
            switch (ProfileClass)
            {
            case CG_GL_VERTEX:
                TypeName = "vertex";
                break;
            case CG_GL_GEOMETRY:
                TypeName = "geometry";
                break;
            case CG_GL_FRAGMENT:
                TypeName = "fragment";
                break;
            }

            const char *Args[ 2 ] =
            {
                Arguments.c_str(),
                NULL
            };
            
            m_Program = cgCreateProgram( CCgContext::GetContext(), SourceType, SourceStr.c_str(), Profile, 
                (Entry.length() == 0) ? NULL : Entry.c_str(), (Arguments.length() == 0) ? NULL : Args );
            if (!m_Program)
            {
                m_LastListing = CCgContext::GetLastListing();
    #ifdef _DEBUG
                OutputDebugLog();
    #endif
                throw CCgException( "GL::CCgShader", cgGetError(), "::CCgShader() : Failed to create Cg %s shader.\nSee program log for more details.", TypeName );
            }

            cgCompileProgram( m_Program );
            CGerror Error = cgGetError();
            if (Error != CG_NO_ERROR)
            {
                m_LastListing = CCgContext::GetLastListing();
    #ifdef _DEBUG
                OutputDebugLog();
    #endif
                throw CCgException( "GL::CCgShader", Error, "::CCgShader() : Failed to compile Cg %s shader.\nSee program log for more details.", TypeName );
            }
        }
        catch (const Sys::CException& Ex)
        {
            if (cgIsProgram( m_Program ))
                cgDestroyProgram( m_Program );

            CCgContext::Release();

            throw Ex;
        }
    }
    //
    // CheckDomain
    //
    void CCgShader::CheckDomain( 
                                CGprofile Profile, CGGLenum ProfileClass 
                                ) const
    {
        CGdomain ProfileDomain = cgGetProfileDomain( Profile );
        bool Valid = true;

        switch (ProfileClass)
        {
        case CG_GL_VERTEX:
            if (ProfileDomain != CG_VERTEX_DOMAIN)
                Valid = false;
            break;
        case CG_GL_GEOMETRY:
            if (ProfileDomain != CG_GEOMETRY_DOMAIN)
                Valid = false;
            break;
        case CG_GL_FRAGMENT:
            if (ProfileDomain != CG_FRAGMENT_DOMAIN)
                Valid = false;
            break;
        }

        if (!Valid)
            throw Sys::CDeveloperException( "GL::CCgShader", "::CheckDomain() : Invalid profile: %s.", GetProfileName( Profile ) );
    }
Exemple #14
0
void pre_main(void)
{
#ifdef DEBUG_LOG
char debug_fname[1024];
retro_create_path_string(debug_fname, sizeof(debug_fname), g_dir, "debug.txt");
SetLogFilename(debug_fname);
#endif
	// start up inputs first thing because settings_load may remap them
	input_init();
	
	// load settings, or at least get the defaults,
	// so we know the initial screen resolution.
	settings_load();

   char filename[1024];
	FILE *fp;

	NX_LOG("= Extracting Files =\n");

	retro_create_path_string(filename, sizeof(filename), g_dir, "Doukutsu.exe");
	fp = fopen(filename, "rb");

   extract_files(fp);

	if (sound_init()) { fatal("Failed to initialize sound."); error = 1; return; }
   
	extract_stages(fp);

	fclose(fp);
	
   settings->files_extracted = true;
   settings_save();
	
	if (Graphics::init(settings->resolution)) { NX_ERR("Failed to initialize graphics.\n"); error = 1; return; }
	if (font_init()) { NX_ERR("Failed to load font.\n"); error = 1; return; }
	
	//return;
	
	if (check_data_exists())
	{
		error = 1;
		return;
	}
	
	//Graphics::ShowLoadingScreen();
	if (trig_init()) { fatal("Failed trig module init."); error = 1; return; }
	
	if (tsc_init()) { fatal("Failed to initialize script engine."); error = 1; return; }
	if (textbox.Init()) { fatal("Failed to initialize textboxes."); error = 1; return; }
	if (Carets::init()) { fatal("Failed to initialize carets."); error = 1; return; }
	
	if (game.init())
	{
		error = 1;
		return;
	}
	game.setmode(GM_NORMAL);
	// set null stage just to have something to do while we go to intro
	game.switchstage.mapno = 0;
	
	//#define REPLAY
	#ifdef REPLAY
		game.switchstage.mapno = START_REPLAY;
		//Replay::set_ffwd(6000);
		//Replay::set_stopat(3500);
		game.switchstage.param = 1;
	#else
		//game.switchstage.mapno = LOAD_GAME;
		//game.pause(GP_OPTIONS);
		
		if (settings->skip_intro && file_exists(GetProfileName(settings->last_save_slot)))
			game.switchstage.mapno = LOAD_GAME;
		else
			game.setmode(GM_INTRO);
	#endif
	
	// for debug
	if (game.paused) { game.switchstage.mapno = 0; game.switchstage.eventonentry = 0; }
	if (game.switchstage.mapno == LOAD_GAME) inhibit_loadfade = true;
	
	game.running = true;
	freshstart = true;
	
	NX_LOG("Entering main loop...\n");
	
	//return;
}