swbf-unmunge v1.1.1

Releasing the source files for your mod or map? Post em' here. (Applies to both SWBF1 & SWBF2)

Moderator: Moderators

User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: swbf-unmunge v1.1.0

Post by Anakin »

uf_print is not defined for me.
Hidden/Spoiler:
[code]
print("fullHD_insert: trying to take control of NewButtonWindow()..")
if NewButtonWindow and not fullHD_NewButtonWindow then
print(" : success")

-- backup old function
print(" : backup old function")
fullHD_NewButtonWindow = NewButtonWindow

-- some variables
local screenW, screenH = ScriptCB_GetScreenInfo()

-- redefine NewButtonWindow
print(" : redefine NewButtonWindow()")
NewButtonWindow = function(...)
local temp = arg[1]

-- fix the size and position for the boxes for instant action and muliplayer
if temp.titleText == "ifs.controls.General.map" or temp.titleText == "ifs.missionselect.selectmode" or temp.titleText == "ifs.missionselect.selectera" or temp.titleText == "ifs.missionselect.playlist" then
temp.x = screenW * temp.x/800
temp.y = screenH * temp.y/600
temp.width = screenW * temp.width/800
temp.height = screenH * temp.height/600
end

if uf_print then
uf_print(temp, 1, 0)
else
print("Leider nein")
end

-- let the original function happen
return fullHD_NewButtonWindow(unpack(arg))
end
else
print(" : failed")
if fullHD_NewButtonWindow then
print(" : backup variable fullHD_NewButtonWindow already in use!")
else
print(" : no NewButtonWindow() to take over!")
end
end

[/code]
I understood this function correctly, i give it a table and it will show me the whole content of it? That can be very usefull to find an identifier in the given parameters
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.0

Post by Teancum »

The uf_ functions are part of Zerted's 1.3 code. Is that inatalled?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: swbf-unmunge v1.1.0

Post by Anakin »

yes and the custom functions and global variables from 1.3 are available but not that function. But the whole utility_functions2.script is missing in the shell.lvl 1.3 Is it maybe only available for ingame script but not for galactic conquest?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: swbf-unmunge v1.1.0

Post by [RDH]Zerted »

You understand the function correctly. Keep in mind printing out large tables can take awhile. Lua has a global table named _G which contains everything you can see.

It is in ingame.lvl. I know I've used it in shell modding but maybe it wasn't in the released v1.3. It's easy to simply add the function somewhere:
Hidden/Spoiler:
[code]
--
---- Description ----
-- Attempts to display the contents of the given table
-- WARNING: tables with nested tables pointing back at themselves or a parent table will cause this function to enter a recursive, infinite loop
--
---- Parameters ----
-- data - the table to display
-- nested - true if should attempt to display any nested tables (tables inside of tables etc...)
-- depth - the current nested level
--
---- Returns ----
-- (nothing)
--
function uf_print( data, nested, depth )
if (not data) then return end --must have something to print
if (not type) then return end --must have something to print
if depth == 0 then
print(depth..": uf_print(): Starting: ", data, type, nested, depth)
end

--for each pair in the given table,
for key,value in pairs(data) do

--check for nils
if key == nil and value == nil then
print(depth..": uf_print(): Both the key and value are nil")
elseif key == nil then
print(depth..": uf_print(): Nil key, but value is:", value)
elseif value == nil then
print(depth..": uf_print(): Nil value, but key is:", key)
else
--have no nils (but a continue keyword would have been nice...)

--display the key, value pair if possible
if key ~= "mapluafile" then
--normal display
print(depth..": Key, Value: ", key, value)
else
--have to format map lua file values to prevent crash when outputting the value
local map = string.format(value, "<A>", "<B>")
print(depth..": Key, Formated Value: ", key, map)
end

--if nested, search deeper, but don't recurse into the global table or our starting table
if nested and key ~= "_G" and key ~= data then

--the developers didn't include type(), so have to use this hack to determine if the value represents a table
local result = pcall(function(array)
table.getn(array)
end, value)

--can only process tables
if result then
uf_print(value, nested, depth+1)
end
end
end
end

if depth == 0 then
print(depth..": uf_print(): Finished: ", data, nested, depth)
else
print()
end
end
[/code]
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: swbf-unmunge v1.1.0

Post by Anakin »

yeah i already added it to my script and the function works perfectly.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: swbf-unmunge v1.1.0

Post by Marth8880 »

[RDH]Zerted wrote:I hadn't thought of it before, but I do have a paid site now, so I could probably rehost everything there...
Why not just host on GitHub/etc.? :o
User avatar
cbadal
Corporal
Corporal
Posts: 155
Joined: Sun Jan 18, 2015 5:23 pm
Projects :: SWBF2 XBOX Mod Environment
Games I'm Playing :: SW Battlefront 2
xbox live or psn: No gamertag set
Contact:

Re: swbf-unmunge v1.1.0

Post by cbadal »

So, I'm using this trying to port "Christmas in Jingling' Town" to the XBox and it seems to get most of the assets out.
But some of the objects don't seem to be working correctly. Like I fall through ice sheets, fall through steps, walk through some house walls, fall through some road pieces.

Anyone know how can I correct those issues?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.0

Post by Teancum »

Not trying to hijack this thread too much with a quick answer, but when you're in ZeroEdit go to Object mode > Place > Browse. Navigate from /Data_[WORLD]/Worlds/[WORLD]/World1 to /Data_[WORLD]/common/odf and look for the com_inv_colX.odf files (where X is the size). These are invisible cubes that do nothing but collision. They're great for fixing holes in collisions that don't happen on PC for some reason, but do on consoles.
User avatar
cbadal
Corporal
Corporal
Posts: 155
Joined: Sun Jan 18, 2015 5:23 pm
Projects :: SWBF2 XBOX Mod Environment
Games I'm Playing :: SW Battlefront 2
xbox live or psn: No gamertag set
Contact:

Re: swbf-unmunge v1.1.0

Post by cbadal »

Teancum wrote:Not trying to hijack this thread too much with a quick answer, but when you're in ZeroEdit go to Object mode > Place > Browse. Navigate from /Data_[WORLD]/Worlds/[WORLD]/World1 to /Data_[WORLD]/common/odf and look for the com_inv_colX.odf files (where X is the size). These are invisible cubes that do nothing but collision. They're great for fixing holes in collisions that don't happen on PC for some reason, but do on consoles.
What if these issues are happening on PC and Xbox?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.0

Post by Teancum »

Same difference in the end. Just use them to plug the holes.
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.0

Post by SleepKiller »

cbadal wrote:So, I'm using this trying to port "Christmas in Jingling' Town" to the XBox and it seems to get most of the assets out.
But some of the objects don't seem to be working correctly. Like I fall through ice sheets, fall through steps, walk through some house walls, fall through some road pieces.

Anyone know how can I correct those issues?
Ah yes that is an issue the tool has that I keep forgetting to document. The tool doesn't really understand the game's collision mesh format properly. My guess is that is what is causing the issues you're seeing. It understands it well enough for some cases and sometimes it get's perfect output. Other times it'll read it out in an interleaved way skipping every other triangle, leaving the meshes shape intact but with holes in it.

The simplest solution for fixing this after the fact is likely to just import the mesh into XSI. After that you have a couple things you can try, if XSI has an option or plugin to triangulate points you could delete the collision meshes faces and run that. The second option would be to just delete the broken collision mesh and make a new one by copying the normal meshes (naming them collision_n obviously) and running mesh simplification over them.

If you don't have XSI setup Teancum's suggestion is likely to be the easiest option.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.0

Post by Teancum »

I was surprised how easy it was to import the msh, duplicate it and use that as collision. I'll have to make a quick tutorial sometime.

/endHijack
User avatar
cbadal
Corporal
Corporal
Posts: 155
Joined: Sun Jan 18, 2015 5:23 pm
Projects :: SWBF2 XBOX Mod Environment
Games I'm Playing :: SW Battlefront 2
xbox live or psn: No gamertag set
Contact:

Re: swbf-unmunge v1.1.0

Post by cbadal »

Teancum wrote:I was surprised how easy it was to import the msh, duplicate it and use that as collision. I'll have to make a quick tutorial sometime.

/endHijack
Easy == Good
I'd like to see that tutorial sometime :)
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: swbf-unmunge v1.1.1

Post by Anakin »

any chance to unmunge addme scripts?
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.1

Post by SleepKiller »

Unlikely at the moment sorry, I just don't have the time or motivation to implement a feature like that.

addme scripts are pretty simple though, what kind of output does cbadal's Lua tools give on them?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: swbf-unmunge v1.1.1

Post by Anakin »

Hidden/Spoiler:
[code]-- NAME: addme mLocation: 0x8; Body Length: 2128, Body Start: 0x34, Body End: 0x884
-- C:\BF2_ModTools\space_template\addme\addme.lua
-- PC luac code size = 315; PC code:
--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end




--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

-- INFO 0x1 0x0 0x0 0x0 0x1 0x0 0x0 0x0 [/code]
I noticed that sometimes this tool has a output like this

Code: Select all

-- ********* LUAC Code Size MATCH!!! ***********
-- ********* Binary Equal !!! ***********
does this mean that there is no different to the original script? and is there a way to show only the differences if there are such?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.1

Post by Teancum »

Would it be possible with this or a separate tool to unmunge compiled animations back to individual. msh files? Like if we provided the names via the .anims file it would name them in the order they extracted, but if no names were provided they would have generic ordered names like anim[x].msh. It would be great to have individual animations from Kit Gusto and Asajj Ventress from the Xbox.

Thanks!
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.1

Post by SleepKiller »

It's certainly possible. But because of the (suspected) complexity of the format and low count of uses for it I just never did it. I don't have the time to add support for it right now but I won't rule out ever doing it.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: swbf-unmunge v1.1.1

Post by Teancum »

That's a very fair answer. Thanks.
User avatar
cbadal
Corporal
Corporal
Posts: 155
Joined: Sun Jan 18, 2015 5:23 pm
Projects :: SWBF2 XBOX Mod Environment
Games I'm Playing :: SW Battlefront 2
xbox live or psn: No gamertag set
Contact:

Re: swbf-unmunge v1.1.1

Post by cbadal »

So if the collision data for some of the objects gets messed up when unmunged, how can I fix it?
Post Reply