swbf-unmunge v1.1.1

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

Moderator: Moderators

Master of the Force
User avatar
Posts: 4754
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: swbf-unmunge v1.1.0

Postby Anakin » Tue Feb 20, 2018 9:06 am

uf_print is not defined for me.

Hidden/Spoiler:
Code: Select all
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



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

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.0

Postby Teancum » Tue Feb 20, 2018 1:20 pm

The uf_ functions are part of Zerted's 1.3 code. Is that inatalled?

Master of the Force
User avatar
Posts: 4754
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: swbf-unmunge v1.1.0

Postby Anakin » Tue Feb 20, 2018 1:43 pm

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?

Gametoast Staff
User avatar
Posts: 2973
Joined: Sun Feb 26, 2006 7:36 am
Location: USA
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.0

Postby [RDH]Zerted » Tue Feb 20, 2018 8:41 pm

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: Select all
--
---- 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

Master of the Force
User avatar
Posts: 4754
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: swbf-unmunge v1.1.0

Postby Anakin » Wed Feb 21, 2018 5:28 am

yeah i already added it to my script and the function works perfectly.

Resistance Leader
User avatar
Posts: 5084
Joined: Tue Feb 09, 2010 8:43 pm
Location: Los Angeles, CA
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Civ3 + DEHR
xbox live or psn: Marth8880

Re: swbf-unmunge v1.1.0

Postby Marth8880 » Sun Feb 25, 2018 6:27 pm

[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

Private First Class
User avatar
Posts: 77
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

Re: swbf-unmunge v1.1.0

Postby cbadal » Mon Mar 05, 2018 3:08 am

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?

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.0

Postby Teancum » Mon Mar 05, 2018 4:28 am

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.

Private First Class
User avatar
Posts: 77
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

Re: swbf-unmunge v1.1.0

Postby cbadal » Mon Mar 05, 2018 12:49 pm

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?

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.0

Postby Teancum » Mon Mar 05, 2018 1:33 pm

Same difference in the end. Just use them to plug the holes.

Corporal
Posts: 141
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.0

Postby SleepKiller » Tue Mar 06, 2018 4:40 am

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.

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.0

Postby Teancum » Tue Mar 06, 2018 12:33 pm

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

Private First Class
User avatar
Posts: 77
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

Re: swbf-unmunge v1.1.0

Postby cbadal » Wed Mar 07, 2018 12:19 pm

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 :)

Master of the Force
User avatar
Posts: 4754
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: swbf-unmunge v1.1.1

Postby Anakin » Wed Mar 14, 2018 2:32 pm

any chance to unmunge addme scripts?

Corporal
Posts: 141
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.1

Postby SleepKiller » Wed Mar 14, 2018 9:55 pm

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?

Master of the Force
User avatar
Posts: 4754
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: swbf-unmunge v1.1.1

Postby Anakin » Thu Mar 15, 2018 5:25 am

Hidden/Spoiler:
Code: Select all
-- 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


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?

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.1

Postby Teancum » Thu Mar 15, 2018 8:56 am

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!

Corporal
Posts: 141
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: swbf-unmunge v1.1.1

Postby SleepKiller » Sun Mar 18, 2018 7:48 pm

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.

Jedi Admin
User avatar
Posts: 11000
Joined: Wed Sep 07, 2005 11:42 pm
Location: Indiana
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set

Re: swbf-unmunge v1.1.1

Postby Teancum » Sun Mar 18, 2018 8:39 pm

That's a very fair answer. Thanks.

Private First Class
User avatar
Posts: 77
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

Re: swbf-unmunge v1.1.1

Postby cbadal » Mon Mar 19, 2018 8:48 pm

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

PreviousNext

Return to Released Assets

Who is online

Users browsing this forum: No registered users and 2 guests