(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
04-23-23 08:45 PM
Acmlm's Board - I3 Archive - - Posts by sloat
User Post
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 12-15-05 04:55 PM, in Realloc() fails for some reason Link
don't you have to use "this" with everything...or am i stuck in php mode?

also, what exception is it giving you?
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 12-19-05 02:00 AM, in Realloc() fails for some reason Link
Originally posted by HyperHacker
[edit 2] Hah! Figured out why it wasn't showing any error... I forgot SDL has a built-in exception handler, which apparently decided to just kill the program. With that off, I do get an error: The instruction at "0x7c910de3" referenced memory at "0x7473654c". The memory could not be "read".


It looks like 0x7473654C is a string that's getting dereferenced too many times, or in this case, probably overwriting your file pointer. If you convert it to ascii you get "tseL". But remember that an x86 processor always reads addresses from low to high, so the actual string that it thinks is a pointer is "Lest". I dunno if that has any significance to you, but to me it would be a starting point.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 12-19-05 04:41 PM, in Opening 4MB files...or well, have a seamless hex editor... Link
I believe MisterJones means make a file mapping object, which would be much more efficient. It's also how Hex Workshop can open 700meg files with little or no lag.

Check out CreateFileMapping and MapViewOfFile.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 12-21-05 02:23 PM, in Opening 4MB files...or well, have a seamless hex editor... Link
Originally posted by MathOnNapkins
I remember looking into it a few times for various projects, and it seemed like if you altered the memory mapped file it would cause instant (i.e. irreversible if you don't keep track) changes to the file on disk. If I'm wrong about that somebody correct me please.


With Windows, it's more like a copy gets loaded in to the process address space. You use the FlushViewOfFile to save changes. So you can modify to your heart's content and not have to save it.

To close it, first you call UnmapViewOfFile, then CloseHandle on the file mapping object, then CloseHandle on the file.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 01-09-06 01:41 AM, in [WinAPI] Making custom messages Link
You don't have to use RegisterWindowMessage unless you need to make sure that the number you use doesn't interfere with some other message. But that would probably only happen if you're subclassing a control.

#define WM_MYMESSAGE WM_USER+0x1337

You can use WM_APP instead if you're really paranoid about duplicate values.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 01-12-06 07:14 PM, in [WinAPI] Making custom messages Link
InvalidateRect will cause flicker if you're not using double buffering. It can be slow with double buffering. You can try using ScrollWindowEx which has a param for flags for repainting, or if you're using double buffering, you can try ScrollDC. ScrollDC is more for if you don't want to redraw the entire window contents (which is a good thing), but the code to manage a backbuffer and scrolling it will be more complex.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 01-12-06 07:37 PM, in Which method is better for a plugin system? Link
I'd say keep the main program functions separate and make a plugin SDK -- an interface for the plugin to access the main program (if it really needs it). There might be a way to have the application export functions (like a dll) and use a header/library for the plugin to have access. Or if that doesn't work, you can have a message-only or otherwise hidden window in the application for the plugin to communicate with via messages.

The rest of the plugin would be a bunch of callbacks that it registers (in the init function or whatever) to specific application events. The main application would keep a linked-list of event-handlers so more than one plugin can handle the same event. When that event gets fired, the application simply walks down the chain until it reaches the end, or a plugin has asked the chain to stop.

I wouldn't worry too much about 64-bit and 32-bit at the moment. Yeah, the plugin would probably have to be recompiled, but so would the application.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 01-13-06 08:09 PM, in [WinAPI] Making custom messages Link
double buffering is something you have to do manually, with a memory DC and memory bitmap. you basically draw everything to this memory DC, then use BitBlt to set it to the screen. There are plenty of examples of it on MSDN (if you can find them) or google.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 01-31-06 01:32 AM, in Programming UNIX GUIs Link
if you want a native look, you should also check out wxWidgets. It's almost as simple as Qt, and might be more lightweight (not really sure though).

The biggest gripe most people have with Qt is the license -- you can either pay for the toolkit or license your application under the GPL. But if that doesn't matter, then by all means use it. It's definitely more robust and proven.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 02-13-06 12:22 AM, in C# editor problems.. Link
MSDN says you can get a performance boost using a CachedBitmap class and the Graphics:: DrawCachedBitmap method. But you might not be able to use it depending on your situation.

There's no doubt that GDI+ is slower than regular GDI or DirectX, but it still shouldn't be that slow. Once you've got it loaded and ready to go, it should draw almost instantly. The only time I've ever had something go very slow was when I was fooling around with the automatic gamma correction and alpha-blending. Still, it was rendering a 550x320 bitmap with about 10 sprites at about 6 or 7 frames per second.


(edited by sloat on 02-12-06 11:22 PM)
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 02-13-06 05:35 PM, in Low-Power Random Numbers Link
For typical use, it shouldn't be a problem. But remember, it's a pseudorandom number generator. It's not safe for cryptography (IOW, the algorithm can be derived from the output) and it will repeat sequences eventually.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 02-16-06 12:56 AM, in .NET Bitmap Problems Link
I'll throw my possible solution in to the ring...

set the graphics object (whatever you're drawing to) .SmoothingMode property to System.Drawing.Drawing2D.SmoothingMode.None
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 03-27-06 02:23 AM, in StackWalk64 isn't walking so much as stomping Link
Try adding a _stdcall or WINAPI directive to your function type definitions. They're the same thing, so it doesn't matter which you choose. I forget where to put it though, so good luck.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 04-05-06 03:34 PM, in Doing a modulus with limited resources Link
for SNES, it might be possible to multiply by the (reciprocal * 2^8)+1 if you're using a constant. I've never tried it on SNES, but with GBA and x86 asm, it works. The result would be in the high-byte of the multiplication result.

You could multiply the result by the divisor and subtract from the original number to get the remainder. I have no idea if all this would be slower than the regular divide function though.

Here's an example:

;123 / 10 = 12
(1/10 * 2^8)+1 = 0x1A

123 * 0x1A = 0x0C7E

As you can see, the high-byte of the result is 0x0C, which is 12.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 06-14-06 02:47 PM, in C++ vs C# vs Java? Link
C# as a language is really nice. Very similar to Java, just with better features, better syntax, less crummy-ness.

Java and C# both require large runtimes. Java is mostly cross-platform (any OS the runtime is supported on) and C# is getting better platform support thanks to the Mono Project, which I hear is getting pretty decent.

However, for an editor, I wouldn't use either Java or C#. In my experience, the higher level the language, the harder it is to work with binary files. I honestly wouldn't even know where to begin with either C# or Java. I do remember when I was messing with stuff in VB4, binary files gave me many headaches. In contrast, with the zamn editor (written in C), I could make structs and arrays of structs and copy the data from the game almost directly in to them. And writing the data back was about as simple.

So, I would (and did) stick with C/C++. Things like memory mapped file I/O are too useful to not have. And if you code it carefully, you can have it cross platform with little effort.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 07-21-06 12:54 PM, in Windows keyboard hook; how to get true numpad status? Link
From what I can remember, they Keyboard Hook can't be used to modify input. The only way I was ever able to modify keyboard data or block the keystroke message was with a WH_GETMESSAGE hook.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 07-21-06 07:43 PM, in Windows keyboard hook; how to get true numpad status? Link
Originally posted by HyperMackerel
That's not what I meant. When my keyboard hook is called it's being told that Insert is pressed. I want it to still be told that Num0 is pressed.


My mistake. I was just inspecting it and it seems bit 24 of the lParam will be set if you're using the regular insert key and cleared if you do shift+numpad0. But it still registers as an insert keystroke.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 08-31-06 12:34 AM, in Layering via BitBlt Link
If it's that confusing, just don't use BitBlt at all then. Clear the background using ExtFloodFill or FillRect (whichever works better for you), and just use TransparentBlt to do all your drawing.

Chances are it won't show up properly anyway since, IIRC, the SNES uses the palette index to indicate transparency and not the color value. Probably the best solution would be to do masking for each tile, and draw each with BitBlt using a SRCAND-SRCPAINT double blit. Another solution would be to change the color value of palette index 0 to something that isn't in the game...then you can use TransparentBlt with no ill effects.

Generating masks on the fly and changing pixel colors present their own problems -- the most noticable would be how slow the pixel manipulation functions are. Unless you're prepared to jump in to the fun fun world of DIBs, you should stick with broken rendering, or...

Using a separate, static bitmap mask would work. But then, that's another file to add to your project.

btw, TransparentBlt hates Windows 98. It will cause huge memory leaks, and may not even work at all.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 09-12-06 04:37 PM, in XML Questions Link
You have to define how to show the tag with your stylesheet. Basically, you define an xsl:template block and match "i" (or whatever tag you want to render). In that, you put your html and an 'xsl:value-of select="."' tag

Then, you use xsl:apply-templates instead of xsl:value-of to output, and you should be set.

Hope this helps.
sloat



 





Since: 11-18-05
From: Delaware, US

Last post: 6011 days
Last view: 6011 days
Posted on 11-07-06 12:15 PM, in Various text drawing methods are ignoring font colour Link
Originally posted by HyperHacker

WindowBackDC = CreateCompatibleDC(0);
WindowBMP = CreateCompatibleBitmap(WindowBackDC, WindowWidth, WindowHeight);


I'm pretty sure this is the issue. You should get the DC of the current window (from the hWnd param) and use that to create both the memory DC and Bitmap.

Originally posted by Buried in MSDN

Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap.

Acmlm's Board - I3 Archive - - Posts by sloat


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.032 seconds; used 426.02 kB (max 545.57 kB)