Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: ww2- on August 19, 2006, 02:03:57 PM

Title: How to interpret .rej files?
Post by: ww2- on August 19, 2006, 02:03:57 PM
I'm trying to compile my own build with scroll acceleration patch, using a August 14th source (I understand that the August 15th build introduced changes too big for the patch to work properly).

The problem is I don't know the right way to make the changes indicated in reject files. Ok, lines with a '+' sign in front of them have to added to the source, and lines with a '-' sign in front of them have to be removed. But in what part of the source code should I make the addition or removal?

When trying to apply the scroll acceleration patch, for instance, I get the following errors:

Code: [Select]
Hunk #1 FAILED at 563.
(...) -- saving rejects to file apps/settings.c.rej

The settings.c.rej file:

Code: [Select]
***************
*** 563,568 ****
      {1, S_O(warnon_erase_dynplaylist), false,
          "warn when erasing dynamic playlist", off_on },
 
      /* If values are just added to the end, no need to bump the version. */
      /* new stuff to be added at the end */
 
--- 563,573 ----
      {1, S_O(warnon_erase_dynplaylist), false,
          "warn when erasing dynamic playlist", off_on },
 
+ #if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI)
+     {9, S_O(ipod_scroll_wheel_acceleration_fast), 55, "ipod scroll wheel fast threshold in clicks/sec", NULL }, /* 0...511 */
+     {9, S_O(ipod_scroll_wheel_acceleration_faster), 110, "ipod scroll wheel faster threshold in clicks/sec", NULL }, /* 0...511 */
+     {9, S_O(ipod_scroll_wheel_acceleration_fastest), 165, "ipod scroll wheel fastest threshold in clicks/sec", NULL }, /* 0...511 */
+ #endif   
      /* If values are just added to the end, no need to bump the version. */
      /* new stuff to be added at the end */

I (erroneously) suppose the first block of code (line 563 to 568) is what the patcher found, and the second block (line 563 to 573) is how it should actually be. So, pursuing this logic, I open the settings.c file to add the changes, and here are the contents of line 563 to 568:

Code: [Select]
    {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
    {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
#endif

#ifdef HAVE_DIRCACHE
    {1, S_O(dircache), false, "dircache", off_on },

Seems to be totally unrelated, so I use the text editor to find the "{1, S_O(warnon_erase_dynplaylist), false," part. It is actually in line 579 of settings.c. What should I do?

I was unable to find any info on how to proceed in making the necessary alterations indicated in a .rej file or even on how to read (interpret) such a file. Can you please clarify this to me?
Title: Re: How to interpret .rej files?
Post by: ryran on August 19, 2006, 04:02:30 PM
You got it pretty close.

The thing is, when that patch was made '{1, S_O(warnon_erase_dynplaylist), false,' WAS at line 563; however, it no longer is (there have been bagazillions of changes to the source since TP made that patch), so patch wasn't really sure how to proceed. This is a simple one though--you can fix it by just inserting the + code, minus the plus and the additional space
Code: [Select]
#if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI)
    {9, S_O(ipod_scroll_wheel_acceleration_fast), 55, "ipod scroll wheel fast threshold in clicks/sec", NULL }, /* 0...511 */
    {9, S_O(ipod_scroll_wheel_acceleration_faster), 110, "ipod scroll wheel faster threshold in clicks/sec", NULL }, /* 0...511 */
    {9, S_O(ipod_scroll_wheel_acceleration_fastest), 165, "ipod scroll wheel fastest threshold in clicks/sec", NULL }, /* 0...511 */
right before the '/* If values' blahblahblah line.

Also, this might be a good time to note: if you've already used the scroll acceleration patch and like me, found the defaults a little too crazy aggressive, these are the lines you can modify to change them (the defaults).
Title: Re: How to interpret .rej files?
Post by: ww2- on August 19, 2006, 04:48:33 PM
Thanks for answering =)

So, I suppose it's just a question of finding one or more references that are in both the .rej file and the source, then inserting the extra code without messing up any of the structure.

But how did you figure out that the block of code was to be inserted just before the
Code: [Select]
/* If values (...) part, and not anywhere (anywhere that doesn't compromise the code structure, I mean) between
Code: [Select]
{1, S_O(warnon_erase_dynplaylist), false (...) and
Code: [Select]
/* If values (...)?

Would it work if I just inserted the extra code right after
Code: [Select]
     {1, S_O(warnon_erase_dynplaylist), false (...)?
Title: Re: How to interpret .rej files?
Post by: ww2- on August 19, 2006, 07:44:50 PM
Anyway, I just compiled a build with several patches (scroll acceleration, quick menu exit, auto pause and usb connection) and everything worked fine. Did the necessary edits based on the .rej files and that part seems a lot more intuitive now. Thanks for your help.
Title: Re: How to interpret .rej files?
Post by: ryran on August 19, 2006, 07:50:47 PM
Awesome! Congrats! :)

Oh and to answer your last question: yes it would work fine. It's easier to just add it to the end of that section though, as in, by searching for that ending text.
Title: Re: How to interpret .rej files?
Post by: asterix2112 on August 24, 2006, 04:18:01 PM
Which scroll acceleration patch are you using?

Thanks, - John
Title: Re: How to interpret .rej files?
Post by: ryran on August 24, 2006, 06:21:27 PM
Uhhh... he was using TPD's. http://rockbox.org/tracker/task/5594