Halomods Community Portal: WaeV's Programming Adventures - Halomods Community Portal

Jump to content

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Code
WaeV's Programming Adventures

#21 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 16 May 2011 - 06:40 AM

View Postkornman00, on 16 May 2011 - 05:10 AM, said:

If you're wanting to be cross-platform, wouldn't you want a consistent look-and-feel, not a "native" (and thus, more specific to a platform) one?

I guess. It's possible to do either, though. QT is pretty good at looking native, and that has bindings for a lot of languages.

View Postkornman00, on 16 May 2011 - 05:10 AM, said:

My main disgusts with Java have always been: people touting it as "pure-OO" when it's not (primitives in Java are not objects), no operating overloading (please, I'm not a fucking child, I don't need some idiot to "protect me from myself"), no support for value types (this actually goes with the first point), no support of unsigned integers (really? come on), and the overhead needed to develop with Swing. There's more, but those are my main gripes I've always expressed. Not sure how much of it applies to the JVM.

Pretty much all of those are language-specific.

View Postkornman00, on 16 May 2011 - 05:10 AM, said:

How many companies/future possible employers exclusively use the JVM? I've never heard of any kind of study, so I'm curious as to what your findings are for current companies.

I don't know about exclusively, but Java is a very http://www.tiobe.com...tpci/index.html language. Ruby shows up on the charts too, barely. It's much more popular among startups and small companies willing to take the "risk" and not go with Java or C#.

Following out my plan to learn those languages would leave me hireable by any of those companies with use Java, but I would have the added advantage of knowing extra languages and different paradigms. Broadening my horizons that way would leave me a better programmer no matter which language I choose, I think.

#22 User is offline   Dwood 

  • Member
  • PipPip
  • Group: Members
  • Joined: 05-May 11
  • LocationSpanish Fork, UT

Posted 17 May 2011 - 03:02 PM

View PostWaeV, on 16 May 2011 - 04:52 AM, said:

The JVM is certainly well-performing.


The problem with that is that Java was written in C. There's no real way that Java can outperform the language it was written in.

#23 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 17 May 2011 - 07:28 PM

False! Posted Image Languages like C, C++, and Fortran are AOT, or "ahead-of-time" compiled languages. Languages like Java, C#, and Scala are JIT "just-in-time" compiled languages. When JIT languages are first run they can be a little sluggish, but over time they become more and more optimized as the JIT compiler learns which optimizations to make - sometimes outperforming their AOT counterparts!


As for not being able to outperform the language something was written in, look no further than assembly/C. With a highly optimizing compiler, it's possible to write a program which runs faster in C than assembly. If you knew EXACTLY which optimizations to make you theoretically COULD make the same program in assembly, but it'd take a hell of a long time.

Which brings me to my second point. Development speed is more important than performance. This isn't true for a few things, like video game engines, but for most everything else it is much more preferable to finish a somewhat more sluggish program in four months than a fast one in a year. Depending on which language you pick, JIT and AOT are juuuust about tied at this point, with a slight advantage conceded to AOT. What really matters is development speed.

This post has been edited by WaeV: 17 May 2011 - 07:55 PM


#24 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 31 May 2011 - 08:10 AM

At the risk of making this thread even more like a personal blog, I just feel like pointing out that I've been waaaay overthinking a lot of this stuff lately. I need to talk less and DO more.

Although as it's summer I'll be focusing on computer stuff a lot less, especially Halo. I might do a bit here and there. Once September rolls around I'll probably get back into programming Halo stuff.

This post has been edited by WaeV: 31 May 2011 - 08:10 AM


#25 User is offline   kornman00 

  • SourceGuy 2.0
  • Group: Administrators
  • Joined: 15-November 01


Users Awards

Posted 01 June 2011 - 03:29 AM

You know, the site supports user blogs :P. I have one (only used it once so far)

#26 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 17 December 2011 - 01:04 AM

Back again!

I've been working in C# to produce a reference-viewer, but I don't know how to find references in a tag's meta. I can iterate through the tag index just fine, and I can load a tag's name and meta. What I don't know how to do is to figure out where exactly in the meta the references are located.

Is there some algorithmic way of locating references? Or is it just a few different hard-coded cases for different types of tag?

Edit: I received a great answer from Modzy, Here it is, if anyone is curious.

Modzy said:

Unless you're working with plugins or other mapped methods, the common way to find the locations of references is to use an algorithm, similar to the reflexive algorithm.

References are the following:
32-bit Tag class (bitm, snd!, etc.)
32-bit Name memory offset (offset to the name in memory, within the text section of the index)
32-bit zero (always true)
32-bit Tag ID (the reference's ID, same as it appears in the index)

Now, the easiest way is to create an array/dictionary and store all the tag IDs you read in the index, along with the tag's information so you know what the IDs go to.
Once you've got that, it's a simple matter of checking the tag's data 32-bits at a time and checking to see if the 32-bit int that you read at any given time is a Tag ID (check to see if the int matches one of the IDs in your array/dictionary).
Once you've found an ID, you can step back 16 bytes and check to see if it has a tag class. If it does have a class, you can then read the memory offset if you wish, which will give you all the information of that particular reference. However, there is a third common data type among the reflexive and reference, known as a lone ID. As the name implies, lone IDs are just a tag ID without the class or memory offset. They are still important, though, as they are a type of reference that effect game play in the same way as a normal reference.

Note: normally, the reflexive, reference, and lone ID finding code is one big combined algorithm for efficiency.


It didn't occur to me to simply scan through the data 4 bytes at a time, looking for tag IDs.

This post has been edited by WaeV: 17 December 2011 - 02:34 AM


#27 User is offline   kornman00 

  • SourceGuy 2.0
  • Group: Administrators
  • Joined: 15-November 01


Users Awards

Posted 17 December 2011 - 06:04 PM

Bungie only used that tag_reference structure in Halo1. In all games afterwards, the runtime uses a simplified tag_reference structure that is just the group tag and the tag index (tag names are debug data and are never loaded by the runtime).

#28 User is offline   OwnZjoO 

  • Member
  • PipPip
  • Group: Members
  • Joined: 06-May 11

Posted 06 January 2012 - 04:34 AM

Feel free to look at the one I released if you're still working on this at all. It has reverse lookup as well if you're interested in that at all.

Halo Ident Swapper - I hosted it off site because I couldn't figure out how to upload a file.

This post has been edited by OwnZjoO: 06 January 2012 - 04:36 AM


#29 User is offline   xorgasm 

  • Member
  • PipPip
  • Group: Members
  • Joined: 26-August 11

Posted 14 January 2012 - 06:01 AM

View PostWaeV, on 17 December 2011 - 01:04 AM, said:

Modzy said:

References are the following:
32-bit Tag class (bitm, snd!, etc.)
32-bit Name memory offset (offset to the name in memory, within the text section of the index)
32-bit zero (always true)
32-bit Tag ID (the reference's ID, same as it appears in the index)



This is actually not necessarily true, the third field specifies the length of the name, at least it does in uncached tags (i.e. guerrilla tags,) and internally within tool. Which, off hand isn't really important, but if you ever want to load tags output by guerrilla, it's extremely important.

It's always zero in a cached map though.

#30 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 23 January 2012 - 05:25 PM

Ooh, thanks for the information.

It still really bothers me that a dependency swapper has to cross-reference every four bytes with the ident list just to see where the references are. I can't think of a better way to do it, aside from having tag-specific parsers which take reflexives into account.

#31 User is offline   OwnZjoO 

  • Member
  • PipPip
  • Group: Members
  • Joined: 06-May 11

Posted 30 January 2012 - 02:24 AM

Yeah, aside from having something more than a dumb scanner that's what you have to do. If you have the structure mapped out and know where to look, then you can just look at the locations you want. It's really not that awful though, if you have a machine with generous amounts of memory like most people today. In my reference swapper that I linked to above it loads the whole map into a memory stream before any reading is done, allowing for really quick reading at the small sacrifice these days of additional memory overhead(What's 60-100MB when you have 2-4GB?).

#32 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 23 February 2012 - 05:06 AM

Progress on my C# program has slowed, particularly since my desktop has been out of commission for the past two months. Now that I've had my fun mucking about on my own, I'm interested in looking into BlamLib/OpenSauce, but I don't know much about them.

I'm admittedly not very well versed in C++. I've basically tried to avoid it up to this point. Is BlamLib/OpenSauce a C++ library? Do I need to compile it along with my project, or link to a precompiled dll? Does it have heavy Microsoft dependencies?

#33 User is offline   kornman00 

  • SourceGuy 2.0
  • Group: Administrators
  • Joined: 15-November 01


Users Awards

Posted 23 February 2012 - 09:43 AM

With a couple of people showing more interest in BlamLib, I'll probably take some time in the coming weeks to add some wiki entries for it.

But in the meantime I'll answer questions here. Okay, so BlamLib is part of the "OpenSauce" codebase, but is for the most part .NET-based. If you want to get technical, the Halo game and editor extensions (basically, everything that falls under this folder in the code) is the "Yelo" part of the codebase. "Yelo" is the internal name for actual game (Halo1_CE, Halo2_Xbox) and editor (the official HEKs) extensions.

For OpenSauce in general, this wiki entry about using the codebase will probably help with getting started.

Now, there is a C++ part of the BlamLib libraries, found in the LowLevel library. Anything that would require "unsafe" code blocks in C# or talking directly to native\Win32 APIs is done in here. However, that's where the C++ code stops. From here, it's all .NET (3.5, but the code should be able to target v2.0 of .NET as well). BlamLib only has two major dependencies, C++ boost (for LowLevel) and SlimDX, which are described in detail in the "using the code" wiki I linked to earlier. Everything else is either already provided by the .NET framework or included as part of the BlamLib codebase.

Not exactly sure what you're asking as far as the MS dependencies. If you're wanting to develop with Mono.NET instead you're going to have some hurdles, at the very least because Mono hasn't finalized a C++/cli compiler (last I checked), so you won't be able to use the Mono SDK to build LowLevel. However, VS2008 Express's C++ IDE should handle it just fine if you need a free alternative.

Now, as far as "using" BlamLib goes...you would normally reference it just like you would reference System.Xml or any other .NET assembly. This is what we do with OpenSauceIDE, which is where we do most of our GUI frontend crap. There's also the unmaintained BlamLib.Forms library. At one point I was rewriting the tag editor frontend for that TagInterface system but it was just going to take too much time and there were, and still are, other lower hanging fruit that need to be picked, so to speak. Then there's BlamLib.Test. This is a short of half-assed unit test library. IIRC, VS2008 Express doesn't have support for running VS unit tests. Hindsight, I should have used a free unit testing framework...but it's too late to change. Anyway, with the Test library I have code that tests the various general and game-specific components of the BlamLib library. From .map and .tag processing, to resource extraction and converting (eg, taking Halo1 and Halo2 render models and pooping out COLLADA files), there's a lot there.

I can talk about the individual parts of BlamLib later. For now, I'll leave you to digest all of that and formulate any more questions you may have!

#34 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 24 February 2012 - 11:07 PM

Thanks for the response! I'll be looking into this.

#35 User is offline   HaloExtreme117 

  • Tyson FTW!
  • PipPip
  • Group: Members
  • Joined: 19-June 12
  • LocationIpswich, Suffolk, UK

Posted 19 August 2012 - 08:13 PM

It's a pity this died :/

Revive mb? :)

#36 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 19 August 2012 - 09:58 PM

No, it's not dead. This just isn't the forum I frequent most. Here's my latest thread on my progress: http://www.opencarna...rter-pre-alpha/


I'm nowhere near a usable finished product, but I'm pushing along. At the moment I'm investigating .xml/.ent plugins.

#37 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 23 August 2012 - 04:02 AM

Well, it's been some months, but I'm going to have to concede the JVM/.Net argument earlier in this thread. The HotSpot JIT compiler may be a fine piece of work, but JVM vs CLR performance is pretty much moot. C# is vastly more comfortable to work with than Java, and the JVM has no equal to the power of native interop with Managed C++.


I'm really pumped to make a large push forward with my Halo programming efforts, since in the past few days I've managed to find a way to embed the window of an external process within a WPF program. Now my modding application will be able to have an embedded instance of Halo! While that's just a small step (and may or may not be a good idea), I've been inspired to look into memory editing. I'm envisioning "merely" replicating the functionality that Conure's memory editor had, which IIRC was essentially just some HMT-style meta editing.

Posted Image

Having embraced .Net as a platform, I'm interested in BlamLib again as well. I'm still focused on the Halo PC platform over CE, but there's certainly a lot that could be potentially shared. But I'm just as in the dark about BlamLib as I was several months ago, and Kornmann doesn't seem to have gotten around to that wiki page...


tl;dr Still working, but I need help! Any info regarding memory editing OR BlamLib would be greatly appreciated. Thanks!

This post has been edited by WaeV: 23 August 2012 - 06:07 AM


#38 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 26 August 2012 - 09:02 AM

GitHub repo is live: https://github.com/ChadSki/Quickbeam

#39 User is offline   WaeV 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 06-May 11
  • LocationCosmos

Posted 02 September 2013 - 07:52 PM

Scriptable runtime reference-swapping, y'all!

Posted Image

https://github.com/ChadSki/halolib.py

This post has been edited by WaeV: 02 September 2013 - 07:55 PM


#40 User is offline   nintendo9713 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Joined: 09-May 11

Posted 02 September 2013 - 10:32 PM

That's really cool WaeV!

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users