Keka_Umans
New Member
@jlutz555 looks like the last .sbf doesn't work i tried about 15 times on two computers. at the moment i'm unrooted/droidless(serviceing) so it may take awhile depending on how slow verizon wants to be this month
@jlutz555 looks like the last .sbf doesn't work i tried about 15 times on two computers. at the moment i'm unrooted/droidless(serviceing) so it may take awhile depending on how slow verizon wants to be this month
Here's the latest...electronics just seem to hate me sometimes
Try these two...Here's an image for one of the geniuses here...
might be a stupid question but the hex code on the end of the CG42.smg...whats it for? andf what could happen if you changed it? does anybody have a bootlooder only .sbf or .zip whichever is necessary...i would like a clean start so to speak, but would prefer not to have to go back to stock/unrooted and re-update/re-root
@jlutz555 no need to hold onto that file...i may not get a chance to try again for a couple days and i gave you the wrong pirate she wanted one with a hat and peg leg
That is too funny!WIFE'S PHONE: MOTOROLA DROID2 - unrooted (she won't let me touch it) :sad:
#!/usr/local/bin/perl
# MotoCache1 - take 480 x 182, 24 bit BMP file and make it into a CG42 code group
#
# Syntax:
# MakeCG42FromBMP.pl filename.bmp [/noclip] [/nomirror] [/noflip]
#
# Ordinarily the BMP file needs to have the first 54 bytes removed (clip),
# the image needs to be mirrored (mirror), the image needs to be flipped (flip),
# and 64 bytes of 0xFF needs to be padded to the end (pad). If any of these
# steps have already been done to the supplied file, use the appropriate
# switch to tell script not to do it again.
#
use strict;
my $file = shift(@ARGV);
my %switches = map {lc($_)=>1} @ARGV;
print "\nMakeCG42FromBMP v.2.0 - MotoCache1\n\n";
if (not -e $file) {
print "Make Droid1 CG42 from a 480 x 182, 24 bit BMP file.\n\n";
print "Syntax: MakeCG42FromBMP.pl filename.bmp [/noclip] [/nomirror] [/noflip]\n\n";
print " /noclip - first 54 bytes of BMP already removed, don't do it\n";
print " /nomirror - image already mirrored (or you want it to appear backwards)\n";
print " /noflip - image already flipped (or you want it to appear upside down)\n\n";
exit;
}
print "Processing $file...\n\n";
# The most likely source of trouble would be if the input file isn't right, so we're going
# to spend some code to make sure it is, and try to give useful messages if it is not.
# Fle size check
if ($switches{'/noclip'}) {
# File should be 262080 bytes
if (-s $file == 262134) {
print "You specified the /noclip switch, but your file is 262134 bytes which means\n";
print "it needs to be clipped. Cannot continue.\n\n";
exit;
} elsif (-s $file != 262080) {
print "You specified the /noclip switch. A file that has already been clipped should\n";
print "be 262080 bytes, but the your file is " . (-s $file) . " Cannot continue.\n\n";
exit;
} else {
# File is good for /noclip - nothing special to do
}
} else {
# File should be 262134 bytes
if (-s $file == 262080) {
print "You did not specify the /noclip switch, but your file is 262080 bytes which means\n";
print "it should not be clipped. Cannot continue.\n\n";
exit;
} elsif (-s $file != 262134) {
print "An appropriate 480 x 182, 24 bit BMP should be 262134 bytes. Your file is \n";
print (-s $file) . " bytes. Cannot continue.\n\n";
exit;
} else {
# File is good
}
}
print " File $file is correct size (262134 bytes).\n";
# Open source file and read in binary mode
open (IN,$file) or die ("Can't open $file for input. Error: $!");
binmode IN;
# Open target file and write in binary mode
open (OUT,">$file.CG42.smg") or die ("Can't open $file.CG42.smg for output. Error: $!");
binmode OUT;
my ($imageData,$bytesRead);
if (not $switches{'/noclip'}) {
print " Clipping...\n";
$bytesRead = read(IN,$imageData,54); # clip
}
# Read image data
$bytesRead = read(IN,$imageData,262080);
close IN;
if ($bytesRead == 262080) {
print " Read 262080 image bytes.\n";
} else {
die ("\nFailed to read 262080 image bytes. Cannot continue.");
}
unless ($switches{'/nomirror'}) {
print " Mirroring...\n";
$imageData = mirrorImage(3,480,182,\$imageData);
}
unless ($switches{'/noflip'}) {
print " Flipping...\n";
$imageData = reverse(split(//,$imageData));
}
print " Padding...\n";
$imageData .= "\xFF" x 64;
print " Writing output file $file.CG42.smg...\n";
print OUT $imageData;
close OUT;
print "\nDone!\n\n";
sub mirrorImage {
my $bytesPerPx = shift;
my $widthPx = shift;
my $heightPx = shift;
my $imageRef = shift; # Reference to scalar holding image
my $lineBytes = $bytesPerPx * $widthPx;
my @array = unpack("(a$lineBytes)$heightPx", $$imageRef);
for (my $row=0; $row <= ($heightPx-1); $row++) {
$array[$row] = pack("(a$bytesPerPx)$widthPx",reverse(unpack("(a$bytesPerPx)$widthPx", $array[$row])));
}
$$imageRef = pack("(a$lineBytes)$heightPx",@array);
}
This is progressing great and many thanks for all of your hard work and passion! Question, does the Droid X use the same 480x182 image size? Will this program change work correctly for the X?
Thanks,
Swiss