Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

127 Neutral

About Daggerbot

  • Rank

Personal Information

  • Interests
  1. Daggerbot

    CPU lost some pins :(

    Could it potentially damage the motherboard if we try the CPU with these pins missing? If not, I think it would be worth trying anyway.
  2. Daggerbot

    CPU lost some pins :(

    While "helping" a friend upgrade his computer, we managed to break two pins off of the CPU. I've been looking around for a socket AM3 pinout, so we can determine if by some chance these pins aren't used for anything, but I can't find any such information. Does anyone have access or know where I can find a datasheet that would have this information? Any help is appreciated.
  3. Daggerbot

    [C++] Lambda function strangeness

    Here's the constructor: [source] MainMenu::MainMenu () : m_substate(MAIN), m_name_entry(20) { // m_main_menu m_main_menu.add('c', "Continue saved game", []{}); m_main_menu.add('n', "Start new game", [this]{substate(CHAPTER_SELECTION);}); m_main_menu.add('q', "Quit game", [this]{State::current(nullptr);}); } [/source] And the State class: [source] class State { public: virtual ~State (); // Current state static StatePtr current (); static void current (const StatePtr &state); // Events virtual void draw () = 0; virtual void receive (int c) = 0; }; [/source]
  4. I have a function that takes a std::function<void ()> argument to define what to do when i certain action occurs. The actions are usually only a single line of code, so I decided to try the lambda syntax for the first time. For some reason gcc wants me to capture this just to call a static function. Why would this be necessary? Is it a bug in gcc? Here's the code: [source] m_main_menu.add('q', "Quit Game", []{State::current(nullptr);}); [/source] State::current is a static function that sets the current game state. Setting it to nullptr causes the main loop to end. Why would this need to be captured in order to call a static function? This isn't a major issue at all, but just a curiosity. Any help is appreciated.
  5. I've used libpng for loading images many times before, but I'm getting a crash that I've never seen before. I tried two different versions of libpng with the same results, so the problem appears to be with zlib. Here's the code for my PNG loader: [source lang="cpp"]bool base::Image::load_png (IODevice &in) { png_byte signature [PNG_SIG_SIZE] = {0}; PNGReader png; PixelFormat format; boost::scoped_array<png_bytep> rows; try { // Check signature, PNG_SIG_SIZE); if (png_sig_cmp(signature, 0, PNG_SIG_SIZE) != 0) { throw std::logic_error("Stream is not a PNG image"); } // Setup input png_set_read_fn(png.readp, &in, &on_png_read); png_set_sig_bytes(png.readp, PNG_SIG_SIZE); // Get info and allocate image png_read_info(png.readp, png.infop); switch (png_get_color_type(png.readp, png.infop)) { case PNG_COLOR_TYPE_GRAY: format = LUM_8; break; case PNG_COLOR_TYPE_GRAY_ALPHA: format = LUM_ALPHA_8; break; case PNG_COLOR_TYPE_PALETTE: case PNG_COLOR_TYPE_RGB: format = RGB_8; break; case PNG_COLOR_TYPE_RGB_ALPHA: format = RGB_ALPHA_8; break; default: throw std::invalid_argument("Invalid PNG color type"); } reset(Vec2u(png_get_image_width(png.readp, png.infop), png_get_image_height(png.readp, png.infop)), format, NULL, 0); // Setup transformations png_set_expand(png.readp); png_set_strip_16(png.readp); png_set_packing(png.readp); // Read data rows.reset(new png_bytep [size.y]); for (unsigned int y = 0; y < size.y; y++) { rows[y] = &data.get()[y * pitch]; } png_read_image(png.readp, rows.get()); // Finish return true; } catch (const std::exception &e) { destroy(); error_string = e.what(); return false; } }[/source] PNGReader is just a basic structure that creates and destroys the PNG structs in a way that takes advantage of RAII. [source lang="cpp"]struct PNGReader { png_structp readp; png_infop infop; // Constructor PNGReader () : readp(NULL), infop(NULL) { readp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, &on_png_error, &on_png_warning); if (!readp) { throw std::runtime_error("png_create_read_struct failed"); } infop = png_create_info_struct(readp); if (!infop) { throw std::runtime_error("png_create_info_struct failed"); } } // Destructor ~PNGReader () { if (infop) { png_destroy_read_struct(&readp, &infop, NULL); } else if (readp) { png_destroy_read_struct(&readp, NULL, NULL); } } };[/source] I can't find any problems in my code that would cause zlib to crash. I even replaced the PNGReader struct with manual calls and got the same results. Here's the stack trace: #0 0x00007ffff6676975 in raise () from /lib/ #1 0x00007ffff6677deb in abort () from /lib/ #2 0x00007ffff66b36ae in __libc_message () from /lib/ #3 0x00007ffff66b9326 in malloc_printerr () from /lib/ #4 0x00007ffff4b8fb5a in inflateEnd () from /usr/lib/ #5 0x00007ffff7749707 in ?? () from /usr/lib/ #6 0x00007ffff774997a in png_destroy_read_struct () from /usr/lib/ #7 0x000000000040e8c7 in PNGReader::~PNGReader (this=0x7fffffffe410, __in_chrg=<optimized out="">) at src/base/image_png.cpp:78 #8 0x000000000040e507 in base::Image::load_png (this=0x7fffffffe4f0, in=...) at src/base/image_png.cpp:166 #9 0x0000000000406244 in get_texture (path=...) at src/resource.cpp:94 #10 0x000000000040b307 in vd_main (args=...) at src/main.cpp:36 #11 0x000000000040b523 in main (argc=1, argv=0x7fffffffe7f8) at src/main.cpp:75 Has anyone had a similar error when using libpng or zlib? Any help is appreciated.</optimized></png_bytep>
  6. In a program that uses SDL and OpenGL, calling SDL_SetVideoMode appears to preserve the previous OpenGL context whenever possible. Is there a way of knowing if the context is reset? I haven't encountered this yet, but it seems like something that would happen if some vital video settings change. This could be very important in determining when to reload textures and rebuild vertex buffers. Any help is appreciated.
  7. Daggerbot

    libvorbisfile confusion

    A pointer to an array of arrays makes sense. The incorrect syntax in the example and the fact that the packing is different from that of ov_read threw me off a bit. I'll treat it as a pointer to an array of channels and see how that goes. Thanks for tge reply ;)
  8. In the Ogg/Vorbis libs, there is a function called ov_read_float, which decodes data from the stream in a floating point format. For some reason the output parameter takes a pointer to a pointer to a pointer to a float, and the documentation doesn't explain why or how to use the output value. What's even worse is that they left out a level of indirection in the example at the bottom of the page. Is anyone familiar with this library? Any help is appreciated.
  9. Daggerbot

    NCurses and UTF-8 :(

    I've found a partial solution. Linking to -lncursesw rather than -lcurses and setting the locale to "en_US.UTF-8" makes the box chars appear correctly. But now I need to find a way to ensure that the locale is UTF-8, but not necessarily English, and some might not have it installed.
  10. I'm using NCurses for the Unix-like port of a text-based app. I know for a fact that my terminal (xfce4-terminal) supports UTF-8, as I have tested it with printf. Afaik, most other major terminals, such as the ones used by Gnome, KDE, and Mac OS X, support UTF-8 as well. I expected that printing UTF-8 text to NCurses would be pretty straightforward, but I was apparently wrong. In my test program which draws a box with Unicode box drawing chars, the output is junk. Interestingly enough, the junk consisted only of ASCII chars. This is strange because the strings don't contain any ASCII chars at all, with the exception of spaces. It appears that NCurses is discarding the highest bit of each byte. Why would it do this? Is there some kind of function that enables UTF-8 output? If all else fails, I'll change my console class to print pure ANSI escape sequences, rather than using NCurses. I would have done this in the first place if I had any idea to handle input from non-printable keys like F1-F12, arrows, page up/down, etc. Has anyone else here had the same problem with NCurses? Any help is appreciated.
  11. Daggerbot

    Java X(

    Most of the coding I've done throughout my life has been in either C or C++. I've done quite a bit of Java, but have been unable to complete anything substantial with it because of various little annoyances. I normally do my coding in Gedit for its simplicity, and simply type 'make' into the command line to build my program. But writing a makefile for a Java based app isn't as clean as it should be. When writing a C/C++ app, GCC can generate a dependency list for each source file. When any of the dependencies (headers) are modified, make knows to recompile the source. But in Java, if, for example, I change the constant 'ClassOne.CONSTANT' which is used by 'ClassTwo', there's no way for make to know that 'ClassTwo' should be rebuilt. I've searched for dependency generators with no luck. After giving up on the simple command line + text editor style of development for Java, I tried out a few IDEs. I liked JCreator, but this appears to be for only Windows, which I try to avoid whenever I can. I also tried NetBeans and Eclipse, both of which I find completely unusable. Both of them try to write code for you, such as increasing indentation, writing closing brackets, and inaccurately predicting which method name I'm writing. And it appears that some of these annoying features are impossible to disable. Is there a single Java IDE out there with a text editor whose only purpose is to edit text? Before giving up on Java development forever, I'd like to see if there are any other options that you guys think may suit me. Any help is appreciated
  12. I'm testing a resource manager that uses weak tables in a Lua program, but the weak references don't seem to work. Here's the code: t = {} setmetatable(t, {__mode = 'v'}) t[1] = 'some ' .. 'string' collectgarbage('collect') for k, v in pairs(t) do print(k, v) end The table contains the pair (1, 'some string'). The table is set to have weak references to values, and there is no other reference to the string. I was under the impression that the string would be collected, resulting in no output, but I keep getting "1 some string". Am I forgetting to do something? Or can a resource manager be implemented without using weak tables? Any help is appreciated.
  13. Normally when a new user chooses a password, the server sends a salt that the client will use to mix up the hash value. This helps to prevent rainbow table attacks. But I see another obvious vulnerability. If the protocol used is very simple, or if the client is open-source, a modified client can skip the password hashing process and send this sniffed value to log in as that user. I'm sure that this isn't a problem when SSL is used, but it can be a problem with my project, which implements a Telnet-like protocol, but with password encryption added. What if the server sends the client two different salts each time the user logs in: the original salt used when registering, and a second one that changes each time the user logs in? Is this method used commonly in games? It seems like a nice addition, but how much more secure do you think this would make it?
  14. The title is somewhat explanatory. I know how to build matrices for all of the common transformations (translation, rotation around a fixed or arbitrary axis, scaling) and how to multiply matrices. Now that I'm writing some code for a [very] simple 3D engine, I'm not sure how to use this knowledge. Let's say I have two classes: camera and object. A camera has the properties: position and rotation (yaw, pitch, roll). An object has the properties: position, rotation, and scale. Each of these properties can be represented as a 3-part vector of floating point values. I'm completely stumped on how to use this information to properly build a model/view matrix. I've played around with the order of transformations a bit, but I have so far only ended up with weird, distorted geometry and blank screens. I've been googling unsuccessfully, as I'm not even sure which keywords to search for. Is there a guide on this topic somewhere that you can point me to? Or an obvious solution that will make me question my intelligence? Any help is appreciated. Camera - World coordinates (x, y, z) - Rotation (yaw, pitch, roll) Object - World coordinates (x, y, z) - Rotation (yaw, pitch, roll again?) - Scaling (x, y, z)
  15. I'm currently having trouble figuring out which order to apply matrix transformations in. My camera object has position (translation) and rotation properties, while my mesh instances have position, rotation and scale properties. I've always been told to multiply matrices in the order: scale, rotate, then translate. In this case, since I want to scale only the mesh, and not the coordinate system in general, I would scale last instead. But there's still a problem. Translating after rotating seems to translate based on the direction of the camera/mesh, which is not what I want, and rotating after translating seems to rotate around the origin [0,0,0], rather the position of the mesh. Is there a simple way to apply the properties of my camera and mesh instances with these properties, or do I need to completely rethink things? Any help is appreciated. EDIT: After a few more minutes of googling, I found the solution. Transforming the matrix using (A = B * A), rather than (A = A * , applies the transformation from the origin.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!