2022-01-26 04:37 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002723FSSCPmodelspublic2012-11-12 01:32
ReporterFUBAR-BDHR 
Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target Version3.6.16Fixed in Version 
Summary0002723: Ship lab crashes for any ship with show secondaries
DescriptionAny model I try to load with show secondaries enabled crashes. Looks like this was broke in revision 9232. Looking at the code even if the load would have worked 2 lines down it tries to use the primary model instead of the secondary as well.
Steps To ReproduceGo into the ship lab, select any ship that has show secondaries enabled and try to view it.
Additional InformationStack:

     fs2_open_3_6_15d_INF_SSE2.exe!debug_int3(char * file, int line) Line 768 C++
     fs2_open_3_6_15d_INF_SSE2.exe!WinAssert(char * text, char * filename, int linenum) Line 963 + 0x13 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!cfopen(char * file_path, char * mode, int type, int dir_type, bool localize) Line 652 + 0x2e bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!read_model_file(polymodel * pm, char * filename, int n_subsystems, model_subsystem * subsystems, int ferror) Line 964 + 0x14 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!model_load(char * filename, int n_subsystems, model_subsystem * subsystems, int ferror, int duplicate) Line 2466 + 0x19 bytes C++
> fs2_open_3_6_15d_INF_SSE2.exe!labviewer_change_model(char * model_fname, int lod, int sel_index) Line 287 + 0x27 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!labviewer_change_ship_lod(Tree * caller) Line 2014 + 0x29 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!Tree::DoMouseUp(float frametime) Line 1880 + 0x14 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!GUIObject::OnFrame(float frametime, int * unused_queue) Line 927 + 0x1a bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!GUIObject::OnFrame(float frametime, int * unused_queue) Line 904 C++
     fs2_open_3_6_15d_INF_SSE2.exe!GUIScreen::OnFrame(float frametime, bool doevents) Line 513 C++
     fs2_open_3_6_15d_INF_SSE2.exe!GUISystem::OnFrame(float frametime, bool doevents, bool clearandflip) Line 664 + 0x18 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!lab_do_frame(float frametime) Line 2276 + 0x25 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!game_do_state(int state) Line 6737 + 0x13 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!gameseq_process_events() Line 407 + 0x14 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!game_main(char * cmdline) Line 7086 + 0x5 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrev, char * szCmdLine, int nCmdShow) Line 7155 + 0x9 bytes C++
     fs2_open_3_6_15d_INF_SSE2.exe!__tmainCRTStartup() Line 275 + 0x2c bytes C
     fs2_open_3_6_15d_INF_SSE2.exe!WinMainCRTStartup() Line 189 C
     kernel32.dll!75f9339a()
     [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
     ntdll.dll!77a09ef2()
     ntdll.dll!77a09ec5()
TagsNo tags attached.
Attached Files
  • rar file icon fs2_open.rar (78,282 bytes) 2012-11-03 16:58
  • patch file icon labweapons_fix.patch (3,739 bytes) 2012-11-03 20:49 -
    Index: code/lab/lab.cpp
    ===================================================================
    --- code/lab/lab.cpp	(revision 9304)
    +++ code/lab/lab.cpp	(working copy)
    @@ -270,11 +270,15 @@
     				sip = &Ship_info[Lab_selected_index];
     				l = 0;
     				for (j = 0; j < sip->num_primary_banks; j++) {
    +					weapon_info *wip = &Weapon_info[sip->primary_bank_weapons[j]];
     					if (!sip->draw_primary_models[j])
     						continue;
    -					Lab_weaponmodel_num[l] = model_load(Weapon_info[sip->primary_bank_weapons[j]].external_model_name, 0, NULL, 0);
    +					Lab_weaponmodel_num[l] = -1;
    +					if ( strlen(wip->external_model_name) ){
    +						Lab_weaponmodel_num[l] = model_load(wip->external_model_name, 0, NULL);
    +					}
     					if (Lab_weaponmodel_num[l] >= 0) {
    -						strcpy_s(Lab_weaponmodel_filename[l], Weapon_info[sip->primary_bank_weapons[j]].external_model_name);
    +						strcpy_s(Lab_weaponmodel_filename[l], wip->external_model_name);
     					} else {
     						memset( Lab_weaponmodel_filename[l], 0, sizeof(Lab_weaponmodel_filename[l]) );
     					}
    @@ -282,11 +286,15 @@
     				}
     			
     				for (j = 0; j < sip->num_secondary_banks; j++) {
    +					weapon_info *wip = &Weapon_info[sip->secondary_bank_weapons[j]];
     					if (!sip->draw_secondary_models[j])
     						continue;
    -					Lab_weaponmodel_num[l] = model_load(Weapon_info[sip->secondary_bank_weapons[j]].external_model_name, 0, NULL, 0);
    +					Lab_weaponmodel_num[l] = -1;
    +					if ( strlen(wip->external_model_name) ){
    +						Lab_weaponmodel_num[l] = model_load(wip->external_model_name, 0, NULL);
    +					}
     					if (Lab_weaponmodel_num[l] >= 0) {
    -						strcpy_s(Lab_weaponmodel_filename[l], Weapon_info[sip->primary_bank_weapons[j]].external_model_name);
    +						strcpy_s(Lab_weaponmodel_filename[l], wip->external_model_name);
     					} else {
     						memset( Lab_weaponmodel_filename[l], 0, sizeof(Lab_weaponmodel_filename[l]) );
     					}
    @@ -877,9 +885,11 @@
     			for (j = 0; j < sip->num_primary_banks; j++) {
     				if (!sip->draw_primary_models[j])
     					continue;
    -				w_bank *bank = &model_get(Lab_model_num)->gun_banks[j];
    -				for(k = 0; k < bank->num_slots; k++) {	
    -					model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k], render_flags);
    +				if (Lab_weaponmodel_num[l] >= 0) {
    +					w_bank *bank = &model_get(Lab_model_num)->gun_banks[j];
    +					for(k = 0; k < bank->num_slots; k++) {	
    +						model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k], render_flags);
    +					}
     				}
     				l++;
     			}
    @@ -890,17 +900,19 @@
     			for (j = 0; j < sip->num_secondary_banks; j++) {
     				if (!sip->draw_secondary_models[j])
     					continue;
    -				bank = &(model_get(Lab_model_num))->missile_banks[j];
    -				if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
    -					for(k = 0; k < bank->num_slots; k++) {
    -						model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k], render_flags);
    +				if (Lab_weaponmodel_num[l] >= 0) {
    +					bank = &(model_get(Lab_model_num))->missile_banks[j];
    +					if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
    +						for(k = 0; k < bank->num_slots; k++) {
    +							model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k], render_flags);
    +						}
    +					} else {
    +						for(k = 0; k < bank->num_slots; k++)
    +						{
    +							secondary_weapon_pos = bank->pnt[k];
    +							model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &secondary_weapon_pos, render_flags);
    +						}
     					}
    -				} else {
    -					for(k = 0; k < bank->num_slots; k++)
    -					{
    -						secondary_weapon_pos = bank->pnt[k];
    -						model_render(Lab_weaponmodel_num[l], &vmd_identity_matrix, &secondary_weapon_pos, render_flags);
    -					}
     				}
     				l++;
     			}
    
    patch file icon labweapons_fix.patch (3,739 bytes) 2012-11-03 20:49 +

-Relationships
+Relationships

-Notes

~0014013

Admiral MS (developer)

Made a patch that should fix the crash.
I originally thought that ships having show external weapons enabled always requires the weapons to have external models...

~0014036

Goober5000 (administrator)

Patch committed in r9342.
+Notes

-Issue History
Date Modified Username Field Change
2012-11-03 16:58 FUBAR-BDHR New Issue
2012-11-03 16:58 FUBAR-BDHR File Added: fs2_open.rar
2012-11-03 20:49 Admiral MS File Added: labweapons_fix.patch
2012-11-03 20:53 Admiral MS Note Added: 0014013
2012-11-05 13:52 Goober5000 Target Version => 3.6.16
2012-11-12 01:32 Goober5000 Note Added: 0014036
2012-11-12 01:32 Goober5000 Status new => resolved
2012-11-12 01:32 Goober5000 Resolution open => fixed
+Issue History