Review your favorite Linux distribution.
Go Back > Blogs > MrCode
User Name


This is the first "blog" of any kind I've ever had, so it's probably not the greatest...

Just a little snippet about me:

I'd like to consider myself relatively tech-savvy; obviously I use Linux (Arch to be precise; K.I.S.S. FTW), and I enjoy learning new things about computers in general (both software and hardware-related).

This blog is mostly just for whenever I feel like telling the world about my experiences with computers/Linux (or just life in general), or just posting for the hell of it.
Rate this Entry

My first "FOSS hack"

Posted 02-04-2011 at 04:16 AM by MrCode
Updated 02-04-2011 at 04:17 AM by MrCode

I was mildly annoyed at the fact that LTris only lets you choose between 50, 100, 200, and no limit (as many frames as the system can render at a time) as FPS options, so I took the liberty of changing:

switch ( config.fps ) {
    case 1: fps_delay = 20; break;
    case 2: fps_delay = 10; break;
    case 3: fps_delay = 5; break;

switch ( config.fps ) {
    case 1: fps_delay = 17; break;
    case 2: fps_delay = 10; break;
    case 3: fps_delay = 5; break;
in tetris.c, and building it up from source into a custom package (I'm really liking the Arch Build System right now ):

$ makepkg -o #extract source without building

[do tweaks]

$ makepkg -e #build from ./src dir, without extracting from source archive
# pacman -U ltris-1.0.14-1-i686.pkg.tar.xz
I even changed the menu entry to fit the change:

in manager.c:
char *str_fps[] = { _("No Limit"), _("50 FPS"), _("100 FPS"), _("200 FPS") ,};
char *str_fps[] = { _("No Limit"), _("~60 FPS"), _("100 FPS"), _("200 FPS") ,};
I say "~60" because the timer is in milliseconds, 1000/60 = 16.(6)*, and fps_delay is an int, so I couldn't use the exact value (this might be why 50 FPS is given as the lower option instead of 60 ). But hey, 17 is probably a good-enough approximation, and I think it works well, even if it isn't in perfect vsync.

I guess you could say this is my first "hack" on a piece of open-source software. Yeah, so it merely consisted of changing the value of a variable assignment and the contents of a character string (i.e. no real structural changes ), but at least I took the time to do it...

Do I get my FOSS geek cred now?

(* - "16.(6)" means "sixteen point six repeating", or "16.66666666...".)
Views 886 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 10:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration