code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
#import "CPTestCase.h" @class CPXYGraph; @interface CPXYPlotSpaceTests : CPTestCase { CPXYGraph *graph; } @property (retain,readwrite) CPXYGraph *graph; @end
08iteng-ipad
framework/Source/CPXYPlotSpaceTests.h
Objective-C
bsd
167
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> /** @category NSDecimalNumber(CPExtensions) * @brief Core Plot extensions to NSDecimalNumber. **/ @interface NSDecimalNumber(CPExtensions) -(CGFloat)floatValue; @end
08iteng-ipad
framework/Source/NSDecimalNumberExtensions.h
Objective-C
bsd
239
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> /// @file /** * @brief Enumeration of numeric types **/ typedef enum _CPNumericType { CPNumericTypeInteger, ///< Integer CPNumericTypeFloat, ///< Float CPNumericTypeDouble ///< Double } CPNumericType; /** * @brief Enumeration of error bar types **/ typedef enum _CPErrorBarType { CPErrorBarTypeCustom, ///< Custom error bars CPErrorBarTypeConstantRatio, ///< Constant ratio error bars CPErrorBarTypeConstantValue ///< Constant value error bars } CPErrorBarType; /** * @brief Enumeration of axis scale types **/ typedef enum _CPScaleType { CPScaleTypeLinear, ///< Linear axis scale CPScaleTypeLogN, ///< Log base <i>n</i> axis scale CPScaleTypeLog10, ///< Log base 10 axis scale CPScaleTypeAngular, ///< Angular axis scale CPScaleTypeDateTime, ///< Date/time axis scale CPScaleTypeCategory ///< Category axis scale } CPScaleType; /** * @brief Enumeration of axis coordinates **/ typedef enum _CPCoordinate { CPCoordinateX = 0, ///< X axis CPCoordinateY = 1, ///< Y axis CPCoordinateZ = 2 ///< Z axis } CPCoordinate; /** * @brief RGBA color for gradients **/ typedef struct _CPRGBAColor { CGFloat red; ///< The red component (0 ≤ red ≤ 1). CGFloat green; ///< The green component (0 ≤ green ≤ 1). CGFloat blue; ///< The blue component (0 ≤ blue ≤ 1). CGFloat alpha; ///< The alpha component (0 ≤ alpha ≤ 1). } CPRGBAColor; /** * @brief Enumeration of label positioning offset directions **/ typedef enum _CPSign { CPSignNone = 0, ///< No offset CPSignPositive = +1, ///< Positive offset CPSignNegative = -1 ///< Negative offset } CPSign; /** * @brief Enumeration of constraint types used in spring and strut model. **/ typedef enum _CPConstraint { CPConstraintNone, ///< No constraint. Free movement, equivalent to "spring". CPConstraintFixed ///< Distance is fixed. Equivalent to a "strut". } CPConstraint; /** * @brief Constraints for a relative position. **/ typedef struct _CPConstraints { CPConstraint lower; ///< The constraint on the lower range. CPConstraint upper; ///< The constraint on the upper range. } CPConstraints; /** * @brief Locations around the edge of a rectangle. **/ typedef enum _CPRectAnchor { CPRectAnchorBottomLeft, ///< The bottom left corner CPRectAnchorBottom, ///< The bottom center CPRectAnchorBottomRight, ///< The bottom right corner CPRectAnchorLeft, ///< The left middle CPRectAnchorRight, ///< The right middle CPRectAnchorTopLeft, ///< The top left corner CPRectAnchorTop, ///< The top center CPRectAnchorTopRight, ///< The top right CPRectAnchorCenter ///< The center of the rect } CPRectAnchor; /** * @brief Label and constraint alignment constants. **/ typedef enum _CPAlignment { CPAlignmentLeft, ///< Align horizontally to the left side. CPAlignmentCenter, ///< Align horizontally to the center. CPAlignmentRight, ///< Align horizontally to the right side. CPAlignmentTop, ///< Align vertically to the top. CPAlignmentMiddle, ///< Align vertically to the middle. CPAlignmentBottom ///< Align vertically to the bottom. } CPAlignment; /// @name Default Z Positions /// @{ extern const CGFloat CPDefaultZPositionAxis; extern const CGFloat CPDefaultZPositionAxisSet; extern const CGFloat CPDefaultZPositionGraph; extern const CGFloat CPDefaultZPositionPlot; extern const CGFloat CPDefaultZPositionPlotArea; extern const CGFloat CPDefaultZPositionPlotAreaFrame; extern const CGFloat CPDefaultZPositionPlotGroup; /// @}
08iteng-ipad
framework/Source/CPDefinitions.h
Objective-C
bsd
3,634
#import <Foundation/Foundation.h> #import "CPPlotSpace.h" @interface CPPolarPlotSpace : CPPlotSpace { } @end
08iteng-ipad
framework/Source/CPPolarPlotSpace.h
Objective-C
bsd
117
#import "CPPlotSpaceAnnotation.h" #import "CPPlotSpace.h" #import "CPPlotAreaFrame.h" #import "CPPlotArea.h" /** @brief Positions a content layer relative to some anchor point in a plot space. * @todo More documentation needed. **/ @implementation CPPlotSpaceAnnotation /** @property anchorPlotPoint * @brief An array of NSDecimalNumbers giving the anchor plot coordinates. **/ @synthesize anchorPlotPoint; /** @property plotSpace * @brief The plot space which the anchor is defined in. **/ @synthesize plotSpace; #pragma mark - #pragma mark Init/Dealloc /** @brief Initializes a newly allocated CPPlotSpaceAnnotation object. * * This is the designated initializer. The initialized layer will be anchored to * a point in plot coordinates. * * @param newPlotSpace The plot space which the anchor is defined in. * @param newPlotPoint An array of NSDecimalNumbers giving the anchor plot coordinates. * @return The initialized CPPlotSpaceAnnotation object. **/ -(id)initWithPlotSpace:(CPPlotSpace *)newPlotSpace anchorPlotPoint:(NSArray *)newPlotPoint { if ( self = [super init] ) { plotSpace = [newPlotSpace retain]; anchorPlotPoint = [newPlotPoint copy]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(positionContentLayer) name:CPPlotSpaceCoordinateMappingDidChangeNotification object:plotSpace]; } return self; } -(void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [plotSpace release]; [anchorPlotPoint release]; [super dealloc]; } #pragma mark - #pragma mark Layout -(void)positionContentLayer { CPLayer *content = self.contentLayer; if ( content ) { CPLayer *hostLayer = self.annotationHostLayer; if ( hostLayer ) { NSArray *plotAnchor = self.anchorPlotPoint; if ( plotAnchor ) { NSUInteger anchorCount = plotAnchor.count; CGFloat myRotation = self.rotation; CGPoint anchor = self.contentAnchorPoint; // Get plot area point NSDecimal *decimalPoint = malloc(sizeof(NSDecimal) * anchorCount); for ( NSUInteger i = 0; i < anchorCount; i++ ) { decimalPoint[i] = [[plotAnchor objectAtIndex:i] decimalValue]; } CPPlotSpace *thePlotSpace = self.plotSpace; CGPoint plotAreaViewAnchorPoint = [thePlotSpace plotAreaViewPointForPlotPoint:decimalPoint]; free(decimalPoint); CPPlotArea *plotArea = thePlotSpace.graph.plotAreaFrame.plotArea; CGPoint newPosition = [plotArea convertPoint:plotAreaViewAnchorPoint toLayer:hostLayer]; CGPoint offset = self.displacement; newPosition.x = round(newPosition.x + offset.x); newPosition.y = round(newPosition.y + offset.y); // Pixel-align the label layer to prevent blurriness if ( myRotation == 0.0 ) { CGSize currentSize = content.bounds.size; newPosition.x = newPosition.x - round(currentSize.width * anchor.x) + (currentSize.width * anchor.x); newPosition.y = newPosition.y - round(currentSize.height * anchor.y) + (currentSize.height * anchor.y); } content.anchorPoint = anchor; content.position = newPosition; content.transform = CATransform3DMakeRotation(myRotation, 0.0, 0.0, 1.0); [content setNeedsDisplay]; } } } } #pragma mark - #pragma mark Accessors -(void)setAnchorPlotPoint:(NSArray *)newPlotPoint { if ( anchorPlotPoint != newPlotPoint ) { [anchorPlotPoint release]; anchorPlotPoint = [newPlotPoint copy]; [self positionContentLayer]; } } @end
08iteng-ipad
framework/Source/CPPlotSpaceAnnotation.m
Objective-C
bsd
3,473
#import "CPXYGraph.h" @interface CPDerivedXYGraph : CPXYGraph { } @end
08iteng-ipad
framework/Source/CPDerivedXYGraph.h
Objective-C
bsd
74
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @class CPColor; @interface CPLineStyle : NSObject <NSCopying, NSMutableCopying> { @private CGLineCap lineCap; // CGLineDash lineDash; // We should make a struct to keep this information CGLineJoin lineJoin; CGFloat miterLimit; CGFloat lineWidth; NSArray *dashPattern; CGFloat patternPhase; // StrokePattern; // We should make a struct to keep this information CPColor *lineColor; } @property (nonatomic, readonly, assign) CGLineCap lineCap; @property (nonatomic, readonly, assign) CGLineJoin lineJoin; @property (nonatomic, readonly, assign) CGFloat miterLimit; @property (nonatomic, readonly, assign) CGFloat lineWidth; @property (nonatomic, readonly, retain) NSArray *dashPattern; @property (nonatomic, readonly, assign) CGFloat patternPhase; @property (nonatomic, readonly, retain) CPColor *lineColor; /// @name Factory Methods /// @{ +(id)lineStyle; /// @} /// @name Drawing /// @{ -(void)setLineStyleInContext:(CGContextRef)theContext; /// @} @end
08iteng-ipad
framework/Source/CPLineStyle.h
Objective-C
bsd
1,038
#import "CPTestCase.h" @interface CPNumericDataTests : CPTestCase { } @end
08iteng-ipad
framework/Source/CPNumericDataTests.h
Objective-C
bsd
79
#import "CPDataSourceTestCase.h" #import "CPExceptions.h" #import "CPScatterPlot.h" #import "CPPlotRange.h" #import "CPUtilities.h" const CGFloat CPDataSourceTestCasePlotOffset = 0.5; /** @cond */ @interface CPDataSourceTestCase () -(CPPlotRange *)plotRangeForData:(NSArray *)dataArray; @end /** @endcond */ @implementation CPDataSourceTestCase @synthesize xData; @synthesize yData; @synthesize nRecords; @synthesize xRange; @synthesize yRange; @synthesize plots; -(void)dealloc { self.plots = nil; [super dealloc]; } -(void)setUp { //check CPDataSource conformance STAssertTrue([self conformsToProtocol:@protocol(CPPlotDataSource)], @"CPDataSourceTestCase should conform to <CPPlotDataSource>"); } -(void)tearDown { self.xData = nil; self.yData = nil; [[self plots] removeAllObjects]; } -(void)buildData { NSMutableArray *arr = [NSMutableArray arrayWithCapacity:self.nRecords]; for ( NSUInteger i=0; i < self.nRecords; i++ ) { [arr insertObject:[NSDecimalNumber numberWithUnsignedInteger:i] atIndex:i]; } self.xData = arr; arr = [NSMutableArray arrayWithCapacity:self.nRecords]; for ( NSUInteger i=0; i < self.nRecords; i++ ) { [arr insertObject:[NSDecimalNumber numberWithFloat:sin(2*M_PI*(float)i/(float)nRecords)] atIndex:i]; } self.yData = arr; } -(void)addPlot:(CPPlot *)newPlot { if ( nil == self.plots ) { self.plots = [NSMutableArray array]; } [[self plots] addObject:newPlot]; } -(CPPlotRange *)xRange { [self buildData]; return [self plotRangeForData:self.xData]; } -(CPPlotRange *)yRange { [self buildData]; CPPlotRange *range = [self plotRangeForData:self.yData]; if ( self.plots.count > 1 ) { range.length = CPDecimalAdd([range length], CPDecimalFromDouble(self.plots.count)); } return range; } -(CPPlotRange *)plotRangeForData:(NSArray *)dataArray { double min = [[dataArray valueForKeyPath:@"@min.doubleValue"] doubleValue]; double max = [[dataArray valueForKeyPath:@"@max.doubleValue"] doubleValue]; double range = max-min; return [CPPlotRange plotRangeWithLocation:CPDecimalFromDouble(min - 0.05*range) length:CPDecimalFromDouble(range + 0.1*range)]; } #pragma mark - #pragma mark Plot Data Source Methods -(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot { return self.nRecords; } -(NSArray *)numbersForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange { NSArray *result; switch ( fieldEnum ) { case CPScatterPlotFieldX: result = [[self xData] objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; break; case CPScatterPlotFieldY: result = [[self yData] objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; if ( self.plots.count > 1 ) { STAssertTrue([[self plots] containsObject:plot], @"Plot missing"); NSMutableArray *shiftedResult = [NSMutableArray arrayWithCapacity:result.count]; for ( NSDecimalNumber *d in result ) { [shiftedResult addObject:[d decimalNumberByAdding:[NSDecimalNumber decimalNumberWithDecimal:CPDecimalFromDouble(CPDataSourceTestCasePlotOffset * ([[self plots] indexOfObject:plot]+1))]]]; } result = shiftedResult; } break; default: [NSException raise:CPDataException format:@"Unexpected fieldEnum"]; } return result; } @end
08iteng-ipad
framework/Source/CPDataSourceTestCase.m
Objective-C
bsd
3,669
#import "CPNumericDataTypeConversionPerformanceTests.h" #import "CPNumericData.h" #import "CPNumericData+TypeConversion.h" #import <mach/mach_time.h> static const size_t numberOfSamples = 10000000; static const NSUInteger numberOfReps = 5; @implementation CPNumericDataTypeConversionPerformanceTests -(void)testFloatToDoubleConversion { NSMutableData *data = [[NSMutableData alloc] initWithLength:numberOfSamples * sizeof(float)]; float *samples = (float *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPNumericData *floatNumericData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(float), CFByteOrderGetCurrent()) shape:nil]; [data release]; mach_timebase_info_data_t time_base_info; mach_timebase_info(&time_base_info); NSUInteger iterations = 0; uint64_t elapsed = 0; for ( NSUInteger i = 0; i < numberOfReps; i++ ) { uint64_t start = mach_absolute_time(); CPNumericData *doubleNumericData = [floatNumericData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:CFByteOrderGetCurrent()]; uint64_t now = mach_absolute_time(); elapsed += now - start; [[doubleNumericData retain] release]; iterations++; } double avgTime = 1.0e-6 * (double)(elapsed * time_base_info.numer / time_base_info.denom) / iterations; STFail(@"Avg. time = %g ms for %lu points.", avgTime, (unsigned long)numberOfSamples); [floatNumericData release]; } -(void)testDoubleToFloatConversion { NSMutableData *data = [[NSMutableData alloc] initWithLength:numberOfSamples * sizeof(double)]; double *samples = (double *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPNumericData *doubleNumericData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; [data release]; mach_timebase_info_data_t time_base_info; mach_timebase_info(&time_base_info); NSUInteger iterations = 0; uint64_t elapsed = 0; for ( NSUInteger i = 0; i < numberOfReps; i++ ) { uint64_t start = mach_absolute_time(); CPNumericData *floatNumericData = [doubleNumericData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(float) byteOrder:CFByteOrderGetCurrent()]; uint64_t now = mach_absolute_time(); elapsed += now - start; [[floatNumericData retain] release]; iterations++; } double avgTime = 1.0e-6 * (double)(elapsed * time_base_info.numer / time_base_info.denom) / iterations; STFail(@"Avg. time = %g ms for %lu points.", avgTime, (unsigned long)numberOfSamples); [doubleNumericData release]; } -(void)testIntegerToDoubleConversion { NSMutableData *data = [[NSMutableData alloc] initWithLength:numberOfSamples * sizeof(NSInteger)]; NSInteger *samples = (NSInteger *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i) * 1000.0; } CPNumericData *integerNumericData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPIntegerDataType, sizeof(NSInteger), CFByteOrderGetCurrent()) shape:nil]; [data release]; mach_timebase_info_data_t time_base_info; mach_timebase_info(&time_base_info); NSUInteger iterations = 0; uint64_t elapsed = 0; for ( NSUInteger i = 0; i < numberOfReps; i++ ) { uint64_t start = mach_absolute_time(); CPNumericData *doubleNumericData = [integerNumericData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:CFByteOrderGetCurrent()]; uint64_t now = mach_absolute_time(); elapsed += now - start; [[doubleNumericData retain] release]; iterations++; } double avgTime = 1.0e-6 * (double)(elapsed * time_base_info.numer / time_base_info.denom) / iterations; STFail(@"Avg. time = %g ms for %lu points.", avgTime, (unsigned long)numberOfSamples); [integerNumericData release]; } -(void)testDoubleToIntegerConversion { NSMutableData *data = [[NSMutableData alloc] initWithLength:numberOfSamples * sizeof(double)]; double *samples = (double *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i) * 1000.0; } CPNumericData *doubleNumericData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; [data release]; mach_timebase_info_data_t time_base_info; mach_timebase_info(&time_base_info); NSUInteger iterations = 0; uint64_t elapsed = 0; for ( NSUInteger i = 0; i < numberOfReps; i++ ) { uint64_t start = mach_absolute_time(); CPNumericData *integerNumericData = [doubleNumericData dataByConvertingToType:CPIntegerDataType sampleBytes:sizeof(NSInteger) byteOrder:CFByteOrderGetCurrent()]; uint64_t now = mach_absolute_time(); elapsed += now - start; [[integerNumericData retain] release]; iterations++; } double avgTime = 1.0e-6 * (double)(elapsed * time_base_info.numer / time_base_info.denom) / iterations; STFail(@"Avg. time = %g ms for %lu points.", avgTime, (unsigned long)numberOfSamples); [doubleNumericData release]; } @end
08iteng-ipad
framework/Source/CPNumericDataTypeConversionPerformanceTests.m
Objective-C
bsd
5,387
#import "CPDefinitions.h" #import "CPLineStyle.h" #import "CPUtilities.h" #import "CPXYAxis.h" #import "CPXYAxisSet.h" /** @brief A set of cartesian (X-Y) axes. **/ @implementation CPXYAxisSet /** @property xAxis * @brief The x-axis. **/ @dynamic xAxis; /** @property yAxis * @brief The y-axis. **/ @dynamic yAxis; #pragma mark - #pragma mark Init/Dealloc -(id)initWithFrame:(CGRect)newFrame { if ( self = [super initWithFrame:newFrame] ) { CPXYAxis *xAxis = [(CPXYAxis *)[CPXYAxis alloc] initWithFrame:newFrame]; xAxis.coordinate = CPCoordinateX; xAxis.tickDirection = CPSignNegative; CPXYAxis *yAxis = [(CPXYAxis *)[CPXYAxis alloc] initWithFrame:newFrame]; yAxis.coordinate = CPCoordinateY; yAxis.tickDirection = CPSignNegative; self.axes = [NSArray arrayWithObjects:xAxis, yAxis, nil]; [xAxis release]; [yAxis release]; } return self; } #pragma mark - #pragma mark Drawing -(void)renderAsVectorInContext:(CGContextRef)context { if ( self.borderLineStyle ) { [super renderAsVectorInContext:context]; CALayer *superlayer = self.superlayer; CGRect borderRect = CPAlignRectToUserSpace(context, [self convertRect:superlayer.bounds fromLayer:superlayer]); [self.borderLineStyle setLineStyleInContext:context]; CGContextStrokeRect(context, borderRect); } } #pragma mark - #pragma mark Accessors -(CPXYAxis *)xAxis { return [self.axes objectAtIndex:CPCoordinateX]; } -(CPXYAxis *)yAxis { return [self.axes objectAtIndex:CPCoordinateY]; } @end
08iteng-ipad
framework/Source/CPXYAxisSet.m
Objective-C
bsd
1,524
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> /** @brief Defines a layer layout manager. All methods are optional. **/ @protocol CPLayoutManager <NSObject> @optional /** @brief Invalidates the layout of a layer. * @param layer The layer that requires layout. * * This method is called when the preferred size of the layer may have changed. * The receiver should invalidate any cached state. **/ -(void)invalidateLayoutOfLayer:(CALayer *)layer; /** @brief Layout each sublayer of the given layer. * @param layer The layer whose sublayers require layout. * * The receiver should set the frame of each sublayer that requires layout. **/ -(void)layoutSublayersOfLayer:(CALayer *)layer; /** @brief Returns the preferred size of a layer in its coordinate system. * @param layer The layer that requires layout. * @return The preferred size of the layer. * * If this method is not implemented the preferred size is assumed to be the size of the bounds of <code>layer</code>. **/ -(CGSize)preferredSizeOfLayer:(CALayer *)layer; /** @brief Returns the minimum size of a layer in its coordinate system. * @param layer The layer that requires layout. * @return The minimum size of the layer. * * If this method is not implemented the minimum size is assumed to be (0, 0). **/ -(CGSize)minimumSizeOfLayer:(CALayer *)layer; /** @brief Returns the maximum size of a layer in its coordinate system. * @param layer The layer that requires layout. * @return The maximum size of the layer. * * If this method is not implemented the maximum size is assumed to be the size of the bounds of <code>layer</code>'s superlayer. **/ -(CGSize)maximumSizeOfLayer:(CALayer *)layer; @end
08iteng-ipad
framework/Source/CPLayoutManager.h
Objective-C
bsd
1,714
#import <Foundation/Foundation.h> /** @brief The basis of all event processing in Core Plot. **/ @protocol CPResponder <NSObject> /// @name User Interaction /// @{ /** @brief Informs the receiver that the user has pressed the mouse button (Mac OS) or touched the screen (iPhone OS). * @param event The OS event. * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ -(BOOL)pointingDeviceDownEvent:(id)event atPoint:(CGPoint)interactionPoint; /** @brief Informs the receiver that the user has released the mouse button (Mac OS) or lifted their finger off the screen (iPhone OS). * @param event The OS event. * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ -(BOOL)pointingDeviceUpEvent:(id)event atPoint:(CGPoint)interactionPoint; /** @brief Informs the receiver that the user has moved the mouse with the button pressed (Mac OS) or moved their finger while touching the screen (iPhone OS). * @param event The OS event. * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ -(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint; /** @brief Informs the receiver that tracking of mouse moves (Mac OS) or touches (iPhone OS) has been cancelled for any reason. * @param event The OS event. * @return Whether the event was handled or not. **/ -(BOOL)pointingDeviceCancelledEvent:(id)event; /// @} @end
08iteng-ipad
framework/Source/CPResponder.h
Objective-C
bsd
1,532
#import <Foundation/Foundation.h> /** @category NSNumber(CPExtensions) * @brief Core Plot extensions to NSNumber. **/ @interface NSNumber(CPExtensions) -(NSDecimalNumber *)decimalNumber; @end
08iteng-ipad
framework/Source/NSNumberExtensions.h
Objective-C
bsd
198
#import <Foundation/Foundation.h> #import "CPLineStyle.h" @class CPColor; @interface CPMutableLineStyle : CPLineStyle { } @property (nonatomic, readwrite, assign) CGLineCap lineCap; @property (nonatomic, readwrite, assign) CGLineJoin lineJoin; @property (nonatomic, readwrite, assign) CGFloat miterLimit; @property (nonatomic, readwrite, assign) CGFloat lineWidth; @property (nonatomic, readwrite, retain) NSArray *dashPattern; @property (nonatomic, readwrite, assign) CGFloat patternPhase; @property (nonatomic, readwrite, retain) CPColor *lineColor; @end
08iteng-ipad
framework/Source/CPMutableLineStyle.h
Objective-C
bsd
563
#import <Foundation/Foundation.h> #import "CPFill.h" @class CPGradient; @interface _CPFillGradient : CPFill <NSCopying, NSCoding> { @private CPGradient *fillGradient; } /// @name Initialization /// @{ -(id)initWithGradient:(CPGradient *)aGradient; /// @} /// @name Drawing /// @{ -(void)fillRect:(CGRect)theRect inContext:(CGContextRef)theContext; -(void)fillPathInContext:(CGContextRef)theContext; /// @} @end
08iteng-ipad
framework/Source/_CPFillGradient.h
Objective-C
bsd
419
#import "CPDefinitions.h" const CGFloat CPDefaultZPositionAxis = 0; ///< Default Z position for CPAxis. const CGFloat CPDefaultZPositionAxisSet = 0; ///< Default Z position for CPAxisSet. const CGFloat CPDefaultZPositionGraph = 0; ///< Default Z position for CPGraph. const CGFloat CPDefaultZPositionPlot = 0; ///< Default Z position for CPPlot. const CGFloat CPDefaultZPositionPlotArea = 0; ///< Default Z position for CPPlotArea. const CGFloat CPDefaultZPositionPlotAreaFrame = 0; ///< Default Z position for CPPlotAreaFrame. const CGFloat CPDefaultZPositionPlotGroup = 0; ///< Default Z position for CPPlotGroup.
08iteng-ipad
framework/Source/CPDefinitions.m
Objective-C
bsd
627
#import "CPAxisLabel.h" #import "CPConstrainedPosition.h" #import "CPDefinitions.h" #import "CPExceptions.h" #import "CPFill.h" #import "CPLimitBand.h" #import "CPLineStyle.h" #import "CPPlotArea.h" #import "CPPlotRange.h" #import "CPPlotSpace.h" #import "CPUtilities.h" #import "CPXYAxis.h" #import "CPXYPlotSpace.h" /** @cond */ @interface CPXYAxis () @property (readwrite, retain) CPConstrainedPosition *constrainedPosition; -(void)drawTicksInContext:(CGContextRef)theContext atLocations:(NSSet *)locations withLength:(CGFloat)length isMajor:(BOOL)major; -(void)orthogonalCoordinateViewLowerBound:(CGFloat *)lower upperBound:(CGFloat *)upper; -(CGPoint)viewPointForOrthogonalCoordinateDecimal:(NSDecimal)orthogonalCoord axisCoordinateDecimal:(NSDecimal)coordinateDecimalNumber; -(void)updateConstraints; @end /** @endcond */ #pragma mark - /** @brief A 2-dimensional cartesian (X-Y) axis class. **/ @implementation CPXYAxis /** @property orthogonalCoordinateDecimal * @brief The data coordinate value where the axis crosses the orthogonal axis. **/ @synthesize orthogonalCoordinateDecimal; /** @property constraints * @brief The constraints used when positioning relative to the plot area. * For axes fixed in the plot coordinate system, this is ignored. **/ @synthesize constraints; /** @property isFloatingAxis * @brief True if the axis floats independent of the plot space. * If false, the axis is fixed relative to the plot space coordinates, and moves * whenever the plot space ranges change. * When true, the axis must be constrained relative to the plot area, in view coordinates. * The default value is NO, meaning the axis is positioned in plot coordinates. **/ @synthesize isFloatingAxis; @synthesize constrainedPosition; #pragma mark - #pragma mark Init/Dealloc -(id)initWithFrame:(CGRect)newFrame { if ( self = [super initWithFrame:newFrame] ) { CPConstraints newConstraints = {CPConstraintNone, CPConstraintNone}; orthogonalCoordinateDecimal = [[NSDecimalNumber zero] decimalValue]; isFloatingAxis = NO; self.constraints = newConstraints; self.tickDirection = CPSignNone; } return self; } -(id)initWithLayer:(id)layer { if ( self = [super initWithLayer:layer] ) { CPXYAxis *theLayer = (CPXYAxis *)layer; isFloatingAxis = theLayer->isFloatingAxis; orthogonalCoordinateDecimal = theLayer->orthogonalCoordinateDecimal; constraints = theLayer->constraints; constrainedPosition = [theLayer->constrainedPosition retain]; } return self; } -(void)dealloc { [constrainedPosition release]; [super dealloc]; } #pragma mark - #pragma mark Coordinate Transforms -(void)orthogonalCoordinateViewLowerBound:(CGFloat *)lower upperBound:(CGFloat *)upper { NSDecimal zero = CPDecimalFromInteger(0); CPCoordinate orthogonalCoordinate = (self.coordinate == CPCoordinateX ? CPCoordinateY : CPCoordinateX); CPXYPlotSpace *xyPlotSpace = (CPXYPlotSpace *)self.plotSpace; CPPlotRange *orthogonalRange = [xyPlotSpace plotRangeForCoordinate:orthogonalCoordinate]; NSAssert( orthogonalRange != nil, @"The orthogonalRange was nil in orthogonalCoordinateViewLowerBound:upperBound:" ); CGPoint lowerBoundPoint = [self viewPointForOrthogonalCoordinateDecimal:orthogonalRange.location axisCoordinateDecimal:zero]; CGPoint upperBoundPoint = [self viewPointForOrthogonalCoordinateDecimal:orthogonalRange.end axisCoordinateDecimal:zero]; *lower = (self.coordinate == CPCoordinateX ? lowerBoundPoint.y : lowerBoundPoint.x); *upper = (self.coordinate == CPCoordinateX ? upperBoundPoint.y : upperBoundPoint.x); } -(CGPoint)viewPointForOrthogonalCoordinateDecimal:(NSDecimal)orthogonalCoord axisCoordinateDecimal:(NSDecimal)coordinateDecimalNumber { CPCoordinate orthogonalCoordinate = (self.coordinate == CPCoordinateX ? CPCoordinateY : CPCoordinateX); NSDecimal plotPoint[2]; plotPoint[self.coordinate] = coordinateDecimalNumber; plotPoint[orthogonalCoordinate] = orthogonalCoord; CGPoint point = [self convertPoint:[self.plotSpace plotAreaViewPointForPlotPoint:plotPoint] fromLayer:self.plotArea]; return point; } -(CGPoint)viewPointForCoordinateDecimalNumber:(NSDecimal)coordinateDecimalNumber { CGPoint point = [self viewPointForOrthogonalCoordinateDecimal:self.orthogonalCoordinateDecimal axisCoordinateDecimal:coordinateDecimalNumber]; if ( self.isFloatingAxis ) { if ( self.constrainedPosition ) { CGFloat lb, ub; [self orthogonalCoordinateViewLowerBound:&lb upperBound:&ub]; constrainedPosition.lowerBound = lb; constrainedPosition.upperBound = ub; CGFloat position = constrainedPosition.position; if ( self.coordinate == CPCoordinateX ) { point.y = position; } else { point.x = position; } } else { [NSException raise:CPException format:@"Plot area relative positioning requires a CPConstrainedPosition"]; } } return point; } #pragma mark - #pragma mark Drawing -(void)drawTicksInContext:(CGContextRef)theContext atLocations:(NSSet *)locations withLength:(CGFloat)length isMajor:(BOOL)major { CPLineStyle *lineStyle = (major ? self.majorTickLineStyle : self.minorTickLineStyle); if ( !lineStyle ) return; [lineStyle setLineStyleInContext:theContext]; CGContextBeginPath(theContext); for ( NSDecimalNumber *tickLocation in locations ) { // Tick end points CGPoint baseViewPoint = [self viewPointForCoordinateDecimalNumber:[tickLocation decimalValue]]; CGPoint startViewPoint = baseViewPoint; CGPoint endViewPoint = baseViewPoint; CGFloat startFactor = 0.0; CGFloat endFactor = 0.0; switch ( self.tickDirection ) { case CPSignPositive: endFactor = 1.0; break; case CPSignNegative: endFactor = -1.0; break; case CPSignNone: startFactor = -0.5; endFactor = 0.5; break; default: NSLog(@"Invalid sign in [CPXYAxis drawTicksInContext:]"); } switch ( self.coordinate ) { case CPCoordinateX: startViewPoint.y += length * startFactor; endViewPoint.y += length * endFactor; break; case CPCoordinateY: startViewPoint.x += length * startFactor; endViewPoint.x += length * endFactor; break; default: NSLog(@"Invalid coordinate in [CPXYAxis drawTicksInContext:]"); } startViewPoint = CPAlignPointToUserSpace(theContext, startViewPoint); endViewPoint = CPAlignPointToUserSpace(theContext, endViewPoint); // Add tick line CGContextMoveToPoint(theContext, startViewPoint.x, startViewPoint.y); CGContextAddLineToPoint(theContext, endViewPoint.x, endViewPoint.y); } // Stroke tick line CGContextStrokePath(theContext); } -(void)renderAsVectorInContext:(CGContextRef)theContext { [super renderAsVectorInContext:theContext]; [self relabel]; // Ticks [self drawTicksInContext:theContext atLocations:self.minorTickLocations withLength:self.minorTickLength isMajor:NO]; [self drawTicksInContext:theContext atLocations:self.majorTickLocations withLength:self.majorTickLength isMajor:YES]; // Axis Line if ( self.axisLineStyle ) { CPPlotRange *range = [[self.plotSpace plotRangeForCoordinate:self.coordinate] copy]; if ( self.visibleRange ) { [range intersectionPlotRange:self.visibleRange]; } CGPoint startViewPoint = CPAlignPointToUserSpace(theContext, [self viewPointForCoordinateDecimalNumber:range.location]); CGPoint endViewPoint = CPAlignPointToUserSpace(theContext, [self viewPointForCoordinateDecimalNumber:range.end]); [self.axisLineStyle setLineStyleInContext:theContext]; CGContextBeginPath(theContext); CGContextMoveToPoint(theContext, startViewPoint.x, startViewPoint.y); CGContextAddLineToPoint(theContext, endViewPoint.x, endViewPoint.y); CGContextStrokePath(theContext); [range release]; } } #pragma mark - #pragma mark Grid Lines -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major { CPLineStyle *lineStyle = (major ? self.majorGridLineStyle : self.minorGridLineStyle); if ( lineStyle ) { [super renderAsVectorInContext:context]; [self relabel]; CPPlotSpace *thePlotSpace = self.plotSpace; NSSet *locations = (major ? self.majorTickLocations : self.minorTickLocations); CPCoordinate selfCoordinate = self.coordinate; CPCoordinate orthogonalCoordinate = (selfCoordinate == CPCoordinateX ? CPCoordinateY : CPCoordinateX); CPPlotRange *orthogonalRange = [[thePlotSpace plotRangeForCoordinate:orthogonalCoordinate] copy]; CPPlotRange *theGridLineRange = self.gridLinesRange; if ( theGridLineRange ) { [orthogonalRange intersectionPlotRange:theGridLineRange]; } CPPlotArea *thePlotArea = self.plotArea; NSDecimal startPlotPoint[2]; NSDecimal endPlotPoint[2]; startPlotPoint[orthogonalCoordinate] = orthogonalRange.location; endPlotPoint[orthogonalCoordinate] = orthogonalRange.end; CGContextBeginPath(context); for ( NSDecimalNumber *location in locations ) { startPlotPoint[selfCoordinate] = endPlotPoint[selfCoordinate] = [location decimalValue]; // Start point CGPoint startViewPoint = [self convertPoint:[thePlotSpace plotAreaViewPointForPlotPoint:startPlotPoint] fromLayer:thePlotArea]; // End point CGPoint endViewPoint = [self convertPoint:[thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint] fromLayer:thePlotArea]; // Align to pixels startViewPoint = CPAlignPointToUserSpace(context, startViewPoint); endViewPoint = CPAlignPointToUserSpace(context, endViewPoint); // Add grid line CGContextMoveToPoint(context, startViewPoint.x, startViewPoint.y); CGContextAddLineToPoint(context, endViewPoint.x, endViewPoint.y); } // Stroke grid lines [lineStyle setLineStyleInContext:context]; CGContextStrokePath(context); [orthogonalRange release]; } } #pragma mark - #pragma mark Background Bands -(void)drawBackgroundBandsInContext:(CGContextRef)context { NSArray *bandArray = self.alternatingBandFills; NSUInteger bandCount = bandArray.count; if ( bandCount > 0 ) { NSArray *locations = [self.majorTickLocations allObjects]; if ( locations.count > 0 ) { CPPlotSpace *thePlotSpace = self.plotSpace; CPCoordinate selfCoordinate = self.coordinate; CPPlotRange *range = [[thePlotSpace plotRangeForCoordinate:selfCoordinate] copy]; if ( range ) { CPPlotRange *theVisibleRange = self.visibleRange; if ( theVisibleRange ) { [range intersectionPlotRange:theVisibleRange]; } } CPCoordinate orthogonalCoordinate = (selfCoordinate == CPCoordinateX ? CPCoordinateY : CPCoordinateX); CPPlotRange *orthogonalRange = [[thePlotSpace plotRangeForCoordinate:orthogonalCoordinate] copy]; CPPlotRange *theGridLineRange = self.gridLinesRange; if ( theGridLineRange ) { [orthogonalRange intersectionPlotRange:theGridLineRange]; } NSDecimal zero = CPDecimalFromInteger(0); NSSortDescriptor *sortDescriptor = nil; if ( CPDecimalGreaterThanOrEqualTo(range.length, zero) ) { sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES]; } else { sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:NO]; } locations = [locations sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]]; [sortDescriptor release]; NSUInteger bandIndex = 0; id null = [NSNull null]; NSDecimal lastLocation = range.location; NSDecimal startPlotPoint[2]; NSDecimal endPlotPoint[2]; startPlotPoint[orthogonalCoordinate] = orthogonalRange.location; endPlotPoint[orthogonalCoordinate] = orthogonalRange.end; for ( NSDecimalNumber *location in locations ) { NSDecimal currentLocation = [location decimalValue]; if ( !CPDecimalEquals(CPDecimalSubtract(currentLocation, lastLocation), zero) ) { CPFill *bandFill = [bandArray objectAtIndex:bandIndex++]; bandIndex %= bandCount; if ( bandFill != null ) { // Start point startPlotPoint[selfCoordinate] = currentLocation; CGPoint startViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:startPlotPoint]; // End point endPlotPoint[selfCoordinate] = lastLocation; CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint]; // Fill band CGRect fillRect = CGRectMake(MIN(startViewPoint.x, endViewPoint.x), MIN(startViewPoint.y, endViewPoint.y), ABS(endViewPoint.x - startViewPoint.x), ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPAlignRectToUserSpace(context, fillRect) inContext:context]; } } lastLocation = currentLocation; } // Fill space between last location and the range end if ( !CPDecimalEquals(lastLocation, range.end) ) { CPFill *bandFill = [bandArray objectAtIndex:bandIndex]; if ( bandFill != null ) { // Start point startPlotPoint[selfCoordinate] = range.end; CGPoint startViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:startPlotPoint]; // End point endPlotPoint[selfCoordinate] = lastLocation; CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint]; // Fill band CGRect fillRect = CGRectMake(MIN(startViewPoint.x, endViewPoint.x), MIN(startViewPoint.y, endViewPoint.y), ABS(endViewPoint.x - startViewPoint.x), ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPAlignRectToUserSpace(context, fillRect) inContext:context]; } } [range release]; [orthogonalRange release]; } } } -(void)drawBackgroundLimitsInContext:(CGContextRef)context { NSArray *limitArray = self.backgroundLimitBands; if ( limitArray.count > 0 ) { CPPlotSpace *thePlotSpace = self.plotSpace; CPCoordinate selfCoordinate = self.coordinate; CPPlotRange *range = [[thePlotSpace plotRangeForCoordinate:selfCoordinate] copy]; if ( range ) { CPPlotRange *theVisibleRange = self.visibleRange; if ( theVisibleRange ) { [range intersectionPlotRange:theVisibleRange]; } } CPCoordinate orthogonalCoordinate = (selfCoordinate == CPCoordinateX ? CPCoordinateY : CPCoordinateX); CPPlotRange *orthogonalRange = [[thePlotSpace plotRangeForCoordinate:orthogonalCoordinate] copy]; CPPlotRange *theGridLineRange = self.gridLinesRange; if ( theGridLineRange ) { [orthogonalRange intersectionPlotRange:theGridLineRange]; } NSDecimal startPlotPoint[2]; NSDecimal endPlotPoint[2]; startPlotPoint[orthogonalCoordinate] = orthogonalRange.location; endPlotPoint[orthogonalCoordinate] = orthogonalRange.end; for ( CPLimitBand *band in self.backgroundLimitBands ) { CPFill *bandFill = band.fill; if ( bandFill ) { CPPlotRange *bandRange = [band.range copy]; if ( bandRange ) { [bandRange intersectionPlotRange:range]; // Start point startPlotPoint[selfCoordinate] = bandRange.location; CGPoint startViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:startPlotPoint]; // End point endPlotPoint[selfCoordinate] = bandRange.end; CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint]; // Fill band CGRect fillRect = CGRectMake(MIN(startViewPoint.x, endViewPoint.x), MIN(startViewPoint.y, endViewPoint.y), ABS(endViewPoint.x - startViewPoint.x), ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPAlignRectToUserSpace(context, fillRect) inContext:context]; [bandRange release]; } } } [range release]; [orthogonalRange release]; } } #pragma mark - #pragma mark Description -(NSString *)description { CPPlotRange *range = [self.plotSpace plotRangeForCoordinate:self.coordinate]; CGPoint startViewPoint = [self viewPointForCoordinateDecimalNumber:range.location]; CGPoint endViewPoint = [self viewPointForCoordinateDecimalNumber:range.end]; return [NSString stringWithFormat:@"<%@ with range: %@ viewCoordinates: %@ to %@>", [super description], range, CPStringFromPoint(startViewPoint), CPStringFromPoint(endViewPoint)]; }; #pragma mark - #pragma mark Titles // Center title in the plot range by default -(NSDecimal)defaultTitleLocation { CPPlotRange *axisRange = [self.plotSpace plotRangeForCoordinate:self.coordinate]; if ( axisRange ) { return CPDecimalDivide(CPDecimalAdd(axisRange.location, axisRange.end), CPDecimalFromDouble(2.0)); } else { return CPDecimalFromInteger(0); } } #pragma mark - #pragma mark Constraints -(void)updateConstraints { if ( self.plotSpace ) { CGPoint axisPoint = [self viewPointForOrthogonalCoordinateDecimal:self.orthogonalCoordinateDecimal axisCoordinateDecimal:CPDecimalFromInteger(0)]; CGFloat position = (self.coordinate == CPCoordinateX ? axisPoint.y : axisPoint.x); CGFloat lb, ub; [self orthogonalCoordinateViewLowerBound:&lb upperBound:&ub]; CPConstrainedPosition *cp = [[CPConstrainedPosition alloc] initWithPosition:position lowerBound:lb upperBound:ub]; cp.constraints = self.constraints; self.constrainedPosition = cp; [cp release]; } else { self.constrainedPosition = nil; } } #pragma mark - #pragma mark Accessors -(void)setConstraints:(CPConstraints)newConstraints { constraints = newConstraints; [self updateConstraints]; } -(void)setOrthogonalCoordinateDecimal:(NSDecimal)newCoord { orthogonalCoordinateDecimal = newCoord; [self updateConstraints]; } -(void)setCoordinate:(CPCoordinate)newCoordinate { if ( self.coordinate != newCoordinate ) { [super setCoordinate:newCoordinate]; switch ( newCoordinate ) { case CPCoordinateX: switch ( self.labelAlignment ) { case CPAlignmentLeft: case CPAlignmentCenter: case CPAlignmentRight: // ok--do nothing break; default: self.labelAlignment = CPAlignmentCenter; break; } break; case CPCoordinateY: switch ( self.labelAlignment ) { case CPAlignmentTop: case CPAlignmentMiddle: case CPAlignmentBottom: // ok--do nothing break; default: self.labelAlignment = CPAlignmentMiddle; break; } break; default: [NSException raise:NSInvalidArgumentException format:@"Invalid coordinate: %lu", newCoordinate]; break; } } } @end
08iteng-ipad
framework/Source/CPXYAxis.m
Objective-C
bsd
18,632
#import "CPTestCase.h" @interface CPMutableNumericDataTests : CPTestCase { } @end
08iteng-ipad
framework/Source/CPMutableNumericDataTests.h
Objective-C
bsd
86
#import <Foundation/Foundation.h> @class CPPlotRange; @class CPFill; @interface CPLimitBand : NSObject <NSCoding, NSCopying> { @private CPPlotRange *range; CPFill *fill; } @property (nonatomic, readwrite, retain) CPPlotRange *range; @property (nonatomic, readwrite, retain) CPFill *fill; +(CPLimitBand *)limitBandWithRange:(CPPlotRange *)newRange fill:(CPFill *)newFill; -(id)initWithRange:(CPPlotRange *)newRange fill:(CPFill *)newFill; @end
08iteng-ipad
framework/Source/CPLimitBand.h
Objective-C
bsd
451
#import <Foundation/Foundation.h> #import "CPDefinitions.h" /// @file /** @brief Enumeration of possible results of a plot range comparison. **/ typedef enum _CPPlotRangeComparisonResult { CPPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. CPPlotRangeComparisonResultNumberInRange, ///< Number is in the range. CPPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. } CPPlotRangeComparisonResult; @interface CPPlotRange : NSObject <NSCoding, NSCopying> { @private NSDecimal location; NSDecimal length; double locationDouble; double lengthDouble; } /// @name Range Limits /// @{ @property (nonatomic, readwrite) NSDecimal location; @property (nonatomic, readwrite) NSDecimal length; @property (nonatomic, readonly) NSDecimal end; @property (nonatomic, readonly) double locationDouble; @property (nonatomic, readonly) double lengthDouble; @property (nonatomic, readonly) double endDouble; @property (nonatomic, readonly) NSDecimal minLimit; @property (nonatomic, readonly) NSDecimal midPoint; @property (nonatomic, readonly) NSDecimal maxLimit; @property (nonatomic, readonly) double minLimitDouble; @property (nonatomic, readonly) double midPointDouble; @property (nonatomic, readonly) double maxLimitDouble; /// @} /// @name Factory Methods /// @{ +(CPPlotRange *)plotRangeWithLocation:(NSDecimal)loc length:(NSDecimal)len; /// @} /// @name Initialization /// @{ -(id)initWithLocation:(NSDecimal)loc length:(NSDecimal)len; /// @} /// @name Checking Ranges /// @{ -(BOOL)contains:(NSDecimal)number; -(BOOL)containsDouble:(double)number; -(BOOL)isEqualToRange:(CPPlotRange *)otherRange; /// @} /// @name Combining Ranges /// @{ -(void)unionPlotRange:(CPPlotRange *)otherRange; -(void)intersectionPlotRange:(CPPlotRange *)otherRange; /// @} /// @name Shifting Ranges /// @{ -(void)shiftLocationToFitInRange:(CPPlotRange *)otherRange; -(void)shiftEndToFitInRange:(CPPlotRange *)otherRange; /// @} /// @name Expanding/Contracting Ranges /// @{ -(void)expandRangeByFactor:(NSDecimal)factor; /// @} /// @name Range Comparison /// @{ -(CPPlotRangeComparisonResult)compareToNumber:(NSNumber *)number; -(CPPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number; -(CPPlotRangeComparisonResult)compareToDouble:(double)number; /// @} @end
08iteng-ipad
framework/Source/CPPlotRange.h
Objective-C
bsd
2,315
#import <Foundation/Foundation.h> #import "CPAnnotation.h" #import "CPConstrainedPosition.h" @interface CPLayerAnnotation : CPAnnotation { @private __weak CPLayer *anchorLayer; CPConstrainedPosition *xConstrainedPosition; CPConstrainedPosition *yConstrainedPosition; CPRectAnchor rectAnchor; } @property (nonatomic, readonly, assign) __weak CPLayer *anchorLayer; @property (nonatomic, readwrite, assign) CPRectAnchor rectAnchor; -(id)initWithAnchorLayer:(CPLayer *)anchorLayer; @end
08iteng-ipad
framework/Source/CPLayerAnnotation.h
Objective-C
bsd
497
#import "CPNumericData+TypeConversion.h" #import "CPUtilities.h" #import "complex.h" @implementation CPNumericData(TypeConversion) /** @brief Copies the current numeric data and converts the data to a new data type. * @param newDataType The new data type format. * @param newSampleBytes The number of bytes used to store each sample. * @param newByteOrder The new byte order. * @return A copy of the current numeric data converted to the new data type. **/ -(CPNumericData *)dataByConvertingToType:(CPDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder { return [self dataByConvertingToDataType:CPDataType(newDataType, newSampleBytes, newByteOrder)]; } /** @brief Copies the current numeric data and converts the data to a new data type. * @param newDataType The new data type. * @return A copy of the current numeric data converted to the new data type. **/ -(CPNumericData *)dataByConvertingToDataType:(CPNumericDataType)newDataType { CPNumericDataType myDataType = self.dataType; NSParameterAssert(myDataType.dataTypeFormat != CPUndefinedDataType); NSParameterAssert(myDataType.byteOrder != CFByteOrderUnknown); NSParameterAssert(CPDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPUndefinedDataType); NSParameterAssert(newDataType.byteOrder != CFByteOrderUnknown); NSData *newData = nil; CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); if ( (myDataType.dataTypeFormat == newDataType.dataTypeFormat) && (myDataType.sampleBytes == newDataType.sampleBytes) && (myDataType.byteOrder == newDataType.byteOrder) ) { newData = [self.data retain]; } else if ( (myDataType.sampleBytes == sizeof(int8_t)) && (newDataType.sampleBytes == sizeof(int8_t)) ) { newData = [self.data retain]; } else { NSUInteger sampleCount = self.data.length / myDataType.sampleBytes; newData = [[NSMutableData alloc] initWithLength:(sampleCount * newDataType.sampleBytes)]; NSData *sourceData = nil; if ( myDataType.byteOrder != hostByteOrder ) { sourceData = [self.data mutableCopy]; [self swapByteOrderForData:(NSMutableData *)sourceData sampleSize:myDataType.sampleBytes]; } else { sourceData = [self.data retain]; } [self convertData:sourceData dataType:&myDataType toData:(NSMutableData *)newData dataType:&newDataType]; [sourceData release]; if ( newDataType.byteOrder != hostByteOrder ) { [self swapByteOrderForData:(NSMutableData *)newData sampleSize:newDataType.sampleBytes]; } } CPNumericData *result = [CPNumericData numericDataWithData:newData dataType:newDataType shape:self.shape]; [newData release]; return result; } #pragma mark - #pragma mark Data conversion utilites /** @brief Copies a data buffer and converts the data to a new data type without changing the byte order. * * The data is assumed to be in host byte order and no byte order conversion is performed. * @param sourceData The source data buffer. * @param sourceDataType The data type of the source. * @param destData The destination data buffer. * @param destDataType The new data type. **/ -(void)convertData:(NSData *)sourceData dataType:(CPNumericDataType *)sourceDataType toData:(NSMutableData *)destData dataType:(CPNumericDataType *)destDataType { NSUInteger sampleCount = sourceData.length / sourceDataType->sampleBytes; // Code generated with "CPNumericData+TypeConversions_Generation.py" // ======================================================================== switch ( sourceDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( sourceDataType->sampleBytes ) { case sizeof(int8_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int8_t -> int8_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int8_t)); } break; case sizeof(int16_t): { // int8_t -> int16_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // int8_t -> int32_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // int8_t -> int64_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // int8_t -> uint8_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // int8_t -> uint16_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // int8_t -> uint32_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // int8_t -> uint64_t const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // int8_t -> float const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // int8_t -> double const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // int8_t -> float complex const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // int8_t -> double complex const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // int8_t -> NSDecimal const int8_t *fromBytes = (int8_t *)sourceData.bytes; const int8_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromChar(*fromBytes++); } break; } break; } break; case sizeof(int16_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int16_t -> int8_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // int16_t -> int16_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int16_t)); } break; case sizeof(int32_t): { // int16_t -> int32_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // int16_t -> int64_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // int16_t -> uint8_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // int16_t -> uint16_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // int16_t -> uint32_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // int16_t -> uint64_t const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // int16_t -> float const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // int16_t -> double const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // int16_t -> float complex const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // int16_t -> double complex const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // int16_t -> NSDecimal const int16_t *fromBytes = (int16_t *)sourceData.bytes; const int16_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromShort(*fromBytes++); } break; } break; } break; case sizeof(int32_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int32_t -> int8_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // int32_t -> int16_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // int32_t -> int32_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int32_t)); } break; case sizeof(int64_t): { // int32_t -> int64_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // int32_t -> uint8_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // int32_t -> uint16_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // int32_t -> uint32_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // int32_t -> uint64_t const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // int32_t -> float const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // int32_t -> double const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // int32_t -> float complex const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // int32_t -> double complex const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // int32_t -> NSDecimal const int32_t *fromBytes = (int32_t *)sourceData.bytes; const int32_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromLong(*fromBytes++); } break; } break; } break; case sizeof(int64_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int64_t -> int8_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // int64_t -> int16_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // int64_t -> int32_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // int64_t -> int64_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int64_t)); } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // int64_t -> uint8_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // int64_t -> uint16_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // int64_t -> uint32_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // int64_t -> uint64_t const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // int64_t -> float const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // int64_t -> double const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // int64_t -> float complex const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // int64_t -> double complex const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // int64_t -> NSDecimal const int64_t *fromBytes = (int64_t *)sourceData.bytes; const int64_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromLongLong(*fromBytes++); } break; } break; } break; } break; case CPUnsignedIntegerDataType: switch ( sourceDataType->sampleBytes ) { case sizeof(uint8_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // uint8_t -> int8_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // uint8_t -> int16_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // uint8_t -> int32_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // uint8_t -> int64_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint8_t -> uint8_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint8_t)); } break; case sizeof(uint16_t): { // uint8_t -> uint16_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // uint8_t -> uint32_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // uint8_t -> uint64_t const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // uint8_t -> float const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // uint8_t -> double const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // uint8_t -> float complex const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // uint8_t -> double complex const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // uint8_t -> NSDecimal const uint8_t *fromBytes = (uint8_t *)sourceData.bytes; const uint8_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromUnsignedChar(*fromBytes++); } break; } break; } break; case sizeof(uint16_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // uint16_t -> int8_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // uint16_t -> int16_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // uint16_t -> int32_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // uint16_t -> int64_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint16_t -> uint8_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // uint16_t -> uint16_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint16_t)); } break; case sizeof(uint32_t): { // uint16_t -> uint32_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // uint16_t -> uint64_t const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // uint16_t -> float const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // uint16_t -> double const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // uint16_t -> float complex const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // uint16_t -> double complex const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // uint16_t -> NSDecimal const uint16_t *fromBytes = (uint16_t *)sourceData.bytes; const uint16_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromUnsignedShort(*fromBytes++); } break; } break; } break; case sizeof(uint32_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // uint32_t -> int8_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // uint32_t -> int16_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // uint32_t -> int32_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // uint32_t -> int64_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint32_t -> uint8_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // uint32_t -> uint16_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // uint32_t -> uint32_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint32_t)); } break; case sizeof(uint64_t): { // uint32_t -> uint64_t const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // uint32_t -> float const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // uint32_t -> double const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // uint32_t -> float complex const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // uint32_t -> double complex const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // uint32_t -> NSDecimal const uint32_t *fromBytes = (uint32_t *)sourceData.bytes; const uint32_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromUnsignedLong(*fromBytes++); } break; } break; } break; case sizeof(uint64_t): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // uint64_t -> int8_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // uint64_t -> int16_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // uint64_t -> int32_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // uint64_t -> int64_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint64_t -> uint8_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // uint64_t -> uint16_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // uint64_t -> uint32_t const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // uint64_t -> uint64_t memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint64_t)); } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // uint64_t -> float const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // uint64_t -> double const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // uint64_t -> float complex const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // uint64_t -> double complex const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // uint64_t -> NSDecimal const uint64_t *fromBytes = (uint64_t *)sourceData.bytes; const uint64_t *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromUnsignedLongLong(*fromBytes++); } break; } break; } break; } break; case CPFloatingPointDataType: switch ( sourceDataType->sampleBytes ) { case sizeof(float): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // float -> int8_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // float -> int16_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // float -> int32_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // float -> int64_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // float -> uint8_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // float -> uint16_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // float -> uint32_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // float -> uint64_t const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // float -> float memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float)); } break; case sizeof(double): { // float -> double const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // float -> float complex const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // float -> double complex const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // float -> NSDecimal const float *fromBytes = (float *)sourceData.bytes; const float *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromFloat(*fromBytes++); } break; } break; } break; case sizeof(double): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // double -> int8_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // double -> int16_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // double -> int32_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // double -> int64_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // double -> uint8_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // double -> uint16_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // double -> uint32_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // double -> uint64_t const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // double -> float const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // double -> double memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double)); } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // double -> float complex const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // double -> double complex const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // double -> NSDecimal const double *fromBytes = (double *)sourceData.bytes; const double *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromDouble(*fromBytes++); } break; } break; } break; } break; case CPComplexFloatingPointDataType: switch ( sourceDataType->sampleBytes ) { case sizeof(float complex): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // float complex -> int8_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // float complex -> int16_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // float complex -> int32_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // float complex -> int64_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // float complex -> uint8_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // float complex -> uint16_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // float complex -> uint32_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // float complex -> uint64_t const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // float complex -> float const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // float complex -> double const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // float complex -> float complex memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float complex)); } break; case sizeof(double complex): { // float complex -> double complex const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double complex)*fromBytes++; } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // float complex -> NSDecimal const float complex *fromBytes = (float complex *)sourceData.bytes; const float complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromFloat(*fromBytes++); } break; } break; } break; case sizeof(double complex): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // double complex -> int8_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int8_t)*fromBytes++; } break; case sizeof(int16_t): { // double complex -> int16_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int16_t)*fromBytes++; } break; case sizeof(int32_t): { // double complex -> int32_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int32_t)*fromBytes++; } break; case sizeof(int64_t): { // double complex -> int64_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (int64_t)*fromBytes++; } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // double complex -> uint8_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint8_t)*fromBytes++; } break; case sizeof(uint16_t): { // double complex -> uint16_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint16_t)*fromBytes++; } break; case sizeof(uint32_t): { // double complex -> uint32_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint32_t)*fromBytes++; } break; case sizeof(uint64_t): { // double complex -> uint64_t const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (uint64_t)*fromBytes++; } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // double complex -> float const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float)*fromBytes++; } break; case sizeof(double): { // double complex -> double const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (double)*fromBytes++; } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // double complex -> float complex const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = (float complex)*fromBytes++; } break; case sizeof(double complex): { // double complex -> double complex memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double complex)); } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // double complex -> NSDecimal const double complex *fromBytes = (double complex *)sourceData.bytes; const double complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFromDouble(*fromBytes++); } break; } break; } break; } break; case CPDecimalDataType: switch ( sourceDataType->sampleBytes ) { case sizeof(NSDecimal): switch ( destDataType->dataTypeFormat ) { case CPUndefinedDataType: break; case CPIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // NSDecimal -> int8_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; int8_t *toBytes = (int8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalCharValue(*fromBytes++); } break; case sizeof(int16_t): { // NSDecimal -> int16_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; int16_t *toBytes = (int16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalShortValue(*fromBytes++); } break; case sizeof(int32_t): { // NSDecimal -> int32_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; int32_t *toBytes = (int32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalLongValue(*fromBytes++); } break; case sizeof(int64_t): { // NSDecimal -> int64_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; int64_t *toBytes = (int64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalLongLongValue(*fromBytes++); } break; } break; case CPUnsignedIntegerDataType: switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // NSDecimal -> uint8_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; uint8_t *toBytes = (uint8_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalUnsignedCharValue(*fromBytes++); } break; case sizeof(uint16_t): { // NSDecimal -> uint16_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; uint16_t *toBytes = (uint16_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalUnsignedShortValue(*fromBytes++); } break; case sizeof(uint32_t): { // NSDecimal -> uint32_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; uint32_t *toBytes = (uint32_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalUnsignedLongValue(*fromBytes++); } break; case sizeof(uint64_t): { // NSDecimal -> uint64_t const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; uint64_t *toBytes = (uint64_t *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalUnsignedLongLongValue(*fromBytes++); } break; } break; case CPFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float): { // NSDecimal -> float const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; float *toBytes = (float *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFloatValue(*fromBytes++); } break; case sizeof(double): { // NSDecimal -> double const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; double *toBytes = (double *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalDoubleValue(*fromBytes++); } break; } break; case CPComplexFloatingPointDataType: switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // NSDecimal -> float complex const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; float complex *toBytes = (float complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalFloatValue(*fromBytes++); } break; case sizeof(double complex): { // NSDecimal -> double complex const NSDecimal *fromBytes = (NSDecimal *)sourceData.bytes; const NSDecimal *lastSample = fromBytes + sampleCount; double complex *toBytes = (double complex *)destData.mutableBytes; while ( fromBytes < lastSample ) *toBytes++ = CPDecimalDoubleValue(*fromBytes++); } break; } break; case CPDecimalDataType: switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // NSDecimal -> NSDecimal memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(NSDecimal)); } break; } break; } break; } break; } // End of code generated with "CPNumericData+TypeConversions_Generation.py" // ======================================================================== } /** @brief Swaps the byte order for each sample stored in a data buffer. * @param sourceData The data buffer. * @param sampleSize The number of bytes in each sample stored in sourceData. **/ -(void)swapByteOrderForData:(NSMutableData *)sourceData sampleSize:(size_t)sampleSize { NSUInteger sampleCount; switch ( sampleSize ) { case sizeof(uint16_t): { uint16_t *samples = (uint16_t *)sourceData.mutableBytes; sampleCount = sourceData.length / sampleSize; uint16_t *lastSample = samples + sampleCount; while ( samples < lastSample ) { uint16_t swapped = CFSwapInt16(*samples); *samples++ = swapped; } } break; case sizeof(uint32_t): { uint32_t *samples = (uint32_t *)sourceData.mutableBytes; sampleCount = sourceData.length / sampleSize; uint32_t *lastSample = samples + sampleCount; while ( samples < lastSample ) { uint32_t swapped = CFSwapInt32(*samples); *samples++ = swapped; } } break; case sizeof(uint64_t): { uint64_t *samples = (uint64_t *)sourceData.mutableBytes; sampleCount = sourceData.length / sampleSize; uint64_t *lastSample = samples + sampleCount; while ( samples < lastSample ) { uint64_t swapped = CFSwapInt64(*samples); *samples++ = swapped; } } break; default: // do nothing break; } } @end
08iteng-ipad
framework/Source/CPNumericData+TypeConversion.m
Objective-C
bsd
72,472
#import "CPNumericDataTypeConversionTests.h" #import "CPNumericData.h" #import "CPNumericData+TypeConversion.h" #import "CPUtilities.h" static const NSUInteger numberOfSamples = 5; static const double precision = 1.0e-6; @implementation CPNumericDataTypeConversionTests -(void)testFloatToDoubleConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; float *samples = (float *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPNumericData *fd = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPNumericData *dd = [fd dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; [fd release]; const double *doubleSamples = (const double *)[dd.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEqualsWithAccuracy((double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", samples[i], doubleSamples[i]); } } -(void)testDoubleToFloatConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; double *samples = (double *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPNumericData *dd = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPNumericData *fd = [dd dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(float) byteOrder:NSHostByteOrder()]; [dd release]; const float *floatSamples = (const float *)[fd.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEqualsWithAccuracy((double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", floatSamples[i], samples[i]); } } -(void)testFloatToIntegerConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; float *samples = (float *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i) * 1000.0f; } CPNumericData *fd = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPNumericData *intData = [fd dataByConvertingToType:CPIntegerDataType sampleBytes:sizeof(NSInteger) byteOrder:NSHostByteOrder()]; [fd release]; const NSInteger *intSamples = (const NSInteger *)[intData.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEqualsWithAccuracy((NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", samples[i], (long)intSamples[i]); } } -(void)testIntegerToFloatConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSInteger)]; NSInteger *samples = (NSInteger *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i) * 1000.0; } CPNumericData *intData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; CPNumericData *fd = [intData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(float) byteOrder:NSHostByteOrder()]; [intData release]; const float *floatSamples = (const float *)[fd.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEqualsWithAccuracy(floatSamples[i], (float)samples[i], precision, @"(float)%g != (NSInteger)%ld", floatSamples[i], (long)samples[i]); } } -(void)testTypeConversionSwapsByteOrderInteger { CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); CFByteOrder swappedByteOrder = (hostByteOrder == CFByteOrderBigEndian) ? CFByteOrderLittleEndian : CFByteOrderBigEndian; uint32_t start = 1000; NSData *startData = [NSData dataWithBytesNoCopy:&start length:sizeof(uint32_t) freeWhenDone:NO]; CPNumericData *intData = [[CPNumericData alloc] initWithData:startData dataType:CPDataType(CPUnsignedIntegerDataType, sizeof(uint32_t), hostByteOrder) shape:nil]; CPNumericData *swappedData = [intData dataByConvertingToType:CPUnsignedIntegerDataType sampleBytes:sizeof(uint32_t) byteOrder:swappedByteOrder]; [intData release]; uint32_t end = *(const uint32_t *)swappedData.bytes; STAssertEquals(CFSwapInt32(start), end, @"Bytes swapped"); CPNumericData *roundTripData = [swappedData dataByConvertingToType:CPUnsignedIntegerDataType sampleBytes:sizeof(uint32_t) byteOrder:hostByteOrder]; uint32_t startRoundTrip = *(const uint32_t *)roundTripData.bytes; STAssertEquals(start, startRoundTrip, @"Round trip"); } -(void)testDecimalToDoubleConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSDecimal)]; NSDecimal *samples = (NSDecimal *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = CPDecimalFromDouble(sin(i)); } CPNumericData *decimalData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()) shape:nil]; CPNumericData *doubleData = [decimalData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; [decimalData release]; const double *doubleSamples = (const double *)[doubleData.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEquals(CPDecimalDoubleValue(samples[i]), doubleSamples[i], @"(NSDecimal)%@ != (double)%g", CPDecimalStringValue(samples[i]), doubleSamples[i]); } } -(void)testDoubleToDecimalConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; double *samples = (double *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPNumericData *doubleData = [[CPNumericData alloc] initWithData:data dataType:CPDataType(CPFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPNumericData *decimalData = [doubleData dataByConvertingToType:CPDecimalDataType sampleBytes:sizeof(NSDecimal) byteOrder:NSHostByteOrder()]; [doubleData release]; const NSDecimal *decimalSamples = (const NSDecimal *)[decimalData.data bytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertTrue(CPDecimalEquals(decimalSamples[i], CPDecimalFromDouble(samples[i])), @"(NSDecimal)%@ != (double)%g", CPDecimalStringValue(decimalSamples[i]), samples[i]); } } -(void)testTypeConversionSwapsByteOrderDouble { CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); CFByteOrder swappedByteOrder = (hostByteOrder == CFByteOrderBigEndian) ? CFByteOrderLittleEndian : CFByteOrderBigEndian; double start = 1000.0; NSData *startData = [NSData dataWithBytesNoCopy:&start length:sizeof(double) freeWhenDone:NO]; CPNumericData *doubleData = [[CPNumericData alloc] initWithData:startData dataType:CPDataType(CPFloatingPointDataType, sizeof(double), hostByteOrder) shape:nil]; CPNumericData *swappedData = [doubleData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:swappedByteOrder]; [doubleData release]; uint64_t end = *(const uint64_t *)swappedData.bytes; union swap { double v; CFSwappedFloat64 sv; } result; result.v = start; STAssertEquals(CFSwapInt64(result.sv.v), end, @"Bytes swapped"); CPNumericData *roundTripData = [swappedData dataByConvertingToType:CPFloatingPointDataType sampleBytes:sizeof(double) byteOrder:hostByteOrder]; double startRoundTrip = *(const double *)roundTripData.bytes; STAssertEquals(start, startRoundTrip, @"Round trip"); } -(void)testRoundTripToDoubleArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; double *samples = (double *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPNumericDataType theDataType = CPDataType(CPFloatingPointDataType, sizeof(double), NSHostByteOrder()); CPNumericData *doubleData = [[CPNumericData alloc] initWithData:data dataType:theDataType shape:nil]; NSArray *doubleArray = [doubleData sampleArray]; STAssertEquals(doubleArray.count, numberOfSamples, @"doubleArray size"); CPNumericData *roundTripData = [[CPNumericData alloc] initWithArray:doubleArray dataType:theDataType shape:nil]; STAssertEquals(roundTripData.numberOfSamples, numberOfSamples, @"roundTripData size"); const double *roundTrip = (const double *)roundTripData.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEquals(samples[i], roundTrip[i], @"Round trip"); } [doubleData release]; [roundTripData release]; } -(void)testRoundTripToIntegerArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSInteger)]; NSInteger *samples = (NSInteger *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i) * 1000.0; } CPNumericDataType theDataType = CPDataType(CPIntegerDataType, sizeof(NSInteger), NSHostByteOrder()); CPNumericData *intData = [[CPNumericData alloc] initWithData:data dataType:theDataType shape:nil]; NSArray *integerArray = [intData sampleArray]; STAssertEquals(integerArray.count, numberOfSamples, @"integerArray size"); CPNumericData *roundTripData = [[CPNumericData alloc] initWithArray:integerArray dataType:theDataType shape:nil]; STAssertEquals(roundTripData.numberOfSamples, numberOfSamples, @"roundTripData size"); const NSInteger *roundTrip = (const NSInteger *)roundTripData.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertEquals(samples[i], roundTrip[i], @"Round trip"); } [intData release]; [roundTripData release]; } -(void)testRoundTripToDecimalArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSDecimal)]; NSDecimal *samples = (NSDecimal *)[data mutableBytes]; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = CPDecimalFromDouble(sin(i)); } CPNumericDataType theDataType = CPDataType(CPDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()); CPNumericData *decimalData = [[CPNumericData alloc] initWithData:data dataType:theDataType shape:nil]; NSArray *decimalArray = [decimalData sampleArray]; STAssertEquals(decimalArray.count, numberOfSamples, @"doubleArray size"); CPNumericData *roundTripData = [[CPNumericData alloc] initWithArray:decimalArray dataType:theDataType shape:nil]; STAssertEquals(roundTripData.numberOfSamples, numberOfSamples, @"roundTripData size"); const NSDecimal *roundTrip = (const NSDecimal *)roundTripData.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { STAssertTrue(CPDecimalEquals(samples[i], roundTrip[i]), @"Round trip"); } [decimalData release]; [roundTripData release]; } @end
08iteng-ipad
framework/Source/CPNumericDataTypeConversionTests.m
Objective-C
bsd
11,766
#import <SenTestingKit/SenTestingKit.h> @interface CPTestCase : SenTestCase { } @end
08iteng-ipad
framework/Source/CPTestCase.h
Objective-C
bsd
90
#import "CPGraph.h" #import "CPExceptions.h" #import "CPPlot.h" #import "CPPlotArea.h" #import "CPPlotAreaFrame.h" #import "CPMutableTextStyle.h" #import "CPPlotSpace.h" #import "CPFill.h" #import "CPAxisSet.h" #import "CPAxis.h" #import "CPTheme.h" #import "CPLayerAnnotation.h" #import "CPTextLayer.h" NSString * const CPGraphNeedsRedrawNotification = @"CPGraphNeedsRedrawNotification"; /** @cond */ @interface CPGraph() @property (nonatomic, readwrite, retain) NSMutableArray *plots; @property (nonatomic, readwrite, retain) NSMutableArray *plotSpaces; @property (nonatomic, readwrite, retain) CPLayerAnnotation *titleAnnotation; -(void)plotSpaceMappingDidChange:(NSNotification *)notif; @end /** @endcond */ #pragma mark - /** @brief An abstract graph class. * @todo More documentation needed **/ @implementation CPGraph /** @property axisSet * @brief The axis set. **/ @dynamic axisSet; /** @property plotAreaFrame * @brief The plot area frame. **/ @synthesize plotAreaFrame; /** @property plots * @brief An array of all plots associated with the graph. **/ @synthesize plots; /** @property plotSpaces * @brief An array of all plot spaces associated with the graph. **/ @synthesize plotSpaces; /** @property defaultPlotSpace * @brief The default plot space. **/ @dynamic defaultPlotSpace; /** @property topDownLayerOrder * @brief An array of graph layers to be drawn in an order other than the default. * @see CPPlotArea#topDownLayerOrder **/ @dynamic topDownLayerOrder; /** @property title * @brief The title string. * Default is nil. **/ @synthesize title; /** @property titleTextStyle * @brief The text style of the title. **/ @synthesize titleTextStyle; /** @property titlePlotAreaFrameAnchor * @brief The location of the title with respect to the plot area frame. * Default is top center. **/ @synthesize titlePlotAreaFrameAnchor; /** @property titleDisplacement * @brief A vector giving the displacement of the title from the edge location. **/ @synthesize titleDisplacement; @synthesize titleAnnotation; #pragma mark - #pragma mark Init/Dealloc -(id)initWithFrame:(CGRect)newFrame { if ( self = [super initWithFrame:newFrame] ) { plots = [[NSMutableArray alloc] init]; // Margins self.paddingLeft = 20.0; self.paddingTop = 20.0; self.paddingRight = 20.0; self.paddingBottom = 20.0; // Plot area CPPlotAreaFrame *newArea = [(CPPlotAreaFrame *)[CPPlotAreaFrame alloc] initWithFrame:self.bounds]; self.plotAreaFrame = newArea; [newArea release]; // Plot spaces plotSpaces = [[NSMutableArray alloc] init]; CPPlotSpace *newPlotSpace = [self newPlotSpace]; [self addPlotSpace:newPlotSpace]; [newPlotSpace release]; // Axis set CPAxisSet *newAxisSet = [self newAxisSet]; self.axisSet = newAxisSet; [newAxisSet release]; // Title title = nil; titlePlotAreaFrameAnchor = CPRectAnchorTop; titleTextStyle = [[CPMutableTextStyle textStyle] retain]; titleDisplacement = CGPointZero; titleAnnotation = nil; self.needsDisplayOnBoundsChange = YES; } return self; } -(id)initWithLayer:(id)layer { if ( self = [super initWithLayer:layer] ) { CPGraph *theLayer = (CPGraph *)layer; plotAreaFrame = [theLayer->plotAreaFrame retain]; plots = [theLayer->plots retain]; plotSpaces = [theLayer->plotSpaces retain]; title = [theLayer->title retain]; titlePlotAreaFrameAnchor = theLayer->titlePlotAreaFrameAnchor; titleTextStyle = [theLayer->titleTextStyle retain]; titleDisplacement = theLayer->titleDisplacement; titleAnnotation = [theLayer->titleAnnotation retain]; } return self; } -(void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [plotAreaFrame release]; [plots release]; [plotSpaces release]; [title release]; [titleTextStyle release]; [titleAnnotation release]; [super dealloc]; } #pragma mark - #pragma mark Retrieving Plots /** @brief Makes all plots reload their data. **/ -(void)reloadData { [self.plots makeObjectsPerformSelector:@selector(reloadData)]; } /** @brief Makes all plots reload their data if their data cache is out of date. **/ -(void)reloadDataIfNeeded { [self.plots makeObjectsPerformSelector:@selector(reloadDataIfNeeded)]; } /** @brief All plots associated with the graph. * @return An array of all plots associated with the graph. **/ -(NSArray *)allPlots { return [NSArray arrayWithArray:self.plots]; } /** @brief Gets the plot at the given index in the plot array. * @param index An index within the bounds of the plot array. * @return The plot at the given index. **/ -(CPPlot *)plotAtIndex:(NSUInteger)index { return [self.plots objectAtIndex:index]; } /** @brief Gets the plot with the given identifier. * @param identifier A plot identifier. * @return The plot with the given identifier. **/ -(CPPlot *)plotWithIdentifier:(id <NSCopying>)identifier { for (CPPlot *plot in self.plots) { if ( [[plot identifier] isEqual:identifier] ) return plot; } return nil; } #pragma mark - #pragma mark Organizing Plots /** @brief Add a plot to the default plot space. * @param plot The plot. **/ -(void)addPlot:(CPPlot *)plot { [self addPlot:plot toPlotSpace:self.defaultPlotSpace]; } /** @brief Add a plot to the given plot space. * @param plot The plot. * @param space The plot space. **/ -(void)addPlot:(CPPlot *)plot toPlotSpace:(CPPlotSpace *)space { if ( plot ) { [self.plots addObject:plot]; plot.plotSpace = space; plot.graph = self; [self.plotAreaFrame.plotGroup addPlot:plot]; } } /** @brief Remove a plot from the graph. * @param plot The plot to remove. **/ -(void)removePlot:(CPPlot *)plot { if ( [self.plots containsObject:plot] ) { plot.plotSpace = nil; plot.graph = nil; [self.plotAreaFrame.plotGroup removePlot:plot]; [self.plots removeObject:plot]; } else { [NSException raise:CPException format:@"Tried to remove CPPlot which did not exist."]; } } /** @brief Add a plot to the default plot space at the given index in the plot array. * @param plot The plot. * @param index An index within the bounds of the plot array. **/ -(void)insertPlot:(CPPlot* )plot atIndex:(NSUInteger)index { [self insertPlot:plot atIndex:index intoPlotSpace:self.defaultPlotSpace]; } /** @brief Add a plot to the given plot space at the given index in the plot array. * @param plot The plot. * @param index An index within the bounds of the plot array. * @param space The plot space. **/ -(void)insertPlot:(CPPlot* )plot atIndex:(NSUInteger)index intoPlotSpace:(CPPlotSpace *)space { if (plot) { [self.plots insertObject:plot atIndex:index]; plot.plotSpace = space; plot.graph = self; [self.plotAreaFrame.plotGroup addPlot:plot]; } } /** @brief Remove a plot from the graph. * @param identifier The identifier of the plot to remove. **/ -(void)removePlotWithIdentifier:(id <NSCopying>)identifier { CPPlot* plotToRemove = [self plotWithIdentifier:identifier]; if (plotToRemove) { plotToRemove.plotSpace = nil; plotToRemove.graph = nil; [self.plotAreaFrame.plotGroup removePlot:plotToRemove]; [self.plots removeObjectIdenticalTo:plotToRemove]; } } #pragma mark - #pragma mark Retrieving Plot Spaces -(CPPlotSpace *)defaultPlotSpace { return ( self.plotSpaces.count > 0 ? [self.plotSpaces objectAtIndex:0] : nil ); } /** @brief All plot spaces associated with the graph. * @return An array of all plot spaces associated with the graph. **/ -(NSArray *)allPlotSpaces { return [NSArray arrayWithArray:self.plotSpaces]; } /** @brief Gets the plot space at the given index in the plot space array. * @param index An index within the bounds of the plot space array. * @return The plot space at the given index. **/ -(CPPlotSpace *)plotSpaceAtIndex:(NSUInteger)index { return ( self.plotSpaces.count > index ? [self.plotSpaces objectAtIndex:index] : nil ); } /** @brief Gets the plot space with the given identifier. * @param identifier A plot space identifier. * @return The plot space with the given identifier. **/ -(CPPlotSpace *)plotSpaceWithIdentifier:(id <NSCopying>)identifier { for (CPPlotSpace *plotSpace in self.plotSpaces) { if ( [[plotSpace identifier] isEqual:identifier] ) return plotSpace; } return nil; } #pragma mark - #pragma mark Set Plot Area -(void)setPlotAreaFrame:(CPPlotAreaFrame *)newArea { if ( plotAreaFrame != newArea ) { plotAreaFrame.graph = nil; [plotAreaFrame removeFromSuperlayer]; [plotAreaFrame release]; plotAreaFrame = [newArea retain]; [self addSublayer:newArea]; plotAreaFrame.graph = self; for ( CPPlotSpace *space in self.plotSpaces ) { space.graph = self; } } } #pragma mark - #pragma mark Organizing Plot Spaces /** @brief Add a plot space to the graph. * @param space The plot space. **/ -(void)addPlotSpace:(CPPlotSpace *)space { [self.plotSpaces addObject:space]; space.graph = self; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(plotSpaceMappingDidChange:) name:CPPlotSpaceCoordinateMappingDidChangeNotification object:space]; } /** @brief Remove a plot space from the graph. * @param plotSpace The plot space. **/ -(void)removePlotSpace:(CPPlotSpace *)plotSpace { if ( [self.plotSpaces containsObject:plotSpace] ) { [[NSNotificationCenter defaultCenter] removeObserver:self name:CPPlotSpaceCoordinateMappingDidChangeNotification object:plotSpace]; // Remove space plotSpace.graph = nil; [self.plotSpaces removeObject:plotSpace]; // Update axes that referenced space for ( CPAxis *axis in self.axisSet.axes ) { if ( axis.plotSpace == plotSpace ) axis.plotSpace = nil; } } else { [NSException raise:CPException format:@"Tried to remove CPPlotSpace which did not exist."]; } } #pragma mark - #pragma mark Coordinate Changes in Plot Spaces -(void)plotSpaceMappingDidChange:(NSNotification *)notif { CPPlotSpace *plotSpace = notif.object; BOOL backgroundBandsNeedRedraw = NO; for ( CPAxis *axis in self.axisSet.axes ) { if ( axis.plotSpace == plotSpace ) { [axis setNeedsRelabel]; backgroundBandsNeedRedraw |= (axis.backgroundLimitBands.count > 0); } } for ( CPPlot *plot in self.plots ) { if ( plot.plotSpace == plotSpace ) { [plot setNeedsDisplay]; } } if ( backgroundBandsNeedRedraw ) { [self.plotAreaFrame.plotArea setNeedsDisplay]; } } #pragma mark - #pragma mark Axis Set -(CPAxisSet *)axisSet { return self.plotAreaFrame.axisSet; } -(void)setAxisSet:(CPAxisSet *)newSet { self.plotAreaFrame.axisSet = newSet; } #pragma mark - #pragma mark Themes /** @brief Apply a theme to style the graph. * @param theme The theme object used to style the graph. **/ -(void)applyTheme:(CPTheme *)theme { [theme applyThemeToGraph:self]; } #pragma mark - #pragma mark Layout +(CGFloat)defaultZPosition { return CPDefaultZPositionGraph; } #pragma mark - #pragma mark Accessors -(void)setPaddingLeft:(CGFloat)newPadding { if ( newPadding != self.paddingLeft ) { [super setPaddingLeft:newPadding]; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } -(void)setPaddingRight:(CGFloat)newPadding { if ( newPadding != self.paddingRight ) { [super setPaddingRight:newPadding]; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } -(void)setPaddingTop:(CGFloat)newPadding { if ( newPadding != self.paddingTop ) { [super setPaddingTop:newPadding]; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } -(void)setPaddingBottom:(CGFloat)newPadding { if ( newPadding != self.paddingBottom ) { [super setPaddingBottom:newPadding]; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } -(NSArray *)topDownLayerOrder { return self.plotAreaFrame.plotArea.topDownLayerOrder; } -(void)setTopDownLayerOrder:(NSArray *)newArray { self.plotAreaFrame.plotArea.topDownLayerOrder = newArray; } -(void)setTitle:(NSString *)newTitle { if ( newTitle != title ) { [title release]; title = [newTitle copy]; CPLayerAnnotation *theTitleAnnotation = self.titleAnnotation; if ( title ) { if ( theTitleAnnotation ) { ((CPTextLayer *)theTitleAnnotation.contentLayer).text = title; } else { CPLayerAnnotation *newTitleAnnotation = [[CPLayerAnnotation alloc] initWithAnchorLayer:plotAreaFrame]; CPTextLayer *newTextLayer = [[CPTextLayer alloc] initWithText:title style:self.titleTextStyle]; newTitleAnnotation.contentLayer = newTextLayer; newTitleAnnotation.displacement = self.titleDisplacement; newTitleAnnotation.rectAnchor = self.titlePlotAreaFrameAnchor; [self addAnnotation:newTitleAnnotation]; self.titleAnnotation = newTitleAnnotation; [newTextLayer release]; [newTitleAnnotation release]; } } else { if ( theTitleAnnotation ) { [self removeAnnotation:theTitleAnnotation]; self.titleAnnotation = nil; } } } } -(void)setTitleTextStyle:(CPMutableTextStyle *)newStyle { if ( newStyle != titleTextStyle ) { [titleTextStyle release]; titleTextStyle = [newStyle copy]; ((CPTextLayer *)self.titleAnnotation.contentLayer).textStyle = titleTextStyle; } } -(void)setTitleDisplacement:(CGPoint)newDisplace { if ( !CGPointEqualToPoint(newDisplace, titleDisplacement) ) { titleDisplacement = newDisplace; titleAnnotation.displacement = newDisplace; } } -(void)setTitlePlotAreaFrameAnchor:(CPRectAnchor)newAnchor { if ( newAnchor != titlePlotAreaFrameAnchor ) { titlePlotAreaFrameAnchor = newAnchor; titleAnnotation.rectAnchor = titlePlotAreaFrameAnchor; } } #pragma mark - #pragma mark Event Handling -(BOOL)pointingDeviceDownEvent:(id)event atPoint:(CGPoint)interactionPoint { // Plots for ( CPPlot *plot in self.plots ) { if ( [plot pointingDeviceDownEvent:event atPoint:interactionPoint] ) return YES; } // Axes Set if ( [self.axisSet pointingDeviceDownEvent:event atPoint:interactionPoint] ) return YES; // Plot area if ( [self.plotAreaFrame pointingDeviceDownEvent:event atPoint:interactionPoint] ) return YES; // Plot spaces // Plot spaces do not block events, because several spaces may need to receive // the same event sequence (e.g., dragging coordinate translation) BOOL handledEvent = NO; for ( CPPlotSpace *space in self.plotSpaces ) { BOOL handled = [space pointingDeviceDownEvent:event atPoint:interactionPoint]; handledEvent |= handled; } return handledEvent; } -(BOOL)pointingDeviceUpEvent:(id)event atPoint:(CGPoint)interactionPoint { // Plots for ( CPPlot *plot in self.plots ) { if ( [plot pointingDeviceUpEvent:event atPoint:interactionPoint] ) return YES; } // Axes Set if ( [self.axisSet pointingDeviceUpEvent:event atPoint:interactionPoint] ) return YES; // Plot area if ( [self.plotAreaFrame pointingDeviceUpEvent:event atPoint:interactionPoint] ) return YES; // Plot spaces // Plot spaces do not block events, because several spaces may need to receive // the same event sequence (e.g., dragging coordinate translation) BOOL handledEvent = NO; for ( CPPlotSpace *space in self.plotSpaces ) { BOOL handled = [space pointingDeviceUpEvent:event atPoint:interactionPoint]; handledEvent |= handled; } return handledEvent; } -(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint { // Plots for ( CPPlot *plot in self.plots ) { if ( [plot pointingDeviceDraggedEvent:event atPoint:interactionPoint] ) return YES; } // Axes Set if ( [self.axisSet pointingDeviceDraggedEvent:event atPoint:interactionPoint] ) return YES; // Plot area if ( [self.plotAreaFrame pointingDeviceDraggedEvent:event atPoint:interactionPoint] ) return YES; // Plot spaces // Plot spaces do not block events, because several spaces may need to receive // the same event sequence (e.g., dragging coordinate translation) BOOL handledEvent = NO; for ( CPPlotSpace *space in self.plotSpaces ) { BOOL handled = [space pointingDeviceDraggedEvent:event atPoint:interactionPoint]; handledEvent |= handled; } return handledEvent; } -(BOOL)pointingDeviceCancelledEvent:(id)event { // Plots for ( CPPlot *plot in self.plots ) { if ( [plot pointingDeviceCancelledEvent:event] ) return YES; } // Axes Set if ( [self.axisSet pointingDeviceCancelledEvent:event] ) return YES; // Plot area if ( [self.plotAreaFrame pointingDeviceCancelledEvent:event] ) return YES; // Plot spaces BOOL handledEvent = NO; for ( CPPlotSpace *space in self.plotSpaces ) { BOOL handled = [space pointingDeviceCancelledEvent:event]; handledEvent |= handled; } return handledEvent; } @end #pragma mark - @implementation CPGraph(AbstractFactoryMethods) /** @brief Creates a new plot space for the graph. * @return A new plot space. **/ -(CPPlotSpace *)newPlotSpace { return nil; } /** @brief Creates a new axis set for the graph. * @return A new axis set. **/ -(CPAxisSet *)newAxisSet { return nil; } @end
08iteng-ipad
framework/Source/CPGraph.m
Objective-C
bsd
17,634
#import "CPColor.h" #import "CPMutableTextStyle.h" #import "CPTextStyleTests.h" #import <QuartzCore/QuartzCore.h> @implementation CPTextStyleTests -(void)testDefaults { CPMutableTextStyle *textStyle= [CPMutableTextStyle textStyle]; STAssertEqualObjects(@"Helvetica", textStyle.fontName, @"Default font name is not Helvetica"); STAssertEquals((CGFloat)12.0, textStyle.fontSize, @"Default font size is not 12.0"); STAssertEqualObjects([CPColor blackColor], textStyle.color, @"Default color is not [CPColor blackColor]"); } @end
08iteng-ipad
framework/Source/CPTextStyleTests.m
Objective-C
bsd
538
#import "CPTestCase.h" @interface CPAxisLabelTests : CPTestCase { } @end
08iteng-ipad
framework/Source/CPAxisLabelTests.h
Objective-C
bsd
77
efg fge
10-3-lab-sample
trunk/lab4/abc.tex
TeX
gpl3
7
package buggy; import java.io.*; import java.util.*; public class Main { public static void main (String[] args) throws java.io.IOException { int num1 = readInteger(); System.out.println ("\nYou entered the integer: " + num1); int num2 = Reverse(num1); int result = Sq_diff(num1,num2); System.out.println ("The computed result is: " + result); } private static int Sq_diff(int num1, int num2) { C1 o1 = new C1(num1,num2); C2 o2 = new C2(num1,num2); int result1 = o1.compute(); int result2 = o2.compute(); return result1*result2; } private static int Reverse(int number ) { int reversedNumber = 0; int temp = 0; while(number != 0){ temp = number%10; reversedNumber = reversedNumber * 10 + temp; number = number/10; } return reversedNumber; } private static int readInteger() throws java.io.IOException { String s1; String s2; int num = 0; BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); boolean cont = true; while (cont) { System.out.print ("Enter an integer:"); s1 = br.readLine(); StringTokenizer st = new StringTokenizer (s1); s2 = ""; while (cont && st.hasMoreTokens()) { s2 = st.nextToken(); num = Integer.parseInt(s2); cont = false; } } return num; } }
10-3-lab-sample
trunk/lab4/src/buggy/Main.java
Java
gpl3
1,402
package buggy; public class C0 { int x = 0; int y = 0; int compute() { return 0; } }
10-3-lab-sample
trunk/lab4/src/buggy/C0.java
Java
gpl3
105
package buggy; public class C1 extends C0{ C1(int x, int y) { this.x = x; this.y = y; } @Override public int compute() { return x+y; } }
10-3-lab-sample
trunk/lab4/src/buggy/C1.java
Java
gpl3
167
package buggy; public class C2 extends C0{ C2(int x, int y) { this.x = x; this.y = y; } @Override public int compute() { return x-y; } }
10-3-lab-sample
trunk/lab4/src/buggy/C2.java
Java
gpl3
165
#include <stdio.h> #include <stdlib.h> #include <string.h> // memset #include <sys/types.h> #include <cell/font.h> #include <cell/fontFT.h> #include "fonts.h" static uint32_t getUcs4( uint8_t*utf8, uint32_t*ucs4, uint32_t alterCode ); static void cellFontRenderTrans_blendCast_ARGB8( CellFontImageTransInfo* transInfo, uint32_t _color); // uint8_t r, uint8_t g, uint8_t b ); //static void cellFontRenderTrans_AlphaCast_ARGB8( CellFontImageTransInfo* transInfo, uint8_t r, uint8_t g, uint8_t b ); static uint32_t getUcs4( uint8_t*utf8, uint32_t*ucs4, uint32_t alterCode ) { uint64_t code = 0L; uint32_t len = 0; code = (uint64_t)*utf8; if ( code ) { utf8++; len++; if ( code >= 0x80 ) { while (1) { if ( code & 0x40 ) { uint64_t mask = 0x20L; uint64_t encode; uint64_t n; for ( n=2;;n++ ) { if ( (code & mask) == 0 ) { len = n; mask--; if ( mask == 0 ) { // 0xFE or 0xFF *ucs4 = 0x00000000; return 0; } break; } mask = (mask >> 1); } code &= mask; for ( n=1; n<len; n++ ) { encode = (uint64_t)*utf8; if ( (encode & 0xc0) != 0x80 ) { if ( ucs4 ) *ucs4 = alterCode; return n; } code = ( ( code << 6 ) | (encode & 0x3f) ); utf8++; } break; } else { for( ;; utf8++ ) { code = (uint64_t)*utf8; if ( code < 0x80 ) break; if ( code & 0x40 ) break; len++; } if ( code < 0x80 ) break; } } } } if ( ucs4 ) *ucs4 = (uint32_t)code; return len; } float Fonts_GetPropTextWidth( CellFont* cf, uint8_t* utf8, float w, float h, float slant, float between, float* strWidth, uint32_t* count ) { uint32_t code; float width=0.0f; float d = 0.0f; CellFontGlyphMetrics metrics; uint32_t preFontId; uint32_t fontId; uint32_t cn = 0; int ret; if ( (! utf8) || CELL_OK != cellFontSetScalePixel( cf, w, h ) || CELL_OK != cellFontSetEffectSlant( cf, slant ) ) { if ( strWidth ) *strWidth = 0.0f; if ( count ) *count = 0; return width; } utf8 += getUcs4( utf8, &code, 0x3000 ); ret = cellFontGetFontIdCode( cf, code, &fontId, (uint32_t*)0 ); if ( ret != CELL_OK || code == 0 ) { if ( strWidth ) *strWidth = 0; if ( count ) *count = 0; return 0.0f; } preFontId = fontId; if ( CELL_OK == cellFontGetCharGlyphMetrics( cf, code, &metrics ) ) { width = -(metrics.Horizontal.bearingX); width += metrics.Horizontal.advance + between; } else { width = 0.0f; width += w + between; } for (cn=1;;cn++) { utf8 += getUcs4( utf8, &code, 0x3000 ); if ( code == 0x00000000 ) break; ret = cellFontGetFontIdCode( cf, code, &fontId, (uint32_t*)0 ); if ( ret != CELL_OK ) { width += w + between; continue; } if ( fontId != preFontId ) { preFontId = fontId; cellFontSetEffectSlant( cf, 0.0f ); ret = cellFontGetCharGlyphMetrics( cf, code, &metrics ); if ( ret == CELL_OK ) { if ( metrics.Horizontal.bearingX < 0.0f ) { width += -(metrics.Horizontal.bearingX); } } cellFontSetEffectSlant( cf, slant ); ret = cellFontGetCharGlyphMetrics( cf, code, &metrics ); } else { ret = cellFontGetCharGlyphMetrics( cf, code, &metrics ); } if ( ret == CELL_OK ) { width += d = metrics.Horizontal.advance + between; } else { metrics.Horizontal.advance = w; metrics.Horizontal.bearingX = metrics.width = 0; width += d = w + between; } } if ( strWidth ) *strWidth = width; width += - d + metrics.Horizontal.bearingX + metrics.width; return width; } float Fonts_GetVerticalTextHeight( CellFont* cf, uint8_t* utf8, float w, float h, float between, float* strHeight, uint32_t* count ) { uint32_t code; CellFontGlyphMetrics metrics; float height = 0.0f; int flag = 0; float d = 0.0f; int n; if ( (!utf8) || *utf8 == 0x00 || CELL_OK != cellFontSetScalePixel( cf, w, h ) ) { if ( strHeight ) *strHeight = 0; if ( count ) *count = 0; return 0; } for ( n=0;;n++ ) { utf8 += getUcs4( utf8, &code, 0x3000 ); if ( code == 0x00000000 ) break; if ( flag <= 0 ) { if ( flag && ( code == 0x300d || code == 0x300f || code == 0xfe42 || code == 0xfe44 ) ) { height += - d + metrics.Vertical.bearingY + metrics.height; } } d = 0; if ( CELL_OK == cellFontGetCharGlyphMetricsVertical( cf, code, &metrics ) ) { if ( flag < 0 || metrics.Vertical.bearingY < 0 ) { height += -metrics.Vertical.bearingY; } flag = 1; height += d = metrics.Vertical.advance + between; if ( code==0x20 || ( code >= 0x3000 && code <= 0x3002 ) ) flag = -1; } else { metrics.Vertical.advance = metrics.Vertical.bearingY = metrics.height = 0.0f; height += d = h + between; flag = -1; } } if ( strHeight ) *strHeight = height; if ( count ) *count = n; height += - d + metrics.Vertical.bearingY + metrics.height; return height; } float Fonts_GetTextRescale( float scale, float w, float newW, float*ratio ) { float rate, rescale; rate = (newW/w); rescale = scale * rate; if ( ratio ) *ratio = rate; return rescale; } float Fonts_GetPropTextWidthRescale( float scale, float w, float newW, float*ratio ) { return Fonts_GetTextRescale( scale, w, newW, ratio ); } float Fonts_GetVerticalTextHeightRescale( float scale, float h, float newH, float*ratio ) { return Fonts_GetTextRescale( scale, h, newH, ratio ); } int Fonts_BindRenderer( CellFont* cf, CellFontRenderer* rend ) { int ret = cellFontBindRenderer( cf, rend ); return ret; } int Fonts_UnbindRenderer( CellFont* cf ) { int ret = cellFontUnbindRenderer( cf ); return ret; } float Fonts_RenderPropText( CellFont* cf, CellFontRenderSurface* surf, float x, float y, uint8_t* utf8, float w, float h, float slant, float between, int32_t _color ) { uint32_t code; CellFontGlyphMetrics metrics; CellFontImageTransInfo TransInfo; uint32_t preFontId; // uint32_t fontId; (void) slant; int ret; if ( (!utf8) || *utf8 == 0x00 ) return x; ret = cellFontSetupRenderScalePixel( cf, w, h ); if ( ret != CELL_OK ) { // Fonts_PrintError("Fonts_RenderPropText:",ret); return x; } utf8 += getUcs4( utf8, &code, 0x3000 ); { cellFontGetFontIdCode( cf, code, &preFontId, (uint32_t*)0 ); if ( CELL_OK == cellFontGetRenderCharGlyphMetrics( cf, code, &metrics ) ) { x += -(metrics.Horizontal.bearingX); } } for ( ;; ) { ret = cellFontRenderCharGlyphImage( cf, code, surf, x, y, &metrics, &TransInfo ); if ( ret == CELL_OK ) { x += metrics.Horizontal.advance + between; // cellFontRenderTrans_blendCast_ARGB8( &TransInfo, 255, 255, 255 ); cellFontRenderTrans_blendCast_ARGB8( &TransInfo, _color); // cellFontRenderTrans_AlphaCast_ARGB8( &TransInfo, 255, 255, 255 ); } else { x += w + between; } utf8 += getUcs4( utf8, &code, 0x3000 ); if ( code == 0x00000000 ) break; } return x; } float Fonts_RenderVerticalText( CellFont* cf, CellFontRenderSurface* surf, float x, float y, uint8_t* utf8, float w, float h, float slant, float between ) { uint32_t code; CellFontGlyphMetrics metrics; CellFontImageTransInfo TransInfo; int flag = 0; float d = 0.0f; int ret; if ( (!utf8) || *utf8 == 0x00 ) return y; ret = cellFontSetupRenderScalePixel( cf, w, h ); if ( ret != CELL_OK ) { // Fonts_PrintError("Fonts_RenderVerticalText:",ret); return y; } for ( ;; ) { utf8 += getUcs4( utf8, &code, 0x3000 ); if ( code == 0x00000000 ) break; if ( flag <= 0 ) { if ( flag && ( code == 0x300d || code == 0x300f || code == 0xff42 || code == 0xff4f ) ) { y += d = -d + metrics.Vertical.bearingY + metrics.height; x -= d * slant; } } d = 0; if ( CELL_OK == cellFontGetRenderCharGlyphMetricsVertical( cf, code, &metrics ) ) { if ( flag < 0 || metrics.Vertical.bearingY < 0 ) { y += d = -metrics.Vertical.bearingY; x -= d * slant; } } flag = 1; ret = cellFontRenderCharGlyphImageVertical( cf, code, surf, x, y, &metrics, &TransInfo ); if ( ret == CELL_OK ) { y += d = metrics.Vertical.advance + between; x -= d * slant; cellFontRenderTrans_blendCast_ARGB8( &TransInfo, 0x00ffffff); if ( code==0x20 || ( code >= 0x3000 && code <= 0x3002 ) ) flag = -1; } else { y -= d; x += d * slant; metrics.Vertical.advance = metrics.Vertical.bearingY = metrics.height = 0.0f; y += d = h + between; x -= d * slant; flag = -1; } } return y; } static void cellFontRenderTrans_blendCast_ARGB8( CellFontImageTransInfo* transInfo, uint32_t _color) // uint8_t r, uint8_t g, uint8_t b ) { if ( transInfo ) { unsigned char* tex; unsigned char* img = transInfo->Image; int img_bw = transInfo->imageWidthByte; int tex_bw = transInfo->surfWidthByte; int w = transInfo->imageWidth; int h = transInfo->imageHeight; uint64_t a0,a1,_a; uint64_t ARGBx2; uint64_t R0, G0, B0;//A0, uint64_t A0, A1, R1, G1, B1; int x, y; float d_alpha1, d_alpha0; uint8_t _r, _b, _g; uint8_t _r0, _b0, _g0, _r1, _g1, _b1; _a = (_color>>24) & 0xff; _b = (_color>>16) & 0xff; _g = (_color>> 8) & 0xff; _r = (_color ) & 0xff; for ( y=0; y < h; y++ ) { tex = ((uint8_t*)transInfo->Surface) + tex_bw*y; for ( x=0; x < w; x++ ) { if ( ((sys_addr_t)tex) & 7 ) { a1 = img[x]; if ( a1 ) { ARGBx2 = *(uint32_t*)tex; A1=_a; //A1 = (255-a1); R1 = ((ARGBx2>>16)&0xff); G1 = ((ARGBx2>> 8)&0xff); B1 = ((ARGBx2 )&0xff); d_alpha1 = (a1/255.0f) * (_a/255.0f); _r1 = (int) (_r * d_alpha1); _g1 = (int) (_g * d_alpha1); _b1 = (int) (_b * d_alpha1); d_alpha1 = 1.0f - (a1/255.0f) * (_a/255.0f); R1 = (int) (R1 * d_alpha1) + _r1; G1 = (int) (G1 * d_alpha1) + _g1; B1 = (int) (B1 * d_alpha1) + _b1; *(uint32_t*)tex = (a1> _a ? a1 : _a) | (R1<<24)| (G1<<16)| (B1<<8); } tex += 4; } else{ a0 = img[x]; x++; a1 = img[x]; if ( a0 || a1 ) { ARGBx2 = *(uint64_t*)tex; //A0 = (255-a0); //A1 = (255-a1); d_alpha0 = (a0/255.0f) * (_a/255.0f); _r0 = (int) (_r * d_alpha0); _g0 = (int) (_g * d_alpha0); _b0 = (int) (_b * d_alpha0); d_alpha1 = (a1/255.0f) * (_a/255.0f); _r1 = (int) (_r * d_alpha1); _g1 = (int) (_g * d_alpha1); _b1 = (int) (_b * d_alpha1); R0 = ((ARGBx2>>56)&0xff); G0 = ((ARGBx2>>48)&0xff); B0 = ((ARGBx2>>40)&0xff); A0 = ((ARGBx2>>32)&0xff); R1 = ((ARGBx2>>24)&0xff); G1 = ((ARGBx2>>16)&0xff); B1 = ((ARGBx2>> 8)&0xff); A1 = ((ARGBx2 )&0xff); d_alpha0 = 1.0f - (a0/255.0f) * (_a/255.0f); R0 = (int) (R0 * d_alpha0) + _r0; G0 = (int) (G0 * d_alpha0) + _g0; B0 = (int) (B0 * d_alpha0) + _b0; d_alpha1 = 1.0f - (a1/255.0f) * (_a/255.0f); R1 = (int) (R1 * d_alpha1) + _r1; G1 = (int) (G1 * d_alpha1) + _g1; B1 = (int) (B1 * d_alpha1) + _b1; /* *(uint64_t*)tex = (a0<<56) | (( A0 * R0 + a0 * _r )/255<<48)| (( A0 * G0 + a0 * _g )/255<<40)| (( A0 * B0 + a0 * _b )/255<<32)| (a1<<24) | (( A1 * R1 + a1 * _r )/255<<16)| (( A1 * G1 + a1 * _g )/255<< 8)| (( A1 * B1 + a1 * _b )/255 ); */ *(uint64_t*)tex = (a0 >= A0 ? a0<<32 : A0<<32) | (R0<<56)| (G0<<48)| (B0<<40)| (a1 >= A1 ? a1 : A1) | (R1<<24)| (G1<<16)| (B1<<8); } tex += 8; } } img += img_bw; } } return; }
000kev000-toy
source/fonts_render.c
C
oos
12,858
#include "mm.h" #include "hvcall.h" // This is mainly adapted from graf's code int mm_insert_htab_entry(u64 va_addr, u64 lpar_addr, u64 prot, u64 * index) { u64 hpte_group, hpte_index = 0, hpte_v, hpte_r, hpte_evicted_v, hpte_evicted_r; hpte_group = (((va_addr >> 28) ^ ((va_addr & 0xFFFFFFFULL) >> 12)) & 0x7FF) << 3; hpte_v = ((va_addr >> 23) << 7) | HPTE_V_VALID; hpte_r = lpar_addr | 0x38 | (prot & HPTE_R_PROT_MASK); int result = lv1_insert_htab_entry(0, hpte_group, hpte_v, hpte_r, HPTE_V_BOLTED, 0, &hpte_index, &hpte_evicted_v, &hpte_evicted_r); if ((result == 0) && (index != 0)) *index = hpte_index; return (int)result; } int mm_map_lpar_memory_region(u64 lpar_start_addr, u64 ea_start_addr, u64 size, u64 page_shift, u64 prot) { int result; u64 i; for (i = 0; i < size >> page_shift; i++) { result = mm_insert_htab_entry(MM_EA2VA(ea_start_addr), lpar_start_addr, prot, 0); if (result != 0) return result; lpar_start_addr += (1 << page_shift); ea_start_addr += (1 << page_shift); } return 0; }
000kev000-toy
source/mm.cpp
C++
oos
1,094
#include <cell/error.h> #include <cell/sysmodule.h> #include <sysutil/sysutil_sysparam.h> #include <stdio.h> #include <string.h> #include <math.h> #include <sys/timer.h> #include <cell/cell_fs.h> #include <cell/gcm.h> #include <cell/control_console.h> #include <sysutil/sysutil_sysparam.h> #include <netex/libnetctl.h> #include "graphics.h" #define ROUNDUP(x, a) (((x)+((a)-1))&(~((a)-1))) CellDbgFontConsoleId consoleID = CELL_DBGFONT_STDOUT_ID; extern u32 frame_index; extern int V_WIDTH; extern int V_HEIGHT; extern float overscan; extern int cover_mode; extern bool key_repeat; extern int xmb_slide_y; extern bool th_device_list; extern bool th_device_separator; extern u16 th_device_separator_y; extern bool th_legend; extern u16 th_legend_y; extern bool th_drive_icon; extern u16 th_drive_icon_x; extern u16 th_drive_icon_y; extern bool use_depth; extern u8 hide_bd; typedef struct { float x, y, z; u32 color; } vtx_color; typedef struct { float x, y, z; float tx, ty; } vtx_texture; u32 screen_width; u32 screen_height; float screen_aspect; u32 color_pitch; u32 depth_pitch; u32 color_offset[2]; u32 depth_offset; extern u32 _binary_vpshader_vpo_start; extern u32 _binary_vpshader_vpo_end; extern u32 _binary_fpshader_fpo_start; extern u32 _binary_fpshader_fpo_end; extern u32 video_buffer; static unsigned char *vertex_program_ptr = (unsigned char *)&_binary_vpshader_vpo_start; static unsigned char *fragment_program_ptr = (unsigned char *)&_binary_fpshader_fpo_start; static CGprogram vertex_program; static CGprogram fragment_program; extern struct _CGprogram _binary_vpshader2_vpo_start; extern struct _CGprogram _binary_fpshader2_fpo_start; extern void *color_base_addr; extern void put_label(uint8_t *buffer, uint32_t width, uint32_t height, char *str1p, char *str2p, char *str3p, uint32_t color); extern void put_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int from_width, int x, int y, int border, uint32_t border_color); extern void print_label(float x, float y, float scale, uint32_t color, char *str1p); extern void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font, float hscale, float vscale, int centered); extern void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT); extern void draw_box( uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, uint32_t border_color); extern void put_texture_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color); extern void put_texture_with_alpha( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color); extern int max_ttf_label; extern u8 *text_bmp; extern u8 *text_USB; extern u8 *text_HDD; extern u8 *text_BLU_1; extern u8 *text_legend; extern u8 *text_FONT; extern int legend_y, legend_h; extern int last_selected; extern int b_box_opaq; extern int b_box_step; extern int draw_legend; static void *vertex_program_ucode; static void *fragment_program_ucode; static u32 fragment_offset; static void *text_vertex_prg_ucode; static void *text_fragment_prg_ucode; static u32 text_fragment_offset; static u32 vertex_offset[2]; static u32 color_index; static u32 position_index; static vtx_color *vertex_color; extern int vert_indx; extern int vert_texture_indx; static u32 text_width; static u32 text_height; static u32 text_colorp; static u32 text_depthp; static vtx_texture *vertex_text; static u32 vertex_text_offset; static u32 text_obj_coord_indx; static u32 text_tex_coord_indx; static CGresource tindex; static CGprogram vertex_prg; static CGprogram fragment_prg; static CellGcmTexture text_param; static u32 local_heap = 0; static void *localAlloc(const u32 size) { u32 align = (size + 1023) & (~1023); u32 base = local_heap; local_heap += align; return (void*)base; } static void *localAllocAlign(const u32 alignment, const u32 size) { local_heap = (local_heap + alignment-1) & (~(alignment-1)); return (void*)localAlloc(size); } void put_vertex(float x, float y, float z, u32 color) { vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vert_indx++; } void setRenderTarget(void) { CellGcmSurface surface; surface.colorFormat = CELL_GCM_SURFACE_A8R8G8B8; surface.colorTarget = CELL_GCM_SURFACE_TARGET_0; surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL; surface.colorOffset[0] = color_offset[frame_index]; surface.colorPitch[0] = color_pitch; surface.colorLocation[1] = CELL_GCM_LOCATION_LOCAL; surface.colorLocation[2] = CELL_GCM_LOCATION_LOCAL; surface.colorLocation[3] = CELL_GCM_LOCATION_LOCAL; surface.colorOffset[1] = 0; surface.colorOffset[2] = 0; surface.colorOffset[3] = 0; surface.colorPitch[1] = 64; surface.colorPitch[2] = 64; surface.colorPitch[3] = 64; surface.depthFormat = CELL_GCM_SURFACE_Z24S8; surface.depthLocation = CELL_GCM_LOCATION_LOCAL; surface.depthOffset = depth_offset; surface.depthPitch = depth_pitch; surface.type = CELL_GCM_SURFACE_PITCH; surface.antialias = CELL_GCM_SURFACE_CENTER_1;//CELL_GCM_SURFACE_SQUARE_ROTATED_4;// surface.width = screen_width; surface.height = screen_height; surface.x = 0; surface.y = 0; cellGcmSetSurface(gCellGcmCurrentContext, &surface); } void initShader(void) { vertex_program = (CGprogram)vertex_program_ptr; fragment_program = (CGprogram)fragment_program_ptr; cellGcmCgInitProgram(vertex_program); cellGcmCgInitProgram(fragment_program); u32 ucode_size; void *ucode; cellGcmCgGetUCode(fragment_program, &ucode, &ucode_size); void *ret = localAllocAlign(64, ucode_size); fragment_program_ucode = ret; memcpy(fragment_program_ucode, ucode, ucode_size); cellGcmCgGetUCode(vertex_program, &ucode, &ucode_size); vertex_program_ucode = ucode; } int text_create( u32 xsize, u32 ysize ); int initDisplay(void) { int ret, i; u32 color_size, depth_size, color_depth= 4, z_depth= 4; // void *color_base_addr, *depth_base_addr, *color_addr[2]; color_base_addr=NULL; void *depth_base_addr, *color_addr[2]; CellVideoOutResolution resolution; CellVideoOutState videoState; //cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState); ret = cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState); if (ret != CELL_OK) return -1; cellVideoOutGetResolution(videoState.displayMode.resolutionId, &resolution); screen_width = resolution.width; screen_height = resolution.height; V_WIDTH = screen_width; V_HEIGHT = screen_height; color_pitch = screen_width*color_depth; depth_pitch = screen_width*z_depth; color_size = color_pitch*screen_height; depth_size = depth_pitch*screen_height; switch (videoState.displayMode.aspect) { case CELL_VIDEO_OUT_ASPECT_4_3: screen_aspect=4.0f/3.0f; break; case CELL_VIDEO_OUT_ASPECT_16_9: screen_aspect=16.0f/9.0f; break; default: screen_aspect=16.0f/9.0f; } CellVideoOutConfiguration videocfg; memset(&videocfg, 0, sizeof(CellVideoOutConfiguration)); videocfg.resolutionId = videoState.displayMode.resolutionId; videocfg.format = CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8; videocfg.pitch = color_pitch; ret = cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, &videocfg, NULL, 0); if (ret != CELL_OK) return -1; // cellGcmSetFlipMode(CELL_GCM_DISPLAY_VSYNC); cellGcmSetFlipMode(CELL_GCM_DISPLAY_HSYNC); // cellGcmSetFlipMode(CELL_GCM_DISPLAY_HSYNC_WITH_NOISE); CellGcmConfig config; cellGcmGetConfiguration(&config); local_heap = (u32) config.localAddress; color_base_addr = localAllocAlign(16, 2*color_size); video_buffer=color_size; for (i = 0; i < 2; i++) { color_addr[i]= (void *)((u32)color_base_addr+ (i*color_size)); ret = cellGcmAddressToOffset(color_addr[i], &color_offset[i]); if(ret != CELL_OK) return -1; ret = cellGcmSetDisplayBuffer(i, color_offset[i], color_pitch, screen_width, screen_height); if(ret != CELL_OK) return -1; } depth_base_addr = localAllocAlign(16, depth_size); ret = cellGcmAddressToOffset(depth_base_addr, &depth_offset); if(ret != CELL_OK) return -1; text_create( 512, 512 ); return 0; } void setDrawEnv(void) { u16 x,y,w,h; float min, max; float scale[4],offset[4]; w = (u16)((float)screen_width*(1.f-overscan/2.f)); h = (u16)((float)screen_height*(1.f-overscan/2.f)); x = (u16)((float)screen_width*overscan/2.f); y = 0; min = 0.0f; max = 1.0f; scale[0] = w * 0.5f * (1.f-overscan/2.f); scale[1] = h * -0.5f * (1.f-overscan/2.f); scale[2] = (max - min) * 0.5f; scale[3] = 0.0f; offset[0] = x + scale[0]; offset[1] = h - y + scale[1]; offset[2] = (max + min) * 0.5f; offset[3] = 0.0f; cellGcmSetColorMask(gCellGcmCurrentContext, CELL_GCM_COLOR_MASK_B | CELL_GCM_COLOR_MASK_G | CELL_GCM_COLOR_MASK_R | CELL_GCM_COLOR_MASK_A); cellGcmSetColorMaskMrt(gCellGcmCurrentContext, 0); //CELL_GCM_COLOR_MASK_B | CELL_GCM_COLOR_MASK_G | CELL_GCM_COLOR_MASK_R | CELL_GCM_COLOR_MASK_A cellGcmSetViewport(gCellGcmCurrentContext, x, y, w, h, min, max, scale, offset); cellGcmSetClearColor(gCellGcmCurrentContext, 0xff000000); cellGcmSetDepthTestEnable(gCellGcmCurrentContext, CELL_GCM_TRUE); cellGcmSetDepthFunc(gCellGcmCurrentContext, CELL_GCM_LESS); cellGcmSetBlendFunc(gCellGcmCurrentContext,CELL_GCM_SRC_ALPHA, CELL_GCM_ONE_MINUS_SRC_ALPHA,CELL_GCM_SRC_ALPHA, CELL_GCM_ONE_MINUS_SRC_ALPHA); cellGcmSetBlendEquation(gCellGcmCurrentContext,CELL_GCM_FUNC_ADD, CELL_GCM_FUNC_ADD); cellGcmSetBlendEnable(gCellGcmCurrentContext,CELL_GCM_TRUE); cellGcmSetShadeMode(gCellGcmCurrentContext, CELL_GCM_SMOOTH); cellGcmSetAlphaFunc(gCellGcmCurrentContext, CELL_GCM_GREATER, 0x01); //cellGcmSetAntiAliasingControl(gCellGcmCurrentContext, CELL_GCM_TRUE, CELL_GCM_FALSE, CELL_GCM_FALSE, 0x41ff); } void setRenderColor(void) { cellGcmSetVertexProgram(gCellGcmCurrentContext, vertex_program, vertex_program_ucode); cellGcmSetVertexDataArray(gCellGcmCurrentContext, position_index, 0, sizeof(vtx_color), 3, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, (u32)vertex_offset[0]); cellGcmSetVertexDataArray(gCellGcmCurrentContext, color_index, 0, sizeof(vtx_color), 4, CELL_GCM_VERTEX_UB, CELL_GCM_LOCATION_LOCAL, (u32)vertex_offset[1]); cellGcmSetFragmentProgram(gCellGcmCurrentContext, fragment_program, fragment_offset); } int setRenderObject(void) { vertex_color = (vtx_color*) localAllocAlign(131072/*128*1024*/, 1536*sizeof(vtx_color)); // 384 quad polygons/textures (384x4 vertices) CGparameter position = cellGcmCgGetNamedParameter(vertex_program, "position"); CGparameter color = cellGcmCgGetNamedParameter(vertex_program, "color"); position_index = cellGcmCgGetParameterResource(vertex_program, position) - CG_ATTR0; color_index = cellGcmCgGetParameterResource(vertex_program, color) - CG_ATTR0; if(cellGcmAddressToOffset(fragment_program_ucode, &fragment_offset) != CELL_OK) return -1; if (cellGcmAddressToOffset(&vertex_color->x, &vertex_offset[0]) != CELL_OK) return -1; if (cellGcmAddressToOffset(&vertex_color->color, &vertex_offset[1]) != CELL_OK) return -1; return 0; } int initFont() { CellDbgFontConfigGcm config; int size = CELL_DBGFONT_FRAGMENT_SIZE + CELL_DBGFONT_VERTEX_SIZE * CONSOLE_WIDTH * CONSOLE_HEIGHT + CELL_DBGFONT_TEXTURE_SIZE; int ret = 0; void*localmem = localAllocAlign(128, size); if( localmem == NULL ) return -1; memset(&config, 0, sizeof(CellDbgFontConfigGcm)); config.localBufAddr = (sys_addr_t)localmem; config.localBufSize = size; config.mainBufAddr = NULL; config.mainBufSize = 0; config.option = CELL_DBGFONT_VERTEX_LOCAL; config.option |= CELL_DBGFONT_TEXTURE_LOCAL; config.option |= CELL_DBGFONT_SYNC_ON; ret = cellDbgFontInitGcm(&config); if(ret < 0) return ret; return 0; } int initConsole() { CellDbgFontConsoleConfig config; config.posLeft = 0.086f; config.posTop = 0.16f; config.cnsWidth = CONSOLE_WIDTH; config.cnsHeight = CONSOLE_HEIGHT; config.scale = 0.72f; config.color = 0xffA0A0A0; consoleID = cellDbgFontConsoleOpen(&config); if (consoleID < 0) return -1; return 0; } void DbgEnable() { cellDbgFontConsoleEnable(consoleID); } void DbgDisable() { cellDbgFontConsoleDisable(consoleID); } int termConsole() { int ret; ret = cellDbgFontConsoleClose(consoleID); if(ret) return -1; consoleID = CELL_DBGFONT_STDOUT_ID; return ret; } int termFont() { int ret; ret = cellDbgFontExitGcm(); if(ret) return -1; return ret; } int DPrintf( const char *string, ... ) { int ret=0; va_list argp; va_start(argp, string); if(consoleID != CELL_DBGFONT_STDOUT_ID) ret = cellDbgFontConsoleVprintf(consoleID, string, argp); va_end(argp); return ret; } void utf8_to_ansi(char *utf8, char *ansi, int len) { u8 *ch= (u8 *) utf8; u8 c; while(*ch!=0 && len>0){ // 3, 4 bytes utf-8 code if(((*ch & 0xF1)==0xF0 || (*ch & 0xF0)==0xe0) && (*(ch+1) & 0xc0)==0x80){ *ansi++=' '; // ignore len--; ch+=2+1*((*ch & 0xF1)==0xF0); } else // 2 bytes utf-8 code if((*ch & 0xE0)==0xc0 && (*(ch+1) & 0xc0)==0x80){ c= (((*ch & 3)<<6) | (*(ch+1) & 63)); if(c>=0xC0 && c<=0xC5) c='A'; else if(c==0xc7) c='C'; else if(c>=0xc8 && c<=0xcb) c='E'; else if(c>=0xcc && c<=0xcf) c='I'; else if(c==0xd1) c='N'; else if(c>=0xd2 && c<=0xd6) c='O'; else if(c>=0xd9 && c<=0xdc) c='U'; else if(c==0xdd) c='Y'; else if(c>=0xe0 && c<=0xe5) c='a'; else if(c==0xe7) c='c'; else if(c>=0xe8 && c<=0xeb) c='e'; else if(c>=0xec && c<=0xef) c='i'; else if(c==0xf1) c='n'; else if(c>=0xf2 && c<=0xf6) c='o'; else if(c>=0xf9 && c<=0xfc) c='u'; else if(c==0xfd || c==0xff) c='y'; else if(c>127) c=*(++ch+1); //' '; if(c=='%') c='#'; *ansi++=c; len--; ch++; } else { if(*ch<32) *ch=32; if(*ch=='%') *ch='#'; *ansi++=*ch; len--; } ch++; } while(len>0) { *ansi++=0; len--; } } void draw_text_stroke(float x, float y, float size, u32 color, const char *str) { // print_label(x, y, size, color, (char*)str); return; /* cellDbgFontPrintf( x-.001f, y+.001f, size, 0xc0000000, str); cellDbgFontPrintf( x-.001f, y-.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.001f, y+.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.001f, y-.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.0015f, y+.0015f, size, 0x90202020, str); */ cellDbgFontPrintf( x-.0015f, y-0.0015, size+0.0030f, 0xE0101010, str); cellDbgFontPrintf( x-.0015f, y+0.0015, size+0.0030f, 0xD0101010, str); cellDbgFontPrintf( x, y, size, color, str); } void draw_device_list(u32 flags, int _cover_mode, int opaq, char *content) { (void)_cover_mode; if(cover_mode==5 || opaq<0x30 || cover_mode==8) return; // float y = 0.15f + 0.05f*15.0f; float y = (float)th_device_separator_y/1080.0f + 0.015; char str[256]; union CellNetCtlInfo net_info; int n,ok=0; float len; float x=0.08; char sizer[255]; char path[255]; if( (cover_mode<3 || cover_mode==6 || cover_mode==7 || cover_mode==4) ) goto just_legend; for(n=0;n<16;n++) { if(th_device_list==0) break; if(n==11 && hide_bd==1) continue; str[0]=0; ok=0; if((flags>>n) & 1) ok=1; if(ok || n==12) { switch(n) { case 0: sprintf(str, "%s", " HDD "); sprintf(path, "/dev_hdd0/"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d/", n-1); break; case 11: sprintf(str, "%s", "Game disc"); if(strstr(content,"AVCHD")!=NULL) sprintf(str, "%s", "AVCHD disc"); else if(strstr(content,"BDMV")!=NULL) sprintf(str, "%s", "Movie disc"); else if(strstr(content,"PS2")!=NULL) sprintf(str, "%s", "PS2 disc"); else if(strstr(content,"DVD")!=NULL) sprintf(str, "%s", "DVD disc"); sprintf(path, "/dev_bdvd/"); break; case 12: sprintf(str, "PS3 IP"); sprintf(path, "/ftp_service"); break; case 13: sprintf(str, " USB "); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, " MS "); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d/", n-1); break; } len=0.025f*(float)(strlen(str)); if(n!=12){ draw_square((x-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f, len+0.04f, 0.095f, -0.9f, ((flags>>(n+16)) & 1) ? 0x0080ffc0 : 0x101010c0); if(n!=11 && n!=13) { if(str[0]) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = (uint64_t)(blockSize * freeSize); //last_refreshD=time(NULL); //dev_free_space[n].freespace=freeSpace; } else { //freeSpace = dev_free_space[n].freespace; freeSpace = 0; } sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); draw_text_stroke( (x+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.70f, COL_LEGEND, sizer); // draw_text_stroke( x+overscan, y+0.045-overscan, 0.70f-overscan,((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : 0xc0c0c0a0, sizer); } if(n==13) {sprintf(sizer, "PFS Drive"); draw_text_stroke( (x+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.70f, COL_LEGEND, sizer);} draw_text_stroke( x, y-0.005, 1.0f, ((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : COL_LEGEND, str); } else { if(cellNetCtlGetInfo(16, &net_info) < 0) str[0]=0; else { sprintf(sizer, "%s", net_info.ip_address); draw_square((x-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f, len+0.04f, 0.095f, -0.9f, 0x101060c0); draw_text_stroke( (x+(len+0.02f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045, 0.65f,((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, sizer); draw_text_stroke( x, y-0.005, 1.0f, ((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, str); } } len=0.025f*(float)(strlen(str)); x+=len; } } just_legend: if( (cover_mode==4 && th_legend==1) ) { // float legend_font=0.9f; // if(overscan>0.05) legend_font=(float)(legend_font-(legend_font*overscan)); // draw_text_stroke( 0.08f+(overscan/4.0f), (((float)th_legend_y/1080.f)+0.02f)-overscan, legend_font, COL_LEGEND, "X - Load [] - Game settings [R1] - Next mode\nO - Exit /\\ - System menu [L1] - Prev mode" ); set_texture( text_legend, 1665, 96); display_img(127, th_legend_y+15, 1665, 96, 1665, 96, -0.5f, 1665, 96); } if( (cover_mode<3 || cover_mode==6 || cover_mode==7) && draw_legend ) { if(th_legend==1) { if( cover_mode==1 || cover_mode==6 || cover_mode==7) put_texture_with_alpha( text_bmp, text_legend, 1665, 96, 1665, 127, th_legend_y, 0, 0); else put_texture_with_alpha( text_bmp, text_legend, 1665, 96, 1665, 127, th_legend_y+15, 0, 0); } if(th_device_separator==1) draw_box( text_bmp, 1920, 2, 0, th_device_separator_y, 0x80808080); u32 info_color=0xffc0c0c0; u32 info_color2=0xff808080; if(th_device_list==1) { x=0.1f; max_ttf_label=0; for(n=0;n<16;n++) { str[0]=0; ok=0; if(n==11 && hide_bd==1) continue; if((flags>>n) & 1) ok=1; if(ok || n==12) { switch(n) { case 0: sprintf(str, "%s", " HDD "); sprintf(path, "/dev_hdd0/"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d/", n-1); break; case 11: sprintf(str, "%s", "Game disc"); if(strstr(content,"AVCHD")!=NULL) sprintf(str, "%s", "AVCHD disc"); else if(strstr(content,"BDMV")!=NULL) sprintf(str, "%s", "Movie disc"); else if(strstr(content,"PS2")!=NULL) sprintf(str, "%s", "PS2 disc"); else if(strstr(content,"DVD")!=NULL) sprintf(str, "%s", "DVD disc"); sprintf(path, "/dev_bdvd/"); break; case 12: sprintf(str, "PS3 IP"); sprintf(path, "/ftp_service"); break; case 13: sprintf(str, " USB "); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, " MS "); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d/", n-1); break; } len=0.025f*(float)(strlen(str)); sizer[0]=0; if(n!=12){ if(n!=11 && n!=13) { if(str[0]) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = (uint64_t)(blockSize * freeSize); } else { freeSpace = 0; } sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); //draw_text_stroke( (x+overscan+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f-overscan, 0.70f-overscan, COL_LEGEND, sizer); } if(n==13) { sprintf(sizer, "PFS Drive"); //draw_text_stroke( (x+overscan+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f-overscan, 0.70f-overscan, COL_LEGEND, sizer); } //draw_text_stroke( x+overscan, y-0.005-overscan, 1.0f-overscan, ((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : COL_LEGEND, str); print_label_ex( x, (((float)(th_device_separator_y+15))/1080.f), 1.5f, info_color, str, 1.04f, 0.00f, 15, 0.6f, 0.6f, 1); print_label_ex( x, (((float)(th_device_separator_y+44))/1080.f), 1.5f, info_color2, sizer, 1.00f, 0.00f, 15, 0.5f, 0.5f, 1); } else { if(cellNetCtlGetInfo(16, &net_info) < 0) str[0]=0; else { sprintf(sizer, "%s", net_info.ip_address); //draw_square((x+overscan-0.5f)*2.0f-0.02f, (0.5f-y+0.01+overscan)*2.0f, len+0.04f, 0.095f, -0.9f, 0x101060c0); //draw_text_stroke( (x+overscan+(len+0.02f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045-overscan, 0.65f-overscan,((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, sizer); //draw_text_stroke( x+overscan, y-0.005-overscan, 1.0f-overscan, ((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, str); print_label_ex( x, (((float)(th_device_separator_y+15))/1080.f), 1.5f, info_color, str, 1.04f, 0.00f, 15, 0.6f, 0.6f, 1); print_label_ex( x, (((float)(th_device_separator_y+44))/1080.f), 1.5f, info_color2, sizer, 1.00f, 0.00f, 15, 0.5f, 0.5f, 1); } } len=0.11f; x+=len; } } flush_ttf(text_bmp, 1920, 1080); } draw_legend=0; } } void draw_list( t_menu_list *menu, int menu_size, int selected, int dir_mode, int display_mode, int _cover_mode, int game_sel_last, int opaq ) { (void)_cover_mode; if(cover_mode==5 || cover_mode==0 || cover_mode==8) return; float y = 0.1f; int i = 0, c=0; char str[256]; char ansi[256]; float len=0; u32 color, color2; game_sel_last+=0; int flagb= selected & 0x10000; int max_entries=14; if(cover_mode==1) max_entries=8; if(cover_mode==7) max_entries=32; selected&= 0xffff; if(cover_mode==4 || cover_mode==1 || cover_mode==6 || cover_mode==7) { int grey=(menu[selected].title[0]=='_' || menu[selected].split); if(grey && menu[selected].title[0]=='_') {utf8_to_ansi(menu[selected].title+1, ansi, 60);} else {utf8_to_ansi(menu[selected].title, ansi, 60);} ansi[60]=0; color= (flagb && selected==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu[selected].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[selected].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[selected].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[selected].content,"DVD")!=NULL) color=COL_DVD; if(grey) sprintf(str, "%s (Split)", ansi); else sprintf(str, "%s", ansi); len=(0.023f*(float)(strlen(str)))/2; sprintf(str, "%i of %i", selected+1, menu_size); if(cover_mode==4) // draw_text_stroke( 0.5f-(float)(len/2), 0.71f, 0.88f, color, str); // else { // draw_text_stroke( 0.5f-(float)(len/2), 0.6f, 0.88f, color, str); /*if(selected!=last_selected) { last_selected=selected; int tmp_legend_y=legend_y; legend_y=0; memset(text_bmp, 0, 737280); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].title_id, color); legend_y=tmp_legend_y; } */ set_texture( text_bmp, 1920, legend_h); display_img(0, 728, 1920, legend_h, 1920, legend_h, -0.5f, 1920, legend_h); } // len=(0.023f*(float)(strlen(str)))/2; // bottom device icon if(cover_mode==1 || cover_mode==6 || cover_mode==7) { // draw_text_stroke( 0.5f-(float)(len/2), 0.75f, 0.88f, color, str); if(selected!=last_selected) { last_selected=selected; memcpy(text_bmp + (1920*4*legend_y), text_FONT, (1920*4*legend_h)); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].title_id, color); if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( text_bmp, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( text_bmp, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( text_bmp, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } } if(cover_mode==6) return; float s_x, s_y, s_h, s_w, b_size; int game_rel=0, c_x=0, c_y=0, c_game=0, c_w=0, c_h=0; if(cover_mode==1) { game_rel=int(selected/8)*8; c_game= selected-(game_rel); if(c_game<4) { c_y=64; c_x= 150 + (433*c_game); } else { c_y=430; c_x= 150 + (433*(c_game-4)); } if(menu[selected].cover!=1) { c_y+=124; c_w=320; c_h=176; } else { c_x+=30; c_w=260; c_h=300; } } if(cover_mode==7) { game_rel=int(selected/32)*32; c_game= selected-(game_rel); if(c_game<8) { c_y=62; c_x= 118 + (int)(216.5f*c_game); } if(c_game>7 && c_game<16) { c_y=240; c_x= 118 + (int)(216.5f*(c_game-8)); } if(c_game>15 && c_game<24) { c_y=418; c_x= 118 + (int)(216.5f*(c_game-16)); } if(c_game>23 && c_game<32) { c_y=596; c_x= 118 + (int)(216.5f*(c_game-24)); } if(menu[selected].cover!=1) { c_y+=62; c_w=160; c_h=88; c_x+=7; } else { c_x+=15; c_w=130; c_h=150; } } b_size = 0.008f; s_x=(float) c_x/1920.0f-b_size; s_y=(float) c_y/1080.0f-b_size; s_h=(float) c_h/1080.0f+2.0f*b_size; s_w=(float) c_w/1920.0f+2.0f*b_size; uint32_t b_color = 0x0080ff80; if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) b_color = 0xff800000; if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) b_color = 0x39b3f900; if(strstr(menu[selected].title_id, "AVCHD")!=NULL) b_color = 0xeeeb1a00; if(menu[selected].title[0]=='_' || menu[selected].split) b_color = 0xff000000; b_box_opaq+=b_box_step; if(b_box_opaq>0xfb) b_box_step=-4; if(b_box_opaq<0x20) b_box_step= 8; b_color = (b_color & 0xffffff00) | b_box_opaq; draw_square((s_x-0.5f)*2.0f, (0.5f-s_y)*2.0f , s_w*2.0f, b_size, -0.9f, b_color); draw_square((s_x-0.5f)*2.0f, (0.5f-s_y-s_h)*2.0f+b_size , s_w*2.0f, b_size, -0.9f, b_color); draw_square((s_x-0.5f)*2.0f, (0.5f-s_y)*2.0f , b_size, s_h*2.0f, -0.9f, b_color); draw_square((s_x+s_w-0.5f)*2.0f-b_size, (0.5f-s_y)*2.0f , b_size, s_h*2.0f, -0.9f, b_color); } // else // draw_text_stroke( 0.5f-(float)(len/2), 0.63f, 0.88f, color, str); } else { while( (c<max_entries && i < menu_size) ) { if( (display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { int grey=0; if(i<menu_size) { grey=(menu[i].title[0]=='_' || menu[i].split); if(grey && menu[i].title[0]=='_') { utf8_to_ansi(menu[i].title+1, ansi, 128); } else { utf8_to_ansi(menu[i].title, ansi, 128); } if(dir_mode==0 && (cover_mode==0 || cover_mode==2)) { ansi[40]=0; } if(dir_mode==1 && (cover_mode==0 || cover_mode==2)) { ansi[55]=0; } if(dir_mode==0 && cover_mode==3) { ansi[47]=0; } if(dir_mode==1 && cover_mode==3) { ansi[62]=0; } if( (cover_mode==1 || cover_mode==4 || cover_mode==7)) { ansi[128]=0; } if(grey) sprintf(str, "%s (Split)", ansi); else sprintf(str, "%s", ansi); } else { sprintf(str, " "); } color= 0xff606060; if(i==selected) color= (flagb && i==0) ? COL_PS3DISCSEL : ((grey==0) ? COL_SEL : 0xff008080); else { color= (flagb && i==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu[i].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[i].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[i].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[i].content,"DVD")!=NULL) color=COL_DVD; } color2=( (color & 0x00ffffff) | (opaq<<24)); if(dir_mode==1) { len=0.023f*(float)(strlen(str)+2); if(i==selected) // && cover_mode==3 draw_text_stroke( 0.08f, y-0.005f, 0.88f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y-0.005f, 0.88f, color2, str); else cellDbgFontPrintf( 0.08f, y-0.005f, 0.88f, color2, str); } else { len=0.03f*(float)(strlen(str)); if(dir_mode==0){ if(i==selected) draw_text_stroke( 0.08f, y-0.005f, 1.2f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y-0.005f, 1.2f, color2, str); else cellDbgFontPrintf( 0.08f, y-0.005f, 1.2f, color2, str); } else //dir2 { len=0.023f*(float)(strlen(str)+2); if(i==selected) // && cover_mode==3 draw_text_stroke( 0.08f, y+0.001f, 0.88f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y+0.001f, 0.88f, color2, str); else cellDbgFontPrintf( 0.08f, y+0.001f, 0.88f, color2, str); } } if(strlen(str)>1 && dir_mode==1) { sprintf(str, "%s", menu[i].path); if(strstr(menu[i].content,"AVCHD")!=NULL || strstr(menu[i].content,"BDMV")!=NULL) sprintf(str, "(%s) %s", menu[i].entry, menu[i].details); str[102]=0; if(0.01125f*(float)(strlen(str))>len) len=0.01125f*(float)(strlen(str)); if(i==selected) cellDbgFontPrintf( 0.08f, (y+0.022f), 0.45f, color, str); else cellDbgFontPrintf( 0.08f, (y+0.022f), 0.45f, color2, str); } if(i==selected) { u32 b_color=0x0080ffd0; b_box_opaq+=b_box_step; if(b_box_opaq>0xd0) b_box_step=-2; if(b_box_opaq<0x30) b_box_step= 1; b_color = (b_color & 0xffffff00) | (b_box_opaq-20); draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.1f, -0.9f, b_color); } y += 0.05f; c++; } i++; } } // cover_mode==4 return; } static void init_text_shader( void ) { void *ucode; u32 ucode_size; vertex_prg = &_binary_vpshader2_vpo_start; fragment_prg = &_binary_fpshader2_fpo_start; cellGcmCgInitProgram( vertex_prg ); cellGcmCgInitProgram( fragment_prg ); cellGcmCgGetUCode( fragment_prg, &ucode, &ucode_size ); text_fragment_prg_ucode = localAllocAlign(64, ucode_size ); cellGcmAddressToOffset( text_fragment_prg_ucode, &text_fragment_offset ); memcpy( text_fragment_prg_ucode, ucode, ucode_size ); cellGcmCgGetUCode( vertex_prg, &text_vertex_prg_ucode, &ucode_size ); } int text_create( u32 xsize, u32 ysize ) { u32 color_size; u32 color_limit; u32 depth_size; u32 depth_limit; u32 buffer_width; text_width = xsize; text_height =ysize; buffer_width = ROUNDUP( text_width, 64 ); text_colorp = cellGcmGetTiledPitchSize( buffer_width*4 ); if( text_colorp == 0 ) return -1; text_depthp = cellGcmGetTiledPitchSize( buffer_width*4 ); if( text_depthp == 0 ) return -1; color_size = text_colorp*ROUNDUP( text_height, 64 ); color_limit = ROUNDUP( 2*color_size, 0x10000 ); depth_size = text_depthp*ROUNDUP( text_height, 64 ); depth_limit = ROUNDUP( depth_size, 0x10000 ); init_text_shader(); vertex_text = (vtx_texture*) localAllocAlign(128*1024, 1024*sizeof(vtx_texture)); cellGcmAddressToOffset( (void*)vertex_text, &vertex_text_offset ); text_param.format = CELL_GCM_TEXTURE_A8R8G8B8; text_param.format |= CELL_GCM_TEXTURE_LN; text_param.remap = CELL_GCM_TEXTURE_REMAP_REMAP << 14 | CELL_GCM_TEXTURE_REMAP_REMAP << 12 | CELL_GCM_TEXTURE_REMAP_REMAP << 10 | CELL_GCM_TEXTURE_REMAP_REMAP << 8 | CELL_GCM_TEXTURE_REMAP_FROM_G << 6 | CELL_GCM_TEXTURE_REMAP_FROM_R << 4 | CELL_GCM_TEXTURE_REMAP_FROM_A << 2 | CELL_GCM_TEXTURE_REMAP_FROM_B; text_param.mipmap = 1; text_param.cubemap = CELL_GCM_FALSE; text_param.dimension = CELL_GCM_TEXTURE_DIMENSION_2; CGparameter objCoord = cellGcmCgGetNamedParameter( vertex_prg, "a2v.objCoord" ); if( objCoord == 0 ) return -1; CGparameter texCoord = cellGcmCgGetNamedParameter( vertex_prg, "a2v.texCoord" ); if( texCoord == 0) return -1; CGparameter texture = cellGcmCgGetNamedParameter( fragment_prg, "texture" ); if( texture == 0 ) return -1; text_obj_coord_indx = cellGcmCgGetParameterResource( vertex_prg, objCoord) - CG_ATTR0; text_tex_coord_indx = cellGcmCgGetParameterResource( vertex_prg, texCoord) - CG_ATTR0; tindex = (CGresource) (cellGcmCgGetParameterResource( fragment_prg, texture ) - CG_TEXUNIT0 ); return 0; } int set_texture( u8 *buffer, u32 x_size, u32 y_size ) { int ret; u32 buf_offs; ret = cellGcmAddressToOffset( buffer, &buf_offs ); if( CELL_OK != ret ) return ret; text_param.depth = 1; text_param.width = x_size; text_param.height = y_size; text_param.pitch = x_size*4; text_param.offset = buf_offs; text_param.location = CELL_GCM_LOCATION_MAIN; cellGcmSetTexture( gCellGcmCurrentContext, tindex, &text_param ); cellGcmSetTextureControl( gCellGcmCurrentContext, tindex, 1, 0, 15, CELL_GCM_TEXTURE_MAX_ANISO_1 ); cellGcmSetTextureAddress( gCellGcmCurrentContext, tindex, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL, CELL_GCM_TEXTURE_ZFUNC_LESS, 0 ); // cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX ); if(V_WIDTH<1280) cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_CONVOLUTION_MIN, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_GAUSSIAN ); else cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX ); cellGcmSetVertexProgram( gCellGcmCurrentContext, vertex_prg, text_vertex_prg_ucode ); cellGcmSetFragmentProgram( gCellGcmCurrentContext, fragment_prg, text_fragment_offset); cellGcmSetInvalidateTextureCache( gCellGcmCurrentContext, CELL_GCM_INVALIDATE_TEXTURE ); cellGcmSetVertexDataArray( gCellGcmCurrentContext, text_obj_coord_indx, 0, sizeof(vtx_texture), 3, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, vertex_text_offset ); cellGcmSetVertexDataArray( gCellGcmCurrentContext, text_tex_coord_indx, 0, sizeof(vtx_texture), 2, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, ( vertex_text_offset + sizeof(float)*3 ) ); return ret; } void display_img_persp(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, int keystoneL, int keystoneR) { vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y-keystoneL)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y-keystoneR)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height+keystoneR)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+2].ty=((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height+keystoneL)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= 0.0f; vertex_text[vert_texture_indx+3].ty= ((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void display_img(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty) { if((cover_mode==8) && V_WIDTH==720) { x-=(int)((float)width*0.04f); y-=(int)((float)height*0.06f); width+=(int)((float)width*0.08f); height+=(int)((float)height*0.12f); } vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+2].ty=((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= 0.0f; vertex_text[vert_texture_indx+3].ty= ((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void display_img_nr(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty) { vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= 0.0f; vertex_text[vert_texture_indx+2].ty= ((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x+width)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+3].ty=((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_TRIANGLE_STRIP, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } int angle_coord_x(int radius, float __angle) { float _angle=__angle; if(_angle>=360.f) _angle= __angle - 360.f; if(_angle<0.f) _angle=360.f+__angle; return (int) ((float) radius * cos((_angle/360.f * 6.283185307179586476925286766559f))); } int angle_coord_y(int radius, float __angle) { float _angle=__angle; if(_angle>=360.f) _angle= __angle - 360.f; if(_angle<0.f) _angle=360.f+__angle; return (int) ((float) radius * sin((_angle/360.f * 6.283185307179586476925286766559f))); } void display_img_angle(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, float _angle) { int _radius; if((cover_mode==8) && V_WIDTH==720) { x-=(int)((float)width*0.04f); y-=(int)((float)height*0.06f); width+=(int)((float)width*0.08f); height+=(int)((float)height*0.12f); } _radius = (int)(((float)width*sqrt(2.f))/2.f); // diagonal/2 -> works for square textures at the moment // center of rotation int xC= x+width/2; int yC= y+height/2; vertex_text[vert_texture_indx].x= ((float) ((xC+angle_coord_x(_radius, _angle))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((yC+angle_coord_y(_radius, _angle))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((xC+angle_coord_x(_radius, _angle+90.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((yC+angle_coord_y(_radius, _angle+90.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((xC+angle_coord_x(_radius, _angle-90.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((yC+angle_coord_y(_radius, _angle-90.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= 0.0f; vertex_text[vert_texture_indx+2].ty= ((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((xC+angle_coord_x(_radius, _angle-180.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((yC+angle_coord_y(_radius, _angle-180.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+3].ty=((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_TRIANGLE_STRIP, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void draw_square(float x, float y, float w, float h, float z, u32 color) { vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vertex_color[vert_indx+1].x = x+w; vertex_color[vert_indx+1].y = y; vertex_color[vert_indx+1].z = z; vertex_color[vert_indx+1].color=color; vertex_color[vert_indx+2].x = x+w; vertex_color[vert_indx+2].y = y-h; vertex_color[vert_indx+2].z = z; vertex_color[vert_indx+2].color=color; vertex_color[vert_indx+3].x = x; vertex_color[vert_indx+3].y = y-h; vertex_color[vert_indx+3].z = z; vertex_color[vert_indx+3].color=color; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_indx, 4); vert_indx+=4; } void draw_square_angle(float _x, float _y, float w, float h, float z, u32 color, float _angle) { int _radius; (void) w; (void) h; _radius = (int)(((float) 540.f * sqrt(2.f))/2.f); // diagonal/2 -> works for square textures at the moment float x=_x+(float)angle_coord_x(_radius, _angle)/1920.f; float y=_y+(float)angle_coord_y(_radius, _angle)/1080.f; vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vertex_color[vert_indx+1].x = x+w; vertex_color[vert_indx+1].y = y; vertex_color[vert_indx+1].z = z; vertex_color[vert_indx+1].color=color; vertex_color[vert_indx+2].x = x+w; vertex_color[vert_indx+2].y = y-h; vertex_color[vert_indx+2].z = z; vertex_color[vert_indx+2].color=color; vertex_color[vert_indx+3].x = x; vertex_color[vert_indx+3].y = y-h; vertex_color[vert_indx+3].z = z; vertex_color[vert_indx+3].color=color; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_indx, 4); vert_indx+=4; }
000kev000-toy
source/graphics.cpp
C++
oos
46,781
#include <stdio.h> #include <stdlib.h> #include <sys/paths.h> #include <cell/font.h> #include <cell/fontFT.h> #include "fonts.h" static Fonts_t Fonts; extern char app_usrdir; static void* fonts_malloc( void*, uint32_t size ); static void fonts_free( void*, void*p ); static void* fonts_realloc( void*, void* p, uint32_t size ); static void* fonts_calloc( void*, uint32_t numb, uint32_t blockSize ); static void* loadFileF( uint8_t* fname, size_t *size, int offset, int addSize ); static void* fonts_malloc( void*obj, uint32_t size ) { obj=NULL; return malloc( size ); } static void fonts_free( void*obj, void*p ) { obj=NULL; free( p ); } static void* fonts_realloc( void*obj, void* p, uint32_t size ) { obj=NULL; return realloc( p, size ); } static void* fonts_calloc( void*obj, uint32_t numb, uint32_t blockSize ) { obj=NULL; return calloc( numb, blockSize ); } static void* loadFileF( uint8_t* fname, size_t *size, int offset, int addSize ) { FILE* fp; size_t file_size; void* p; fp = fopen( (const char*)fname, "rb" ); if (! fp ) { // printf("cannot open %s\n", fname ); if ( size ) *size = 0; return NULL; } fseek( fp, 0, SEEK_END ); file_size = ftell( fp ); fseek( fp, 0, SEEK_SET ); if ( size ) *size = file_size; p = malloc( file_size + offset + addSize ); if ( p ) { fread( (unsigned char*)p+offset, file_size, 1, fp ); } fclose( fp ); return p; } int Fonts_LoadModules() { int ret; ret = cellSysmoduleLoadModule( CELL_SYSMODULE_FONT ); if ( ret == CELL_OK ) { ret = cellSysmoduleLoadModule( CELL_SYSMODULE_FREETYPE ); if ( ret == CELL_OK ) { ret = cellSysmoduleLoadModule( CELL_SYSMODULE_FONTFT ); if ( ret == CELL_OK ) { return ret; } cellSysmoduleUnloadModule( CELL_SYSMODULE_FREETYPE ); } // else printf("Fonts: 'CELL_SYSMODULE_FREETYPE' NG! %08x\n",ret); cellSysmoduleUnloadModule( CELL_SYSMODULE_FONT ); } // else printf("Fonts: 'CELL_SYSMODULE_FONT' NG! %08x\n",ret); return ret; } void Fonts_UnloadModules() { cellSysmoduleUnloadModule( CELL_SYSMODULE_FONTFT ); cellSysmoduleUnloadModule( CELL_SYSMODULE_FREETYPE ); cellSysmoduleUnloadModule( CELL_SYSMODULE_FONT ); } Fonts_t* Fonts_Init() { static CellFontEntry UserFontEntrys[USER_FONT_MAX]; static uint32_t FontFileCache[FONT_FILE_CACHE_SIZE/sizeof(uint32_t)]; CellFontConfig config; int ret; //---------------------------------------------------------------------- CellFontConfig_initialize( &config ); config.FileCache.buffer = FontFileCache; config.FileCache.size = FONT_FILE_CACHE_SIZE; config.userFontEntrys = UserFontEntrys; config.userFontEntryMax = sizeof(UserFontEntrys)/sizeof(CellFontEntry); config.flags = 0; //---------------------------------------------------------------------- ret = cellFontInit( &config ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontInit=", ret ); return (Fonts_t*)0; } return &Fonts; } int Fonts_InitLibraryFreeType( const CellFontLibrary** lib ) { CellFontLibraryConfigFT config; const CellFontLibrary* fontLib; int ret; CellFontLibraryConfigFT_initialize( &config ); config.MemoryIF.Object = NULL; config.MemoryIF.Malloc = fonts_malloc; config.MemoryIF.Free = fonts_free; config.MemoryIF.Realloc = fonts_realloc; config.MemoryIF.Calloc = fonts_calloc; ret = cellFontInitLibraryFreeType( &config, &fontLib ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontInitLibrary_FreeType=", ret ); // } if ( lib ) *lib = fontLib; return ret; } int Fonts_CreateRenderer( const CellFontLibrary* lib, uint32_t initSize, CellFontRenderer* rend ) { CellFontRendererConfig config; int ret; CellFontRendererConfig_initialize( &config ); CellFontRendererConfig_setAllocateBuffer( &config, initSize, 0 ); ret = cellFontCreateRenderer( lib, &config, rend ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontCreateRenderer=", ret ); return ret; } return ret; } int Fonts_OpenFonts( const CellFontLibrary*lib, Fonts_t* fonts, char* _app_usrdir ) { int n; int ret=CELL_OK; { static struct { uint32_t isMemory; int fontsetType; } openSystemFont[ SYSTEM_FONT_MAX ] = { { 0, CELL_FONT_TYPE_GOTHIC_JAPANESE_CJK_LATIN2_SET }, //CELL_FONT_TYPE_DEFAULT_GOTHIC_LATIN_SET { 0, CELL_FONT_TYPE_DEFAULT_GOTHIC_JP_SET }, { 1, CELL_FONT_TYPE_DEFAULT_SANS_SERIF }, { 1, CELL_FONT_TYPE_DEFAULT_SERIF }, { 1, CELL_FONT_TYPE_ROUND_SANS_EUROPEAN_CJK_LATIN_SET }, { 1, CELL_FONT_TYPE_GOTHIC_SCHINESE_CJK_JP_SET }, { 1, CELL_FONT_TYPE_GOTHIC_TCHINESE_CJK_JP_SET }, { 1, CELL_FONT_TYPE_GOTHIC_JAPANESE_CJK_JP_SET }, { 1, CELL_FONT_TYPE_DEFAULT_SANS_SERIF } }; CellFontType type; fonts->sysFontMax = 9; for ( n=0; n < fonts->sysFontMax; n++ ) { if (! openSystemFont[n].isMemory ) continue; type.type = openSystemFont[n].fontsetType; type.map = CELL_FONT_MAP_UNICODE; ret = cellFontOpenFontsetOnMemory( lib, &type, &fonts->SystemFont[n] ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontOpenFontset=", ret ); Fonts_CloseFonts( fonts ); return ret; } fonts->openState |= (1<<n); //cellFontSetResolutionDpi( &fonts->SystemFont[n], 36, 36 ); //cellFontSetScalePoint( &fonts->SystemFont[n], 18.f, 10.125f ); cellFontSetResolutionDpi( &fonts->SystemFont[n], 72, 72 ); cellFontSetScalePoint( &fonts->SystemFont[n], 26.f, 26.f ); } for ( n=0; n < fonts->sysFontMax; n++ ) { if ( openSystemFont[n].isMemory ) continue; type.type = openSystemFont[n].fontsetType; type.map = CELL_FONT_MAP_UNICODE; ret = cellFontOpenFontset( lib, &type, &fonts->SystemFont[n] ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontOpenFontset=", ret ); Fonts_CloseFonts( fonts ); return ret; } fonts->openState |= (1<<n); //cellFontSetResolutionDpi( &fonts->SystemFont[n], 36, 36 ); //cellFontSetScalePoint( &fonts->SystemFont[n], 18.f, 10.125f ); cellFontSetResolutionDpi( &fonts->SystemFont[n], 72, 72 ); cellFontSetScalePoint( &fonts->SystemFont[n], 26.f, 26.f ); } } { char ufontpath[256]; static struct { uint32_t isMemory; const char* filePath; } userFont[ USER_FONT_MAX ] = { { 0, "font0.ttf" }, //arial { 0, "font1.ttf" }, //tekton { 0, "font2.ttf" }, //coperplate { 0, "font3.ttf" }, //ps3 rodin { 0, "font4.ttf" }, //kristen { 0, "fontA.ttf" }, //bank gothic { 0, "fontB.ttf" }, //typewriter { 0, "fontC.ttf" }, //monospaced { 0, "fontD.ttf" }, //spiderman { 0, "fontE.ttf" }, //arial narro }; uint32_t fontUniqueId = 0; fonts->userFontMax = 10; for ( n=0; n < fonts->userFontMax; n++ ) { if(n<5) sprintf(ufontpath, "%s/fonts/user/font%i.ttf", _app_usrdir, n);// userFont[n].filePath); else sprintf(ufontpath, "%s/fonts/system/font%c.ttf", _app_usrdir, n+60);// userFont[n].filePath); uint8_t* path = (uint8_t*)ufontpath; //userFont[n].filePath if (! userFont[n].isMemory ) { ret = cellFontOpenFontFile( lib, path, 0, fontUniqueId, &fonts->UserFont[n] ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontOpenFile=", ret ); Fonts_CloseFonts( fonts ); // printf(" Fonts: [%s]\n", userFont[n].filePath); return ret; } } else { size_t size; void *p = loadFileF( path, &size, 0, 0 ); ret = cellFontOpenFontMemory( lib, p, size, 0, fontUniqueId, &fonts->UserFont[n] ); if ( ret != CELL_OK ) { if (p) free( p ); // Fonts_PrintError( " Fonts:cellFontMemory=", ret ); Fonts_CloseFonts( fonts ); // printf(" Fonts: [%s]\n", userFont[n].filePath); return ret; } } fonts->openState |= (1<<(FONT_USER_FONT0+n)); fontUniqueId++; if ( ret == CELL_OK ) { cellFontSetResolutionDpi( &fonts->UserFont[n], 72, 72 ); cellFontSetScalePoint( &fonts->UserFont[n], 26.f, 26.f ); } } } return ret; } int Fonts_GetFontsHorizontalLayout( Fonts_t* fonts, uint32_t fontmask, float scale, float* lineHeight, float*baseLineY ) { float ascent = 0.0f; float descent = 0.0f; int ret = CELL_OK; if ( fonts ) { CellFont* cf; CellFontHorizontalLayout Layout; int n; for ( n=0; n < fonts->sysFontMax; n++ ) { if ( (fontmask & (1<<n))==0x00000000 ) continue; cf = &fonts->SystemFont[n]; ret = cellFontSetScalePixel( cf, scale, scale ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.SystemFont:cellFontSetScalePixel=", ret ); // } ret = cellFontGetHorizontalLayout( cf, &Layout ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.SystemFont:cellFontGetHorizontalLayout=", ret ); // } if ( Layout.baseLineY > ascent ) { ascent = Layout.baseLineY; } if ( Layout.lineHeight - Layout.baseLineY > descent ) { descent = Layout.lineHeight - Layout.baseLineY; } } for ( n=0; n < fonts->userFontMax; n++ ) { if ( (fontmask & (1<<(FONT_USER_FONT0+n)))==0x00000000 ) continue; cf = &fonts->UserFont[n]; ret = cellFontSetScalePixel( cf, scale, scale ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.SystemFont:cellFontSetScalePixel=", ret ); // } ret = cellFontGetHorizontalLayout( cf, &Layout ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.UserFont:cellFontGetHorizontalLayout=", ret ); // } if ( Layout.baseLineY > ascent ) { ascent = Layout.baseLineY; } if ( Layout.lineHeight - Layout.baseLineY > descent ) { descent = Layout.lineHeight - Layout.baseLineY; } } } if ( lineHeight ) *lineHeight = ascent + descent; if ( baseLineY ) *baseLineY = ascent; return CELL_OK; } int Fonts_AttachFont( Fonts_t* fonts, int fontEnum, CellFont*cf ) { CellFont* openedFont = (CellFont*)0; int ret; if ( fonts ) { if ( fontEnum < FONT_USER_FONT0 ) { uint32_t n = fontEnum; if ( n < (uint32_t)fonts->sysFontMax ) { if ( fonts->openState & (1<<fontEnum) ) { openedFont = &fonts->SystemFont[ n ]; } } } else { uint32_t n = fontEnum - FONT_USER_FONT0; if ( n < (uint32_t)fonts->userFontMax ) { if ( fonts->openState & (1<<fontEnum) ) { openedFont = &fonts->UserFont[ n ]; } } } } ret = cellFontOpenFontInstance( openedFont, cf ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:AttachFont:cellFontOpenFontInstance=", ret ); // } return ret; } int Fonts_SetFontScale( CellFont* cf, float scale ) { int ret; ret = cellFontSetScalePixel( cf, scale, scale ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontSetScalePixel=", ret ); // } return ret; } int Fonts_SetFontEffectWeight( CellFont* cf, float effWeight ) { int ret; ret = cellFontSetEffectWeight( cf, effWeight ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontSetEffectWeight=", ret ); // } return ret; } int Fonts_SetFontEffectSlant( CellFont* cf, float effSlant ) { int ret; ret = cellFontSetEffectSlant( cf, effSlant ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontSetEffectSlant=", ret ); // } return ret; } int Fonts_GetFontHorizontalLayout( CellFont* cf, float* lineHeight, float*baseLineY ) { CellFontHorizontalLayout Layout; int ret; ret = cellFontGetHorizontalLayout( cf, &Layout ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontGetHorizontalLayout=", ret ); return ret; } if ( lineHeight ) *lineHeight = Layout.lineHeight; if ( baseLineY ) *baseLineY = Layout.baseLineY; return ret; } int Fonts_GetFontVerticalLayout( CellFont* cf, float* lineWidth, float*baseLineX ) { CellFontVerticalLayout Layout; int ret; ret = cellFontGetVerticalLayout( cf, &Layout ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontGetVerticalLayout=", ret ); return ret; } if ( lineWidth ) *lineWidth = Layout.lineWidth; if ( baseLineX ) *baseLineX = Layout.baseLineX; return ret; } int Fonts_DetachFont( CellFont*cf ) { int ret = cellFontCloseFont( cf ); // if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts:cellFontCloseFont=", ret ); // } return ret; } int Fonts_CloseFonts( Fonts_t* fonts ) { int n; int ret, err = CELL_FONT_OK; if (! fonts ) return err; for ( n=0; n < fonts->sysFontMax; n++ ) { uint32_t checkBit = (1<<n); if ( fonts->openState & checkBit ) { ret = cellFontCloseFont( &fonts->SystemFont[n] ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.SystemFont:cellFontCloseFont=", ret ); err = ret; continue; } fonts->openState &= (~checkBit); } } for ( n=0; n < fonts->userFontMax; n++ ) { uint32_t checkBit = (1<<(FONT_USER_FONT0+n)); if ( fonts->openState & checkBit ) { ret = cellFontCloseFont( &fonts->UserFont[n] ); if ( ret != CELL_OK ) { // Fonts_PrintError( " Fonts.UserFont:cellFontCloseFont=", ret ); err = ret; continue; } fonts->openState &= (~checkBit); } } return err; } int Fonts_DestroyRenderer( CellFontRenderer* renderer ) { int ret = cellFontDestroyRenderer( renderer ); return ret; } int Fonts_EndLibrary( const CellFontLibrary* lib ) { int ret = cellFontEndLibrary( lib ); return ret; } int Fonts_End() { int ret = cellFontEnd(); return ret; }
000kev000-toy
source/fonts.c
C
oos
13,987
/* syscall8.c Copyright (c) 2010 Hermes <www.elotrolado.net> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "syscall8.h" static uint64_t syscall8(register uint64_t cmd, register uint64_t param1, register uint64_t param2, register uint64_t param3) { __asm__ volatile ("li 11, 0x8\n\t" "sc\n\t" : "=r" (cmd), "=r" (param1), "=r" (param2), "=r" (param3) : "r" (cmd), "r" (param1), "r" (param2), "r" (param3) : "%r0", "%r12", "%lr", "%ctr", "%xer", "%cr0", "%cr1", "%cr5", "%cr6", "%cr7", "memory"); return cmd; } int sys8_disable(uint64_t key) { return (int) syscall8(0ULL, key, 0ULL, 0ULL); } int sys8_enable(uint64_t key) { return (int) syscall8(1ULL, key, 0ULL, 0ULL); } uint64_t sys8_memcpy(uint64_t dst, uint64_t src, uint64_t size) { return syscall8(2ULL, dst, src, size); } uint64_t sys8_memset(uint64_t dst, uint64_t val, uint64_t size) { return syscall8(3ULL, dst, val, size); } uint64_t sys8_call(uint64_t addr, uint64_t param1, uint64_t param2) { return syscall8(4ULL, addr, param1, param2); } uint64_t sys8_alloc(uint64_t size, uint64_t pool) { return syscall8(5ULL, size, pool, 0ULL); } uint64_t sys8_free(uint64_t addr, uint64_t pool) { return syscall8(6ULL, addr, pool, 0ULL); } void sys8_panic(void) { syscall8(7ULL, 0ULL, 0ULL, 0ULL); } int sys8_perm_mode(uint64_t mode) { return (int) syscall8(8ULL, mode, 0ULL, 0ULL); } uint64_t sys8_path_table(uint64_t addr_table) { return syscall8(9ULL, addr_table, 0ULL, 0ULL); }
000kev000-toy
source/syscall8.c
C
oos
3,003
#include "common.h" #include "peek_poke.h" #include "hvcall.h" #include "mm.h" #include <string.h> #include <psl1ght/lv2.h> u64 mmap_lpar_addr; extern unsigned char bdemu[0x1380]; int map_lv1() { int result = lv1_undocumented_function_114(HV_START_OFFSET, HV_PAGE_SIZE, HV_SIZE, &mmap_lpar_addr); if (result != 0) return 0; result = mm_map_lpar_memory_region(mmap_lpar_addr, HV_BASE, HV_SIZE, HV_PAGE_SIZE, 0); if (result) return 0; return 1; } void unmap_lv1() { if (mmap_lpar_addr != 0) lv1_undocumented_function_115(mmap_lpar_addr); } int lv2launch(u64 addr) { system_call_8(9, (u64) addr, 0,0,0,0,0,0,0); return_to_user_prog(int); } void hermes_payload_341(void) { if( Lv2Syscall1(6, 0x8000000000017CE0ULL) == 0x7C6903A64E800420ULL) return; int l, n; for(l = 0; l < 25; l++) { u8 * p = (u8 *) bdemu; for(n = 0; n < 3840; n += 8) { static u64 value; memcpy(&value, &p[n], 8); Lv2Syscall2(7, 0x80000000007e0000ULL + (u64) n, ~value); __asm__("sync"); value = Lv2Syscall1(6, 0x8000000000000000ULL); } // enable syscall9 Lv2Syscall2(7, 0x8000000000017CE0ULL , 0x7C6903A64E800420ULL); __asm__("sync"); } if(Lv2Syscall1(6, 0x8000000000017CE0ULL) == 0x7C6903A64E800420ULL) lv2launch(0x80000000007e0000ULL); __asm__("sync"); } void psgroove_main(int enable) { if( Lv2Syscall1(6, 0x8000000000346690ULL) == 0x80000000002BE570ULL ) return; install_new_poke(); if (!map_lv1()) { remove_new_poke(); return; } Lv2Syscall2(7, HV_BASE + HV_OFFSET + 0, 0x0000000000000001ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 8, 0xe0d251b556c59f05ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 16, 0xc232fcad552c80d7ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 24, 0x65140cd200000000ULL); unmap_lv1(); remove_new_poke(); if(enable==0) { int n=0; u64 val=0x0000000000000000ULL; u8 * p = (u8 *) bdemu; // 34 @ 2D8430 (110) for(n = 0; n < 0x110; n += 8) { memcpy(&val, &p[n+0xd8], 8); Lv2Syscall2(7, 0x80000000002D8430ULL + (u64) n, ~val); } // 27 @ 2BE4A0 (D8) for(n = 0; n < 0xd8; n += 8) { memcpy(&val, &p[n], 8); Lv2Syscall2(7, 0x80000000002BE4A0ULL + (u64) n, ~val); } Lv2Syscall2(7, 0x80000000002D8498ULL, 0x38A000064BD7623DULL ); // 06 symbols search /dev_b Lv2Syscall2(7, 0x80000000002D8504ULL, 0x38A000024BD761D1ULL ); // 0x002D7800 (/app_home) 2 search } Lv2Syscall2(7, 0x8000000000055EA0ULL, 0x63FF003D60000000ULL ); // fix 8001003D error Lv2Syscall2(7, 0x8000000000055F64ULL, 0x3FE080013BE00000ULL ); // fix 8001003E error Lv2Syscall2(7, 0x8000000000055F10ULL, 0x419E00D860000000ULL ); Lv2Syscall2(7, 0x8000000000055F18ULL, 0x2F84000448000098ULL ); Lv2Syscall2(7, 0x800000000007AF64ULL, 0x2F83000060000000ULL ); Lv2Syscall2(7, 0x800000000007AF78ULL, 0x2F83000060000000ULL ); if(enable==0) { Lv2Syscall2(7, 0x8000000000346690ULL, 0x80000000002BE570ULL ); // enable syscall36 Lv2Syscall2(7, 0x80000000002B3274ULL, 0x480251EC2BA30420ULL ); // hook open } } void hermes_payload_355(int enable) { if( Lv2Syscall1(6, 0x8000000000346690ULL) == 0x800000000000F010ULL ) return; install_new_poke(); if (!map_lv1()) { remove_new_poke(); return; } Lv2Syscall2(7, HV_BASE + HV_OFFSET + 0, 0x0000000000000001ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 8, 0xe0d251b556c59f05ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 16, 0xc232fcad552c80d7ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 24, 0x65140cd200000000ULL); unmap_lv1(); remove_new_poke(); if(enable==0) { int n=0; u64 val=0x0000000000000000ULL; u8 * p = (u8 *) bdemu; for(n = 0; n < 0x200; n += 8) { memcpy(&val, &p[n], 8); Lv2Syscall2(7, 0x800000000000EF48ULL + (u64) n, ~val); } for(n = 0; n < 0x200; n += 8) { memcpy(&val, &p[n+0x200], 8); Lv2Syscall2(7, 0x800000000000F1E8ULL + (u64) n, ~val); } } Lv2Syscall2(7, 0x8000000000055EA0ULL, 0x63FF003D60000000ULL ); // fix 8001003D error Lv2Syscall2(7, 0x8000000000055F64ULL, 0x3FE080013BE00000ULL ); // fix 8001003E error Lv2Syscall2(7, 0x8000000000055F10ULL, 0x419E00D860000000ULL ); Lv2Syscall2(7, 0x8000000000055F18ULL, 0x2F84000448000098ULL ); Lv2Syscall2(7, 0x800000000007AF64ULL, 0x2F83000060000000ULL ); Lv2Syscall2(7, 0x800000000007AF78ULL, 0x2F83000060000000ULL ); if(enable==0) { Lv2Syscall2(7, 0x8000000000346690ULL, 0x800000000000F010ULL ); // enable syscall36 Lv2Syscall2(7, 0x80000000003465B0ULL, 0x800000000000F2E0ULL ); // enable syscall8 Lv2Syscall2(7, 0x80000000002b3298ULL, 0x4bd5bda04bd9b411ULL ); // hook open() } }
000kev000-toy
source/syscall36.cpp
C++
oos
4,644
#include "peek_poke.h" int poke_syscall = 7; u64 lv2_peek(u64 address) { return Lv2Syscall1(6, address); } void lv2_poke(u64 address, u64 value) { Lv2Syscall2(poke_syscall, address, value); } void lv2_poke32(u64 address, u32 value) { u32 next = lv2_peek(address) & 0xffffffff; lv2_poke(address, (u64) value << 32 | next); } u64 lv1_peek(u64 address) { return Lv2Syscall1(6, HV_BASE + address); } void lv1_poke(u64 address, u64 value) { Lv2Syscall2(7, HV_BASE + address, value); } void install_new_poke() { // install poke with icbi instruction lv2_poke(NEW_POKE_SYSCALL_ADDR, 0xF88300007C001FACULL); lv2_poke(NEW_POKE_SYSCALL_ADDR + 8, 0x4C00012C4E800020ULL); poke_syscall = NEW_POKE_SYSCALL; } void remove_new_poke() { poke_syscall = 7; lv2_poke(NEW_POKE_SYSCALL_ADDR, 0xF821FF017C0802A6ULL); lv2_poke(NEW_POKE_SYSCALL_ADDR + 8, 0xFBC100F0FBE100F8ULL); }
000kev000-toy
source/peek_poke.cpp
C++
oos
877
/* # Portions of code and idea for localization by: # (c) 2006 Eugene Plotnikov <e-plotnikov@operamail.com> # SMS Media Player for PS2 / PS2DEV Open Source Project # Used: SMS_Locale.h, SMS_Locale.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "language.h" static unsigned char s_pDebugMode [] = "Debug Mode"; static unsigned char s_pQuit0 [] = "Quit to XMB\xE2\x84\xA2"; static unsigned char s_pQuit1 [] = "Quit to XMB\xE2\x84\xA2 screen?"; static unsigned char s_pRestart0 [] = "Restart multiMAN?"; static unsigned char s_pWarnFTP [] = "There are active FTP connections!\n\nAre you sure you want to continue and abort FTP transfers?"; static unsigned char s_pWarnSNES [] = "To play SNES games you must install the latest version of SNEX9x for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnGEN [] = "To play Genesis+ GX games you must install the latest version of GENESIS Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnFCEU [] = "To play NES/FCE Ultra games you must install the latest version of FCEU Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnVBA [] = "To play GameBoy/Advanced games you must install the latest version of VBA Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnFBA [] = "To play FBA games you must install the latest version of FB Alpha/Next for the PS3\xE2\x84\xA2"; static unsigned char s_pCopy0 [] = "Copying %d files (%1.3f GB), please wait..."; static unsigned char s_pCopy1 [] = "Copying %d files, please wait..."; static unsigned char s_pCopy2 [] = "Creating links for %d files (%1.3f GB), please wait..."; static unsigned char s_pCopy3 [] = "Installing Game Files to HDD cache, please wait..."; static unsigned char s_pCopy4 [] = "Copying over %d+ files (%1.3f+ GB), please wait..."; static unsigned char s_pCopy5 [] = "Copying, please wait!"; static unsigned char s_pCopy6 [] = "Copying file, please wait..."; static unsigned char s_pCopy7 [] = "Do you want to create a shadow copy of the selected folder?\n\nSource: [%s]\n\nDestination: [/dev_hdd0/G/<special_pkg_id>"; static unsigned char s_pCopy8 [] = "Do you want to create a shadow copy of the selected folder?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pCopy9 [] = "Do you want to copy the selected folders?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pCopy10 [] = "Do you want to enable BD-ROM GAME DISC mirror on external USB?\n\nSource: [%s]\n\nDestination: [Emulated BD-ROM on USB device]"; static unsigned char s_pCopy11 [] = "Do you want to copy the selected file?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pCopy12 [] = "Do you want to copy selected %i files?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pNetCopy0 [] = "Copying network folder (%i files in %i folders) from [%s], please wait!"; static unsigned char s_pNetCopy1 [] = "Copying file to network host [%s], please wait!"; static unsigned char s_pNetCopy2 [] = "Copying network file from [%s], please wait!"; static unsigned char s_pNetCopy3 [] = "Copying local folder (%i files in %i folders) to network host [%s], please wait!"; static unsigned char s_pNetCopy4 [] = "Transferred %.2f of %.2f MB. Remaining: %imin %2.2isec"; static unsigned char s_pMove0 [] = "Do you want to move the selected folders?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pMove1 [] = "Do you want to move the selected file?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pMove2 [] = "Do you want to move selected %i files?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pMove3 [] = "Moving, please wait!"; static unsigned char s_pMove4 [] = "Moving file, please wait..."; static unsigned char s_pWarnINET [] = "Internet connection is not available or an error has occured!"; static unsigned char s_pErrSRV0 [] = "Error occured while contacting the server!\n\nPlease try again later."; static unsigned char s_pErrUPD0 [] = "Error occured while downloading the update!\n\nPlease try again later."; static unsigned char s_pErrUPD1 [] = "Error occured while contacting the update server!\n\nPlease try again later."; static unsigned char s_pErrMNT [] = "Error occured while parsing device mount table!"; static unsigned char s_pErrMVGAME [] = "Error occured while moving game to new location!"; static unsigned char s_pErrMVAV [] = "Error (%08X) occured while setting active AVCHD folder.\n\nCannot rename [%s] to [%s]"; static unsigned char s_pDownUpdate [] = "Downloading update data, please wait!"; static unsigned char s_pDownCover [] = "Downloading cover, please wait!"; static unsigned char s_pDownFile [] = "Downloading file, please wait!"; static unsigned char s_pDownTheme [] = "Downloading theme, please wait!"; static unsigned char s_pDownMSG0 [] = "\nDownloaded %.1f of %.3f MB. Remaining: %imin %2.2isec (/\\ to cancel)\nSave path: %s"; static unsigned char s_pDownMSG1 [] = "Downloaded %1.2f of %1.2f KB. Remaining: %imin %2.2isec\n\nPress /\\ to cancel download"; static unsigned char s_pDownMSG2 [] = "Downloaded %1.2f of %1.2f KB. Remaining: %imin %2.2isec"; static unsigned char s_pParamVer [] = "Game requires PS3 firmware version %.2f.\n\nDo you want to change PARAM.SFO version to %.2f?"; static unsigned char s_pLastPlay [] = "Setting data for last played game, please wait..."; static unsigned char s_pSetAccess [] = "Setting access permissions, please wait..."; static unsigned char s_pSetAccess1 [] = "Setting access permissions, please wait!\n\nThis operation will be performed only once."; static unsigned char s_pPreProcess [] = "Pre-processing required for this title.\n\nDo you want to install required data to internal HDD?"; static unsigned char s_pNoSpace0 [] = "Not enough space to complete cache operation! (Available: %.2fMB)\n\nAdditional %.2fMB of free space required!"; static unsigned char s_pNoSpace1 [] = "Not enough space on destination drive! (Available: %.2fMB)\n\nAdditional %.2fMB of free space required!"; static unsigned char s_pErrNoMemWeb [] = "Not enough memory to launch web browser!\n\nPlease restart multiMAN and try again."; static unsigned char s_pErrNoMem [] = "Please restart multiMAN from PS3 XMB\xE2\x84\xA2"; //multiMAN Update static unsigned char s_pPleaseWait [] = "Please wait..."; static unsigned char s_pWhatsNew [] = "What's new in multiMAN %s:\n\n%s"; static unsigned char s_pNewVer [] = "New version found: %s\n\nYour current version: %s\n\nDo you want to download the update?"; static unsigned char s_pNewVerDL [] = "Download completed successfully!\n\nInstall the update from [* Install Package Files] XMB\xE2\x84\xA2 tab.\n\nUpdate file saved as: %s\n\n%s?"; static unsigned char s_pNewVerNN [] = "You already have the latest version: %s\n\n There is no need to update."; static unsigned char s_pNewVerUSB [] = "Please attach USB storage device to save update data and try again!"; //Game Update static unsigned char s_pGameUpdate1 [] = "%s\n\nVersion: %s (%i update)\nUpdate size: %.2fMB\n\nDownload update now?"; static unsigned char s_pGameUpdate2 [] = "%s\n\nVersions: %s - %s (%i updates)\nTotal update size: %.2fMB\n\nDownload updates now?"; static unsigned char s_pGameUpdate3 [] = "%s\n\nYou already have version %.2f installed.\n\nDo you want to download newer updates only?"; static unsigned char s_pGameUpdate5 [] = "Download completed successfully!\n\nUpdate files saved in: %s\n\n%s?"; static unsigned char s_pGameUpdate6 [] = "You already have the latest version of the game."; static unsigned char s_pGameUpdate7 [] = "Cannot find update information for this title!"; //Selection menus captions static unsigned char s_pSelTheme [] = "Select Theme"; static unsigned char s_pSelLang [] = "Select Language"; static unsigned char s_pDelGameC [] = "Delete Game Cache"; //File Manager top static unsigned char s_pFMGames [] = "Games"; static unsigned char s_pFMUpdate [] = "Update"; static unsigned char s_pFMAbout [] = "About"; static unsigned char s_pFMHelp [] = "Help"; static unsigned char s_pFMThemes [] = "Themes"; //File Manager Command menu static unsigned char s_pCMMulDir [] = "Multiple folders"; static unsigned char s_pCMMulFile [] = "Multiple files"; static unsigned char s_pCMCopy [] = "Copy"; static unsigned char s_pCMMove [] = "Move"; static unsigned char s_pCMRename [] = "Rename"; static unsigned char s_pCMDelete [] = "Delete"; static unsigned char s_pCMShortcut [] = "Create Shortcut"; static unsigned char s_pCMShadow [] = "Shadow for PKG game"; static unsigned char s_pCMBDMirror [] = "Activate BD-Mirror"; static unsigned char s_pCMNetHost [] = "Refresh Net Host"; static unsigned char s_pCMHexView [] = "Open in HEX Viewer"; static unsigned char s_pCMProps [] = "Properties"; static unsigned char s_pCMNewDir [] = "Create New Folder"; static unsigned char s_pApplyTheme [] = "Applying \x22%s\x22 theme, please wait..."; // system menu static unsigned char s_pMMUpdate [] = "Update"; static unsigned char s_pMMUpdateL1 [] = "Check for available program updates."; static unsigned char s_pMMUpdateL2 [] = "multiMAN is being updated constantly, so make sure"; static unsigned char s_pMMUpdateL3 [] = "to check for new versions regularly."; static unsigned char s_pMMUpdateL4 [] = "Internet connection required."; static unsigned char s_pMMRefresh [] = "Refresh List"; static unsigned char s_pMMRefreshL1 [] = "Re-scan internal and external hard disk drives."; static unsigned char s_pMMRefreshL2 [] = "Force multiMAN to refresh and re-detect content"; static unsigned char s_pMMRefreshL3 [] = "(games, video, other). Use this option if you"; static unsigned char s_pMMRefreshL4 [] = "transfer content via FTP. Shortcut is SELECT+L3."; static unsigned char s_pMMFileMan [] = "File Manager"; static unsigned char s_pMMFileManL1 [] = "Switch to File Manager mode. Shortcut is SELECT+START."; static unsigned char s_pMMFileManL2 [] = "Use file manager to manage your files and folders, to copy,"; static unsigned char s_pMMFileManL3 [] = "move or rename them, to view images and play music and video."; static unsigned char s_pMMFileManL4 [] = "SHOWTIME may be required to play some content."; static unsigned char s_pMMShowtimeST [] = "Launch Showtime"; static unsigned char s_pMMShowtimeSTL1 [] = "Quit multiMAN and launch Showtime Player."; static unsigned char s_pMMShowtimeSTL2 [] = "Showtime Media Player is a feature rich"; static unsigned char s_pMMShowtimeSTL3 [] = "application, which allows you to play"; static unsigned char s_pMMShowtimeSTL4 [] = "various video, audio and graphic formats."; static unsigned char s_pMMNTFS [] = "PFS / NTFS driver"; static unsigned char s_pMMNTFSL1 [] = "Switch between FAT32 and NTFS drivers."; static unsigned char s_pMMNTFSL2 [] = "To use this option you must connect external USB HDD,"; static unsigned char s_pMMNTFSL3 [] = "formatted with FAT32 or NTFS file system."; static unsigned char s_pMMNTFSL4 [] = "Proper USB.CFG required. Shortcut is START+TRIANGLE."; static unsigned char s_pMMShowtimeLK [] = "Link VIDEO to Showtime"; static unsigned char s_pMMShowtimeLKL1 [] = "Create links of your XMB\xE2\x84\xA2 video files to"; static unsigned char s_pMMShowtimeLKL2 [] = "a special folder for Showtime Media Player"; static unsigned char s_pMMShowtimeLKL3 [] = "to find them. When linking completes, multiMAN"; static unsigned char s_pMMShowtimeLKL4 [] = "will launch Showtime."; static unsigned char s_pMMScrShot [] = "Screenshot"; static unsigned char s_pMMScrShotL1 [] = "Take a screenshot of your game list."; static unsigned char s_pMMScrShotL2 [] = "Current screen will be saved as RGB raw file to /dev_hdd0"; static unsigned char s_pMMScrShotL3 [] = "or in the root folder of connected USB device."; static unsigned char s_pMMScrShotL4 [] = "Shortcut is START+R2."; static unsigned char s_pMMScrSave [] = "Screensaver"; static unsigned char s_pMMScrSaveL1 [] = "Turn on multiMAN's screensaver."; static unsigned char s_pMMScrSaveL2 [] = "A screen with falling 'stars' will appear on"; static unsigned char s_pMMScrSaveL3 [] = "your display. Press a button to quit"; static unsigned char s_pMMScrSaveL4 [] = "the screensaver mode."; static unsigned char s_pMMRestart [] = "Restart"; static unsigned char s_pMMRestartL1 [] = "Restart multiMAN. Shortcut is START+SELECT."; static unsigned char s_pMMRestartL2 [] = "You can remotely restart multiMAN by connecting to your"; static unsigned char s_pMMRestartL3 [] = "Playstation\xC2\xAE\x33 system via telnet to port 8080"; static unsigned char s_pMMRestartL4 [] = "and type 'restart'."; static unsigned char s_pMMSetup [] = "multiMAN Setup"; static unsigned char s_pMMSetupL1 [] = "Switch to XMMB Settings column."; static unsigned char s_pMMSetupL2 [] = "You can edit all multiMAN options in XMMB mode."; static unsigned char s_pMMSetupL3 [] = "If you select this option, the current display"; static unsigned char s_pMMSetupL4 [] = "mode will be changed."; static unsigned char s_pMMQuit [] = "Quit"; static unsigned char s_pMMQuitL1 [] = "Quit multiMAN and return to XMB\xE2\x84\xA2 home screen."; static unsigned char s_pMMQuitL2 [] = "You can remotely quit multiMAN by connecting to your"; static unsigned char s_pMMQuitL3 [] = "Playstation\xC2\xAE\x33 system via telnet to port 8080"; static unsigned char s_pMMQuitL4 [] = "and type 'quit'."; static unsigned char s_pMMHelp [] = "Help"; static unsigned char s_pMMHelpL1 [] = "Start the HELP application."; static unsigned char s_pMMHelpL2 [] = "This option will execute external"; static unsigned char s_pMMHelpL3 [] = "help.MME application and quit multiMAN."; static unsigned char s_pMMHelpL4 [] = "Avoid using it during FTP transfers."; static unsigned char s_pButNavigate [] = "Navigate"; static unsigned char s_pButSelect [] = "Select"; static unsigned char s_pButBack [] = "Back"; static unsigned char s_pButCancel [] = "Cancel"; static unsigned char s_pButApply [] = "Apply"; static unsigned char s_pButConfirm [] = "Confirm"; static unsigned char s_pButGenre [] = "Genre"; static unsigned char s_pButDownload [] = "Download"; static unsigned char s_pButLoad [] = "Load"; static unsigned char s_pButPrev [] = "Prev Title"; static unsigned char s_pButNext [] = "Next Title"; static unsigned char s_pButLast [] = "Last Title"; static unsigned char s_pButFirst [] = "First Title"; static unsigned char s_pSelGenre [] = "Select Genre"; static unsigned char s_pButDownTheme[] = "Download Theme"; // Game settings menu static unsigned char s_pGMCopy [] = "Copy"; static unsigned char s_pGMCopyL1 [] = "Create a backup copy of \x22%s\x22."; static unsigned char s_pGMCopyL2 [] = "To protect your Playstation\xC2\xAE\x33 Blu-ray\xE2\x84\xA2 game disc,"; static unsigned char s_pGMCopyL3 [] = "transfer its contents to internal or external hard disk drive."; static unsigned char s_pGMDelete [] = "Delete"; static unsigned char s_pGMDeleteL1 [] = "Permanently delete game files."; static unsigned char s_pGMDeleteL2 [] = "If you are running low on disk space, delete the game from your"; static unsigned char s_pGMDeleteL3 [] = "hard disk drive. Use this option with caution!"; static unsigned char s_pGMRename [] = "Rename"; static unsigned char s_pGMRenameL1 [] = "Pick a name of your choice for the game."; static unsigned char s_pGMRenameL2 [] = "You can use the on-screen keyboard or external USB keyboard"; static unsigned char s_pGMRenameL3 [] = "for input. Use (TM), (R) and (C) to enter \xE2\x84\xA2, \xC2\xAE and \xC2\xA9 symbols."; static unsigned char s_pGMUpdate [] = "Update"; static unsigned char s_pGMUpdateL1 [] = "Check for game updates."; static unsigned char s_pGMUpdateL2 [] = "This feature allows you to download all available updates"; static unsigned char s_pGMUpdateL3 [] = "or only the latest. Internet connection required."; static unsigned char s_pGMTest [] = "Test"; static unsigned char s_pGMTestL1 [] = "Verify all files and folders of the game."; static unsigned char s_pGMTestL2 [] = "Testing will report various data as Total Size, Number of files,"; static unsigned char s_pGMTestL3 [] = "Big files (over 4GB) and if game contains split (.666##) files."; static unsigned char s_pGMPerm [] = "Permissions"; static unsigned char s_pGMPermL1 [] = "Re-apply file and folder access permissions."; static unsigned char s_pGMPermL2 [] = "On rare occasions it may be required to perform resetting of"; static unsigned char s_pGMPermL3 [] = "ownership and execution flags of game contents."; static unsigned char s_pPOPGS [] = ": Game Settings"; static unsigned char s_pPOPChangeS [] = ": Change Setting"; static unsigned char s_pPOPSysInfo [] = ": View System Information"; static unsigned char s_pPOPLang [] = ": Change Display Language"; static unsigned char s_pPOPCache [] = ": Clear Cached Files"; static unsigned char s_pPOPPhoto [] = ": View Photo"; static unsigned char s_pPOPMusic [] = ": Play Music"; static unsigned char s_pPOPST [] = ": Launch Showtime"; static unsigned char s_pPOPVideo [] = ": Play Video"; static unsigned char s_pPOPRefGames [] = ": Refresh List"; static unsigned char s_pPOPRefRoms [] = ": Refresh ROMs"; static unsigned char s_pPOPRom [] = ": Load Game ROM"; static unsigned char s_pPOPGrpGenre [] = ": Group Titles by Genre"; static unsigned char s_pPOPGrpEmu [] = ": Group ROMs by Emulator"; static unsigned char s_pPOPGrpName [] = ": Group Titles by Name"; static unsigned char s_pPOPSwitch [] = ": Switch Display"; static unsigned char s_pPOP1of1 [] = "%s: %i of %i"; static unsigned char s_pPOPPlaying [] = "Playing"; static unsigned char s_pPOPPaused [] = "Paused"; static unsigned char s_pPOPVol [] = "[Volume: %i]"; // Alpha group "Other" static unsigned char s_pOther [] = "Other"; // Genres static unsigned char s_pGENOther [] = "Other"; static unsigned char s_pGENAct [] = "Action"; static unsigned char s_pGENAdv [] = "Adventure"; static unsigned char s_pGENFam [] = "Family"; static unsigned char s_pGENFight [] = "Fighting"; static unsigned char s_pGENParty [] = "Party"; static unsigned char s_pGENPlat [] = "Platform"; static unsigned char s_pGENPuzz [] = "Puzzle"; static unsigned char s_pGENRole [] = "Role Playing"; static unsigned char s_pGENRace [] = "Racing"; static unsigned char s_pGENShoot [] = "Shooter"; static unsigned char s_pGENSim [] = "Sim"; static unsigned char s_pGENSport [] = "Sports"; static unsigned char s_pGENStrat [] = "Strategy"; static unsigned char s_pGENTriv [] = "Trivia"; static unsigned char s_pGEN3D [] = "3D Support"; // Retro Groups static unsigned char s_pRETRO [] = "Retro"; static unsigned char s_pRETSNES [] = "SNES"; static unsigned char s_pRETFCEU [] = "FCEU"; static unsigned char s_pRETVBA [] = "VBA"; static unsigned char s_pRETGEN [] = "GEN+"; static unsigned char s_pRETFBA [] = "FBANext"; // XMMB Column names ("Empty", "multiMAN", ... Retro, ...) static unsigned char s_pXCS [] = "Settings"; // 2 static unsigned char s_pXCP [] = "Photo"; // 3 static unsigned char s_pXCM [] = "Music"; // 4 static unsigned char s_pXCV [] = "Video"; // 5 static unsigned char s_pXCG [] = "Game"; // 6 static unsigned char s_pXCF [] = "Favorites"; // 7 static unsigned char s_pXCW [] = "Web"; // 9 static unsigned char s_pPS2 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the [PLAYSTATION\xC2\xAE\x32 Format Game] icon."; static unsigned char s_pPKG [] = "Do you want to exit to XMB\xE2\x84\xA2 to install selected package from [* Install package files] menu?"; static unsigned char s_pNoSplit1 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor use XMMB mode to launch the title."; static unsigned char s_pNoSplit2 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor use [Hermes] option for BD-Emulator type in SETTINGS XMMB column\nand restart your PS3\xE2\x84\xA2 system."; static unsigned char s_pNoSplit3 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor enable [Verify USB Games] option in SETTINGS XMMB column\nand restart your PS3\xE2\x84\xA2 system."; static unsigned char s_pVerifying [] = "Verifying game data, please wait..."; static unsigned char s_pCanceled [] = "Operation failed or canceled."; static unsigned char s_pNotSupported[] = "Your current configuration doesn't support this function!"; static unsigned char s_pNotSupported2[] = "Your current configuration doesn't support this function!\n\n (unable to create file cache)"; static unsigned char s_pPS3DISC [] = "Please insert an original PLAYSTATION\xC2\xAE\x33 game disc before proceeding!"; static unsigned char s_pThmInstall [] = "Do you want to exit to XMB\xE2\x84\xA2 to install \x22%s\x22 theme from [* Install package files] menu?"; static unsigned char s_pToDBoot [] = "Do you want to start the game without exiting to XMB?\n\nWarning: Some games do not support such launch mode!"; static unsigned char s_pDLST [] = "Showtime for multiMAN application is missing!\n\nDo you want to download it now?"; static unsigned char s_pStartBD1 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the /app_home icon."; static unsigned char s_pStartBD2 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the Blu-ray\xE2\x84\xA2 Game Disc icon."; static unsigned char s_pOverwrite [] = "Destination already contains folder with the same name!\n\nContinue and overwrite?\n\n[%s]"; static unsigned char s_pIncomplete [] = "WARNING:\n\nYour installation of multiMAN is incomplete!\nPlease install BASE or FULL version or you may experience graphics display problems!"; static unsigned char s_pErrBDEMU1 [] = "multiMAN cannot enable selected BD-ROM emulator type. Functionality may be restricted!\n\nError: BDEMU.BIN incorrect version"; static unsigned char s_pErrBDEMU2 [] = "multiMAN cannot enable BD-ROM emulator. Functionality may be restricted!\n\nError: BDEMU.BIN missing"; static unsigned char s_pErrBDEMU3 [] = "multiMAN cannot enable BD-ROM emulator. Functionality may be restricted!\n\nError: Unsupported system firmware or BDEMU.BIN incorrect version"; static unsigned char s_pCritical [] = "CRITICAL ERROR:\n\nmultiMAN cannot access or create default backup folder!\nGame backup functions may not work properly.\n\nPlease use different payload if necessary!"; static unsigned char s_pDelFile [] = "Do you want to delete the selected file?\n\n[%s]"; static unsigned char s_pDelFiles [] = "Do you want to delete the selected %i files?"; static unsigned char s_pDelDir [] = "Do you want to delete the selected folder and its contents?\n\n[%s]"; static unsigned char s_pDelDirs [] = "Do you want to delete the selected %i folders and their contents?"; static unsigned char s_pDelFromHDD [] = "Do you want to delete title from internal HDD?"; static unsigned char s_pDelFromUSB [] = "Do you want to delete title from external USB00%c?"; static unsigned char s_pDelFromCache[] = "There is cached data for this title. Do you want to clear it?"; static unsigned char s_pCpHdd2Usb [] = "Do you want to copy game from internal HDD to external USB00%c?"; static unsigned char s_pCpUsb2Hdd [] = "Do you want to copy game from external USB00%c to internal HDD?\n\nSource: /dev_usb00%i/%s/%s\nDestination: %s/%s"; static unsigned char s_pCpPfs2Hdd [] = "Do you want to copy game from external USB disk to internal HDD?\n\nSource: %s\nDestination: %s/%s"; static unsigned char s_pCpUsb2Usb [] = "Do you want to copy game from external USB00%c to external USB00%c?\n\nSource: /dev_usb00%i/%s/%s\nDestination: /dev_usb00%i/%s/%s"; static unsigned char s_pOverwriteNo [] = "Destination already contains folder with the same name!\n\nPlease use FILE MANAGER [SELECT+START] to rename or remove:\n\n[%s]"; static unsigned char s_pDelPartHDD [] = "%s\n\nDelete partial copy from internal HDD?"; static unsigned char s_pDelPartUSB [] = "%s\n\nDelete partial copy from USB00%c?"; static unsigned char s_pDelCacheDone[] = "Game Cache Data cleared!"; static unsigned char s_pCpBD2Hdd [] = "Do you want to copy game from BD-ROM to internal HDD?"; static unsigned char s_pCpBD2Usb [] = "Do you want to copy game from BD-ROM to external USB00%c?"; static unsigned char s_pPinGame [] = "Game parental level: %i - Enter access PIN code:"; static unsigned char s_pPinErr [] = "Entered PIN code is incorrect!"; static unsigned char s_pPinEnter [] = "Enter access PIN code:"; static unsigned char s_pPinNew [] = "Enter NEW access PIN code:"; static unsigned char s_pPinErr2 [] = "Entered PIN code is not accepted!\n\nPlease use four character alphanumeric PIN!"; static unsigned char s_pBd2AVCHD [] = "::: %s :::\n\nDo you want to convert the Blu-ray\xE2\x84\xA2 disc structure to AVCHD\xE2\x84\xA2 format?\n\nNote: The action may improve playback compatibility!"; static unsigned char s_pBd2AVCHD2 [] = "Converting Blu-ray\xE2\x84\xA2 structure to AVCHD\xE2\x84\xA2, please wait..."; static unsigned char s_pActAVCHD [] = "Activate currently selected AVCHD\xE2\x84\xA2 video folder?\n\n::: %s :::\n\nNote: You can start video playback from XMB\xE2\x84\xA2 [Video] tab"; static unsigned char s_pActAVCHD2 [] = "Activating AVCHD\xE2\x84\xA2 structure, please wait..."; static unsigned char s_pBd2AVCHD3 [] = "::: %s :::\n\n%s: %s\n\nDo you want to convert the Blu-ray\xE2\x84\xA2 disc structure to AVCHD\xE2\x84\xA2 format?\n\nNote: The action may improve playback compatibility!"; static unsigned char s_pActBDMV [] = "Activate currently selected Blu-ray\xE2\x84\xA2 (BDMV) video folder?\n\n::: %s :::\n\n[%s: %s]\n\nNote: You can start video playback from XMB\xE2\x84\xA2 [Video] tab"; static unsigned char s_pAttUSB [] = "Please attach USB, SDHC or MemoryStick\xE2\x84\xA2 storage device to activate AVCHD\xE2\x84\xA2 HDD playback!"; static unsigned char s_pAttPFS [] = "Please attach USB storage device before you proceed!\n\nIs the disk connected to your PLAYSTATION\xC2\xAE\x33 system?"; static unsigned char s_pCacheFile [] = "Caching file to internal temporary folder..."; static unsigned char s_pHddErr [] = "This title cannot be loaded from internal HDD.\n\nTransfer to external USB HDD or change title options."; static unsigned char s_pUsbErr [] = "This title cannot be loaded from external USB HDD.\n\nTransfer to internal HDD or change title options."; static unsigned char s_pTitleLocked [] = "Options cannot be changed or title is locked!"; static unsigned char s_pTitleRO [] = "Options cannot be changed for this title!"; static unsigned char s_pRenameTo [] = "Rename [%s] to:"; static unsigned char s_pCreateNew [] = "CREATE NEW FOLDER - Enter name for the new folder:"; static unsigned char s_pXCUP [] = "Update"; static unsigned char s_pXCUP1 [] = "Check for multiMAN updates"; static unsigned char s_pXCFM [] = "File Manager"; static unsigned char s_pXCFM0 [] = "File Manager (Disabled)"; static unsigned char s_pXCFM1 [] = "Manage files and folders"; static unsigned char s_pXCRF [] = "Refresh"; static unsigned char s_pXCRF1 [] = "Scan all connected devices for supported content"; static unsigned char s_pXCRF2 [] = "Scan all connected devices and refresh game list"; static unsigned char s_pXCRF3 [] = "Scan all emulator folders for newly added game ROMs"; static unsigned char s_pXCPF [] = "PFS Driver"; static unsigned char s_pXCPF1 [] = "Toggle between FAT32 and NTFS driver"; static unsigned char s_pXCSS [] = "Screensaver"; static unsigned char s_pXCSS1 [] = "Turn on screensaver mode"; static unsigned char s_pXCTH [] = "Themes"; static unsigned char s_pXCTH1 [] = "Change multiMAN appearance"; static unsigned char s_pXCHL [] = "Help"; static unsigned char s_pXCHL1 [] = "Start helpMMe application"; static unsigned char s_pXCRS [] = "Restart"; static unsigned char s_pXCRS1 [] = "Close and restart multiMAN"; static unsigned char s_pXCQT [] = "Quit"; static unsigned char s_pXCQT1 [] = "Quit multiMAN and return to XMB\xE2\x84\xA2 screen"; static unsigned char s_pXC5LK [] = "Link Video Library to Showtime"; static unsigned char s_pXC5LK1 [] = "Make XMB\xE2\x84\xA2 video files available to Showtime"; static unsigned char s_pXC5ST [] = "Start Showtime Media Center"; static unsigned char s_pXC5ST1 [] = "Launch Showtime to play movies and listen to music"; static unsigned char s_pXC2SS [] = "System Information"; static unsigned char s_pXC2SS1 [] = "Displays information about your PS3\xE2\x84\xA2 system."; static unsigned char s_pXC2IL [] = "Interface Language"; static unsigned char s_pXC2IL1 [] = "Changes multiMAN interface language."; static unsigned char s_pXC2GC [] = "Clear Game Cache Data"; static unsigned char s_pXC2GC1 [] = "Removes cache files for selected title."; /* static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = */ static MMString s_MMStringDef[] = { { sizeof ( s_pDebugMode ) - 1, s_pDebugMode }, //0 { sizeof ( s_pQuit0 ) - 1, s_pQuit0 }, //1 { sizeof ( s_pQuit1 ) - 1, s_pQuit1 }, { sizeof ( s_pRestart0 ) - 1, s_pRestart0 }, { sizeof ( s_pWarnFTP ) - 1, s_pWarnFTP }, { sizeof ( s_pWarnSNES ) - 1, s_pWarnSNES }, { sizeof ( s_pWarnGEN ) - 1, s_pWarnGEN }, { sizeof ( s_pWarnFCEU ) - 1, s_pWarnFCEU }, { sizeof ( s_pWarnVBA ) - 1, s_pWarnVBA }, { sizeof ( s_pWarnFBA ) - 1, s_pWarnFBA }, //9 { sizeof ( s_pCopy0 ) - 1, s_pCopy0 }, //10 { sizeof ( s_pCopy1 ) - 1, s_pCopy1 }, { sizeof ( s_pCopy2 ) - 1, s_pCopy2 }, { sizeof ( s_pCopy3 ) - 1, s_pCopy3 }, { sizeof ( s_pCopy4 ) - 1, s_pCopy4 }, { sizeof ( s_pCopy5 ) - 1, s_pCopy5 }, { sizeof ( s_pCopy6 ) - 1, s_pCopy6 }, { sizeof ( s_pCopy7 ) - 1, s_pCopy7 }, { sizeof ( s_pCopy8 ) - 1, s_pCopy8 }, { sizeof ( s_pCopy9 ) - 1, s_pCopy9 }, { sizeof ( s_pCopy10 ) - 1, s_pCopy10 }, { sizeof ( s_pCopy11 ) - 1, s_pCopy11 }, { sizeof ( s_pCopy12 ) - 1, s_pCopy12 }, //22 { sizeof ( s_pNetCopy0 ) - 1, s_pNetCopy0 }, //23 { sizeof ( s_pNetCopy1 ) - 1, s_pNetCopy1 }, { sizeof ( s_pNetCopy2 ) - 1, s_pNetCopy2 }, { sizeof ( s_pNetCopy3 ) - 1, s_pNetCopy3 }, { sizeof ( s_pNetCopy4 ) - 1, s_pNetCopy4 }, //27 { sizeof ( s_pMove0 ) - 1, s_pMove0 }, //28 { sizeof ( s_pMove1 ) - 1, s_pMove1 }, { sizeof ( s_pMove2 ) - 1, s_pMove2 }, { sizeof ( s_pMove3 ) - 1, s_pMove3 }, { sizeof ( s_pMove4 ) - 1, s_pMove4 }, //32 { sizeof ( s_pWarnINET ) - 1, s_pWarnINET }, //33 { sizeof ( s_pErrSRV0 ) - 1, s_pErrSRV0 }, { sizeof ( s_pErrUPD0 ) - 1, s_pErrUPD0 }, { sizeof ( s_pErrUPD1 ) - 1, s_pErrUPD1 }, //36 { sizeof ( s_pErrMNT ) - 1, s_pErrMNT }, //37 { sizeof ( s_pErrMVGAME ) - 1, s_pErrMVGAME }, { sizeof ( s_pErrMVAV ) - 1, s_pErrMVAV }, { sizeof ( s_pDownUpdate ) - 1, s_pDownUpdate }, //40 { sizeof ( s_pDownCover ) - 1, s_pDownCover }, { sizeof ( s_pDownFile ) - 1, s_pDownFile }, { sizeof ( s_pDownTheme ) - 1, s_pDownTheme }, { sizeof ( s_pDownMSG0 ) - 1, s_pDownMSG0 }, //44 { sizeof ( s_pDownMSG1 ) - 1, s_pDownMSG1 }, { sizeof ( s_pDownMSG2 ) - 1, s_pDownMSG2 }, { sizeof ( s_pParamVer ) - 1, s_pParamVer }, //47 { sizeof ( s_pLastPlay ) - 1, s_pLastPlay }, { sizeof ( s_pSetAccess ) - 1, s_pSetAccess }, { sizeof ( s_pSetAccess1 ) - 1, s_pSetAccess1 }, { sizeof ( s_pPreProcess ) - 1, s_pPreProcess }, //51 { sizeof ( s_pNoSpace0 ) - 1, s_pNoSpace0 }, //52 { sizeof ( s_pNoSpace0 ) - 1, s_pNoSpace1 }, { sizeof ( s_pErrNoMemWeb ) - 1, s_pErrNoMemWeb }, //54 { sizeof ( s_pErrNoMem ) - 1, s_pErrNoMem }, { sizeof ( s_pPleaseWait ) - 1, s_pPleaseWait }, { sizeof ( s_pWhatsNew ) - 1, s_pWhatsNew }, { sizeof ( s_pNewVer ) - 1, s_pNewVer }, { sizeof ( s_pNewVerDL ) - 1, s_pNewVerDL }, { sizeof ( s_pNewVerNN ) - 1, s_pNewVerNN }, //60 { sizeof ( s_pNewVerUSB ) - 1, s_pNewVerUSB }, { sizeof ( s_pGameUpdate1 ) - 1, s_pGameUpdate1 }, //62 { sizeof ( s_pGameUpdate2 ) - 1, s_pGameUpdate2 }, { sizeof ( s_pGameUpdate3 ) - 1, s_pGameUpdate3 }, { sizeof ( s_pGameUpdate5 ) - 1, s_pGameUpdate5 }, { sizeof ( s_pGameUpdate6 ) - 1, s_pGameUpdate6 }, { sizeof ( s_pGameUpdate7 ) - 1, s_pGameUpdate7 }, //67 { sizeof ( s_pSelTheme ) - 1, s_pSelTheme }, { sizeof ( s_pSelLang ) - 1, s_pSelLang }, { sizeof ( s_pDelGameC ) - 1, s_pDelGameC }, //70 { sizeof ( s_pFMGames ) - 1, s_pFMGames }, { sizeof ( s_pFMUpdate ) - 1, s_pFMUpdate }, { sizeof ( s_pFMAbout ) - 1, s_pFMAbout }, { sizeof ( s_pFMHelp ) - 1, s_pFMHelp }, { sizeof ( s_pFMThemes ) - 1, s_pFMThemes }, //75 { sizeof ( s_pCMMulDir ) - 1, s_pCMMulDir }, //76 { sizeof ( s_pCMMulFile ) - 1, s_pCMMulFile }, { sizeof ( s_pCMCopy ) - 1, s_pCMCopy }, //78 { sizeof ( s_pCMMove ) - 1, s_pCMMove }, { sizeof ( s_pCMRename ) - 1, s_pCMRename }, { sizeof ( s_pCMDelete ) - 1, s_pCMDelete }, { sizeof ( s_pCMShortcut ) - 1, s_pCMShortcut }, { sizeof ( s_pCMShadow ) - 1, s_pCMShadow }, { sizeof ( s_pCMBDMirror ) - 1, s_pCMBDMirror }, { sizeof ( s_pCMNetHost ) - 1, s_pCMNetHost }, { sizeof ( s_pCMHexView ) - 1, s_pCMHexView }, { sizeof ( s_pCMProps ) - 1, s_pCMProps }, { sizeof ( s_pCMNewDir ) - 1, s_pCMNewDir }, //88 { sizeof ( s_pApplyTheme ) - 1, s_pApplyTheme }, //89 { sizeof ( s_pMMUpdate ) - 1, s_pMMUpdate }, //90 { sizeof ( s_pMMUpdateL1 ) - 1, s_pMMUpdateL1 }, { sizeof ( s_pMMUpdateL2 ) - 1, s_pMMUpdateL2 }, { sizeof ( s_pMMUpdateL3 ) - 1, s_pMMUpdateL3 }, { sizeof ( s_pMMUpdateL4 ) - 1, s_pMMUpdateL4 }, { sizeof ( s_pMMRefresh ) - 1, s_pMMRefresh }, //95 { sizeof ( s_pMMRefreshL1 ) - 1, s_pMMRefreshL1 }, { sizeof ( s_pMMRefreshL2 ) - 1, s_pMMRefreshL2 }, { sizeof ( s_pMMRefreshL3 ) - 1, s_pMMRefreshL3 }, { sizeof ( s_pMMRefreshL4 ) - 1, s_pMMRefreshL4 }, { sizeof ( s_pMMFileMan ) - 1, s_pMMFileMan }, //100 { sizeof ( s_pMMFileManL1 ) - 1, s_pMMFileManL1 }, { sizeof ( s_pMMFileManL2 ) - 1, s_pMMFileManL2 }, { sizeof ( s_pMMFileManL3 ) - 1, s_pMMFileManL3 }, { sizeof ( s_pMMFileManL4 ) - 1, s_pMMFileManL4 }, { sizeof ( s_pMMShowtimeST ) - 1, s_pMMShowtimeST }, //105 { sizeof ( s_pMMShowtimeSTL1 ) - 1, s_pMMShowtimeSTL1 }, { sizeof ( s_pMMShowtimeSTL2 ) - 1, s_pMMShowtimeSTL2 }, { sizeof ( s_pMMShowtimeSTL3 ) - 1, s_pMMShowtimeSTL3 }, { sizeof ( s_pMMShowtimeSTL4 ) - 1, s_pMMShowtimeSTL4 }, { sizeof ( s_pMMNTFS ) - 1, s_pMMNTFS }, //110 { sizeof ( s_pMMNTFSL1 ) - 1, s_pMMNTFSL1 }, { sizeof ( s_pMMNTFSL2 ) - 1, s_pMMNTFSL2 }, { sizeof ( s_pMMNTFSL3 ) - 1, s_pMMNTFSL3 }, { sizeof ( s_pMMNTFSL4 ) - 1, s_pMMNTFSL4 }, { sizeof ( s_pMMShowtimeLK ) - 1, s_pMMShowtimeLK }, //115 { sizeof ( s_pMMShowtimeLKL1 ) - 1, s_pMMShowtimeLKL1 }, { sizeof ( s_pMMShowtimeLKL2 ) - 1, s_pMMShowtimeLKL2 }, { sizeof ( s_pMMShowtimeLKL3 ) - 1, s_pMMShowtimeLKL3 }, { sizeof ( s_pMMShowtimeLKL4 ) - 1, s_pMMShowtimeLKL4 }, { sizeof ( s_pMMScrShot ) - 1, s_pMMScrShot }, //120 { sizeof ( s_pMMScrShotL1 ) - 1, s_pMMScrShotL1 }, { sizeof ( s_pMMScrShotL2 ) - 1, s_pMMScrShotL2 }, { sizeof ( s_pMMScrShotL3 ) - 1, s_pMMScrShotL3 }, { sizeof ( s_pMMScrShotL4 ) - 1, s_pMMScrShotL4 }, { sizeof ( s_pMMScrSave ) - 1, s_pMMScrSave }, //125 { sizeof ( s_pMMScrSaveL1 ) - 1, s_pMMScrSaveL1 }, { sizeof ( s_pMMScrSaveL2 ) - 1, s_pMMScrSaveL2 }, { sizeof ( s_pMMScrSaveL3 ) - 1, s_pMMScrSaveL3 }, { sizeof ( s_pMMScrSaveL4 ) - 1, s_pMMScrSaveL4 }, { sizeof ( s_pMMRestart ) - 1, s_pMMRestart }, //130 { sizeof ( s_pMMRestartL1 ) - 1, s_pMMRestartL1 }, { sizeof ( s_pMMRestartL2 ) - 1, s_pMMRestartL2 }, { sizeof ( s_pMMRestartL3 ) - 1, s_pMMRestartL3 }, { sizeof ( s_pMMRestartL4 ) - 1, s_pMMRestartL4 }, { sizeof ( s_pMMSetup ) - 1, s_pMMSetup }, //135 { sizeof ( s_pMMSetupL1 ) - 1, s_pMMSetupL1 }, { sizeof ( s_pMMSetupL2 ) - 1, s_pMMSetupL2 }, { sizeof ( s_pMMSetupL3 ) - 1, s_pMMSetupL3 }, { sizeof ( s_pMMSetupL4 ) - 1, s_pMMSetupL4 }, { sizeof ( s_pMMQuit ) - 1, s_pMMQuit }, //140 { sizeof ( s_pMMQuitL1 ) - 1, s_pMMQuitL1 }, { sizeof ( s_pMMQuitL2 ) - 1, s_pMMQuitL2 }, { sizeof ( s_pMMQuitL3 ) - 1, s_pMMQuitL3 }, { sizeof ( s_pMMQuitL4 ) - 1, s_pMMQuitL4 }, { sizeof ( s_pMMHelp ) - 1, s_pMMHelp }, //145 { sizeof ( s_pMMHelpL1 ) - 1, s_pMMHelpL1 }, { sizeof ( s_pMMHelpL2 ) - 1, s_pMMHelpL2 }, { sizeof ( s_pMMHelpL3 ) - 1, s_pMMHelpL3 }, { sizeof ( s_pMMHelpL4 ) - 1, s_pMMHelpL4 }, { sizeof ( s_pButNavigate ) - 1, s_pButNavigate }, //150 { sizeof ( s_pButSelect ) - 1, s_pButSelect }, { sizeof ( s_pButBack ) - 1, s_pButBack }, { sizeof ( s_pButCancel ) - 1, s_pButCancel }, { sizeof ( s_pButApply ) - 1, s_pButApply }, { sizeof ( s_pButConfirm ) - 1, s_pButConfirm }, { sizeof ( s_pButGenre ) - 1, s_pButGenre }, { sizeof ( s_pButDownload ) - 1, s_pButDownload }, { sizeof ( s_pButLoad ) - 1, s_pButLoad }, { sizeof ( s_pButPrev ) - 1, s_pButPrev }, { sizeof ( s_pButNext ) - 1, s_pButNext }, //160 { sizeof ( s_pButLast ) - 1, s_pButLast }, { sizeof ( s_pButFirst ) - 1, s_pButFirst }, { sizeof ( s_pSelGenre ) - 1, s_pSelGenre }, //163 { sizeof ( s_pButDownTheme ) - 1, s_pButDownTheme }, { sizeof ( s_pGMCopy ) - 1, s_pGMCopy }, //165 { sizeof ( s_pGMCopyL1 ) - 1, s_pGMCopyL1 }, { sizeof ( s_pGMCopyL2 ) - 1, s_pGMCopyL2 }, { sizeof ( s_pGMCopyL3 ) - 1, s_pGMCopyL3 }, { sizeof ( s_pGMDelete ) - 1, s_pGMDelete }, //169 { sizeof ( s_pGMDeleteL1 ) - 1, s_pGMDeleteL1 }, { sizeof ( s_pGMDeleteL2 ) - 1, s_pGMDeleteL2 }, { sizeof ( s_pGMDeleteL3 ) - 1, s_pGMDeleteL3 }, { sizeof ( s_pGMRename ) - 1, s_pGMRename }, //173 { sizeof ( s_pGMRenameL1 ) - 1, s_pGMRenameL1 }, { sizeof ( s_pGMRenameL2 ) - 1, s_pGMRenameL2 }, { sizeof ( s_pGMRenameL3 ) - 1, s_pGMRenameL3 }, { sizeof ( s_pGMUpdate ) - 1, s_pGMUpdate }, //177 { sizeof ( s_pGMUpdateL1 ) - 1, s_pGMUpdateL1 }, { sizeof ( s_pGMUpdateL2 ) - 1, s_pGMUpdateL2 }, { sizeof ( s_pGMUpdateL3 ) - 1, s_pGMUpdateL3 }, { sizeof ( s_pGMTest ) - 1, s_pGMTest }, //181 { sizeof ( s_pGMTestL1 ) - 1, s_pGMTestL1 }, { sizeof ( s_pGMTestL2 ) - 1, s_pGMTestL2 }, { sizeof ( s_pGMTestL3 ) - 1, s_pGMTestL3 }, { sizeof ( s_pGMPerm ) - 1, s_pGMPerm }, //185 { sizeof ( s_pGMPermL1 ) - 1, s_pGMPermL1 }, { sizeof ( s_pGMPermL2 ) - 1, s_pGMPermL2 }, { sizeof ( s_pGMPermL3 ) - 1, s_pGMPermL3 }, //188 { sizeof ( s_pPOPGS ) - 1, s_pPOPGS }, //189 { sizeof ( s_pPOPChangeS ) - 1, s_pPOPChangeS }, { sizeof ( s_pPOPSysInfo ) - 1, s_pPOPSysInfo }, { sizeof ( s_pPOPLang ) - 1, s_pPOPLang }, { sizeof ( s_pPOPCache ) - 1, s_pPOPCache }, { sizeof ( s_pPOPPhoto ) - 1, s_pPOPPhoto }, { sizeof ( s_pPOPMusic ) - 1, s_pPOPMusic }, { sizeof ( s_pPOPST ) - 1, s_pPOPST }, { sizeof ( s_pPOPVideo ) - 1, s_pPOPVideo }, { sizeof ( s_pPOPRefGames ) - 1, s_pPOPRefGames }, { sizeof ( s_pPOPRefRoms ) - 1, s_pPOPRefRoms }, { sizeof ( s_pPOPRom ) - 1, s_pPOPRom }, //200 { sizeof ( s_pPOPGrpGenre ) - 1, s_pPOPGrpGenre }, //201 { sizeof ( s_pPOPGrpEmu ) - 1, s_pPOPGrpEmu }, { sizeof ( s_pPOPGrpName ) - 1, s_pPOPGrpName }, { sizeof ( s_pPOPSwitch ) - 1, s_pPOPSwitch }, { sizeof ( s_pPOP1of1 ) - 1, s_pPOP1of1 }, //205 { sizeof ( s_pPOPPlaying ) - 1, s_pPOPPlaying }, { sizeof ( s_pPOPPaused ) - 1, s_pPOPPaused }, { sizeof ( s_pPOPVol ) - 1, s_pPOPVol }, //208 { sizeof ( s_pOther ) - 1, s_pOther }, //209 { sizeof ( s_pGENOther ) - 1, s_pGENOther }, //210 { sizeof ( s_pGENAct ) - 1, s_pGENAct }, { sizeof ( s_pGENAdv ) - 1, s_pGENAdv }, { sizeof ( s_pGENFam ) - 1, s_pGENFam }, { sizeof ( s_pGENFight ) - 1, s_pGENFight }, { sizeof ( s_pGENParty ) - 1, s_pGENParty }, { sizeof ( s_pGENPlat ) - 1, s_pGENPlat }, { sizeof ( s_pGENPuzz ) - 1, s_pGENPuzz }, { sizeof ( s_pGENRole ) - 1, s_pGENRole }, { sizeof ( s_pGENRace ) - 1, s_pGENRace }, { sizeof ( s_pGENShoot ) - 1, s_pGENShoot }, //220 { sizeof ( s_pGENSim ) - 1, s_pGENSim }, { sizeof ( s_pGENSport ) - 1, s_pGENSport }, { sizeof ( s_pGENStrat ) - 1, s_pGENStrat }, { sizeof ( s_pGENTriv ) - 1, s_pGENTriv }, { sizeof ( s_pGEN3D ) - 1, s_pGEN3D }, //225 { sizeof ( s_pRETRO ) - 1, s_pRETRO }, //226 { sizeof ( s_pRETSNES ) - 1, s_pRETSNES }, { sizeof ( s_pRETFCEU ) - 1, s_pRETFCEU }, { sizeof ( s_pRETVBA ) - 1, s_pRETVBA }, { sizeof ( s_pRETGEN ) - 1, s_pRETGEN }, { sizeof ( s_pRETFBA ) - 1, s_pRETFBA }, //231 { sizeof ( s_pXCS ) - 1, s_pXCS }, //232 { sizeof ( s_pXCP ) - 1, s_pXCP }, { sizeof ( s_pXCM ) - 1, s_pXCM }, { sizeof ( s_pXCV ) - 1, s_pXCV }, { sizeof ( s_pXCG ) - 1, s_pXCG }, { sizeof ( s_pXCF ) - 1, s_pXCF }, { sizeof ( s_pXCW ) - 1, s_pXCW }, //238 { sizeof ( s_pPS2 ) - 1, s_pPS2 }, //239 { sizeof ( s_pPKG ) - 1, s_pPKG }, { sizeof ( s_pNoSplit1 ) - 1, s_pNoSplit1 }, { sizeof ( s_pNoSplit2 ) - 1, s_pNoSplit2 }, { sizeof ( s_pNoSplit3 ) - 1, s_pNoSplit3 }, { sizeof ( s_pVerifying ) - 1, s_pVerifying }, //244 { sizeof ( s_pCanceled ) - 1, s_pCanceled }, { sizeof ( s_pNotSupported ) - 1, s_pNotSupported }, { sizeof ( s_pNotSupported2) - 1, s_pNotSupported2 }, { sizeof ( s_pPS3DISC ) - 1, s_pPS3DISC }, { sizeof ( s_pThmInstall ) - 1, s_pThmInstall }, { sizeof ( s_pToDBoot ) - 1, s_pToDBoot }, { sizeof ( s_pDLST ) - 1, s_pDLST }, //251 { sizeof ( s_pStartBD1 ) - 1, s_pStartBD1 }, { sizeof ( s_pStartBD2 ) - 1, s_pStartBD2 }, { sizeof ( s_pOverwrite ) - 1, s_pOverwrite }, { sizeof ( s_pIncomplete ) - 1, s_pIncomplete }, //255 { sizeof ( s_pErrBDEMU1 ) - 1, s_pErrBDEMU1 }, { sizeof ( s_pErrBDEMU2 ) - 1, s_pErrBDEMU2 }, { sizeof ( s_pErrBDEMU3 ) - 1, s_pErrBDEMU3 }, { sizeof ( s_pCritical ) - 1, s_pCritical }, //259 { sizeof ( s_pDelFile ) - 1, s_pDelFile }, //260 { sizeof ( s_pDelFiles ) - 1, s_pDelFiles }, { sizeof ( s_pDelDir ) - 1, s_pDelDir }, { sizeof ( s_pDelDirs ) - 1, s_pDelDirs }, { sizeof ( s_pDelFromHDD ) - 1, s_pDelFromHDD }, { sizeof ( s_pDelFromUSB ) - 1, s_pDelFromUSB }, { sizeof ( s_pDelFromCache ) - 1, s_pDelFromCache }, { sizeof ( s_pCpHdd2Usb ) - 1, s_pCpHdd2Usb }, //267 { sizeof ( s_pCpUsb2Hdd ) - 1, s_pCpUsb2Hdd }, { sizeof ( s_pCpPfs2Hdd ) - 1, s_pCpPfs2Hdd }, { sizeof ( s_pCpUsb2Usb ) - 1, s_pCpUsb2Usb }, { sizeof ( s_pOverwriteNo ) - 1, s_pOverwriteNo }, //271 { sizeof ( s_pDelPartHDD ) - 1, s_pDelPartHDD }, { sizeof ( s_pDelPartUSB ) - 1, s_pDelPartUSB }, { sizeof ( s_pDelCacheDone ) - 1, s_pDelCacheDone }, { sizeof ( s_pCpBD2Hdd ) - 1, s_pCpBD2Hdd }, //275 { sizeof ( s_pCpBD2Usb ) - 1, s_pCpBD2Usb }, { sizeof ( s_pPinGame ) - 1, s_pPinGame }, //277 { sizeof ( s_pPinErr ) - 1, s_pPinErr }, { sizeof ( s_pPinEnter ) - 1, s_pPinEnter }, { sizeof ( s_pPinNew ) - 1, s_pPinNew }, { sizeof ( s_pPinErr2 ) - 1, s_pPinErr2 }, //281 { sizeof ( s_pBd2AVCHD ) - 1, s_pBd2AVCHD }, //282 { sizeof ( s_pBd2AVCHD2 ) - 1, s_pBd2AVCHD2 }, { sizeof ( s_pActAVCHD ) - 1, s_pActAVCHD }, { sizeof ( s_pActAVCHD2 ) - 1, s_pActAVCHD2 }, //285 { sizeof ( s_pBd2AVCHD3 ) - 1, s_pBd2AVCHD3 }, { sizeof ( s_pActBDMV ) - 1, s_pActBDMV }, { sizeof ( s_pAttUSB ) - 1, s_pAttUSB }, { sizeof ( s_pAttPFS ) - 1, s_pAttPFS }, { sizeof ( s_pCacheFile ) - 1, s_pCacheFile }, //290 { sizeof ( s_pHddErr ) - 1, s_pHddErr }, { sizeof ( s_pUsbErr ) - 1, s_pUsbErr }, { sizeof ( s_pTitleLocked ) - 1, s_pTitleLocked }, { sizeof ( s_pTitleRO ) - 1, s_pTitleRO }, //294 { sizeof ( s_pRenameTo ) - 1, s_pRenameTo }, { sizeof ( s_pCreateNew ) - 1, s_pCreateNew }, { sizeof ( s_pXCUP ) - 1, s_pXCUP }, //297 { sizeof ( s_pXCUP1 ) - 1, s_pXCUP1 }, { sizeof ( s_pXCFM ) - 1, s_pXCFM }, { sizeof ( s_pXCFM0 ) - 1, s_pXCFM0 }, //300 { sizeof ( s_pXCFM1 ) - 1, s_pXCFM1 }, { sizeof ( s_pXCRF ) - 1, s_pXCRF }, { sizeof ( s_pXCRF1 ) - 1, s_pXCRF1 }, { sizeof ( s_pXCRF2 ) - 1, s_pXCRF2 }, { sizeof ( s_pXCRF3 ) - 1, s_pXCRF3 }, { sizeof ( s_pXCPF ) - 1, s_pXCPF }, //306 { sizeof ( s_pXCPF1 ) - 1, s_pXCPF1 }, { sizeof ( s_pXCSS ) - 1, s_pXCSS }, { sizeof ( s_pXCSS1 ) - 1, s_pXCSS1 }, { sizeof ( s_pXCTH ) - 1, s_pXCTH }, { sizeof ( s_pXCTH1 ) - 1, s_pXCTH1 }, { sizeof ( s_pXCHL ) - 1, s_pXCHL }, //312 { sizeof ( s_pXCHL1 ) - 1, s_pXCHL1 }, { sizeof ( s_pXCRS ) - 1, s_pXCRS }, { sizeof ( s_pXCRS1 ) - 1, s_pXCRS1 }, { sizeof ( s_pXCQT ) - 1, s_pXCQT }, { sizeof ( s_pXCQT1 ) - 1, s_pXCQT1 }, //317 { sizeof ( s_pXC5LK ) - 1, s_pXC5LK }, { sizeof ( s_pXC5LK1 ) - 1, s_pXC5LK1 }, { sizeof ( s_pXC5ST ) - 1, s_pXC5ST }, { sizeof ( s_pXC5ST1 ) - 1, s_pXC5ST1 }, //321 { sizeof ( s_pXC2SS ) - 1, s_pXC2SS }, { sizeof ( s_pXC2SS1 ) - 1, s_pXC2SS1 }, { sizeof ( s_pXC2IL ) - 1, s_pXC2IL }, { sizeof ( s_pXC2IL1 ) - 1, s_pXC2IL1 }, { sizeof ( s_pXC2GC ) - 1, s_pXC2GC }, { sizeof ( s_pXC2GC1 ) - 1, s_pXC2GC1 }, //327 /*, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, */ }; static MMString s_MMStringUDF[ sizeof ( s_MMStringDef ) / sizeof ( s_MMStringDef[ 0 ] ) ]; //UDF - user defined file with texts MMString g_MMString [ sizeof ( s_MMStringDef ) / sizeof ( s_MMStringDef[ 0 ] ) ]; //holds default GUI texts int MM_LocaleInit ( char *lang_file ) { long lSize=0; unsigned int lIdx = 0; FILE *lFD = fopen(lang_file, "rb"); if ( lFD != NULL ) { fseek ( lFD, 0, SEEK_END ); lSize = ftell(lFD); if ( lSize > 0 ) { unsigned char* lpEnd; unsigned char* lpPtr; unsigned char* lpBuff = lpPtr = ( unsigned char* )malloc ( lSize + 1 ); lpEnd = lpBuff + lSize; fseek( lFD, 3, SEEK_SET); fread( (unsigned char*) lpBuff, lSize, 1, lFD); for(int m=0; m<lSize; m++) { if(lpBuff[m]=='\n') lpBuff[m]=' '; if(lpBuff[m]=='|') lpBuff[m]='\n'; } while ( 1 ) { while ( lpPtr != lpEnd && *lpPtr != '\r' ) ++lpPtr; *lpPtr = '\x00'; s_MMStringUDF[ lIdx ].m_pStr = lpBuff; s_MMStringUDF[ lIdx ].m_Len = lpPtr - lpBuff; if ( !s_MMStringUDF[ lIdx++ ].m_Len || lpPtr++ == lpEnd || lIdx == sizeof ( s_MMStringUDF ) / sizeof ( s_MMStringUDF[ 0 ] ) ) break; if ( *lpPtr == '\r' ) ++lpPtr; lpBuff = lpPtr; } } fclose ( lFD ); } return lIdx; } void MM_LocaleSet ( bool mm_language ) { MMString* lpStr; if ( mm_language ) lpStr = s_MMStringUDF; //user defined translation file else lpStr = s_MMStringDef; //default English memcpy ( g_MMString, lpStr, sizeof ( g_MMString ) ); }
000kev000-toy
source/language.cpp
C++
oos
48,309
#include <stdio.h> #include <string.h> #include <sys/process.h> SYS_PROCESS_PARAM(1001, 0x10000) int main(int argc, char **argv) { (void) argc; char tn[128]; char filename[128]; sprintf(tn, "%s", argv[0]); char *pch=tn; char *pathpos=strrchr(pch,'/'); pathpos[0]=0; sprintf(filename, "%s/RELOADED.BIN", tn); remove(filename); sprintf(filename, "%s/RELOAD.SELF", tn); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 1200, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); }
000kev000-toy
source/main.cpp
C++
oos
512
#include "mscommon.h" static int audioInitCell(void); // SPURS information #define SPURS_SPU_NUM 1 #define SPU_THREAD_GROUP_PRIORITY 128 CellSpurs spurs __attribute__((aligned (128))); sys_ppu_thread_t s_MultiStreamPuThread = 0; void * s_pMultiStreamMemory = NULL; #define CHANNEL CELL_AUDIO_PORT_8CH #define BLOCK CELL_AUDIO_BLOCK_8 #define EXIT_CODE (0xbee) /********************************************************************************** audioInitCell Returns: audio port number returned from cellAudioPortOpen(..) **********************************************************************************/ static int audioInitCell(void) { int ret = 0; unsigned int portNum = -1; // cellMSSystemConfigureSysUtil returns the following data: // Bits 0-3: Number of available output channels // Bit 4: Dolby On status // unsigned int retSysUtil = cellMSSystemConfigureSysUtil(); // unsigned int numChans = (retSysUtil & 0x0000000F); // unsigned int dolbyOn = (retSysUtil & 0x00000010) >> 4; // printf("Number Of Channels: %u\n", numChans); // printf("Dolby enabled: %u\n", dolbyOn); ret = cellAudioInit(); if (ret !=CELL_OK) return -1; audioParam.nChannel = CHANNEL; audioParam.nBlock = BLOCK; ret = cellAudioPortOpen(&audioParam, &portNum); if (ret != CELL_OK) { cellAudioQuit(); return -1; } ret = cellAudioGetPortConfig(portNum, &portConfig); if (ret != CELL_OK) { cellAudioQuit(); return -1; } cellMSSystemConfigureLibAudio(&audioParam, &portConfig); return portNum; } int InitSPURS(void) { int ret = -1; sys_ppu_thread_t thread_id; int ppu_thr_prio __attribute__((aligned (128))); // information for the reverb sys_ppu_thread_get_id(&thread_id); ret = sys_ppu_thread_get_priority(thread_id, &ppu_thr_prio); if(ret == CELL_OK) ret = cellSpursInitialize(&spurs, SPURS_SPU_NUM, SPU_THREAD_GROUP_PRIORITY, ppu_thr_prio-1, 1); if(ret != CELL_OK) return -1; return 1; } /********************************************************************************** InitialiseAudio This function sets up the audio system. Requires: nStreams Maximum number of streams to be active at any time nmaxSubs Maximum number of sub channels to init in MultiStream _nPortNumber Reference to int - Returns port number from CELL audio init _audioParam Reference to CellAudioPortParam - Returns audio params from CELL audio init _portConfig Reference to CellAudioPortConfig - Returns port configuration from CELL audio init Returns: 0 OK -1 Error **********************************************************************************/ long InitialiseAudio( const long nStreams, const long nmaxSubs, int &_nPortNumber , CellAudioPortParam &_audioParam, CellAudioPortConfig &_portConfig) { CellMSSystemConfig cfg; uint8_t prios[8] = {1, 0, 0, 0, 0, 0, 0, 0}; cfg.channelCount=nStreams; cfg.subCount=nmaxSubs; cfg.dspPageCount=0; cfg.flags=CELL_MS_NOFLAGS; _nPortNumber = audioInitCell(); if(_nPortNumber < 0) { return -1; } _audioParam = audioParam; _portConfig = portConfig; // Initialise SPURS MultiStream version int nMemoryNeeded = cellMSSystemGetNeededMemorySize(&cfg); s_pMultiStreamMemory = memalign(128, nMemoryNeeded); if(InitSPURS()==1) cellMSSystemInitSPURS(s_pMultiStreamMemory, &cfg, &spurs, &prios[0]); else return -1; return 0; } void ShutdownMultiStream() { void* pMemory = cellMSSystemClose(); assert(pMemory == s_pMultiStreamMemory); free( s_pMultiStreamMemory); s_pMultiStreamMemory = NULL; pMemory = NULL; }
000kev000-toy
source/mscommon.cpp
C++
oos
3,738
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <assert.h> #include <string.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> #include <time.h> #include <math.h> #include <stddef.h> #include <netdb.h> #include <stdbool.h> #include <sys/synchronization.h> #include <sys/spu_initialize.h> #include <sys/ppu_thread.h> #include <sys/return_code.h> #include <sys/sys_time.h> #include <sys/process.h> #include <sys/memory.h> #include <sys/timer.h> #include <sys/paths.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> //#include <sys/vm.h> #include <cell/http.h> #include <cell/mixer.h> #include <cell/codec.h> #include <cell/audio.h> #include <cell/gcm.h> #include <cell/sysmodule.h> #include <cell/font.h> #include <cell/fontFT.h> #include <cell/dbgfont.h> #include <cell/mstream.h> #include <cell/cell_fs.h> #include <cell/control_console.h> #include <cell/rtc.h> #include <cell/rtc/rtcsvc.h> #include <cell/pad.h> #include <cell/mouse.h> #include <cell/keyboard.h> #include <cell/codec/pngdec.h> #include <cell/codec/jpgdec.h> #include <cell/codec.h> #include <sysutil/sysutil_video_export.h> #include <sysutil/sysutil_music_export.h> #include <sysutil/sysutil_photo_export.h> #include <sysutil/sysutil_msgdialog.h> #include <sysutil/sysutil_oskdialog.h> #include <sysutil/sysutil_syscache.h> #include <sysutil/sysutil_sysparam.h> #include <sysutil/sysutil_common.h> #include <sysutil/sysutil_screenshot.h> #include <sysutil/sysutil_bgmplayback.h> #include <sysutil/sysutil_webbrowser.h> #include <netex/libnetctl.h> #include <netex/errno.h> #include <netex/net.h> #include <arpa/inet.h> #include <netinet/in.h> #include <libftp.h> #include "libpfsm.h" #include "mscommon.h" #include "semaphore.h" #include "syscall8.h" #include "syscall36.h" #include "graphics.h" #include "fonts.h" #include "language.h" #define FB(x) ((x)*1920*1080*4) // 1 video frame buffer #define MB(x) ((x)*1024*1024) // 1 MB #define KB(x) ((x)*1024) // 1 KB SYS_PROCESS_PARAM(1200, 0x80000) //colors (COLOR.INI) u32 COL_PS3DISC=0xff807000; u32 COL_PS3DISCSEL=0xfff0e000; u32 COL_SEL=0xff00ffff; u32 COL_PS3=0xe0e0e0e0; u32 COL_PS2=0xff06b02e; u32 COL_DVD=0xffdcc503; u32 COL_BDMV=0xff0050ff; u32 COL_AVCHD=0xff30ffff; u32 COL_LEGEND=0xc0c0c0a0; u32 COL_FMFILE=0xc0c0c0c0; u32 COL_FMDIR=0xc0808080; u32 COL_FMJPG=0xcc00cc00; u32 COL_FMMP3=0xc033ffee; u32 COL_FMEXE=0xc03310ee; u32 COL_HEXVIEW=0xc0a0a0a0; u32 COL_SPLIT=0xc00080ff; u32 COL_XMB_CLOCK=0xffd0d0d0; u32 COL_XMB_COLUMN=0xf0e0e0e0; u32 COL_XMB_TITLE=0xf0e0e0e0; u32 COL_XMB_SUBTITLE=0xf0909090; u8 XMB_SPARK_SIZE=4; u32 XMB_SPARK_COLOR=0xffffff00; // theme related bool th_device_list=1; bool th_device_separator=1; u16 th_device_separator_y=956; bool th_legend=1; u16 th_legend_y=853; bool th_drive_icon=1; u16 th_drive_icon_x=1790; u16 th_drive_icon_y=964; //NTFS/PFS driver int max_usb_volumes=1; typedef struct _DEV_INFO { struct _DEV_INFO *next; PFSM_DEVICE dev; } DEV_INFO; static DEV_INFO *dev_info; typedef uint64_t u64; //memory info typedef struct { uint32_t total; uint32_t avail; } _meminfo; _meminfo meminfo; // mp3 related #define MP3_MEMORY_KB 384 #define MP3_BUF (MP3_MEMORY_KB/2) #define SAMPLE_FREQUENCY (44100) #define MAX_STREAMS (4) //CELL_MS_MAX_STREAMS//(400) #define MAX_SUBS (4) //(31) CellAudioPortParam audioParam; CellAudioPortConfig portConfig; int nChannel; int sizeNeeded; int *mp3Memory; u64 _mp3_buffer=KB(MP3_MEMORY_KB); int mp3_freq=44100; u32 mp3_durr=0; float mp3_skip=0.f; u32 mp3_packet=0; float mp3_packet_time=0.001f; char mp3_now_playing[512]; float mp3_volume=0.5f; char *pData=NULL; char *pDataB=NULL; char my_mp3_file[512]; bool update_ms=true; bool force_mp3; int force_mp3_fd=-1; char force_mp3_file[512]; u64 force_mp3_offset=0; u64 force_mp3_size=0; bool mm_audio=true; //goes to false if XMB BGM is playing bool mm_is_playing=false; bool is_theme_playing=false; bool audio_sub_proc=false; bool mp3_force_position=false; int StartMultiStream(); void stop_audio(float attn); void stop_mp3(float _attn); void prev_mp3(); void next_mp3(); void main_mp3( char *temp_mp3); int main_mp3_th( char *my_mp3, float skip); void *color_base_addr; u32 frame_index = 0; u32 video_buffer; int V_WIDTH, V_HEIGHT;//, _V_WIDTH, _V_HEIGHT; u8 mp_WIDTH=30, mp_HEIGHT=42; //mouse icon HR // for network and file_copy buffering #define BUF_SIZE (3 * 1024 * 1024) //folder copy #define MAX_FAST_FILES 1 #define MAX_FAST_FILE_SIZE (3 * 1024 * 1024) //used x3 = 9MB #define MEMORY_CONTAINER_SIZE_WEB (64 * 1024 * 1024) //for web browser #define MEMORY_CONTAINER_SIZE (8 * 1024 * 1024) //for OSK, video/photo/music export uint32_t MEMORY_CONTAINER_SIZE_ACTIVE; enum { CALLBACK_TYPE_INITIALIZE = 0, CALLBACK_TYPE_REGIST_1, CALLBACK_TYPE_FINALIZE }; bool ve_initialized=0; bool me_initialized=0; bool pe_initialized=0; static sys_memory_container_t memory_container; static sys_memory_container_t memory_container_web; static int ve_result = 0xDEAD; static int me_result = 0xDEAD; static int pe_result = 0xDEAD; static void video_export( char *filename_v, char *album, int to_unregister); static int video_finalize( void ); static void cb_export_finish( int result, void *userdata); static void cb_export_finish2( int result, void *userdata); static void music_export( char *filename_v, char *album, int to_unregister); static int music_finalize( void ); static void cb_export_finish_m( int result, void *userdata); static void cb_export_finish2_m( int result, void *userdata); static void photo_export( char *filename_v, char *album, int to_unregister); static int photo_finalize( void ); static void cb_export_finish_p( int result, void *userdata); static void cb_export_finish2_p( int result, void *userdata); int download_file(const char *http_file, const char *save_path, int show_progress); int download_file_th(const char *http_file, const char *save_path, int params); //void replacemem(uint64_t _val_search1, uint64_t _val_replace1); static void del_temp( char *path); static void parse_color_ini(); void pokeq( uint64_t addr, uint64_t val); uint64_t peekq(uint64_t addr); void enable_sc36(); void write_last_state(); void save_options(); void mip_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int scaleF); void blur_texture(uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, int wx, int wy, uint32_t c_BRI, int use_grayscale, int iterations, int p_range); void print_label(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font); void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font, float hscale, float vscale, int centered); void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT); void show_sysinfo(); int get_param_sfo_field(char *file, char *field, char *value); void file_copy(char *path, char *path2, int progress); void cache_png(char *path, char *title_id); void fix_perm_recursive(const char* start_path); int my_game_delete(char *path); int my_game_copy(char *path, char *path2); int my_game_copy_pfsm(char *path, char *path2); int load_png_texture(u8 *data, char *name, uint16_t _DW); void change_opacity(u8 *buffer, int delta, u32 size); void draw_stars(); float use_drops=false; void draw_whole_xmb(u8 mode); void draw_xmb_clock(u8 *buffer, const int _xmb_icon); void draw_xmb_icon_text(int _xmb_icon); void draw_xmb_bare(u8 _xmb_icon, u8 _all_icons, bool recursive, int _sub_level); void init_xmb_icons(t_menu_list *list, int max, int sel); void redraw_column_texts(int _xmb_icon); void reset_xmb_checked(); void reset_xmb(u8 _flag); void free_all_buffers(); void free_text_buffers(); void draw_fileman(); void draw_xmb_info(); void apply_theme (const char *theme_file, const char *theme_path); int vert_indx=0, vert_texture_indx=0; void flip(void); //misc thread sys_ppu_thread_t addmus_thr_id; static void add_music_column_thread_entry( uint64_t arg ); bool is_music_loading=0; sys_ppu_thread_t addpic_thr_id; static void add_photo_column_thread_entry( uint64_t arg ); bool is_photo_loading=0; sys_ppu_thread_t addret_thr_id; static void add_retro_column_thread_entry( uint64_t arg ); bool is_retro_loading=0; sys_ppu_thread_t addvid_thr_id; static void add_video_column_thread_entry( uint64_t arg ); bool is_video_loading=0; bool is_decoding_jpg=0; void load_jpg_threaded(int _xmb_icon, int cn); bool is_decoding_png=0; void load_png_threaded(int _xmb_icon, int cn); static void download_thread_entry( uint64_t arg ); sys_ppu_thread_t download_thr_id; static void misc_thread_entry( uint64_t arg ); sys_ppu_thread_t misc_thr_id; static void jpg_thread_entry( uint64_t arg ); sys_ppu_thread_t jpgdec_thr_id; static void png_thread_entry( uint64_t arg ); sys_ppu_thread_t pngdec_thr_id; const int32_t misc_thr_prio = 1600; const size_t app_stack_size = 32768; bool is_game_loading=0; u8 is_any_xmb_column=0; u8 drawing_xmb=0; float angle=0.f; bool debug_mode=false; bool use_pad_sensor=true; static int old_fi=-1; u16 counter_png=0; u8 is_reloaded=0; u32 fdevices=0; u32 fdevices_old=0; //int sub_menu_open=0; int pb_step=429; bool never_used_pfs=1; int repeat_init_delay=60; int repeat_key_delay=6; int repeat_counter1=repeat_init_delay; //wait before repeat int repeat_counter2=repeat_key_delay; // repeat after pause u8 repeat_counter3=1; // accelerate repeat (multiplier) float repeat_counter3_inc=0.f; bool key_repeat=0; char time_result[2]; u16 seconds_clock=0; bool xmb_legend_drawn=0; bool xmb_info_drawn=0; bool use_analog=0; bool join_copy=0; u8 xmb_settings_sel=0; typedef struct { char split_file[512]; char cached_file[512]; } cached_files_struct; cached_files_struct file_to_join[10]; u8 max_joined=0; char d1[512], d2[512], df[512]; unsigned char bdemu[0x1380]; unsigned char mouse[5120]; u8 bdemu2_present=0; bool search_mmiso=false; unsigned int debug_print=102030; long long int last_refresh=0; CellSysCacheParam cache_param ; //web browser volatile int www_running = 0; char status_info[256]; static CellWebBrowserConfig2 config_full; int dim=0, dimc=0; int c_opacity=0xff, c_opacity_delta=-1; int c_opacity2=0xff; int b_box_opaq= 0xf8; //for display mode 2 int b_box_step= -4; float c_firmware=3.41f; bool use_symlinks=0; bool ftp_service=0; u8 ftp_clients=0; bool http_active=false; //nethost char get_cmd[1024]; //pfs static u8 *buf2; u32 BUF_SIZE2=0; time_t time_start; uint32_t blockSize; uint64_t freeSize; uint64_t freeSpace; //FONTS typedef struct SampleRenderTarget { CellFontRenderer Renderer; CellFontRenderSurface Surface; }SampleRenderWork; static const CellFontLibrary* freeType; static Fonts_t* fonts; static SampleRenderWork RenderWork; int legend_y=760, legend_h=96, last_selected, rnd, game_last_page; u16 dox_width=256; u16 dox_height=256; u16 dox_cross_x=15; u16 dox_cross_y=14; u16 dox_cross_w=34; u16 dox_cross_h=34; u16 dox_circle_x=207; u16 dox_circle_y=14; u16 dox_circle_w=34; u16 dox_circle_h=34; u16 dox_triangle_x=80; u16 dox_triangle_y=14; u16 dox_triangle_w=34; u16 dox_triangle_h=34; u16 dox_square_x=143; u16 dox_square_y=14; u16 dox_square_w=36; u16 dox_square_h=34; u16 dox_start_x=12; u16 dox_start_y=106; u16 dox_start_w=42; u16 dox_start_h=36; u16 dox_select_x=72; u16 dox_select_y=108; u16 dox_select_w=50; u16 dox_select_h=34; u16 dox_ls_x=132; u16 dox_ls_y=70; u16 dox_ls_w=56; u16 dox_ls_h=56; u16 dox_rs_x=196; u16 dox_rs_y=196; u16 dox_rs_w=58; u16 dox_rs_h=56; u16 dox_pad_x=7; u16 dox_pad_y=200; u16 dox_pad_w=53; u16 dox_pad_h=53; u16 dox_l1_x=130; u16 dox_l1_y=143; u16 dox_l1_w=60; u16 dox_l1_h=24; u16 dox_r1_x=194; u16 dox_r1_y=143; u16 dox_r1_w=60; u16 dox_r1_h=24; u16 dox_l2_x=2; u16 dox_l2_y=143; u16 dox_l2_w=62; u16 dox_l2_h=24; u16 dox_r2_x=66; u16 dox_r2_y=143; u16 dox_r2_w=62; u16 dox_r2_h=24; u16 dox_l3_x=68; u16 dox_l3_y=196; u16 dox_l3_w=58; u16 dox_l3_h=56; u16 dox_r3_x=132; u16 dox_r3_y=196; u16 dox_r3_w=58; u16 dox_r3_h=56; //white circle u16 dox_rb1u_x=192; u16 dox_rb1u_y=70; u16 dox_rb1u_w=32; u16 dox_rb1u_h=31; //white circle selected u16 dox_rb1s_x=192; u16 dox_rb1s_y=101; u16 dox_rb1s_w=32; u16 dox_rb1s_h=31; //gray circle u16 dox_rb2u_x=224; u16 dox_rb2u_y=70; u16 dox_rb2u_w=31; u16 dox_rb2u_h=31; //gray circle selected u16 dox_rb2s_x=224; u16 dox_rb2s_y=101; u16 dox_rb2s_w=31; u16 dox_rb2s_h=31; //selection circle u16 dox_rb3s_x=177; u16 dox_rb3s_y=40; u16 dox_rb3s_w=31; u16 dox_rb3s_h=30; //attention sign u16 dox_att_x=1; u16 dox_att_y=65; u16 dox_att_w=44; u16 dox_att_h=39; //white arrow u16 dox_arrow_w_x=44; u16 dox_arrow_w_y=41; u16 dox_arrow_w_w=44; u16 dox_arrow_w_h=44; //black arrow u16 dox_arrow_b_x=87; u16 dox_arrow_b_y=58; u16 dox_arrow_b_w=44; u16 dox_arrow_b_h=44; static int unload_modules(); void draw_text_stroke(float x, float y, float size, u32 color, const char *str); #define GAME_INI_VER "MMGI0100" //PS3GAME.INI game flags (submenu) #define GAME_STATE_VER "MMLS0106" //LSTAT.BIN multiMAN last state data #define GAME_LIST_VER "MMGL0106" //LLIST.BIN cache for game list #define XMB_COL_VER "MMXC0109" //XMBS.00x xmb[?] structure (1 XMMB column) char current_version[9]="02.01.00"; char current_version_NULL[10]; char versionUP[64]; char hdd_folder[64]="/dev_hdd0/GAMES/"; bool first_launch=1; char app_path[32]; char app_temp[128]; char app_usrdir[64]; char app_homedir[64]; char options_ini[128]; char options_bin[128]; char color_ini[128]; char url_base[28]; char list_file[128]; char list_file_state[128]; char snes_self[512]; char snes_roms[512]; char genp_self[512]; char genp_roms[512]; char fceu_self[512]; char fceu_roms[512]; char vba_self[512]; char vba_roms[512]; char fba_self[512]; char fba_roms[512]; char ini_hdd_dir[64]="/dev_hdd0/GAMES/"; char ini_usb_dir[64]="GAMES"; char hdd_home[128]="/dev_hdd0/GAMES"; //aux search folders char hdd_home_2[128]="/_skip_"; char hdd_home_3[128]="/_skip_"; char hdd_home_4[128]="/_skip_"; char hdd_home_5[128]="/_skip_"; char usb_home[128]="/GAMES"; char usb_home_2[128]="/GAMEZ"; char usb_home_3[128]=" "; char usb_home_4[128]=" "; char usb_home_5[128]=" "; static char cache_dir[128]=" "; char covers_retro[128]=" "; char covers_dir[128]=" "; char themes_dir[128]=" "; char themes_web_dir[128]=" "; char game_cache_dir[128]; char update_dir[128]="/_skip"; char download_dir[128]="/_skip"; int verify_data=1; int usb_mirror=0; int scan_for_apps=0; int date_format=0; // 1=MM/DD/YYYY, 2=YYYY/MM/DD int time_format=1; // 0=12h 1=24h int progress_bar=1; int dim_setting=5; //5 seconds to dim titles int ss_timeout=2; int ss_timer=0; int egg=0; int ss_timer_last=0; int direct_launch_forced=0; int clear_activity_logs=1; int sc36_path_patch=0; int lock_display_mode=-1; int lock_fileman=0; int scale_icon_h=0; char fm_func[32]; int parental_level=0; int parental_pin_entered=0; char parental_pass[16]; int pfs_enabled=0; int xmb_sparks=1; int xmb_game_bg=1; int xmb_cover=1; u8 xmb_cover_column=0; //0-show icon0, 1-show cover int xmb_popup=1; u8 gray_poster=1; u8 confirm_with_x=1; u8 hide_bd=0; #define BUTTON_SELECT (1<<0) #define BUTTON_L3 (1<<1) #define BUTTON_R3 (1<<2) #define BUTTON_START (1<<3) #define BUTTON_UP (1<<4) #define BUTTON_RIGHT (1<<5) #define BUTTON_DOWN (1<<6) #define BUTTON_LEFT (1<<7) #define BUTTON_L2 (1<<8) #define BUTTON_R2 (1<<9) #define BUTTON_L1 (1<<10) #define BUTTON_R1 (1<<11) #define BUTTON_TRIANGLE (1<<12) #define _BUTTON_CIRCLE (1<<13) #define _BUTTON_CROSS (1<<14) #define BUTTON_SQUARE (1<<15) #define BUTTON_PAUSE (1<<16) u16 BUTTON_CROSS = _BUTTON_CROSS; u16 BUTTON_CIRCLE= _BUTTON_CIRCLE; u8 init_finished=0; bool mm_shutdown=0; char userBG[64]; char auraBG[64]; char avchdBG[64]; char blankBG[64]; char playBG[64]; char legend[64]; char xmbicons[64]; char xmbicons2[64]; char xmbdevs[64]; char xmbbg[64]; //char playBGL[64]; char playBGR[64]; char avchdIN[64]; char avchdMV[64]; char helpNAV[64]; char helpMME[128]; int abort_rec=0; char disclaimer[64], bootmusic[64]; char ps2png[64], dvdpng[64]; //char sys_cache[512]; char mouseInfo[128];//char mouseInfo2[128]; u8 *text_bmp=NULL; u8 *text_bmpS=NULL; u8 *text_bmpUBG=NULL; u8 *text_BOOT=NULL; u8 *text_USB=NULL; u8 *text_HDD=NULL; u8 *text_BLU_1=NULL; u8 *text_NET_6=NULL; u8 *text_OFF_2=NULL; u8 *text_FMS=NULL; u8 *text_DOX=NULL; u8 *text_MSG=NULL; u8 *text_INFO=NULL; u8 *text_CFC_3=NULL; u8 *text_SDC_4=NULL; u8 *text_MSC_5=NULL; u8 *text_bmpUPSR=NULL; u8 *text_bmpIC; u8 *text_TEMP; u8 *text_DROPS; u8 *text_legend; u8 *text_FONT; u8 *xmb_col; u8 *xmb_clock; u8 *xmb_icon_globe = NULL; u8 *xmb_icon_help = NULL; u8 *xmb_icon_quit = NULL; u8 *xmb_icon_star = NULL; u8 *xmb_icon_star_small = NULL; u8 *xmb_icon_retro = NULL; u8 *xmb_icon_ftp = NULL; u8 *xmb_icon_folder = NULL; u8 *xmb_icon_desk = NULL; u8 *xmb_icon_hdd = NULL; u8 *xmb_icon_blu = NULL; u8 *xmb_icon_tool = NULL; u8 *xmb_icon_note = NULL; u8 *xmb_icon_film = NULL; u8 *xmb_icon_photo = NULL; u8 *xmb_icon_update = NULL; //u8 *xmb_icon_restart= NULL; u8 *xmb_icon_dev = NULL; u8 *xmb_icon_ss = NULL; u8 *xmb_icon_showtime = NULL; u8 *xmb_icon_theme = NULL; FILE *fpV; int do_move=0; int no_real_progress=0; int payload=0; char payloadT[2]; int socket_handle; int portNum = -1; int multiStreamStarted=0; //OSK CellOskDialogCallbackReturnParam OutputInfo; CellOskDialogInputFieldInfo inputFieldInfo; uint16_t Result_Text_Buffer[128 + 1]; //sys_memory_container_t container=NULL; int enteredCounter = 0; char new_file_name[128]; char iconHDD[64], iconUSB[64], iconBLU[64], iconNET[64], iconOFF[64], iconSDC[64], iconCFC[64], iconMSC[64]; char this_pane[256], other_pane[256]; int cover_available=0, cover_available_1=0, cover_available_2=0, cover_available_3=0, cover_available_4=0, cover_available_5=0, cover_available_6=0; u8 scan_avchd=1; u8 expand_avchd=1; u8 mount_bdvd=1; u8 mount_hdd1=1; u8 animation=3; int direct_launch=1; u8 disable_options=0, force_disable_copy=0; u8 download_covers=0; float overscan=0.0f; u8 force_update_check=0; u8 display_mode=0; // 0-All titles, 1-Games only, 2-AVCHD/Video only u8 game_bg_overlay=1; typedef struct { path_open_entry entries[24]; char arena[0x9000]; } path_open_table; path_open_table open_table; uint64_t dest_table_addr; char gameID[512]; #define MAX_LIST 768 t_menu_list menu_list[MAX_LIST]; void DBPrintf( const char *string) { if(debug_print==102030) return; #if (CELL_SDK_VERSION>0x210001) cellConsolePrintf(debug_print, string); #else (void) string; #endif } #define MAX_LIST_OPTIONS 128 typedef struct { u8 enabled; char label[64]; char value[512]; } t_opt_list; t_opt_list opt_list[MAX_LIST_OPTIONS]; u8 opt_list_max=0; int open_select_menu(char *_caption, int _width, t_opt_list *list, int _max, u8 *buffer, int _max_entries, int _centered); int open_list_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries, int _centered); int open_dd_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries); int context_menu(char *_cap, int _type, char *c_pane, char *o_pane); #define MAX_PANE_SIZE 2560 typedef struct { //unsigned flags; u8 type; //0-dir 1-file char name[128]; char path[512]; char entry[128]; // __0+name for dirs and __1+name for files - used for sorting dirs first int64_t size; time_t time; char datetime[10]; mode_t mode; u8 selected; } t_dir_pane; t_dir_pane pane_l[MAX_PANE_SIZE]; //left directory pane t_dir_pane pane_r[MAX_PANE_SIZE]; //right directory pane int max_dir_l=0; int max_dir_r=0; #define MAX_PANE_SIZE_BARE 2560 typedef struct { char name[128]; char path[512]; int64_t size; time_t time; } t_dir_pane_bare; int state_read=1; int state_draw=1; int draw_legend=1; char current_left_pane[512]="/", current_right_pane[512]="/", my_txt_file[512]; int first_left=0, first_right=0, viewer_open=0; int max_menu_list=0; typedef struct { char host[64]; // char root[512]; char name[512]; char friendly[32]; int port; } net_hosts; net_hosts host_list[10]; int max_hosts=0; #define MAX_F_FILES 3000 typedef struct { char path[384]; uint64_t size; } f_files_stru; f_files_stru f_files[MAX_F_FILES]; int max_f_files=0; int file_counter=0; // to count files int abort_copy=0; // abort process int num_directories=0, num_files_big=0, num_files_split=0; typedef struct { char label[256]; float x; float y; float scale; float weight; float slant; u8 font; float hscale; float vscale; u8 centered; float cut; uint32_t color; } ttf_labels; ttf_labels ttf_label[512]; int max_ttf_label=0; int mode_list=0; u32 forcedevices=0xffff; u8 fm_sel=0; u8 fm_sel_old=15; int game_sel=0; int game_sel_last=0; int cover_mode=8, initial_cover_mode=8, user_font=1, last_cover_mode=8; u8 dir_mode=2; u8 game_details=2; u8 bd_emulator=1; u8 mm_locale=0; u8 mui_font=4; // font for multilingual user interface int net_available=0; union CellNetCtlInfo net_info; int net_avail=1; u8 theme_sound=1; int copy_file_counter=0; //int64_t uint64_t copy_global_bytes=0x00ULL; uint64_t global_device_bytes=0x00ULL; int lastINC=0, lastINC3=0, lastINC2=0; uint64_t memvaloriginal = 0x386000014E800020ULL; uint64_t memvaltemp = 0x386000014E800020ULL; uint64_t memvalnew = 0xE92296887C0802A6ULL; int patchmode = -1; using namespace cell::Gcm; #define IS_DISC (1<<0) #define IS_HDD (1<<1) #define IS_USB (1<<2) #define IS_DBOOT (1<<5) #define IS_BDMIRROR (1<<6) #define IS_PATCHED (1<<7) #define IS_FAV (1<<8) #define IS_EXTGD (1<<9) #define IS_PS3 (1<<13) #define IS_LOCKED (1<<14) #define IS_PROTECTED (1<<15) #define IS_OTHER (0<<16) #define IS_ACTION (1<<16) #define IS_ADVENTURE (2<<16) #define IS_FAMILY (3<<16) #define IS_FIGHTING (4<<16) #define IS_PARTY (5<<16) #define IS_PLATFORM (6<<16) #define IS_PUZZLE (7<<16) #define IS_ROLEPLAY (8<<16) #define IS_RACING (9<<16) #define IS_SHOOTER (10<<16) #define IS_SIM (11<<16) #define IS_SPORTS (12<<16) #define IS_STRATEGY (13<<16) #define IS_TRIVIA (14<<16) #define IS_3D (15<<16) static char genre [16] [48]; static char retro_groups[ 6] [32]; static char xmb_columns [10] [32]; static char alpha_groups[16] [32] = { "All", "A-B", "C-D", "E-F", "G-H", "I-J", "K-L", "M-N", "O-P", "Q-R", "S-T", "U-V", "W-X", "Y-Z", "Other", "---" }; typedef struct { u8 val; u8 font_id; char id[4]; unsigned char eng_name[32]; unsigned char loc_name[32]; } _locales; #define MAX_LOCALES 24 static _locales locales[] = { { 0, 4, "EN", "English", "English" }, { 1, 4, "BG", "Bulgarian", "Български" }, { 2, 4, "RU", "Russian", "Русский" }, { 3, 16, "RO", "Romanian", "Română" }, { 4, 16, "TR", "Turkish", "Türkçe" }, { 5, 4, "ES", "Spanish", "Español" }, { 6, 4, "DE", "German", "Deutsch" }, { 7, 4, "FR", "French", "Français" }, { 8, 4, "IT", "Italian", "Italiano" }, { 9, 4, "BR", "Brazilian", "Português BR" }, { 10, 4, "PR", "Portuguese", "Português" }, { 11, 4, "NL", "Dutch", "Nederlands" }, { 12, 16, "PL", "Polish", "Polski" }, { 13, 16, "GR", "Greek", "Ελληνικά" }, { 14, 4, "UA", "Ukrainian", "Українська" }, { 15, 16, "HU", "Hungarian", "Magyar" }, { 16, 4, "DK", "Danish", "Dansk" }, { 17, 4, "FI", "Finnish", "Suomi" }, { 18, 4, "SE", "Swedish", "Svenska" }, { 19, 4, "MY", "Malaysian", "Melayu" }, { 20, 4, "CN", "Chinese (S)", "简体中文" }, { 21, 4, "CT", "Chinese (T)", "繁体中文" }, { 22, 16, "AR", "Arabic", "ﺔﻴﺑﺮﻌﻟا" }, { 23, 4, "XX", "Other", "Other" } }; uint8_t padLYstick=0, padLXstick=0, padRYstick=0, padRXstick=0; double mouseX=0.5f, mouseY=0.5f, mouseYD=0.0000f, mouseXD=0.0000f, mouseYDR=0.0000f, mouseXDR=0.0000f, mouseYDL=0.0000f, mouseXDL=0.0000f; uint8_t xDZ=30, yDZ=30; uint8_t xDZa=30, yDZa=30; float offY=0.0f, BoffY=0.0f, offX=0.0f, incZ=0.7f, BoffX=0.0f, slideX=0.0f; static void *host_addr; static uint32_t syscall35(const char *srcpath, const char *dstpath); static void syscall_mount(const char *path, int mountbdvd); int load_texture(u8 *data, char *name, uint16_t dw); time_t rawtime; struct tm * timeinfo; int xmb_bg_show=0; int xmb_bg_counter=200; #define MAX_STARS 128 typedef struct { u16 x; u16 y; u8 bri; u8 size; } stars_def; stars_def stars[MAX_STARS]; #define XMB_TEXT_WIDTH 912 #define XMB_TEXT_HEIGHT 74 #define MAX_XMB_TEXTS (1920 * 1080 * 2) / (XMB_TEXT_WIDTH * XMB_TEXT_HEIGHT) typedef struct __xmbtexts { bool used; u8 *data; //pointer to image } xmbtexts __attribute__((aligned(8))); xmbtexts xmb_txt_buf[MAX_XMB_TEXTS]; int xmb_txt_buf_max=0; #define XMB_THUMB_WIDTH 408 #define XMB_THUMB_HEIGHT 408 #define MAX_XMB_THUMBS (1920 * 1080 * 3) / (XMB_THUMB_WIDTH * XMB_THUMB_HEIGHT) typedef struct { int used; int column; u8 *data; //pointer to image } xmbthumbs; xmbthumbs xmb_icon_buf[MAX_XMB_THUMBS]; int xmb_icon_buf_max=0; #define MAX_XMB_OPTIONS 12 typedef struct { // u8 type; //0-list 1-text char label[32]; char value[4]; } xmbopt; //sys_addr_t vm; //pointer to virtual memory #define MAX_XMB_MEMBERS 2560 typedef struct __xmbmem { u8 type; //0 unkn, 1 ps3 game, 2 AVCHD/Blu-ray video from gamelist, 3 showtime vid, 4 music, 5 photo, 6 function, 7 setting, 8 snes rom, 9 fceu rom, 10 vba rom, 11 genp rom, 12 fbanext u8 status; //0 idle, 1 loading, 2 loaded bool is_checked; int game_id; //pointer to menu_list[id] u8 game_split; u32 game_user_flags; char name[128]; char subname[96]; u8 option_size; u8 option_selected; char optionini[20]; xmbopt option[MAX_XMB_OPTIONS]; int data; //pointer to text image (xmbtexts) xmb_txt_buf int icon_buf; u8 *icon; //pointer to icon image u16 iconw; u16 iconh; char file_path[256]; //path to entry file char icon_path[128]; //path to entry icon } xmbmem __attribute__((aligned(16))); #define MAX_XMB_ICONS 10 typedef struct { u8 init; u16 size; u16 first; u8 *data; char name[32]; u8 group; // Bits 0-4: for genre/emulators: genres/retro_groups // Bits 7-5: for alphabetic grouping (alpha_groups) xmbmem member[MAX_XMB_MEMBERS]; } xmb_def; xmb_def xmb[MAX_XMB_ICONS]; //xmb[0] can be used as temp column when doing grouping u8 xmb_icon=6; //1 home, 2 settings, 3 photo, 4 music, 5 video, 6 game, 7 faves, 8 retro, 9 web u8 xmb_icon_last=6; u16 xmb_icon_last_first=0; int xmb_slide=0; int xmb_slide_y=0; int xmb_slide_step=0; int xmb_slide_step_y=0; u8 xmb_sublevel=0; #define MAX_WWW_THEMES 128 typedef struct { u8 type; char name[64]; char pkg[128]; char img[128]; char author[32]; char mmver[16]; char info[64]; } theme_def; theme_def www_theme[MAX_WWW_THEMES]; u8 max_theme=0; int open_theme_menu(char *_caption, int _width, theme_def *list, int _max, int _x, int _y, int _max_entries, int _centered); void draw_xmb_icons(xmb_def *_xmb, const int _xmb_icon, int _xmb_x_offset, int _xmb_y_offset, const bool _recursive, int sub_level); void draw_coverflow_icons(xmb_def *_xmb, const int _xmb_icon_, int __xmb_y_offset); void add_home_column(); void mod_xmb_member(xmbmem *_member, u16 _size, char *_name, char *_subname); #define MAX_DOWN_LIST (128) //queue for background downloads typedef struct { u8 status; char url[512]; char local[512]; } downqueue; downqueue downloads[MAX_DOWN_LIST]; int downloads_max=0; /* #define MAX_MSG (128) //queue for pop-up messages typedef struct { u8 status; char line1[64]; char line2[64]; char line3[64]; } msgqueue; msgqueue message[MAX_MSG]; int max_message=0; */ #define MAX_MP3 1024//MAX_XMB_MEMBERS typedef struct { char path[512]; // u64 size; // u64 pos; } mp3_playlist_type; mp3_playlist_type mp3_playlist[MAX_MP3]; int max_mp3=0; int current_mp3=0; char *tmhour(int _hour) { int th=_hour; if(time_format) th=_hour;//sprintf(time_result, "%2d", _hour); else { if(_hour>11) th=_hour-12; if(!th) th=12; } sprintf(time_result, "%2d", th); return time_result; } void set_xo() { if(confirm_with_x) { BUTTON_CROSS = _BUTTON_CROSS; //(1<<12) BUTTON_CIRCLE= _BUTTON_CIRCLE; //(1<<13) dox_cross_x=15; dox_cross_y=14; dox_cross_w=34; dox_cross_h=34; dox_circle_x=207; dox_circle_y=14; dox_circle_w=34; dox_circle_h=34; } else { BUTTON_CROSS = _BUTTON_CIRCLE; BUTTON_CIRCLE= _BUTTON_CROSS; dox_circle_x=15; dox_circle_y=14; dox_circle_w=34; dox_circle_h=34; dox_cross_x=207; dox_cross_y=14; dox_cross_w=34; dox_cross_h=34; } } /*****************************************************/ /* DIALOG */ /*****************************************************/ #define CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF (0<<7) #define CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON (1<<7) #define CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE (2<<12) volatile int no_video=0; int osk_dialog=0; int osk_open=0; volatile int dialog_ret=0; u32 type_dialog_yes_no = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO; u32 type_dialog_yes_back = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK; u32 type_dialog_ok = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK; u32 type_dialog_no = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON; u32 type_dialog_back = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF; static void dialog_fun1( int button_type, void * ) { switch ( button_type ) { case CELL_MSGDIALOG_BUTTON_YES: dialog_ret=1; break; case CELL_MSGDIALOG_BUTTON_NO: // case CELL_MSGDIALOG_BUTTON_ESCAPE: case CELL_MSGDIALOG_BUTTON_NONE: dialog_ret=2; break; case CELL_MSGDIALOG_BUTTON_ESCAPE: dialog_ret=3; break; default: break; } } static void dialog_fun2( int button_type, void * ) { switch ( button_type ) { case CELL_MSGDIALOG_BUTTON_OK: // case CELL_MSGDIALOG_BUTTON_ESCAPE: case CELL_MSGDIALOG_BUTTON_NONE: dialog_ret=1; break; case CELL_MSGDIALOG_BUTTON_ESCAPE: dialog_ret=3; break; default: break; } } void ClearSurface() { cellGcmSetClearSurface(CELL_GCM_CLEAR_Z | CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G | CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A); } void wait_dialog() { while(!dialog_ret) { if(init_finished) { if(cover_mode==8) draw_whole_xmb(xmb_icon);//draw_xmb_bare(xmb_icon, 1, 0, 0); else if(cover_mode==5) { ClearSurface(); draw_fileman(); flip();sys_timer_usleep(1668);} else if(cover_mode>=0 && cover_mode<3 || cover_mode==6 || cover_mode==7) { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); sys_timer_usleep(1668); flip(); } else if(cover_mode==4) { ClearSurface(); draw_coverflow_icons(xmb, xmb_icon, xmb_slide_y); sys_timer_usleep(1668); flip(); } else {flip();sys_timer_usleep(1668);} } else {flip();sys_timer_usleep(1668);} } cellMsgDialogClose(60.0f); setRenderColor(); } void wait_dialog_simple() { while(!dialog_ret) { sys_timer_usleep(1668); flip(); } cellMsgDialogClose(60.0f); setRenderColor(); } void load_localization(int id) { MM_LocaleSet(0); mui_font = locales[0].font_id; if(id) { char lfile[128]; sprintf(lfile, "%s/lang/LANG_%s.TXT", app_usrdir, locales[id].id); int llines = MM_LocaleInit ( lfile ); if(llines==STR_LAST_ID) { MM_LocaleSet (1); mui_font = locales[id].font_id; user_font = locales[id].font_id; } else { mm_locale=0; char errlang[512]; sprintf(errlang, "Localization file for %s (%s) language is missing or incomplete!\n\n%s: %i lines read, but %i expected!\n\nRestart multiMAN while holding L2+R2 for \"Debug Mode\" to generate LANG_DEFAULT.TXT\nwith all required localization labels.", locales[id].eng_name, locales[id].loc_name, lfile, llines, STR_LAST_ID); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, errlang, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } } if (mui_font>4 && mui_font<10) mui_font+=5; for(int n=0; n<16; n++) sprintf(genre[n], "%s", (const char*)MM_STRING(210+n)); for(int n=0; n< 6; n++) sprintf(retro_groups[n], "%s", (const char*)MM_STRING(226+n)); sprintf(alpha_groups[14], "%s", (const char*)STR_OTHER); sprintf(xmb_columns[0], "Empty"); sprintf(xmb_columns[1], "multiMAN"); for(int n=2; n<8 ; n++) sprintf(xmb_columns[n], "%s", (const char*)MM_STRING(230+n)); // 232-237 sprintf(xmb_columns[8], "%s", (const char*)STR_GRP_RETRO); // Retro sprintf(xmb_columns[9], "%s", (const char*)MM_STRING(238)); // Web for(int n=0; n<MAX_XMB_ICONS ; n++) sprintf(xmb[n].name, "%s", xmb_columns[n]); } int exist(char *path) { struct stat p_stat; return (stat(path, &p_stat)>=0); } int exist_c(const char *path) { struct stat p_stat; return (stat(path, &p_stat)>=0); } int rndv(int maxval) { return (int) ((float)rand() * ((float)maxval / (float)RAND_MAX)); } #if (CELL_SDK_VERSION>0x210001) static void usbdev_init(int check) { FILE *fid; int vid, pid; DEV_INFO *usbdev; int32_t r; char usbcfg[128]; sprintf(usbcfg, "%s/USB.CFG", app_usrdir); fid = fopen(usbcfg, "r"); if (!fid) return; while (fscanf(fid, "%x:%x:%i", &vid, &pid, &max_usb_volumes) != EOF) { if ((usbdev = (DEV_INFO *)malloc(sizeof(DEV_INFO))) == NULL) break; if(check) { if ((r = PfsmDevAdd(vid, pid, &usbdev->dev))) { free(usbdev); } else { usbdev->next = dev_info; dev_info = usbdev; } } } fclose(fid); } static void usbdev_uninit(void) { DEV_INFO *usbdev; while ((usbdev = dev_info)) { dev_info = usbdev->next; PfsmDevDel(&usbdev->dev); free(usbdev); } } #endif void flipc(int _fc) { int flipF; for(flipF = 0; flipF<_fc; flipF++) { sys_timer_usleep(3336); flip(); } } void get_free_memory() { system_call_1(352, (uint64_t) &meminfo); } u32 new_pad=0, old_pad=0; uint8_t old_status=0; uint8_t old_status_k=0; int pad_num=0; static u32 old_info[7]; static int pad_read( void ) { ss_timer=(time(NULL)-ss_timer_last); int ret; u32 padd; u32 dev_type=0; static CellPadData databuf; static CellMouseInfo Info; static CellMouseData Data; static CellKbInfo info; static CellKbData kdata; float mouse_speed=0.001f; uint32_t old_info_m = 0; uint32_t old_info_k = 0; u16 padSensorX; u16 padSensorY; u16 padSensorG; //check for keyboard input if(cellKbSetReadMode (0, CELL_KB_RMODE_INPUTCHAR) != CELL_KB_OK) goto read_mouse; if(cellKbSetCodeType (0, CELL_KB_CODETYPE_ASCII) != CELL_KB_OK) goto read_mouse; if(cellKbGetInfo (&info) != CELL_KB_OK) goto read_mouse; if((info.info & CELL_KB_INFO_INTERCEPTED) && (!(old_info_k & CELL_KB_INFO_INTERCEPTED))){ old_info_k = info.info; }else if((!(info.info & CELL_KB_INFO_INTERCEPTED)) && (old_info_k & CELL_KB_INFO_INTERCEPTED)){ old_info_k = info.info; } if (info.status[0] == CELL_KB_STATUS_DISCONNECTED) goto read_mouse; if (cellKbRead (0, &kdata)!=CELL_KB_OK) goto read_mouse; if (kdata.len == 0) goto read_mouse; // sprintf(mouseInfo, "Keyboard: Buttons : %02X %c", kdata.keycode[0], kdata.keycode[0]); old_status_k = info.status[0]; padd = 0; if(kdata.keycode[0]>0x2f && kdata.keycode[0]<0x37) pad_num=kdata.keycode[0]-0x30; //0-6 switch pad port if(kdata.keycode[0]>0x8039 && kdata.keycode[0]<0x8040 && cover_mode!=5) //F1-F6 switch cover mode { cover_mode=kdata.keycode[0]-0x803a; old_fi=0; old_fi=-1; counter_png=0; goto pad_out; } if(cover_mode==5) { if(kdata.keycode[0]==0x8049 || kdata.keycode[0]==0xC049) padd = (1<<11); //INS= R1 else if(kdata.keycode[0]==0x803b) padd = padd | (1<<14)|(1<<0); //F2= select+x else if(kdata.keycode[0]==0x0009) padd = padd | (1<<10); //TAB= L1 else if(kdata.keycode[0]==0xC050) mouseX-=0.02f; //LEFT (NUM BLOCK) else if(kdata.keycode[0]==0xC04F) mouseX+=0.02f; //RIGHT else if(kdata.keycode[0]==0xC052) mouseY-=0.02f; //UP else if(kdata.keycode[0]==0xC051) mouseY+=0.02f; //DOWN else if(kdata.keycode[0]==0x78 || kdata.keycode[0]==0x58) padd = padd | (1<<13) | (1<<0); //x = select+circle / move else if(kdata.keycode[0]==0x76 || kdata.keycode[0]==0x56) padd = padd | (1<<2); //v = R3 / HEX view else if(kdata.keycode[0]==0xC04B) padd = padd | (1<<8); //PGUP->L2 else if(kdata.keycode[0]==0xC04E) padd = padd | (1<<9); //PGDN->R2 } if(kdata.keycode[0]==0x8050) padd = padd | (1<<7); //LEFT else if(kdata.keycode[0]==0x804F) padd = padd | (1<<5); //RIGHT else if(kdata.keycode[0]==0x8052) padd = padd | (1<<4); //UP else if(kdata.keycode[0]==0x8051) padd = padd | (1<<6); //DOWN else if(kdata.keycode[0]==0x804B) padd = padd | (1<<7); //PGUP->LEFT else if(kdata.keycode[0]==0x804E) padd = padd | (1<<5); //PGDN->RIGHT else if(kdata.keycode[0]==0x804C || kdata.keycode[0]==0xC04C) padd = padd | (1<<15); //DEL else if(kdata.keycode[0]==0x400A || kdata.keycode[0]==0x000A) padd = padd | (1<<14); //ENTER else if(kdata.keycode[0]==0x8029) padd = padd | (1<<12); //ESC->TRIANGLE else if(kdata.keycode[0]==0x402b) padd = padd | (1<<3) | (1<<4); //NUM+ = START-UP else if(kdata.keycode[0]==0x402d) padd = padd | (1<<3) | (1<<6); //NUM- = START-DOWN else if(kdata.keycode[0]==0x402f) padd = padd | (1<<3) | (1<<7); // / = START-left else if(kdata.keycode[0]==0x402a) padd = padd | (1<<3) | (1<<5); // *- = START-right else if(kdata.keycode[0]==0x8044) padd = padd | (1<<0) | (1<<10); //F11 = SELECT+L1 else if(kdata.keycode[0]==0x8045 || kdata.keycode[0]==0x0009) padd = padd | (1<<10); //F12 = L1 else if(kdata.keycode[0]==0x8043) padd = padd | (1<<2); //F10 = R3 else if(kdata.keycode[0]==0x8042) padd = padd | (1<<9); //F9 = R2 else if(kdata.keycode[0]==0x8041) padd = padd | (1<<11); //F8 = R1 else if(kdata.keycode[0]==0x8040 || kdata.keycode[0]==0x8039) padd = padd | (1<<1); //F7 = L3 else if(kdata.keycode[0]==0x43 || kdata.keycode[0]==0x63) padd = padd | (1<<13); //c = circle / copy goto pad_out; // check for mouse input read_mouse: ret = cellMouseGetInfo (&Info); if((Info.info & CELL_MOUSE_INFO_INTERCEPTED) && (!(old_info_m & CELL_MOUSE_INFO_INTERCEPTED))){ old_info_m = Info.info; }else if((!(Info.info & CELL_MOUSE_INFO_INTERCEPTED)) && (old_info_m & CELL_MOUSE_INFO_INTERCEPTED)){ old_info_m = Info.info; } if (Info.status[0] == CELL_MOUSE_STATUS_DISCONNECTED) goto read_pad; ret = cellMouseGetData (0, &Data); if (CELL_OK != ret) goto read_pad; if (Data.update != CELL_MOUSE_DATA_UPDATE) goto read_pad; // sprintf(mouseInfo, "Buttons : %02X | x-axis : %d | y-axis : %d | Wheel : %d | Tilt : %d ", Data.buttons, Data.x_axis, Data.y_axis, Data.wheel, Data.tilt); old_status = Info.status[0]; padd= ((Data.buttons & 1)<<14) | ((Data.buttons & 2)<<12); //LEFT=X / RIGHT=CIRCLE padd = padd | ( (Data.buttons & 4)<<8); //WHEEL=L1 if(Data.x_axis<-1 || Data.x_axis> 1) mouseX+= Data.x_axis*mouse_speed; if(Data.y_axis<-1 || Data.y_axis> 1) mouseY+= Data.y_axis*mouse_speed; if(cover_mode!=4) { if(Data.wheel>0) padd = padd | (1<<4); if(Data.wheel<0) padd = padd | (1<<6); } else { if(Data.wheel>0) padd = padd | (1<<7); if(Data.wheel<0) padd = padd | (1<<5); } if(cover_mode!=5) { if(Data.x_axis>10) padd = padd | (1<<5); if(Data.x_axis<-10) padd = padd | (1<<7); if(Data.y_axis>10) padd = padd | (1<<6); if(Data.y_axis<-10) padd = padd | (1<<4); } mouseYD=0.0f; mouseXD=0.0f; mouseYDL=0.0f; mouseXDL=0.0f; mouseYDR=0.0f; mouseXDR=0.0f; mouseXD=0; mouseYD=0; cellMouseClearBuf(0); goto pad_out; read_pad: CellPadInfo2 infobuf; if ( cellPadGetInfo2(&infobuf) != 0 ) { old_pad = new_pad = 0; return 1; } //pad_num++; //if(pad_num>6) pad_num=0; for(pad_num=0;pad_num<7;pad_num++) if ( infobuf.port_status[pad_num] == CELL_PAD_STATUS_CONNECTED ) {goto pad_ok;} old_pad = new_pad = 0; return 1; pad_ok: if((infobuf.system_info & CELL_PAD_INFO_INTERCEPTED) && (!(old_info[pad_num] & CELL_PAD_INFO_INTERCEPTED))) { old_info[pad_num] = infobuf.system_info; } else if((!(infobuf.system_info & CELL_PAD_INFO_INTERCEPTED)) && (old_info[pad_num] & CELL_PAD_INFO_INTERCEPTED)) { old_info[pad_num] = infobuf.system_info; old_pad = new_pad = 0; goto pad_repeat; } if (cellPadGetDataExtra( pad_num, &dev_type, &databuf ) != CELL_PAD_OK) { old_pad=new_pad = 0; return 1; } if (databuf.len == 0) { new_pad = 0; goto pad_repeat; } padd = ( databuf.button[2] | ( databuf.button[3] << 8 ) ); //digital buttons padRXstick = databuf.button[4]; // right stick padRYstick = databuf.button[5]; padLXstick = databuf.button[6]; // left stick padLYstick = databuf.button[7]; if(use_pad_sensor) { cellPadSetPortSetting( pad_num, CELL_PAD_SETTING_SENSOR_ON); //CELL_PAD_SETTING_PRESS_ON | padSensorX = databuf.button[20]; padSensorY = databuf.button[21]; padSensorG = databuf.button[23]; if(padSensorX>404 && padSensorX<424) padd|=BUTTON_L1; if(padSensorX>620 && padSensorY<640) padd|=BUTTON_R1; } else cellPadSetPortSetting( pad_num, 0); if(debug_mode) { get_free_memory(); sprintf(status_info, "%i %i %i %i (MEM: %.f) %s", databuf.button[20], databuf.button[21], databuf.button[22], databuf.button[23], (double) (meminfo.avail/1024.0f), STR_DEBUG_MODE); } //sprintf(www_info, "--- %i %i ", databuf.len, pad_num); if(dev_type==CELL_PAD_DEV_TYPE_BD_REMOCON) { if(databuf.button[25]==0x0b || databuf.button[25]==0x32) padd|=(1 << 14); //map BD remote [enter] and [play] to [X] else if(databuf.button[25]==0x38) padd|=BUTTON_START | BUTTON_SQUARE; //stop_mp3(5); else if(databuf.button[25]==0x30) padd|=BUTTON_START | BUTTON_LEFT; //prev_mp3(); else if(databuf.button[25]==0x31) padd|=BUTTON_START | BUTTON_RIGHT; //next_mp3(); else if(databuf.button[25]==0x80) padd|=BUTTON_START | BUTTON_SELECT; //BLUE button -> file manager else if(databuf.button[25]==0x82) padd|=BUTTON_L2 | BUTTON_R2; //GREEN -> screensaver else if(databuf.button[25]==0x60) padd|=BUTTON_START | BUTTON_DOWN; //SLOW REV button -> decrease volume else if(databuf.button[25]==0x61) padd|=BUTTON_START | BUTTON_UP; //SLOW FWD button -> increase volume else if(databuf.button[25]==0x39) padd|=BUTTON_PAUSE; } if(cover_mode!=5 && !use_analog) { if(padLYstick<2) padd=padd | BUTTON_UP; if(padLYstick>253) padd=padd | BUTTON_DOWN; if(padLXstick<2) padd=padd | BUTTON_LEFT; if(padLXstick>253) padd=padd | BUTTON_RIGHT; if(padRYstick<2) padd=padd | BUTTON_UP; if(padRYstick>253) padd=padd | BUTTON_DOWN; if(padRXstick<2) padd=padd | BUTTON_LEFT; if(padRXstick>253) padd=padd | BUTTON_RIGHT; } mouseYD=0.0f; mouseXD=0.0f; mouseYDL=0.0f; mouseXDL=0.0f; mouseYDR=0.0f; mouseXDR=0.0f; //deadzone: x=100 y=156 (28 / 10%) if(padRXstick<=(128-xDZa)){ mouseXD=(float)(((padRXstick+xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDR=mouseXD;} if(padRXstick>=(128+xDZa)){ mouseXD=(float)(((padRXstick-xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDR=mouseXD;} if(padRYstick<=(128-yDZa)){ mouseYD=(float)(((padRYstick+yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDR=mouseYD;} if(padRYstick>=(128+yDZa)){ mouseYD=(float)(((padRYstick-yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDR=mouseYD;} if(padLXstick<=(128-xDZa)){ mouseXD=(float)(((padLXstick+xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDL=mouseXD;} if(padLXstick>=(128+xDZa)){ mouseXD=(float)(((padLXstick-xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDL=mouseXD;} if(padLYstick<=(128-yDZa)){ mouseYD=(float)(((padLYstick+yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDL=mouseYD;} if(padLYstick>=(128+yDZa)){ mouseYD=(float)(((padLYstick-yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDL=mouseYD;} pad_out: new_pad=padd & (~old_pad); old_pad= padd; if(new_pad==0 && old_pad==0) goto pad_repeat; c_opacity_delta=16; dimc=0; dim=1; b_box_opaq= 0xfe; b_box_step= -4; ss_timer=(time(NULL)-ss_timer_last); ss_timer_last=time(NULL); pad_repeat: key_repeat=0; if(new_pad==0 && old_pad!=0) { repeat_counter1--; if(repeat_counter1<=0) { repeat_counter1=0; repeat_counter2--; if(repeat_counter2<=0) { if(repeat_counter3_inc<3.f) repeat_counter3_inc+=0.02f; repeat_counter3+=(int)repeat_counter3_inc; repeat_counter2=repeat_key_delay; new_pad=old_pad; ss_timer=0; ss_timer_last=time(NULL); xmb_bg_counter=200; } key_repeat=1; } } else { repeat_counter1=repeat_init_delay; repeat_counter2=repeat_key_delay; repeat_counter3=1; repeat_counter3_inc=0.f; } // sprintf(www_info, "%i %i %i %i %i", new_pad, old_pad, repeat_counter1, repeat_counter2, key_repeat); return 1; } void screen_saver() { pad_read(); c_opacity_delta=0; new_pad=0; old_pad=0; int initial_skip=0; int www_running_old=www_running; if(use_drops) { sprintf(auraBG, "%s/DROPS.PNG", app_usrdir); if(exist(auraBG)) load_png_texture(text_DROPS, auraBG, 256); else use_drops=false; } while(1) { ss_timer=0; ss_timer_last=time(NULL); ClearSurface(); if(use_drops) set_texture(text_DROPS, 256, 256); for(int n=0; n<MAX_STARS; n++) { int move_star= rndv(10); if(use_drops) { display_img(stars[n].x, stars[n].y, 256, 256, 256, 256, 0.85f, 256, 256); if(move_star>4) {stars[n].y+=24; } else {stars[n].y+=16; } if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); stars[n].y=rndv(256); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } else { draw_square(((float)stars[n].x/1920.0f-0.5f)*2.0f, (0.5f-(float)stars[n].y/1080.0f)*2.0f, (stars[n].size/1920.f), (stars[n].size/1080.f), 0.0f, (0xffffff00 | stars[n].bri)); if(move_star>4) {stars[n].x++; } else {stars[n].x--; } if(move_star>3) {stars[n].y++; } if(move_star==2) {stars[n].y--; } if(move_star>7) stars[n].bri-=4; if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); stars[n].y=rndv(1080); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } } setRenderColor(); flip(); sys_timer_usleep(3336); initial_skip++; new_pad=0; old_pad=0; pad_read(); if (( (new_pad || old_pad) && initial_skip>150) || www_running!=www_running_old) {// || c_opacity_delta==16 new_pad=0; break; } } state_draw=1; c_opacity=0xff; c_opacity2=0xff; } void slide_screen_left(uint8_t *buffer) { int slide; for(slide=0;slide>-2048;slide-=128) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((int)slide, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } max_ttf_label=0; memset(buffer, 0, FB(1)); //0x505050 print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)STR_PLEASE_WAIT, 1.04f, 0.0f, mui_font, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } void slide_screen_right(uint8_t *buffer) { int slide; for(slide=0;slide<2048;slide+=128) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((int)slide, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); // new_pad=0; old_pad=0; // pad_read(); // if ( (new_pad || old_pad || c_opacity_delta==16)) { new_pad=0; old_pad=0; break;} } max_ttf_label=0; memset(buffer, 0, FB(1)); print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)STR_PLEASE_WAIT, 1.04f, 0.0f, mui_font, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } int net_used_ignore() { if(ftp_clients==0) return 1; int t_dialog_ret=dialog_ret; dialog_ret=0; cellMsgDialogAbort(); cellMsgDialogOpen2(type_dialog_yes_no, (const char*) STR_WARN_FTP, dialog_fun1, (void *) 0x0000aaaa, NULL); wait_dialog(); if(dialog_ret==1) {dialog_ret=t_dialog_ret; return 1;} dialog_ret=t_dialog_ret; return 0; } bool is_video(char *vfile) { if((strstr(vfile, ".M2TS")!=NULL || strstr(vfile, ".m2ts")!=NULL || strstr(vfile, ".DIVX")!=NULL || strstr(vfile, ".divx")!=NULL || strstr(vfile, ".AVI")!=NULL || strstr(vfile, ".avi")!=NULL || strstr(vfile, ".MTS")!=NULL || strstr(vfile, ".mts")!=NULL || strstr(vfile, ".MPG")!=NULL || strstr(vfile, ".mpg")!=NULL || strstr(vfile, ".MPEG")!=NULL || strstr(vfile, ".mpeg")!=NULL || strstr(vfile, ".MKV")!=NULL || strstr(vfile, ".mkv")!=NULL || strstr(vfile, ".MP4")!=NULL || strstr(vfile, ".mp4")!=NULL || strstr(vfile, ".VOB")!=NULL || strstr(vfile, ".vob")!=NULL || strstr(vfile, ".WMV")!=NULL || strstr(vfile, ".wmv")!=NULL || strstr(vfile, ".FLV")!=NULL || strstr(vfile, ".flv")!=NULL || strstr(vfile, ".MOV")!=NULL || strstr(vfile, ".mov")!=NULL || strstr(vfile, ".M2V")!=NULL || strstr(vfile, ".m2v")!=NULL || strstr(vfile, ".BIK")!=NULL || strstr(vfile, ".bik")!=NULL || strstr(vfile, ".BINK")!=NULL || strstr(vfile, ".bink")!=NULL || strstr(vfile, ".264")!=NULL || strstr(vfile, ".h264")!=NULL) && (strstr(vfile, ".jpg")==NULL && strstr(vfile, ".JPG")==NULL) ) return true; else return false; } bool is_snes9x(char *rom) { if( (strstr(rom, ".smc")!=NULL || strstr(rom, ".SMC")!=NULL || strstr(rom, ".sfc")!=NULL || strstr(rom, ".SFC")!=NULL || strstr(rom, ".fig")!=NULL || strstr(rom, ".FIG")!=NULL || strstr(rom, ".gd3")!=NULL || strstr(rom, ".GD3")!=NULL || strstr(rom, ".gd7")!=NULL || strstr(rom, ".GD7")!=NULL || strstr(rom, ".dx2")!=NULL || strstr(rom, ".DX2")!=NULL || strstr(rom, ".bsx")!=NULL || strstr(rom, ".BSX")!=NULL || strstr(rom, ".swc")!=NULL || strstr(rom, ".SWC")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/snes/")!=NULL || strstr(rom, snes_roms)!=NULL) ) || strstr(rom, ".jma")!=NULL || strstr(rom, ".JMA")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } void launch_snes_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(snes_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_SNES, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)snes_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } bool is_genp(char *rom) { if( ( ( (strstr(rom, ".bin")!=NULL || strstr(rom, ".BIN")!=NULL) && (strstr(rom, "/ROMS/gen/")!=NULL || strstr(rom, genp_roms)!=NULL)) || strstr(rom, ".smd")!=NULL || strstr(rom, ".SMD")!=NULL || strstr(rom, ".md")!=NULL || strstr(rom, ".MD")!=NULL || strstr(rom, ".sms")!=NULL || strstr(rom, ".SMS")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/gen/")!=NULL || strstr(rom, genp_roms)!=NULL) ) || strstr(rom, ".gen")!=NULL || strstr(rom, ".GEN")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_fceu(char *rom) { if( (strstr(rom, ".nes")!=NULL || strstr(rom, ".NES")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/fceu/")!=NULL || strstr(rom, fceu_roms)!=NULL) ) || strstr(rom, ".fds")!=NULL || strstr(rom, ".FDS")!=NULL || strstr(rom, ".unif")!=NULL || strstr(rom, ".UNIF")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_vba(char *rom) { if( (strstr(rom, ".gba")!=NULL || strstr(rom, ".GBA")!=NULL || strstr(rom, ".gbc")!=NULL || strstr(rom, ".GBC")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/vba/")!=NULL || strstr(rom, vba_roms)!=NULL) ) || strstr(rom, ".gb")!=NULL || strstr(rom, ".GB")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_fba(char *rom) { if( (strstr(rom, ".")==NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/fba/")!=NULL || strstr(rom, fba_roms)!=NULL) ) ) ) return true; else return false; } void launch_genp_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(genp_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_GEN, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)genp_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_fceu_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(fceu_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_FCEU, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)fceu_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_vba_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(vba_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_VBA, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)vba_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_fba_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(fba_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_FBA, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)fba_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void get_game_flags(int _game_sel) { menu_list[_game_sel].user=0; if(!exist(menu_list[_game_sel].path)) return; FILE *flist; char game_opts[512]; char tmpid[9]; sprintf(game_opts, "%s/PS3_GAME/PS3GAME.INI", menu_list[_game_sel].path); flist = fopen(game_opts, "rb"); if ( flist != NULL ) { fread((char*) &tmpid, 8, 1, flist); if(strstr(tmpid, GAME_INI_VER)!=NULL) { fseek(flist, 8, SEEK_SET); fread((char*) &menu_list[_game_sel].user, sizeof(menu_list[_game_sel].user), 1, flist); fclose(flist); goto quit_with_ok; } fclose(flist); } quit_with_ok: sprintf(game_opts, "%s/PS3_GAME/PS3DATA.BIN", menu_list[_game_sel].path); if(exist(game_opts)) { remove(game_opts); menu_list[_game_sel].user|= IS_BDMIRROR | IS_USB; } return; } int set_game_flags(int _game_sel) { char game_opts[512]; sprintf(game_opts, "%s/PS3_GAME", menu_list[_game_sel].path); if(!exist(game_opts) || strstr(game_opts, "/dev_bdvd")!=NULL || strstr(game_opts, "/pvd_usb")!=NULL) return 0; sprintf(game_opts, "%s/PS3_GAME/PS3GAME.INI", menu_list[_game_sel].path); FILE *flist; remove(game_opts); flist = fopen(game_opts, "wb"); if ( flist != NULL ) { fwrite( GAME_INI_VER, 8, 1, flist); fwrite( (char*) &menu_list[_game_sel].user, sizeof(menu_list[_game_sel].user), 1, flist); fclose(flist); } return 1; } /****************************************************/ /* FTP SECTION */ /****************************************************/ void ftp_handler(CellFtpServiceEvent event, void * /*data*/, size_t /*datalen*/) { switch(event) { case CELL_FTP_SERVICE_EVENT_SHUTDOWN: case CELL_FTP_SERVICE_EVENT_FATAL: case CELL_FTP_SERVICE_EVENT_STOPPED: ftp_service=0; ftp_clients=0; break; case CELL_FTP_SERVICE_EVENT_CLIENT_CONNECTED: ftp_clients++; break; case CELL_FTP_SERVICE_EVENT_CLIENT_DISCONNECTED: ftp_clients--; break; default: break; } } void ftp_on() { if(ftp_service) return; if(cellFtpServiceRegisterHandler(ftp_handler)>=0) { cellFtpServiceStart(); ftp_service=1; } } void ftp_off() { if(!ftp_service) return; uint64_t result; cellFtpServiceStop(&result); cellFtpServiceUnregisterHandler(); ftp_service=0; ftp_clients=0; } /* #if (CELL_SDK_VERSION>0x210001) #else void ftp_on() { ftp_service=0; } void ftp_off() { ftp_service=0; } #endif */ #define SOCKET_BUF_SIZE_RCV (384 * 1024) #define SOCKET_BUF_SIZE_SND ( 1 * 1024) #define REQUEST_GET2 "\r\n\r\n" // command: DIR GET INF //ret = network_com("GET", "10.20.2.208", 11222, "/", "/dev_hdd0/GAMES/down_test.bin", 3); void net_folder_copy(char *path, char *path_new, char *path_name) { FILE *fp; del_temp(app_temp); int n=0, foundslash=0, t_files, t_folders; uint64_t copy_folder_bytes=0; uint64_t global_folder_bytes=0; char net_host_file[512], net_host_file2[512];//, tempname2[512]; char net_path_bare[512], title[512], date2[10], timeF[8], type[1], net_path[512], parent[512]; char path2[1024], path3[1024], path4[1024], path_relative[512]; char temp[3], length[128], tempname2[128]; char cpath[1024], cpath2[1024], tempname[1024]; int chost=0; int pl=0, pr=0; int len; int ret; int optval; unsigned int temp_a; char sizestr[32]="0"; char string1n[1024]; int seconds2=0; struct sockaddr_in sin; struct hostent *hp; FILE *fid; unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); sprintf(net_host_file2, "%s", path); net_host_file2[10]=0; sprintf(net_host_file,"%s%s", app_usrdir, net_host_file2); fp = fopen ( net_host_file, "r" ); if ( fp != NULL ) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; chost=path[9]-0x30; initConsole(); sprintf(path2, "%s/", path); // host_list[chost].host // host_list[chost].port if ((unsigned int)-1 != (temp_a = inet_addr(host_list[chost].host))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(host_list[chost].host))) { // printf("unknown host %s, %d\n", host_list[chost].host, sys_net_h_errno); goto termination2X; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(host_list[chost].port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { goto termination2X; } optval = SOCKET_BUF_SIZE_RCV; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); optval = SOCKET_BUF_SIZE_SND; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) { // DPrintf("setsockopt() failed (errno=%d)\n", sys_net_errno); goto termination2X; } ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) { // DPrintf("connect() failed (errno=%d)\n", sys_net_errno); goto termination2X; } copy_folder_bytes=0x00ULL; t_files=0; t_folders=0; while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeF, date2, type, parent, tempname2)>=7) { sprintf(net_path, "%s%s", net_host_file2, net_path_bare); net_path[strlen(path2)]=0; // sprintf(string1n, "[%s] [%s] [%s]", path_new); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if((strstr(path_new, "/ps3_home/video")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".avi")!=NULL || strstr(title, ".AVI")!=NULL || strstr(title, ".m2ts")!=NULL || strstr(title, ".M2TS")!=NULL || strstr(title, ".mts")!=NULL || strstr(title, ".MTS")!=NULL || strstr(title, ".m2t")!=NULL || strstr(title, ".M2T")!=NULL || strstr(title, ".divx")!=NULL || strstr(title, ".DIVX")!=NULL || strstr(title, ".mpg")!=NULL || strstr(title, ".MPG")!=NULL || strstr(title, ".mpeg")!=NULL || strstr(title, ".MPEG")!=NULL || strstr(title, ".mp4")!=NULL || strstr(title, ".MP4")!=NULL || strstr(title, ".vob")!=NULL || strstr(title, ".VOB")!=NULL || strstr(title, ".wmv")!=NULL || strstr(title, ".WMV")!=NULL || strstr(title, ".ts")!=NULL || strstr(title, ".TS")!=NULL || strstr(title, ".mov")!=NULL || strstr(title, ".MOV")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home/music")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".mp3")!=NULL || strstr(title, ".MP3")!=NULL || strstr(title, ".wav")!=NULL || strstr(title, ".WAV")!=NULL || strstr(title, ".aac")!=NULL || strstr(title, ".AAC")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home/photo")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".jpg")!=NULL || strstr(title, ".JPG")!=NULL || strstr(title, ".jpeg")!=NULL || strstr(title, ".JPEG")!=NULL || strstr(title, ".png")!=NULL || strstr(title, ".PNG")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home")==NULL && strcmp(net_path, path2)==0)) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } } fclose(fp); // sprintf(string1n, "Copying network folder (%i files in %i folders) from [%s], please wait!\n\n Press [O] twice to abort.", t_files, t_folders, host_list[chost].host); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(copy_folder_bytes<1) goto termination2X; fp = fopen ( net_host_file, "r" ); // if(copy_folder_bytes>1048576) { sprintf(string1n, (const char*)STR_NETCOPY0, t_files, t_folders, host_list[chost].host); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); // ClearSurface(); cellDbgFontPrintf( 0.20f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); dialog_ret=0; cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1n, NULL, NULL, NULL); flip(); } dialog_ret=0; time_start= time(NULL); lastINC2=0;lastINC=0; while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeF, date2, type, parent, tempname2)>=7) { global_device_bytes=0x00ULL; sprintf(net_path, "%s%s", net_host_file2, net_path_bare); net_path[strlen(path2)]=0; // sprintf(path4, "%s%s%s", net_host_file2, parent, type); // sprintf(path3, "%s/0", path); // if(strcmp(path3, path4)==0) // { // strncpy(list[*max ].path, net_path, strlen(net_path)-1); list[*max ].path[strlen(net_path)-1]=0; // } //subfolder if(strcmp(net_path, path2)==0 && strstr(path_new, "/ps3_home")==NULL) { sprintf(path_relative, "/"); sprintf(tempname, "%s%s", net_host_file2, net_path_bare); if(strcmp(tempname, path2)!=0) { pl=strlen(tempname); pr=strlen(path2); for(n=pr;n<pl;n++) { path_relative[n-pr+1]=tempname[n]; path_relative[n-pr+2]=0; } } sprintf(path3, "%s/%s%s", path_new, path_name, path_relative); // sprintf(tempname, "[%s]=[%s] Net: [%s]\n\nLocal: [%s]\n\nRel: %s\n\nNet_path: [%s]", temp, title, net_path_bare, path3, path_relative, net_path); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, tempname, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)==0) { foundslash=0; pl=strlen(path3); for(n=0;n<pl;n++) { tempname[n]=path3[n]; tempname[n+1]=0; if(path3[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } } } if(strcmp(net_path, path2)==0 && strcmp(temp, title)!=0) { if(strtoull(length, NULL, 10)<1) goto skip_zero_files; sprintf(path4, "%s%s%s", net_host_file2, net_path_bare, title); pl=strlen(path4); for(n=11;n<pl;n++) {cpath[n-11]=path4[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(cpath, "%s%s" , path3, title); if((strstr(path_new, "/ps3_home")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".avi")!=NULL || strstr(title, ".AVI")!=NULL || strstr(title, ".m2ts")!=NULL || strstr(title, ".M2TS")!=NULL || strstr(title, ".mts")!=NULL || strstr(title, ".MTS")!=NULL || strstr(title, ".m2t")!=NULL || strstr(title, ".M2T")!=NULL || strstr(title, ".divx")!=NULL || strstr(title, ".DIVX")!=NULL || strstr(title, ".mpg")!=NULL || strstr(title, ".MPG")!=NULL || strstr(title, ".mpeg")!=NULL || strstr(title, ".MPEG")!=NULL || strstr(title, ".mp4")!=NULL || strstr(title, ".MP4")!=NULL || strstr(title, ".vob")!=NULL || strstr(title, ".VOB")!=NULL || strstr(title, ".wmv")!=NULL || strstr(title, ".WMV")!=NULL || strstr(title, ".ts")!=NULL || strstr(title, ".TS")!=NULL || strstr(title, ".mov")!=NULL || strstr(title, ".MOV")!=NULL || strstr(title, ".mp3")!=NULL || strstr(title, ".MP3")!=NULL || strstr(title, ".wav")!=NULL || strstr(title, ".WAV")!=NULL || strstr(title, ".aac")!=NULL || strstr(title, ".AAC")!=NULL || strstr(title, ".jpg")!=NULL || strstr(title, ".JPG")!=NULL || strstr(title, ".jpeg")!=NULL || strstr(title, ".JPEG")!=NULL || strstr(title, ".png")!=NULL || strstr(title, ".PNG")!=NULL) )) { sprintf(cpath, "%s/%s", app_temp, title); } else if(strstr(path_new, "/ps3_home")!=NULL) goto skip_zero_files; remove(cpath); fid = fopen(cpath, "wb"); sprintf(get_cmd, "GET %s%s", cpath2, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0 || ret!=len) { goto terminationX; } ret = recv(socket_handle, (char*)sizestr, 32, 0); copy_global_bytes=strtoull(sizestr+10, NULL, 10); if(copy_global_bytes<1 || copy_folder_bytes<1) goto terminationX; while (1) { int seconds= (int) (time(NULL)-time_start); int eta=0; if(global_folder_bytes>0 && seconds>0) eta=(int) ((copy_folder_bytes-global_folder_bytes)/(global_folder_bytes/seconds)); lastINC3=0; if( ( ((int)(global_folder_bytes*100ULL/copy_folder_bytes)) - lastINC2)>0) { lastINC2=(int) (global_folder_bytes*100ULL / copy_folder_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } // if(copy_folder_bytes>1048576) { if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { // ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); /* sprintf(string1,"Transferred %1.2f of %1.2f KB\n\nRemaining : %imin %2.2isec\nElapsed : %imin %2.2isec",((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60, (seconds/60), seconds % 60); cellDbgFontPrintf( 0.07f, 0.1f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Source : host://%s:%i%s\nDestination: %s", server_name, server_port, net_file, save_path); cellDbgFontPrintf( 0.07f, 0.3f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Speed : %3.2f KB/s (%2.3f Mbit/s)", ((double) global_device_bytes)/seconds/1024.0, ((double) global_device_bytes*8)/seconds/1000.0/1000.0); cellDbgFontPrintf( 0.07f, 0.5f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); */ sprintf(string1n, (const char*) STR_NETCOPY4,((double) global_folder_bytes)/(1024.0)/(1024.0),((double) copy_folder_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1n); seconds2= (int) (time(NULL)); flip(); } } ret = recv(socket_handle, buf, BUF_SIZE, 0); if (ret < 0) { goto terminationX; } if (ret > 0) { global_device_bytes+=ret; global_folder_bytes+=ret; fwrite(buf, ret, 1, fid); } if (ret == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) || dialog_ret==3) break; } //while // DPrintf("Sending WAIT command... "); if(copy_global_bytes<1048576) sys_timer_usleep(250*1000); sprintf(get_cmd, "WAIT ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); // DPrintf("%i\n", len); terminationX: fclose(fid); skip_zero_files: len=0; //if(copy_global_bytes>1048576) {cellMsgDialogAbort(); flip();} // list[*max].type=strtol(type, NULL, 10); // sprintf(list[*max ].path, "%s/%s", path, title); // temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; // if(strcmp(temp, title)==0) // { // sprintf(list[*max ].path, "%s", path); // char *pch=list[*max ].path; // char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; // list[*max ].path[lastO]=0; // } // sprintf(list[*max ].entry, "__%i%s", list[*max].type, title); // list[*max].size=strtoull(length, NULL, 10); } pad_read(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } //while /* cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [O] to continue!"); cellDbgFontDrawGcm(); while(1) { pad_read(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } */ termination2X: // DPrintf("Sent STOP command!\n"); sprintf(get_cmd, "STOP ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); // DPrintf("Aborting socket...\n"); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); if (ret < 0) { DPrintf("shutdown() failed (errno=%d)\n", sys_net_errno); } socketclose(socket_handle); fclose(fp); cellMsgDialogAbort(); sys_timer_usleep(1000000); flip(); /* DPrintf("\nPress [O] to continue..."); while(1) { pad_read(); flip(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } */ if(strstr(path_new, "/ps3_home")!=NULL) { DIR *dir; char tr[512]; for (n=0;n<256;n++ ) { dir=opendir (app_temp); if(!dir) goto quit1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s", entry->d_name); cellDbgFontDrawGcm(); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.89f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); if( strstr(path_new, "/ps3_home/video")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to video library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); video_export(tr, path_name, 0); } else if( strstr(path_new, "/ps3_home/music")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to music library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); music_export(tr, path_name, 0); } else if( strstr(path_new, "/ps3_home/photo")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to photo library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); photo_export(tr, path_name, 0); } sprintf(tr, "%s/%s", app_temp, entry->d_name); if(exist(tr)) remove(tr); } } closedir(dir); } ret = video_finalize(); ret = music_finalize(); ret = photo_finalize(); del_temp(app_temp); } termConsole(); } quit1: if(buf) free(buf); } int network_put(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { int len; int ret; int optval; unsigned int temp_a; // char sizestr[32]="0"; char string1[1024]; int seconds2=0; global_device_bytes=0x00ULL; struct sockaddr_in sin; struct hostent *hp; // time_t time_start; if(show_progress==1) { sprintf(string1, "Establishing server connection, please wait!\n\nContacting %s...", server_name); ClearSurface(); cellDbgFontPrintf( 0.28f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return -1; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return -1; } int fs; uint64_t fsiz = 0, msiz = 0; uint64_t chunk = 320 * 1024; uint64_t readb=0; unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); if(cellFsOpen(save_path, CELL_FS_O_RDONLY, &fs, NULL, 0)!=CELL_FS_SUCCEEDED) goto termination_PUT; cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); copy_global_bytes=msiz; if(msiz<chunk && msiz>0) chunk=msiz; cellFsOpen(save_path, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_SET, NULL); // FILE *fid = fopen(save_path, "rb"); // if(fid==NULL) goto termination_PUT; // fseek(fid, 0, SEEK_END); // copy_global_bytes=ftell(fid); // fseek(fid, 0, SEEK_SET); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_PUT; optval = 320 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_PUT; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_PUT; sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination_PUT; } if (ret != len) { goto termination_PUT; } ret = recv(socket_handle, buf, BUF_SIZE, 0); if(show_progress!=0 && copy_global_bytes>1048576){ dialog_ret=0; sprintf(string1, (const char*) STR_NETCOPY1, server_name); //, (double) (copy_global_bytes/1024.0f/1024.0f) cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; global_device_bytes=0x00ULL; time_start = time(NULL); while(fsiz < msiz) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0 && copy_global_bytes>1048576){ if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1, (const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } if((fsiz+chunk) > msiz) chunk = (msiz-fsiz); if(cellFsRead(fs, (void *)buf, chunk, &readb)!=CELL_FS_SUCCEEDED) goto termination_PUT; fsiz = fsiz + readb; global_device_bytes=fsiz; if(send(socket_handle, buf, readb, 0)<0) goto termination_PUT; if (readb == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while termination_PUT: cellFsClose(fs); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); if(show_progress!=0){ cellMsgDialogAbort(); } //flip(); free(buf); return (0); } int network_del(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { int len; int ret; (void) show_progress; (void) save_path; int optval; unsigned int temp_a; struct sockaddr_in sin; struct hostent *hp; if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return (-1); } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return (-1); } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_DEL; optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_DEL; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_DEL; sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination_DEL; } if (ret != len) { goto termination_DEL; } ret = recv(socket_handle, buf, BUF_SIZE, 0); termination_DEL: sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); return (0); } int read_folder(char *path) { DIR *dir; if(abort_copy==1) return -1; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); num_directories++; if(!d1f) {closedir (dir);abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); sprintf(f_files[max_f_files].path, "%s/", d1f); f_files[max_f_files].size=0; max_f_files++; if(max_f_files>=MAX_F_FILES) break; read_folder(d1f); free(d1f); if(abort_copy) break; } else { char *f= (char *) malloc(512); struct stat s; off64_t size=0LL; if(!f) {abort_copy=2;closedir (dir);return -1;} sprintf(f, "%s/%s", path, entry->d_name); if(stat(f, &s)<0) {abort_copy=3;if(f) free(f);break;} size= s.st_size; sprintf(f_files[max_f_files].path, "%s", f); f_files[max_f_files].size=size; max_f_files++; if(max_f_files>=MAX_F_FILES) break; file_counter++; global_device_bytes+=size; if(f) free(f); if(abort_copy) break; } } closedir (dir); return 0; } int network_com(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { // char *server_name; int len; int ret; int optval; unsigned int temp_a; char string1[1024]; int seconds2=0; global_device_bytes=0x00ULL; struct sockaddr_in sin; struct hostent *hp; // time_t time_start; if(show_progress==1) { if(strstr(command, "GET!")!=NULL) sprintf(string1, "Refreshing network directory structure, please wait!\n\nContacting %s...", server_name); else sprintf(string1, "Establishing server connection, please wait!\n\nContacting %s...", server_name); ClearSurface(); cellDbgFontPrintf( 0.28f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return (-1); } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return (-1); } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); char sizestr[32]="0"; remove(save_path); FILE *fid = fopen(save_path, "wb"); optval = SOCKET_BUF_SIZE_RCV; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); optval = SOCKET_BUF_SIZE_SND; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) { DPrintf("setsockopt() failed (errno=%d)\n", sys_net_errno); goto termination; } // optval = 15; //set socket send/receive/connect timeout to 15 seconds // ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVTIMEO, &optval, sizeof(optval)); // ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDTIMEO, &optval, sizeof(optval)); ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) { DPrintf("connect() failed (errno=%d)\n", sys_net_errno); goto termination; } // strcpy(get_cmd, command); // strcat(get_cmd, " "); // strcat(get_cmd, net_file); // strcat(get_cmd, REQUEST_GET2); sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination; } if (ret != len) { goto termination; } ret = recv(socket_handle, (char*)sizestr, 32, 0); copy_global_bytes=strtoull(sizestr+10, NULL, 10); if(copy_global_bytes<1) goto termination; if(show_progress!=0 && copy_global_bytes>1048576){ sprintf(string1, (const char*) STR_NETCOPY2, server_name); //, (double) (copy_global_bytes/1024.0f/1024.0f) // ClearSurface(); cellDbgFontPrintf( 0.20f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; global_device_bytes=0x00ULL; time_start = time(NULL); // len = 0; while (1) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0 && copy_global_bytes>1048576){ if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); /* sprintf(string1,"Transferred %1.2f of %1.2f KB\n\nRemaining : %imin %2.2isec\nElapsed : %imin %2.2isec",((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60, (seconds/60), seconds % 60); cellDbgFontPrintf( 0.07f, 0.1f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Source : host://%s:%i%s\nDestination: %s", server_name, server_port, net_file, save_path); cellDbgFontPrintf( 0.07f, 0.3f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Speed : %3.2f KB/s (%2.3f Mbit/s)", ((double) global_device_bytes)/seconds/1024.0, ((double) global_device_bytes*8)/seconds/1000.0/1000.0); cellDbgFontPrintf( 0.07f, 0.5f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); */ sprintf(string1, (const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } ret = recv(socket_handle, buf, BUF_SIZE, 0); if (ret < 0) { fclose(fid); goto termination; } if (ret > 0) { global_device_bytes+=ret; fwrite(buf, ret, 1, fid); } if (ret == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while termination: fclose(fid); //termination2: sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); if (ret < 0) { DPrintf("shutdown() failed (errno=%d)\n", sys_net_errno); } socketclose(socket_handle); // sys_timer_usleep(250*1000); if(show_progress!=0){ cellMsgDialogAbort(); } //flip(); free(buf); return (0); } void net_folder_copy_put(char *path, char *path_new, char *path_name) { file_counter=0; global_device_bytes=0; num_directories=0; max_f_files=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Preparing data and network connection, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); read_folder((char*) path); int e=0; if(max_f_files>0) { int len; int ret; int optval; unsigned int temp_a; struct sockaddr_in sin; struct hostent *hp; int fs; uint64_t fsiz = 0, msiz = 0; uint64_t chunk = 1 * 1024 * 1024; //320 * 1024; uint64_t readb=0; int seconds2=0; copy_global_bytes=global_device_bytes; global_device_bytes=0x00ULL; lastINC=0, lastINC3=0, lastINC2=0; char cpath2[1024]; int chost=0; chost=path_new[9]-0x30; if(strlen(path_new)>11) sprintf(cpath2, "/%s", path_new+11); else cpath2[0]=0x00; char server_name[64]; // char net_folder[512]; int server_port; sprintf(server_name, "%s", host_list[chost].host); server_port=host_list[chost].port; if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { cellMsgDialogAbort(); return; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { cellMsgDialogAbort(); return; } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_FC; optval = 320 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_FC; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_FC; cellMsgDialogAbort(); flip(); char string1[256]; sprintf(string1, (const char*) STR_NETCOPY3, file_counter, num_directories, host_list[chost].host); cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flipc(60); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); seconds2= (int) time(NULL); time_start = time(NULL); for(e=0; e<max_f_files; e++) { if(f_files[e].path[strlen(f_files[e].path)-1]!=0x2f) // file sprintf(get_cmd, "PUT-%.f %s/%s%s%s", (double)f_files[e].size, cpath2, path_name, f_files[e].path+strlen(path), REQUEST_GET2); else sprintf(get_cmd, "PUT %s/%s%s%s", cpath2, path_name, f_files[e].path+strlen(path), REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) goto termination_FC; if (ret != len) goto termination_FC; ret = recv(socket_handle, buf, 1 * 1024, 0); if(f_files[e].path[strlen(f_files[e].path)-1]!=0x2f) // file { if(cellFsOpen(f_files[e].path, CELL_FS_O_RDONLY, &fs, NULL, 0)!=CELL_FS_SUCCEEDED) goto termination_SEND; msiz=f_files[e].size; cellFsLseek(fs, 0, CELL_FS_SEEK_SET, NULL); fsiz=0; while(fsiz < msiz) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } // if(copy_global_bytes>1048576) { if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1,(const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } // if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz);} else chunk = 320*1024; // if(cellFsRead(fs, (void *)w, chunk, &readb)!=CELL_FS_SUCCEEDED) {cellFsClose(fs); goto termination_SEND;} cellFsRead(fs, (void *)buf, chunk, &readb); fsiz = fsiz + readb; if (readb == 0 || global_device_bytes>=copy_global_bytes) { break; } if(send(socket_handle, buf, readb, 0)<0) goto termination_SEND; global_device_bytes+=readb; if(fsiz>=msiz) break; pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while cellFsClose(fs); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } if(e!=(max_f_files-1)) { sprintf(get_cmd, "WAIT ! %s", REQUEST_GET2); len = strlen(get_cmd); sys_timer_usleep(500*1000); ret = send(socket_handle, get_cmd, len, 0); if(ret<0) break; sys_timer_usleep(333*1000); } else { sys_timer_usleep(500*1000); sprintf(get_cmd, "STOP ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); } } termination_SEND: termination_FC: cellMsgDialogAbort(); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); if(buf) free(buf); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } //there are files to copy else cellMsgDialogAbort(); } #define HTTP_POOL_SIZE (64 * 1024) int download_file(const char *http_file, const char *save_path, int show_progress) { if(net_avail<0) return 0; // time_t time_start; time_start= time(NULL); char string1[256]; global_device_bytes=0x00UL; int seconds2=0; if(show_progress==1) sprintf(string1, "%s", (const char*) STR_DOWN_UPD); if(show_progress==2) sprintf(string1, "%s", (const char*) STR_DOWN_COVER); if(show_progress==3) sprintf(string1, "%s", (const char*) STR_DOWN_FILE); if(show_progress==4) sprintf(string1, "%s", (const char*) STR_DOWN_THM); if(show_progress!=0){ ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); } if(show_progress>0 && show_progress!=3) { cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; int ret = 0; static char buffer[10240]; CellHttpClientId client = 0; CellHttpTransId trans = 0; CellHttpUri uri; int code = 0; uint64_t length = 0; size_t localRecv = -1; size_t poolSize = 0; void *uriPool = NULL; void *httpPool = NULL; FILE *fid; global_device_bytes=0; remove(save_path); httpPool = malloc(HTTP_POOL_SIZE); if (!httpPool) { goto quit; } if (cellHttpInit(httpPool, (size_t)HTTP_POOL_SIZE) < 0) { goto quit; } if (cellHttpCreateClient(&client) < 0) { goto quit; } cellHttpClientSetConnTimeout(client, 5 * 1000000); if (cellHttpUtilParseUri(NULL, http_file, NULL, 0, &poolSize) < 0) { goto quit; } uriPool = malloc(poolSize); if (!uriPool) { goto quit; } if (cellHttpUtilParseUri(&uri, http_file, uriPool, poolSize, NULL) < 0) { goto quit; } if (cellHttpCreateTransaction(&trans, client, CELL_HTTP_METHOD_GET, &uri) < 0) { goto quit; } free(uriPool); uriPool = NULL; if (cellHttpSendRequest(trans, NULL, 0, NULL) < 0) {goto quit;} if (cellHttpResponseGetStatusCode(trans, &code) < 0) {goto quit;} if (code == 404 || code == 403) {ret=-1; goto quit;} if (cellHttpResponseGetContentLength(trans, &length) < 0) {goto quit;} copy_global_bytes=length; fid = fopen(save_path, "wb"); if (!fid) {goto quit;} memset(buffer, 0x00, sizeof(buffer)); while (localRecv != 0) { if (cellHttpRecvResponse(trans, buffer, sizeof(buffer) - 1, &localRecv) < 0) { fclose(fid); goto quit; } if (localRecv == 0) break; global_device_bytes+=localRecv; fwrite(buffer, localRecv, 1, fid); int seconds= (int) (time(NULL)-time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0 && show_progress!=3){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0){ if(lastINC3>3 || (time(NULL)-seconds2)>1 || (show_progress==3 && www_running)) { ClearSurface(); if(show_progress==3 && www_running) { if(cover_mode==8) { draw_xmb_clock(xmb_clock, 0); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } else { set_texture( text_bmpUPSR, 1920, 1080); BoffX--; if(BoffX<= -3840) BoffX=0; if(BoffX>= -1920) { display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } display_img(1920+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); if(BoffX<= -1920) { display_img(3840+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } } sprintf(string1, (const char*) STR_DOWN_MSG0,((double) global_device_bytes)/(1024.0)/(1024.0f),((double) copy_global_bytes)/(1024.0)/(1024.0f), (eta/60), eta % 60, save_path); cellDbgFontPrintf( 0.07f, 0.9f, 1.0f, 0xc0c0c0c0, string1); } else { draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1, (const char*) STR_DOWN_MSG1,((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); } cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); sprintf(string1, (const char*) STR_DOWN_MSG2,((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60); if(show_progress!=3) cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); flip(); } } pad_read(); if ( ( new_pad & BUTTON_TRIANGLE) || ( old_pad & BUTTON_TRIANGLE)) { ret = 2; new_pad=0; old_pad=0; fclose(fid); remove(save_path); goto quit; } } fclose(fid); ret = 1; quit: if (trans) cellHttpDestroyTransaction(trans); if (client) cellHttpDestroyClient(client); cellHttpEnd(); if (httpPool) free(httpPool); if (uriPool) free(uriPool); if(show_progress==3){ if(exist(download_dir)) sprintf(current_right_pane, "%s", download_dir); else sprintf(current_right_pane, "%s/DOWNLOADS", app_usrdir); state_read=3; } if(show_progress!=0){ cellMsgDialogAbort(); flip(); } if(global_device_bytes==0) remove(save_path); return ret; } int download_file_th(const char *http_file, const char *save_path, int params) { (void) params; // if(net_avail<0) return 0; int ret = 0; u32 received_bytes=0; unsigned char *buffer=NULL; buffer = (unsigned char *) malloc(16384); CellHttpClientId client = 0; CellHttpTransId trans = 0; CellHttpUri uri; int code = 0; uint64_t length = 0; size_t localRecv = -1; size_t poolSize = 0; void *uriPool = NULL; void *httpPool = NULL; FILE *fid; received_bytes=0; remove(save_path); httpPool = malloc(HTTP_POOL_SIZE); if (!httpPool) goto quit_th; if (cellHttpInit(httpPool, (size_t)HTTP_POOL_SIZE) < 0) {goto quit_th;} if (cellHttpCreateClient(&client) < 0) {goto quit_th;} cellHttpClientSetConnTimeout(client, 5 * 1000000); if (cellHttpUtilParseUri(NULL, http_file, NULL, 0, &poolSize) < 0) {goto quit_th;} uriPool = malloc(poolSize);if (!uriPool) {goto quit_th;} if (cellHttpUtilParseUri(&uri, http_file, uriPool, poolSize, NULL) < 0) {goto quit_th;} if (cellHttpCreateTransaction(&trans, client, CELL_HTTP_METHOD_GET, &uri) < 0) {goto quit_th;} free(uriPool); uriPool = NULL; if (cellHttpSendRequest(trans, NULL, 0, NULL) < 0) {goto quit_th;} if (cellHttpResponseGetStatusCode(trans, &code) < 0) {goto quit_th;} if (code == 404 || code == 403) {ret=-1; goto quit_th;} if (cellHttpResponseGetContentLength(trans, &length) < 0) {goto quit_th;} fid = fopen(save_path, "wb"); if (!fid) {goto quit_th;} http_active=true; memset(buffer, 0x00, sizeof(buffer)); while (localRecv != 0) { if (cellHttpRecvResponse(trans, buffer, sizeof(buffer) - 1, &localRecv) < 0) { fclose(fid); goto quit_th; } if (localRecv == 0) break; if (localRecv > 0) { fwrite(buffer, localRecv, 1, fid); received_bytes+=localRecv; } } fclose(fid); ret = 1; quit_th: if(buffer) free(buffer); if (trans) cellHttpDestroyTransaction(trans); if (client) cellHttpDestroyClient(client); cellHttpEnd(); if (httpPool) free(httpPool); if (uriPool) free(uriPool); if(received_bytes==0) remove(save_path); http_active=false; return ret; } void download_cover(char *title_id, char *name) { if(strlen(title_id)!=9 || download_covers!=1 || net_avail<0) return; //strstr (title_id,"NO_ID")!=NULL || strstr (title_id,"AVCHD")!=NULL) return; net_avail=cellNetCtlGetInfo(16, &net_info); if(net_avail<0) return; char covers_url[128]; char string1x[128]; if(strstr(name, ".jpg")!=NULL || strstr(name, ".JPG")!=NULL || strstr(name, ".jpeg")!=NULL || strstr(name, ".JPEG")!=NULL) sprintf(string1x, "%s/%s.JPG", covers_dir, title_id); else sprintf(string1x, "%s/%s.PNG", covers_dir, title_id); sprintf(covers_url, "%s/covers_jpg/%s.JPG", url_base, title_id); u8 is_in_queue=0; for(int n=0;n<downloads_max; n++) if(!strcmp(downloads[downloads_max].url, covers_url)){is_in_queue=1; break;} if(!is_in_queue) { if(downloads_max>=MAX_DOWN_LIST) downloads_max=0; sprintf(downloads[downloads_max].url, "%s", covers_url); sprintf(downloads[downloads_max].local, "%s", string1x); downloads[downloads_max].status=1; downloads_max++; if(downloads_max>=MAX_DOWN_LIST) downloads_max=0; } //if(download_file(covers_url, string1x, 2)==0) net_avail=-1; } //u64 ret2 = syscall_837(837, (u64)"CELL_FS_IOS:USB_MASS_STORAGE000", (u64)"CELL_FS_UDF", (u64)"/dev_usb006", 0, 0, 0, 0, 0); static uint64_t syscall_837(const char *device, const char *format, const char *point, u32 a, u32 b, u32 c, void *buffer, u32 len) { system_call_8(837, (u64)device, (u64)format, (u64)point, a, b, c, (u64)buffer, len); return_to_user_prog(uint64_t); } static uint64_t syscall_838(const char *device) { system_call_1(838, (u64)device); return_to_user_prog(uint64_t); } /*******************/ /* Control Console */ #if (CELL_SDK_VERSION>0x210001) CellConsoleInputProcessorResult _cellConsoleResetBDVD (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nResetting dev_bdvd...\n"); syscall_838("/dev_bdvd"); syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); cellConsolePrintf(uiConnection, "Done!\n\n"); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleFTP (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char ftp_command[32]; if (sscanf(pcInput, "%*s %s", ftp_command)==1) { if(strcmp(ftp_command, "start")==0){ cellConsolePrintf(uiConnection, "Status: Starting FTP server...\n"); ftp_on(); if(ftp_service==0) cellConsolePrintf(uiConnection, "Status: Failed to start FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server started!\n"); } if(strstr(ftp_command, "stop")!=NULL){ cellConsolePrintf(uiConnection, "Status: Stopping FTP server...\n"); ftp_off(); if(ftp_service==1) cellConsolePrintf(uiConnection, "Status: Failed to start FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server stopped!\n"); } if(strstr(ftp_command, "restart")!=NULL){ cellConsolePrintf(uiConnection, "Status: Stopping FTP server...\n"); ftp_off(); cellConsolePrintf(uiConnection, "Status: Starting FTP server...\n"); ftp_on(); if(ftp_service==0) cellConsolePrintf(uiConnection, "Status: Failed to restart FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server restarted!\n"); } } else { if(ftp_service) cellConsolePrintf(uiConnection, "Status: FTP server is running\n\n"); else cellConsolePrintf(uiConnection, "Status: FTP server is stopped\n\n"); cellConsolePrintf(uiConnection, "Usage:\nftp\nftp start\nftp stop\nftp restart\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePeek (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; uint64_t peekA=0; if (sscanf(pcInput, "%*s %s", peek_addr)==1) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; if(peekA>0x80000000007ffff8ULL) return CELL_CONSOLE_INPUT_PROCESSED; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } else { cellConsolePrintf(uiConnection, "Usage: peek <u32 address>\n\npeek 2f8011\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePeekL (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; uint64_t peekA=0; int n=0; if (sscanf(pcInput, "%*s %s", peek_addr)==1) { for(n=0; n<256; n+=8) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL + (uint64_t) n; if(peekA>0x80000000007ffff8ULL) break; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } } else { cellConsolePrintf(uiConnection, "Usage: peekl <u32 address>\n\npeek 2f8011\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePoke (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; char poke_val[32]; poke_val[0]=0; uint64_t peekA=0, pokeA=0; if (sscanf(pcInput, "%*s %s %s", peek_addr, poke_val)==2) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; if(peekA>0x80000000007ffff8ULL) return CELL_CONSOLE_INPUT_PROCESSED; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); pokeA=strtoull(poke_val, NULL, 16); pokeq(peekA, pokeA); peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; cellConsolePrintf(uiConnection, "poke(0x80000000%08X)= 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } else { cellConsolePrintf(uiConnection, "Usage: poke <u32 address> <u64 value>\n\npoke 2f8011 1020304050607080\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleQuitXMB (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nShutting down multiMAN...\n"); unload_modules(); cellConsolePrintf(uiConnection, "Done!\n\n"); sys_process_exit(1); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleSS (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64], scm[128]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); sprintf(scm, "\nSaving screenshot to: [%s]...\n", video_mem); cellConsolePrintf(uiConnection, scm); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; // fwrite(color_base_addr, video_buffer, 1, fpA); for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); cellConsolePrintf(uiConnection, "Done!\n\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleRESTART (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nShutting down multiMAN...\n"); cellConsolePrintf(uiConnection, "Trying to restart...\n"); // debug_print=102030; char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { cellConsolePrintf(uiConnection, "Re-spawning [RELOAD.SELF]...\n"); unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleDebug (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; debug_print=uiConnection; cellConsolePrintf(uiConnection, "Debug enabled.\n\nmultiMAN> "); dialog_ret=3; return CELL_CONSOLE_INPUT_PROCESSED; } #endif /****************************************************/ /* MODULES SECTION */ /****************************************************/ static int unload_mod=0; static int load_modules() { int ret; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_FS); if (ret != CELL_OK) return ret; else unload_mod|=1; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); if(ret != CELL_OK) return ret; else unload_mod|=2; ret = cellSysmoduleLoadModule( CELL_SYSMODULE_IO ); if (ret != CELL_OK) return ret; else unload_mod|=4; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); //cellSysmoduleLoadModule( CELL_SYSMODULE_VDEC_MPEG2 ); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "multiMAN"; screenshot_param.game_title = "multiMAN Screenshots"; screenshot_param.game_comment = current_version_NULL; cellScreenShotSetParameter (&screenshot_param); cellScreenShotSetOverlayImage(app_homedir, (char*) "ICON0.PNG", 50, 850); cellScreenShotEnable(); cellSysmoduleLoadModule( CELL_SYSMODULE_AUDIO ); cellSysmoduleLoadModule( CELL_SYSMODULE_SPURS ); cellMouseInit (1); cellKbInit(1); ret = cellSysmoduleLoadModule(CELL_SYSMODULE_NET); if (ret < 0) return ret; else unload_mod|=16; cellNetCtlInit(); net_available = (cellSysmoduleLoadModule(CELL_SYSMODULE_HTTP)==CELL_OK); net_available = (sys_net_initialize_network()==0) | net_available; #if (CELL_SDK_VERSION>0x210001) cellConsoleInit(); cellConsoleNetworkInitialize(); cellConsoleNetworkServerInit(8080); cellConsoleInputProcessorAdd("resetbd", "Unmount/mount dev_bdvd", "", 0, _cellConsoleResetBDVD); cellConsoleInputProcessorAdd("debug", "Enable disable debug messages", "on|off", 0, _cellConsoleDebug); cellConsoleInputProcessorAdd("poke", "Write value to LV2 memory", "<u32 address> <u64 value>", 0, _cellConsolePoke); cellConsoleInputProcessorAdd("peekl", "Read 256 values from LV2 memory", "<u32 address>", 0, _cellConsolePeekL); cellConsoleInputProcessorAdd("peek", "Read value from LV2 memory", "<u32 address>", 0, _cellConsolePeek); cellConsoleInputProcessorAdd("ftp", "Manage FTP server", "start|stop|restart", 0, _cellConsoleFTP); cellConsoleInputProcessorAdd("quit", "Quit multiMAN and exit to XMB", "", 0, _cellConsoleQuitXMB); cellConsoleInputProcessorAdd("screenshot", "Save current screen as RAW (RGB) image in /dev_hdd0", "", 0, _cellConsoleSS); cellConsoleInputProcessorAdd("restart", "Restart multiMAN", "", 0, _cellConsoleRESTART); #endif ret = Fonts_LoadModules(); if ( ret != CELL_OK ) { return CELL_OK; } fonts = Fonts_Init(); if ( fonts ) { ret = Fonts_InitLibraryFreeType( &freeType ); if ( ret == CELL_OK ) { ret = Fonts_OpenFonts( freeType, fonts, app_usrdir ); if ( ret == CELL_OK ) { ret = Fonts_CreateRenderer( freeType, 0, &RenderWork.Renderer ); if ( ret == CELL_OK ) { // printf("App:Fonts Initialize All OK!\n"); //ret = Fonts_AttachFont( fonts, FONT_SYSTEM_GOTHIC_JP, &FontBitmaps.Font ); //Fonts_BindRenderer( &FontBitmaps.Font, &RenderWork.Renderer ); //FontBitmaps_Init( &FontBitmaps, (CellFont*)0, 24.f, 18.f, 1.0f, 0.1f, 256 ); return CELL_OK; } Fonts_CloseFonts( fonts ); } Fonts_EndLibrary( freeType ); } Fonts_End(); fonts = (Fonts_t*)0; } return ret; } void pfs_mode(int _mode) { #if (CELL_SDK_VERSION>0x210001) if(pfs_enabled && _mode==0) { pfs_enabled=0; usbdev_uninit(); } if(!pfs_enabled && _mode==1) { if(never_used_pfs) { usbdev_init(0); PfsmInit(max_usb_volumes); } usbdev_init(1); pfs_enabled=1; never_used_pfs=0; } if(pfs_enabled && _mode==2) { pfs_enabled=0; usbdev_uninit(); PfsmUninit(); } #else (void) _mode; #endif } void delete_entries(t_menu_list *list, int *max, u32 flag) { int n; n=0; while(n<(*max) ) { if(list[n].flags & flag) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } void sort_entries(t_menu_list *list, int *max) { int n,m,o1=0,o2=0; int fi= (*max); for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(list[n].title[0]=='_') o1=1; else o1=0; if(list[m].title[0]=='_') o2=1; else o2=0; if((strcasecmp(list[n].title+o1, list[m].title+o2)>0 && ((list[n].flags | list[m].flags) & 2048)==0) || ((list[m].flags & 2048) && n==0)) { t_menu_list swap; swap=list[n];list[n]=list[m];list[m]=swap; } } for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) if(strcasecmp(list[n].path, list[m].path)==0 && strstr(list[n].content,"PS3")!=NULL) sprintf(list[m].title, "%s", "_DELETE"); n=0; while(n<(*max) ) { if(strstr(list[n].title, "_DELETE")!=NULL) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } void delete_xmb_member(xmbmem *_xmb, u16 *max, int n) { if((*max) >1) { _xmb[n]=_xmb[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --;} } void sort_xmb_col(xmbmem *_xmb, u16 max, int _first) { if((max)<3) return; int n,m,o1=0,o2=0; u16 fi= (max); for(n=_first; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(_xmb[n].name[0]=='_') o1=1; else o1=0; if(_xmb[m].name[0]=='_') o2=1; else o2=0; if(strcasecmp(_xmb[n].name+o1, _xmb[m].name+o2)>0) { xmbmem swap; swap=_xmb[n];_xmb[n]=_xmb[m];_xmb[m]=swap; } else //remove duplicate entries (by name) in music/photo/video columns (excl. AVCHD/Blu-ray) //preference goes to hdd entries usually (null entries removed by delete_xmb_dubs if(!strcasecmp(_xmb[n].name+o1, _xmb[m].name+o2) && (_xmb[n].type>=4 && _xmb[n].type<=5)) _xmb[n].name[0]=0; } } void delete_xmb_dubs(xmbmem *_xmb, u16 *max) { if((*max)<2) return; int n; for(n=0; n< ((*max) -1);n++) if(_xmb[n].name[0]==0) { if((*max) >1) { _xmb[n]=_xmb[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --;} } } void read_xmb_column(int c, const u8 group) { char colfile[128]; char string1[9]; int backup_group=xmb[c].group; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); FILE *flist = fopen(colfile, "rb"); if(flist!=NULL) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, XMB_COL_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &xmb[c], llist_size, 1, flist); fclose(flist); if(group) { for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { u8 m_grp= (group-1)*2; if( group!=14 && (m_grp+0x41) != xmb[c].member[n].name[0] && (m_grp+0x42) != xmb[c].member[n].name[0] && (m_grp+0x61) != xmb[c].member[n].name[0] && (m_grp+0x62) != xmb[c].member[n].name[0] ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } else if( group==14 && ( (xmb[c].member[n].name[0]>=0x41 && xmb[c].member[n].name[0]<=0x5a) || (xmb[c].member[n].name[0]>=0x61 && xmb[c].member[n].name[0]<=0x7a) ) ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } } sort_xmb_col(xmb[c].member, xmb[c].size, (c==8 ? 1 : 0)); if(xmb[c].size) xmb[c].first= (c==8 ? 1 : 0); } } else { fclose(flist); remove(colfile); xmb[c].size=0; xmb[c].init=0; xmb[c].first=0; backup_group=0; } xmb[c].group=backup_group; free_all_buffers(); free_text_buffers(); } } void read_xmb_column_type(int c, u8 type, const u8 group) { char colfile[128]; char string1[9]; int backup_group=xmb[c].group; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); FILE *flist = fopen(colfile, "rb"); if(flist!=NULL) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, XMB_COL_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &xmb[c], llist_size, 1, flist); fclose(flist); } else { fclose(flist); remove(colfile); xmb[c].size=0; xmb[c].init=0; xmb[c].first=0; xmb[c].group=0; backup_group=0; } for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=type && xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } if(group) { for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { u8 m_grp= (group-1)*2; if( group!=14 && (m_grp+0x41) != xmb[c].member[n].name[0] && (m_grp+0x42) != xmb[c].member[n].name[0] && (m_grp+0x61) != xmb[c].member[n].name[0] && (m_grp+0x62) != xmb[c].member[n].name[0] ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } else if( group==14 && ( (xmb[c].member[n].name[0]>=0x41 && xmb[c].member[n].name[0]<=0x5a) || (xmb[c].member[n].name[0]>=0x61 && xmb[c].member[n].name[0]<=0x7a) ) ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } } sort_xmb_col(xmb[c].member, xmb[c].size, (c==8 ? 1 : 0)); if(xmb[c].size) xmb[c].first= (c==8 ? 1 : 0); } xmb[c].group=backup_group; free_all_buffers(); free_text_buffers(); } } void save_xmb_column(int c) { if(xmb[c].group) return; char colfile[128]; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); remove(colfile); if(xmb[c].size) { FILE *flist = fopen(colfile, "wb"); if(flist!=NULL) { fwrite((char*) XMB_COL_VER, 8, 1, flist); fwrite((char*) &xmb[c], sizeof(xmbmem)*xmb[c].size, 1, flist); fclose(flist); } } } static int unload_modules() { mm_shutdown=true; init_finished=0; /* if(text_bmp!=NULL) { u8 *buffer=text_bmp; ClearSurface(); flip(); max_ttf_label=0; memset(buffer, 0, 1920*1080*4); print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)"Boo!", 1.04f, 0.0f, 15, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); }*/ ClearSurface();flip(); ClearSurface();flip(); save_options(); write_last_state(); FILE *flist; remove(list_file); if(!pfs_enabled) { flist = fopen(list_file, "wb"); if(flist!=NULL) { fwrite((char*) GAME_LIST_VER, 8, 1, flist); fwrite((char*) &menu_list, ((max_menu_list+1)*sizeof(t_menu_list)), 1, flist); //556 sizeof(t_menu_list) fclose(flist); } } else { fdevices_old=0; sprintf(current_left_pane, "%s", "/"); sprintf(current_right_pane, "%s", "/"); } reset_xmb_checked(); if( !(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column)) { for(int c=3;c<9;c++) { if(c==6) c=8; save_xmb_column(c); } } sprintf(list_file_state, "%s/LSTAT.BIN", app_usrdir); remove(list_file_state); flist = fopen(list_file_state, "wb"); if(flist!=NULL) { if(xmb_icon==1 && xmb[xmb_icon].first>6) xmb[xmb_icon].first=1; fwrite((char*) GAME_STATE_VER, 8, 1, flist); fwrite((char*) &fdevices_old, sizeof(fdevices_old), 1, flist); fwrite((char*) &mouseX, sizeof(mouseX), 1, flist); fwrite((char*) &mouseY, sizeof(mouseY), 1, flist); fwrite((char*) &mp3_volume, sizeof(mp3_volume), 1, flist); fwrite((char*) &current_left_pane, sizeof(current_left_pane), 1, flist); fwrite((char*) &current_right_pane, sizeof(current_right_pane), 1, flist); fwrite((char*) &xmb_icon, sizeof(xmb_icon), 1, flist); fwrite((char*) &xmb[xmb_icon].first, sizeof(xmb[xmb_icon].first), 1, flist); fwrite((char*) &xmb[6].group, sizeof(xmb[6].group), 1, flist); fwrite((char*) &xmb[8].group, sizeof(xmb[8].group), 1, flist); fwrite((char*) &xmb[4].group, sizeof(xmb[4].group), 1, flist); fclose(flist); } enable_sc36(); ftp_off(); cellPadEnd(); if(multiStreamStarted) ShutdownMultiStream(); pfs_mode(2); //sys_vm_unmap(vm); if(unload_mod & 16) cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); if(unload_mod & 8) cellSysmoduleUnloadModule(CELL_SYSMODULE_GCM_SYS); if(unload_mod & 4) cellSysmoduleUnloadModule(CELL_SYSMODULE_IO); if(unload_mod & 2) cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); if(unload_mod & 1) cellSysmoduleUnloadModule(CELL_SYSMODULE_FS); //cellSysmoduleUnloadModule(CELL_SYSMODULE_VDEC_MPEG2); cellSysmoduleUnloadModule( CELL_SYSMODULE_SYSUTIL_SCREENSHOT ); cellSysmoduleUnloadModule( CELL_SYSMODULE_AUDIO ); //cellSysmoduleUnloadModule( CELL_SYSMODULE_USBD ); cellSysmoduleUnloadModule( CELL_SYSMODULE_RESC ); cellSysmoduleUnloadModule( CELL_SYSMODULE_SPURS ); if(ve_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_VIDEO_EXPORT ); if(me_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_MUSIC_EXPORT ); if(pe_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_PHOTO_EXPORT ); //FontBitmaps_End( &FontBitmaps ); //Fonts_UnbindRenderer( &FontBitmaps.Font ); //Fonts_DetachFont( &FontBitmaps.Font ); Fonts_CloseFonts( fonts ); Fonts_DestroyRenderer( &RenderWork.Renderer ); Fonts_EndLibrary( freeType ); Fonts_End(); Fonts_UnloadModules(); cellMouseEnd(); cellKbEnd(); sys_memory_container_destroy( memory_container_web ); sys_memory_container_destroy( memory_container ); cellSysmoduleFinalize(); return 0; } /****************************************************/ /* PNG SECTION */ /****************************************************/ typedef struct CtrlMallocArg { u32 mallocCallCounts; } CtrlMallocArg; typedef struct CtrlFreeArg { u32 freeCallCounts; } CtrlFreeArg; void *png_malloc(u32 size, void * a) { CtrlMallocArg *arg; arg = (CtrlMallocArg *) a; arg->mallocCallCounts++; return memalign(16,size+16); } static int png_free(void *ptr, void * a) { CtrlFreeArg *arg; arg = (CtrlFreeArg *) a; arg->freeCallCounts++; free(ptr); return 0; } int map_rsx_memory(u8 *buffer, size_t buf_size) { int ret; u32 offset; ret = cellGcmMapMainMemory(buffer, buf_size, &offset); if(CELL_OK != ret ) return ret; return 0; } int png_w=0, png_h=0, png_w2, png_h2; int jpg_w=0, jpg_h=0; int png_w_th=0, png_h_th=0; /* typedef struct{ sys_ppu_thread_t *ppuThreadId; uint32_t fileNum; usecond_t sleepTime; CellJpgDecCommand *commandPtr; } CellJpgTimerThreadArg_t; */ //typedef int32_t(*CellPngDecCbControlStream)( /*int32_t png_callback( CellPngDecStrmInfo *strmInfo, CellPngDecStrmParam *strmParam, void *cbCtrlStrmArg) { return 0; }*/ /* typedef struct CellPngDecDispInfo { uint64_t outputFrameWidthByte; uint32_t outputFrameHeight; uint64_t outputStartXByte; uint32_t outputStartY; uint64_t outputWidthByte; uint32_t outputHeight; uint32_t outputBitDepth; uint32_t outputComponents; uint32_t nextOutputStartY; uint32_t scanPassCount; void *outputImage; } CellPngDecDispInfo; typedef struct CellPngDecDispParam { void *nextOutputImage; } CellPngDecDispParam; */ /* int32_t pngDispCb( CellPngDecDispInfo *dispInfo, CellPngDecDispParam *dispParam, void *cbCtrlDispArg ) { (void) cbCtrlDispArg; dispParam->nextOutputImage=(u8*)(dispInfo->outputImage) + (dispInfo->outputWidthByte * dispInfo->outputHeight); // ClearSurface(); // set_texture( text_bmp, 1920, 1080); //PIC1.PNG // display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); // flip(); pad_read(); { if ((new_pad & BUTTON_UP)) { c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==8 && xmb[xmb_icon].size>1) { if(xmb[xmb_icon].first==0) {xmb[xmb_icon].first=xmb[xmb_icon].size-1; xmb_bg_show=0; xmb_bg_counter=200;} else xmb_slide_step_y=10; } } else if ((new_pad & BUTTON_DOWN)) { if(cover_mode==8 && xmb[xmb_icon].size>1) { if(xmb[xmb_icon].first==xmb[xmb_icon].size-1) {xmb[xmb_icon].first=0; xmb_bg_show=0; xmb_bg_counter=200;} else xmb_slide_step_y=-10;// && xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first++; } } else if ((new_pad & BUTTON_LEFT)) { if(cover_mode==8 && xmb_icon>1) xmb_slide_step=15; } else if ((new_pad & BUTTON_RIGHT)) { if(cover_mode==8 && xmb_icon<MAX_XMB_ICONS-1) xmb_slide_step=-15; } } draw_xmb_bare(xmb_icon, 1, 1, 0); return 0; } int load_png_partial(u8 *data, char *name, uint16_t _DW, u32 _lines, u16 *_image_id) { int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecOpnParam opnParam; CellPngDecExtInfo extInfo; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecExtInParam extInParam; CellPngDecOutParam outParam; CellPngDecExtOutParam extoutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; // CellPngDecCbCtrlStrm pngCallback; // pngCallback.cbCtrlStrmFunc= png_callback; // pngCallback.cbCtrlStrmArg = NULL; CellPngDecCbCtrlDisp pngDisp; pngDisp.cbCtrlDispFunc = pngDispCb; pngDisp.cbCtrlDispArg = &_image_id; CellPngDecDispParam pngDispInfo; pngDispInfo.nextOutputImage = data; int ret_png=-1; opnParam.selectChunk = 0; //no extra chunks needed InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.ppuThreadPriority = 3071; InParam.spuThreadPriority = 255; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; extInParam.bufferMode = CELL_PNGDEC_LINE_MODE; extInParam.spuMode = CELL_PNGDEC_TRYRECEIVE_EVENT; extInParam.outputCounts = _lines; //extoutParam.outputWidthByte //extoutParam.outputHeight ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w= png_h= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); // ret_file=ret = cellPngDecExtOpen(mHandle, &sHandle, &src, &opnInfo, &pngCallback, &opnParam); ret_file=ret = cellPngDecExtOpen(mHandle, &sHandle, &src, &opnInfo, NULL, &opnParam); if(ret == CELL_OK) { // ret = cellPngDecReadHeader(mHandle, sHandle, &info); ret = cellPngDecExtReadHeader(mHandle, sHandle, &info, &extInfo); } if(ret == CELL_OK && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; inParam.outputColorAlpha = 0xff; // ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); ret = cellPngDecExtSetParameter(mHandle, sHandle, &inParam, &outParam, &extInParam, &extoutParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = _DW * 4; // ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); ret = cellPngDecExtDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo, &pngDisp, &pngDispInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; return ok; } */ int load_jpg_texture_th(u8 *data, char *name, uint16_t _DW) { int ret, ok=-1; jpg_w=0; jpg_h=0; CellJpgDecMainHandle mHandle; CellJpgDecSubHandle sHandle; CellJpgDecInParam inParam; CellJpgDecOutParam outParam; CellJpgDecSrc src; CellJpgDecOpnInfo opnInfo; CellJpgDecInfo info; CellJpgDecDataOutInfo dOutInfo; CellJpgDecDataCtrlParam dCtrlParam; CellJpgDecThreadInParam InParam; CellJpgDecThreadOutParam OutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; float downScale; bool unsupportFlag; MallocArg.mallocCallCounts = 0; FreeArg.freeCallCounts = 0; // InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret = cellJpgDecCreate(&mHandle, &InParam, &OutParam); if(ret == CELL_OK){ src.srcSelect = CELL_JPGDEC_FILE; src.fileName = name; src.fileOffset = 0; src.fileSize = 0; src.streamPtr = NULL; src.streamSize = 0; src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; unsupportFlag = false; ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK){ ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; unsupportFlag = false; ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } } } //decoder open if(ret == CELL_OK){ if(scale_icon_h) { // if(info.imageHeight>info.imageWidth) if( ((float)info.imageHeight / (float)XMB_THUMB_HEIGHT) > ((float)info.imageWidth / (float) XMB_THUMB_WIDTH)) downScale=(float)info.imageHeight / (float)(XMB_THUMB_HEIGHT); else downScale=(float)info.imageWidth / (float) (XMB_THUMB_WIDTH); } else { if(info.imageWidth>1920 || info.imageHeight>1080){ if( ((float)info.imageWidth / 1920) > ((float)info.imageHeight / 1080 ) ){ downScale = (float)info.imageWidth / 1920; }else{ downScale = (float)info.imageHeight / 1080; } } else downScale=1.f; if(strstr(name, "/HDAVCTN/BDMT_O1.jpg")!=NULL || strstr(name, "/BDMV/META/DL/HDAVCTN_O1.jpg")!=NULL) downScale = (float) (info.imageWidth / 320); } if( downScale <= 1.f ){ inParam.downScale = 1; }else if( downScale <= 2.f ){ inParam.downScale = 2; }else if( downScale <= 4.f ){ inParam.downScale = 4; }else{ inParam.downScale = 8; } if(downScale>8.0f) { jpg_w=0; jpg_h=0; goto leave_jpg_th; } inParam.commandPtr = NULL; inParam.method = CELL_JPGDEC_FAST; inParam.outputMode = CELL_JPGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_JPG_RGBA; // if(scale_icon_h) // inParam.outputColorAlpha = 0x80; // else inParam.outputColorAlpha = 0xfe; ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); } if(ret == CELL_OK){ // if( _DW<1920 ) if(scale_icon_h && inParam.downScale) dCtrlParam.outputBytesPerLine = (int) ((info.imageWidth/inParam.downScale) * 4); else dCtrlParam.outputBytesPerLine = _DW * 4; // else // dCtrlParam.outputBytesPerLine = 1920 * 4; // memset(data, 0, sizeof(data)); ret = cellJpgDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_JPGDEC_DEC_STATUS_FINISH)) { jpg_w= outParam.outputWidth; jpg_h= outParam.outputHeight; ok=0; } } leave_jpg_th: ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecDestroy(mHandle); } //decoder create scale_icon_h=0; return ret; } int load_jpg_texture(u8 *data, char *name, uint16_t _DW) { scale_icon_h=0; while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} is_decoding_jpg=1; int ret, ok=-1; png_w=0; png_h=0; CellJpgDecMainHandle mHandle; CellJpgDecSubHandle sHandle; CellJpgDecInParam inParam; CellJpgDecOutParam outParam; CellJpgDecSrc src; CellJpgDecOpnInfo opnInfo; CellJpgDecInfo info; CellJpgDecDataOutInfo dOutInfo; CellJpgDecDataCtrlParam dCtrlParam; CellJpgDecThreadInParam InParam; CellJpgDecThreadOutParam OutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; float downScale; bool unsupportFlag; MallocArg.mallocCallCounts = 0; FreeArg.freeCallCounts = 0; // InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret = cellJpgDecCreate(&mHandle, &InParam, &OutParam); if(ret == CELL_OK){ src.srcSelect = CELL_JPGDEC_FILE; src.fileName = name; src.fileOffset = 0; src.fileSize = 0; src.streamPtr = NULL; src.streamSize = 0; src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; unsupportFlag = false; ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK){ ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; unsupportFlag = false; ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } } } //decoder open if(ret == CELL_OK){ if(scale_icon_h) { // if(info.imageHeight>info.imageWidth) if( ((float)info.imageHeight / (float)XMB_THUMB_HEIGHT) > ((float)info.imageWidth / (float) XMB_THUMB_WIDTH)) downScale=(float)info.imageHeight / (float)(XMB_THUMB_HEIGHT); else downScale=(float)info.imageWidth / (float) (XMB_THUMB_WIDTH); } else { if(info.imageWidth>1920 || info.imageHeight>1080){ if( ((float)info.imageWidth / 1920) > ((float)info.imageHeight / 1080 ) ){ downScale = (float)info.imageWidth / 1920; }else{ downScale = (float)info.imageHeight / 1080; } } else downScale=1.f; if(strstr(name, "/HDAVCTN/BDMT_O1.jpg")!=NULL || strstr(name, "/BDMV/META/DL/HDAVCTN_O1.jpg")!=NULL) downScale = (float) (info.imageWidth / 320); } if( downScale <= 1.f ){ inParam.downScale = 1; }else if( downScale <= 2.f ){ inParam.downScale = 2; }else if( downScale <= 4.f ){ inParam.downScale = 4; }else{ inParam.downScale = 8; } if(downScale>8.0f) { png_w=0; png_h=0; goto leave_jpg; } inParam.commandPtr = NULL; inParam.method = CELL_JPGDEC_FAST; inParam.outputMode = CELL_JPGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_JPG_RGBA; // if(scale_icon_h) // inParam.outputColorAlpha = 0x80; // else inParam.outputColorAlpha = 0xfe; ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); } if(ret == CELL_OK){ // if( _DW<1920 ) if(scale_icon_h && inParam.downScale) dCtrlParam.outputBytesPerLine = (int) ((info.imageWidth/inParam.downScale) * 4); else dCtrlParam.outputBytesPerLine = _DW * 4; // else // dCtrlParam.outputBytesPerLine = 1920 * 4; // memset(data, 0, sizeof(data)); ret = cellJpgDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_JPGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } leave_jpg: ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecDestroy(mHandle); } //decoder create scale_icon_h=0; is_decoding_jpg=0; return ret; } int load_png_texture_th(u8 *data, char *name)//, uint16_t _DW) { int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecOutParam outParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; int ret_png=-1; // InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w_th= png_h_th= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; // src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK) { ret = cellPngDecReadHeader(mHandle, sHandle, &info); if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; cellPngDecClose(mHandle, sHandle); ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellPngDecReadHeader(mHandle, sHandle, &info); } } if(ret == CELL_OK)// && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; // if(use_png_alpha) // inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; // else inParam.outputColorAlpha = 0xff; // inParam.outputColorAlpha = 0x00; ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = info.imageWidth * 4;//_DW * 4; ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); // sys_timer_usleep(500); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w_th= outParam.outputWidth; png_h_th= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; return ok; } int load_png_texture(u8 *data, char *name, uint16_t _DW) { while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} is_decoding_png=1; int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecOutParam outParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; int ret_png=-1; // InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w= png_h= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; // src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK) { ret = cellPngDecReadHeader(mHandle, sHandle, &info); if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; cellPngDecClose(mHandle, sHandle); ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellPngDecReadHeader(mHandle, sHandle, &info); } } if(ret == CELL_OK && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; // if(use_png_alpha) // inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; // else inParam.outputColorAlpha = 0xff; // inParam.outputColorAlpha = 0x00; ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = _DW * 4; ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); // sys_timer_usleep(500); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; is_decoding_png=0; return ok; } int load_raw_texture(u8 *data, char *name, uint16_t _DW) { FILE *fpA; uint32_t _DWO=80, _DHO=45; if(strstr(name, "_960.RAW")!=NULL) { _DWO=960; _DHO=540; } if(strstr(name, "_640.RAW")!=NULL) { _DWO=640; _DHO=360; } if(strstr(name, "_480.RAW")!=NULL) { _DWO=480; _DHO=270; } if(strstr(name, "_320.RAW")!=NULL) { _DWO=320; _DHO=180; } if(strstr(name, "_240.RAW")!=NULL) { _DWO=240; _DHO=135; } if(strstr(name, "_160.RAW")!=NULL) { _DWO=160; _DHO= 90; } if(strstr(name, "_80.RAW")!=NULL) { _DWO= 80; _DHO= 45; } fpA = fopen ( name, "rb" ); if (fpA != NULL) { fseek(fpA, 0, SEEK_SET); if(_DW!=_DWO) { unsigned char* buf = (unsigned char *) memalign(128, ((_DWO * _DHO * 4)<BUF_SIZE?(_DWO * _DHO * 4):BUF_SIZE)); if(buf) { fread(buf, (_DWO * _DHO * 4), 1, fpA); mip_texture( data, (uint8_t *)buf, _DWO, _DHO, (_DW/_DWO)); //scale to 1920x1080 free(buf); } } else fread((u8*)data, (_DWO * _DHO * 4), 1, fpA); fclose(fpA); // int blur=(_DW/_DWO)-1; // if(blur>3) blur=3; // blur_texture( data, _DW, _DHO*(_DW/_DWO), 0, 0, _DW, _DHO*(_DW/_DWO), 0, 0, 1, blur); return 1; } return 0; } int load_texture(u8 *data, char *name, uint16_t dw) { if(strstr(name, ".jpg")!=NULL || strstr(name, ".JPG")!=NULL || strstr(name, ".jpeg")!=NULL || strstr(name, ".JPEG")!=NULL) load_jpg_texture( data, name, dw); else if(strstr(name, ".png")!=NULL || strstr(name, ".PNG")!=NULL) { // if(data==text_bmp && dw==1920) // load_png_partial( data, name, dw, 18, 0); // else load_png_texture( data, name, dw); } else if(strstr(name, ".RAW")!=NULL) load_raw_texture( data, name, dw); return 0; } /****************************************************/ /* syscalls */ /****************************************************/ static void poke_sc36_path( const char *path) { if(sc36_path_patch==0 || payload!=0 || c_firmware!=3.55f || strstr(path, "/dev_bdvd")!=NULL) return; char r_path[64]; u64 p_len; u64 val0=0x0000000000000000ULL; u64 base=0x80000000002D84DEULL; u64 val=0x0000000000000000ULL; strncpy(r_path, path, 18); r_path[19]=0; u8 * p = (u8 *) r_path; p_len=strlen(r_path); if(p_len>18) p_len=18; int n=0; for(n = 0; n < 24; n += 8) { if(n==16 && p_len<=16) break; memcpy(&val, &p[n], 8); pokeq(base + (u64) n, val); if(n>15) pokeq(0x80000000002D84F0ULL, 0x7FA3EB783BE00001ULL ); __asm__("sync"); val0=peekq(0x8000000000000000ULL); } u64 val1 = 0x38A000004BD761D1ULL; u64 val2 = 0x389D00004BD76155ULL; val2 = (val2) | ( (p_len) << 32); if(strstr(path, "/app_home")!=NULL) p_len=2; val1 = (val1) | ( (p_len) << 32); pokeq(0x80000000002D8504ULL, val1 ); pokeq(0x80000000002D852CULL, val2 ); // pokeq(0x80000000003F662DULL, 0x6170705F686F6D65ULL ); // /app_home -> /app_home // pokeq(0x80000000003F662DULL, 0x6465765F62647664ULL ); // /app_home -> /dev_bdvd // pokeq(0x80000000003F672DULL, 0x6465765F62647664ULL ); // /host_root -> /dev_bdvd // pokeq(0x80000000003F6735ULL, 0x0000000000000000ULL ); // /host_root -> /dev_bdvd __asm__("sync"); val0=peekq(0x8000000000000000ULL); } void pokeq( uint64_t addr, uint64_t val) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) return; system_call_2(7, addr, val); } uint64_t peekq(uint64_t addr) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) return 0; system_call_1(6, addr); return_to_user_prog(uint64_t); } void disable_sc36() { return; if( (peekq(0x80000000002D8488ULL) == 0x3BE000017BFFF806ULL) && payloadT[0]==0x44 ) // syscall36 enabled pokeq(0x80000000002D8488ULL, 0x480000447BFFF806ULL ); // syscall36 disable! } void enable_sc36() { return; if( (peekq(0x80000000002D8488ULL) == 0x480000447BFFF806ULL) && payloadT[0]==0x44) // syscall36 disabled pokeq(0x80000000002D8488ULL, 0x3BE000017BFFF806ULL ); // syscall36 enable! } static uint32_t syscall35(const char *srcpath, const char *dstpath) { if(payload==-1) return 0; system_call_2(35, (uint32_t) srcpath, (uint32_t) dstpath); return_to_user_prog(uint32_t); } static void syscall_mount(const char *path, int mountbdvd) { if(mountbdvd==0 || payload==-1) return; if(payload!=2) { system_call_1(36, (uint32_t) path); } if(payload==2) { (void) syscall35("/dev_bdvd", path); (void) syscall35("/app_home", path); } } static void syscall_mount2(char *mountpoint, const char *path) { if(payload==-1) return; if(payload==0) { //PSGroove poke_sc36_path( (char *) mountpoint); system_call_1(36, (uint32_t) path); } if(payload==1) { //Hermes typedef struct { path_open_entry entries[2]; char arena[0x600]; } path_open_table2; syscall_mount( (char*)path, mount_bdvd); (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x200])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].compare_addr= 0ULL; // the last entry always 0 strncpy(&open_table.arena[0], mountpoint, 0x200); // compare 1 strncpy(&open_table.arena[0x200], path, 0x200); // replace 1 open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1 open_table.entries[0].replace_len= strlen(&open_table.arena[0x200]); sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table2)); (void)sys8_path_table( dest_table_addr); } if(payload==2) { //PL3 // (void)syscall35((char *)mountpoint, NULL); (void)syscall35((char *)mountpoint, (char *)path); } } static void mount_with_cache(const char *path, int _joined, u32 flags, const char *title_id) { if(payload!=1) return; // leave if payload is not Hermes if(!(flags & IS_BDMIRROR)) syscall_mount( (char*)path, mount_bdvd); (void) title_id; char s1[512]; char s2[512]; //char s1a[512]; //char s2a[512]; char s_tmp[512]; char cached_file[512]; char ext_gd_path[512]; char hdd_gd_path[512]; u8 no_gd=0; if(strstr(path, "/dev_usb")!=NULL || (flags & IS_BDMIRROR)) { if(flags & IS_BDMIRROR) {sprintf(s_tmp, "%s", "/dev_bdvd");s_tmp[9]=0;} else {strncpy(s_tmp, path, 11); s_tmp[11]=0;} if((flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); } //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else { for(int u=0;u<200;u++) { sprintf(s_tmp, "/dev_usb%03i", u); if(exist(s_tmp)) break; } if(exist(s_tmp) && (flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); fix_perm_recursive(ext_gd_path); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else no_gd=1; } //sprintf(s1a, "%s", "/dev_bdvd");s1a[9]=0; //sprintf(s2a, "%s", "/app_home");s2a[9]=0; u8 entries=0; u32 m_step=0x200; (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); for(int n=0; n<_joined; n++) { sprintf(s1, "/dev_bdvd%s", file_to_join[n].split_file); sprintf(s2, "/app_home%s", file_to_join[n].split_file); sprintf(cached_file, "%s", file_to_join[n].cached_file); //sprintf(filename, "#%i [%s]\n[%s]\n[%s]", n+1, s1, s2, cached_file); //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); strncpy(&open_table.arena[entries*m_step*2], s1, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], cached_file, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], cached_file, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } if( (flags & IS_EXTGD) && no_gd==0 ) { sprintf(hdd_gd_path, "%s", "/dev_hdd0/game");///%s", title_id); strncpy(&open_table.arena[entries*m_step*2], hdd_gd_path , m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], ext_gd_path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } /*if(!(flags & IS_BDMIRROR)) { strncpy(&open_table.arena[entries*m_step*2], s1a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } */ open_table.entries[entries].compare_addr= 0ULL; sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); (void)sys8_path_table( dest_table_addr); } static void mount_with_ext_data(const char *path, u32 flags) { if(!(flags & IS_BDMIRROR)) syscall_mount( (char*)path, mount_bdvd); if(payload!=1 || !(flags & IS_EXTGD)) return; //leave if not Hermes payload or not flagged for External Game Data //char s1a[512]; //char s2a[512]; char s_tmp[512]; char ext_gd_path[512]; char hdd_gd_path[512]; u8 no_gd=0; if(strstr(path, "/dev_usb")!=NULL || (flags & IS_BDMIRROR)) { if(flags & IS_BDMIRROR) {sprintf(s_tmp, "%s", "/dev_bdvd");s_tmp[9]=0;} else {strncpy(s_tmp, path, 11); s_tmp[11]=0;} if((flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } } else { for(int u=0;u<200;u++) { sprintf(s_tmp, "/dev_usb%03i", u); if(exist(s_tmp)) break; } if(exist(s_tmp) && (flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else no_gd=1; } //sprintf(s1a, "%s", "/dev_bdvd");s1a[9]=0; //sprintf(s2a, "%s", "/app_home");s2a[9]=0; u8 entries=0; u32 m_step=0x200; (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); if( (flags & IS_EXTGD) && no_gd==0 ) { sprintf(hdd_gd_path, "%s", "/dev_hdd0/game");///%s", title_id); strncpy(&open_table.arena[entries*m_step*2], hdd_gd_path , m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], ext_gd_path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } /*if(!(flags & IS_BDMIRROR)) { strncpy(&open_table.arena[entries*m_step*2], s1a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; }*/ open_table.entries[entries].compare_addr= 0ULL; sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); (void)sys8_path_table( dest_table_addr); } static void reset_mount_points() { if(payload==-1) return; //syscall_838("/dev_bdvd"); //syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); if(payload!=2) { //Hermes poke_sc36_path( (char *) "/app_home"); system_call_1(36, (uint32_t) "/dev_bdvd"); } if(payload==1) { //Hermes (void)sys8_path_table(0ULL); system_call_1(36, (uint32_t) "/dev_bdvd"); } if(payload==2) { //PL3 (void)syscall35((char *)"/dev_bdvd", NULL);//(char *)"/dev_bdvd" (void)syscall35((char *)"/app_home", (char *)"/dev_usb000"); } } static void mp3_callback( int nCh, void *userData, int callbackType, void *readBuffer, int readSize) { (void) nCh; (void) userData; uint64_t nRead = 0; if(force_mp3_fd==-1) callbackType=CELL_MS_CALLBACK_FINISHSTREAM; if(readSize && callbackType==CELL_MS_CALLBACK_MOREDATA) { if(CELL_FS_SUCCEEDED==cellFsRead(force_mp3_fd, (void*)readBuffer, KB(MP3_BUF), &nRead)) { if(nRead>0) { force_mp3_offset+=nRead; } else { cellFsClose(force_mp3_fd); force_mp3_fd=-1; memset(readBuffer, 0, KB(MP3_BUF)); } } else { cellFsClose(force_mp3_fd); force_mp3_fd=-1; goto try_next_mp3; } //(int) (((float)KB(MP3_BUF)/(float)mp3_packet) * mp3_packet_time * 1000000.f)); goto try_next_mp3;} } if(callbackType==CELL_MS_CALLBACK_FINISHSTREAM || callbackType==CELL_MS_CALLBACK_CLOSESTREAM) { try_next_mp3: update_ms=false; force_mp3_offset=0; if(max_mp3!=0) { current_mp3++; if(current_mp3>max_mp3) current_mp3=1; main_mp3((char*) mp3_playlist[current_mp3].path); xmb_info_drawn=0; } if(!mm_audio) {stop_audio(0); current_mp3=0; max_mp3=0; xmb_info_drawn=0;} } //sprintf(www_info, "[%s]: %.f / %.f (req'd: %i, read: %i)", force_mp3_file, (double)force_mp3_offset, (double)force_mp3_size, readSize, nRead); } static void unknown_mimetype_callback(const char* mimetype, const char* url, void* usrdata) { // sprintf(www_info, "%s(): mimetype:%s url:%s userdata:0x%p\n", __FUNCTION__, mimetype, url, usrdata); (void) mimetype; (void) usrdata; char local_file_d[512], tempfileD[512]; tempfileD[0]=0; sprintf(local_file_d, "%s/DOWNLOADS", app_usrdir); if(exist(download_dir) || strstr(download_dir, "/dev_")!=NULL) sprintf(local_file_d, "%s", download_dir); mkdir(local_file_d, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(local_file_d, 0777); sprintf(tempfileD, "%s", url); char *pathpos=strrchr(tempfileD, '/'); if(exist(download_dir)) sprintf(local_file_d, "%s/%s", download_dir, (pathpos+1)); else sprintf(local_file_d, "%s/DOWNLOADS/%s", app_usrdir, (pathpos+1)); download_file( url, (char *) local_file_d, 3); } DECL_WEBBROWSER_SYSTEM_CALLBACK(system_callback, cb_type, userdata) { (void)userdata; switch (cb_type) { case CELL_SYSUTIL_WEBBROWSER_UNLOADING_FINISHED: www_running = 0; dialog_ret=3; cellWebBrowserShutdown(); //case CELL_SYSUTIL_WEBBROWSER_RELEASED: case CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED: www_running = 0; dialog_ret=3; sys_memory_container_destroy( memory_container_web ); break; case CELL_SYSUTIL_REQUEST_EXITGAME: unload_modules(); sys_process_exit(1); break; default: break; } } static void sysutil_callback( uint64_t status, uint64_t param, void * userdata ) { (void)param; (void)userdata; int ret=0; switch(status) { case CELL_SYSUTIL_REQUEST_EXITGAME: unload_modules(); sys_process_exit(1); break; case CELL_SYSUTIL_OSKDIALOG_LOADED: break; case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED: osk_dialog=-1; enteredCounter=0; osk_open=0; ret = cellOskDialogAbort(); ret = cellOskDialogUnloadAsync(&OutputInfo); break; case CELL_SYSUTIL_OSKDIALOG_FINISHED: if(osk_dialog!=-1) osk_dialog=1; ret = cellOskDialogUnloadAsync(&OutputInfo); break; case CELL_SYSUTIL_OSKDIALOG_UNLOADED: break; case CELL_SYSUTIL_DRAWING_BEGIN: case CELL_SYSUTIL_DRAWING_END: break; case CELL_SYSUTIL_BGMPLAYBACK_PLAY: update_ms=false; mm_audio=false; break; case CELL_SYSUTIL_BGMPLAYBACK_STOP: mm_audio=true; update_ms=true; case CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED: ret = cellOskDialogGetInputText( &OutputInfo ); break; case CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED: if(param == CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD ){ // ret = cellOskDialogSetDeviceMask( CELL_OSKDIALOG_DEVICE_MASK_PAD ); } break; default: break; } } void draw_box( uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, uint32_t border_color) { int line = 1920 * 4; uint32_t pos_to_border = ( y * line) + (x * 4), cline=0; uint32_t lines=0; unsigned char* bt; for(lines=0; lines<(height); lines++) { for(cline=0; cline<(width*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } void put_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; unsigned char* bt; if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { memcpy(buffer_to + pos_to, buffer_from + pos_from, width * 4); pos_from+=row; pos_to+=line; } } void put_texture_with_alpha( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > 1920) width=(1920-x); if( (y+height) > 1080) height=(1080-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_A = (c_pixel ) & 0xff; if(c_pixel_N_A) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; c_pixel_N_R = (int)(buffer_from[pos_from + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_from[pos_from + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_from[pos_from + cline + 2] * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1) + c_pixel_N_B; //keep the higher alpha *(uint32_t*)bt = ((buffer_to[pos_to + cline + 3]>(c_pixel_N_A) ? buffer_to[pos_to + cline + 3] : (c_pixel_N_A) )) | (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8); } } pos_from+=row; pos_to+=line; } } void put_texture_with_alpha_gen( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, u16 to_width, int x, int y) { int row = from_width * 4; int line = to_width * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > to_width) width=(to_width-x); for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_A = (c_pixel ) & 0xff; if(c_pixel_N_A) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; c_pixel_N_R = (int)(buffer_from[pos_from + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_from[pos_from + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_from[pos_from + cline + 2] * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1) + c_pixel_N_B; //keep the higher alpha *(uint32_t*)bt = ((buffer_to[pos_to + cline + 3]>(c_pixel_N_A) ? buffer_to[pos_to + cline + 3] : (c_pixel_N_A) )) | (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8); } } pos_from+=row; pos_to+=line; } } void put_texture_VM_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = V_WIDTH * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width-1; uint32_t height=_height-1; unsigned char* bt; unsigned char* btF; if( (x+width) > Twidth) width=(Twidth-x); if( (y+height) > Theight) height=(Theight-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_R = (c_pixel>>24) & 0xff; c_pixel_N_G = (c_pixel>>16) & 0xff; c_pixel_N_B = (c_pixel>>8) & 0xff; c_pixel_N_A = 255-c_pixel_N_G; if(c_pixel_N_B==0 && c_pixel_N_R==0) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; //c_pixel_N_R = (int)(0x0 * d_alpha); //c_pixel_N_G = (int)(0x0 * d_alpha); //c_pixel_N_B = (int)(0x0 * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 1] * d_alpha1);// + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 2] * d_alpha1);// + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 3] * d_alpha1);// + c_pixel_N_B; *(uint32_t*)bt = 0xff000000 | (c_pixelR<<16) | (c_pixelG<<8) | c_pixelB; } else { *(uint32_t*)bt = 0xff000000 | (c_pixel>>8);// | (c_pixel_N_R<<16) | (c_pixel_N_G<<8) | c_pixel_N_B; } } pos_from+=row; pos_to+=line; } } void draw_mouse_pointer(int m_type) { (void) m_type; put_texture_VM_Galpha( (uint8_t*)(color_base_addr)+video_buffer*frame_index, V_WIDTH, V_HEIGHT, mouse, mp_WIDTH, mp_HEIGHT, mp_WIDTH, (int)(mouseX*(float)V_WIDTH*(1.f-overscan)+overscan*(float)V_WIDTH*0.5f), (int)(mouseY*(float)V_HEIGHT*(1.f-overscan)+overscan*(float)V_HEIGHT*0.5f), 0, 0); } void put_texture_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = Twidth * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > Twidth) width=(Twidth-x); if( (y+height) > Theight) height=(Theight-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_R = (c_pixel>>24) & 0xff; c_pixel_N_G = (c_pixel>>16) & 0xff; c_pixel_N_B = (c_pixel>>8) & 0xff; c_pixel_N_A = 255-c_pixel_N_G; if(c_pixel_N_B==0 && c_pixel_N_R==0) { // if(c_pixel_N_G) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; //c_pixel_N_R = (int)(0x0 * d_alpha); //c_pixel_N_G = (int)(0x0 * d_alpha); //c_pixel_N_B = (int)(0x0 * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1);// + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1);// + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1);// + c_pixel_N_B; *(uint32_t*)bt = (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8) | (c_pixel & 0xff) ; } } else { *(uint32_t*)bt = (c_pixel);// | 0xff);// | (c_pixel_N_R<<16) | (c_pixel_N_G<<8) | c_pixel_N_B; } } pos_from+=row; pos_to+=line; } } void put_reflection( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint32_t _width, uint32_t _height, int x, int y, int dx, int dy, int factor) { int row = Twidth * 4; int line = Twidth * 4; uint32_t pos_to = ( (dy + (_height/factor)) * line) + (dx * 4), cline=0; uint32_t pos_from = ( y * line) + (x * 4); uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; float c_pixel_N_RF, c_pixel_N_GF, c_pixel_N_BF; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (dx+width) > Twidth) width=(Twidth-dx); if( (dy+height/factor) > Theight) height=(Theight-dy); for(lines=0; lines<height; lines+=factor) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_to) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_RF = ( (c_pixel>>24) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_GF = ( (c_pixel>>16) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_BF = ( (c_pixel>>8) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_A = (uint32_t) ( (255.0f - ( 255.0f * ( (float)(lines/(float)height)) )) ); float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = (1.0f-d_alpha)/2.0f; d_alpha= 1.0f - d_alpha1; c_pixel_N_R = (int)(buffer_to[pos_to + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_to[pos_to + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_to[pos_to + cline + 2] * d_alpha); c_pixelR = (int)(c_pixel_N_RF * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(c_pixel_N_GF * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(c_pixel_N_BF * d_alpha1) + c_pixel_N_B; *(uint32_t*)bt = (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8) | (0xff) ; } pos_from+=(row*factor); pos_to-=line; } } /* void alter_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int x, int y, int border, uint32_t border_color) { int row = 320 * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint16_t c_pixel, c_pixelR, c_pixelG, c_pixelB, c_pixelR_AVG, c_pixelG_AVG, c_pixelB_AVG, c_BRI; c_BRI=0; //brightness decrease int use_grayscale=0; int use_blur=0; if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { memset(buffer_to + pos_to_border + cline + 0, (border_color>> 8) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 1, (border_color>>16) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 2, (border_color>>24) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 3, (border_color ) & 0xff, 1); } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { if(!use_blur && !use_grayscale) memcpy(buffer_to + pos_to, buffer_from + pos_from, width * 4); else for(cline=0; cline<(width*4); cline+=4) { if(use_blur) { // box blur if(lines>0 && cline>0 && lines<(height-1) && cline<((width-1)*4)) { c_pixelB = buffer_from[pos_from + cline + 0 + 4]; c_pixelG = buffer_from[pos_from + cline + 1 + 4]; c_pixelR = buffer_from[pos_from + cline + 2 + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - row]; c_pixelG+= buffer_from[pos_from + cline + 1 - row]; c_pixelR+= buffer_from[pos_from + cline + 2 - row]; c_pixelB+= buffer_from[pos_from + cline + 0 + row]; c_pixelG+= buffer_from[pos_from + cline + 1 + row]; c_pixelR+= buffer_from[pos_from + cline + 2 + row]; c_pixelB+= buffer_from[pos_from + cline + 0 - row - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - row - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - row - 4]; c_pixelB+= buffer_from[pos_from + cline + 0 + row + 4]; c_pixelG+= buffer_from[pos_from + cline + 1 + row + 4]; c_pixelR+= buffer_from[pos_from + cline + 2 + row + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - row + 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - row + 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - row + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 + row - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 + row - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 + row - 4]; // average values c_pixelB_AVG=((uint8_t) (c_pixelB/8)); c_pixelG_AVG=((uint8_t) (c_pixelG/8)); c_pixelR_AVG=((uint8_t) (c_pixelR/8)); if(c_BRI>0) { if(c_pixelB_AVG>c_BRI) c_pixelB_AVG-=c_BRI; else c_pixelB_AVG=0; if(c_pixelG_AVG>c_BRI) c_pixelG_AVG-=c_BRI; else c_pixelG_AVG=0; if(c_pixelR_AVG>c_BRI) c_pixelR_AVG-=c_BRI; else c_pixelR_AVG=0; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { memset(buffer_to + pos_to + cline + 0, c_pixelB_AVG, 1); memset(buffer_to + pos_to + cline + 1, c_pixelG_AVG, 1); memset(buffer_to + pos_to + cline + 2, c_pixelR_AVG, 1); } } else { // convert to grayscale only c_pixel = buffer_from[pos_from + cline + 0]; c_pixel+= buffer_from[pos_from + cline + 1]; c_pixel+= buffer_from[pos_from + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } } //use blur else { // convert to grayscale only c_pixel = buffer_from[pos_from + cline + 0]; c_pixel+= buffer_from[pos_from + cline + 1]; c_pixel+= buffer_from[pos_from + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } // keep alpha memset(buffer_to + pos_to + cline + 3, buffer_from[pos_from + cline + 3], 1); } pos_from+=row; pos_to+=line; } } */ void gray_texture( uint8_t *buffer_to, uint32_t width, uint32_t height, int step) { if(gray_poster==0) return; uint32_t cline=0; uint16_t c_pixel; int line=0; (void) step; (void) line; for(cline=0; cline<(width*height*4); cline+=4) { /*if(step){ line++; if(line>=width) { line=0; memset(buffer_to + cline, 0, width*4); cline+=width*4; continue; } }*/ c_pixel = buffer_to[cline]; c_pixel+= buffer_to[cline + 1]; c_pixel+= buffer_to[cline + 2]; memset(buffer_to + cline, (uint8_t) (c_pixel/3), 3); } } /* void to_565_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; uint8_t c_pixelR, c_pixelG, c_pixelB, c_pixel1, c_pixel2; for(cline=0; cline<(width*height*4); cline+=4) { c_pixelR = buffer_from[cline]; c_pixelG = buffer_from[cline + 1]; c_pixelB = buffer_from[cline + 2]; c_pixel1 = (c_pixelR & 0xF8) | ( (c_pixelG & 0xE0) >> 5); c_pixel2 = ( (c_pixelG & 0x1C) << 3) | (c_pixelB >> 3); memset(buffer_to + pos_to, c_pixel1, 1); memset(buffer_to + pos_to+1, c_pixel2, 1); pos_to+=2; } } void to_RGB_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; uint8_t c_pixelR, c_pixelG, c_pixelB, c_pixel1, c_pixel2; for(cline=0; cline<(width*height*2); cline+=2) { c_pixel1 = buffer_from[cline]; c_pixel2 = buffer_from[cline + 1]; c_pixelR = (c_pixel1 & 0xF8); c_pixelG = ( (c_pixel1 & 0x7) << 5) | ((c_pixel2 & 0xE0)>>5); c_pixelB = (c_pixel2 & 0x1f)<<3; memset(buffer_to + pos_to, c_pixelR, 1); memset(buffer_to + pos_to+1, c_pixelG, 1); memset(buffer_to + pos_to+2, c_pixelB, 1); memset(buffer_to + pos_to+3, 0xff, 1); pos_to+=4; } } void to_333_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; for(cline=0; cline<(width*height*4); cline+=4) { memcpy(buffer_to + pos_to, buffer_from + cline, 3); // memcpy(buffer_to + pos_to, buffer_to + cline, 3); pos_to+=3; } } void to_RGB3_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0; for(cline=0; cline<(width*height*3); cline+=3) { memcpy(buffer_to + pos_to, buffer_from + cline, 3); memset(buffer_to + pos_to + 3, 0xff, 1); pos_to+=4; } } */ void mip_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int scaleF) { uint32_t pos_to = 0, pos_from = 0, cline=0, scale, cscale; uint32_t lines=0; if(scaleF<0) { scale=(-1)*scaleF; for(lines=0; lines<height; lines+=scale) { pos_from = lines * width * 4; for(cline=0; cline<(width*4); cline+=(4*scale)) { memcpy(buffer_to + pos_to, buffer_from + pos_from + cline, 4); pos_to+=4; } } } else { scale=scaleF; for(lines=0; lines<height; lines++) { pos_from = lines * width * 4; for(cline=0; cline<(width*4); cline+=4) { for(cscale=0; cscale<scale; cscale++) { memcpy(buffer_to + pos_to, buffer_from + pos_from + cline, 4); pos_to+=4; } } for(cscale=0; cscale<(scale-1); cscale++) { memcpy(buffer_to + pos_to, buffer_to + pos_to - width * scale * 4, width * scale * 4); pos_to+=width * scale * 4; } } } } void blur_texture(uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, int wx, int wy, uint32_t c_BRI, int use_grayscale, int iterations, int p_range) { int p_step = 4 * p_range; int row = width * p_step; int line = width * 4; uint32_t pos_to=0; int lines=0, cline=0, iter=0; (void) height; uint32_t c_pixel, c_pixelR, c_pixelG, c_pixelB, c_pixelR_AVG, c_pixelG_AVG, c_pixelB_AVG; int use_blur=1; if(iterations==0) {use_blur=0; iterations=1;} for(iter=0; iter<iterations; iter++) { pos_to = ( y * line) + (x * 4); for(lines=0; lines<wy; lines++) { for(cline=0; cline<(wx*4); cline+=4) { if(lines>=p_range && cline>=p_range && lines<(wy-p_range) && cline<((wx-p_range)*4)) { /* bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = (*(uint32_t*)(bt + p_step))>>8; c_pixelB = (c_pixel>>16)&0xff; c_pixelG = (c_pixel>> 8)&0xff; c_pixelR = c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row + p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row + p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; // *(uint32_t*)bt = c_pixel; */ if(use_blur) { // box blur // get RGB values for all surrounding pixels // to create average for blurring c_pixelB = buffer_to[pos_to + cline + 0 + p_step]; c_pixelG = buffer_to[pos_to + cline + 1 + p_step]; c_pixelR = buffer_to[pos_to + cline + 2 + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - row]; c_pixelG+= buffer_to[pos_to + cline + 1 - row]; c_pixelR+= buffer_to[pos_to + cline + 2 - row]; c_pixelB+= buffer_to[pos_to + cline + 0 + row]; c_pixelG+= buffer_to[pos_to + cline + 1 + row]; c_pixelR+= buffer_to[pos_to + cline + 2 + row]; c_pixelB+= buffer_to[pos_to + cline + 0 - row - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - row - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - row - p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 + row + p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 + row + p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 + row + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - row + p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - row + p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - row + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 + row - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 + row - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 + row - p_step]; // average values c_pixelB_AVG=((uint8_t) (c_pixelB/8)); c_pixelG_AVG=((uint8_t) (c_pixelG/8)); c_pixelR_AVG=((uint8_t) (c_pixelR/8)); } else //no blur { c_pixelB_AVG = buffer_to[pos_to + cline + 0]; c_pixelG_AVG = buffer_to[pos_to + cline + 1]; c_pixelR_AVG = buffer_to[pos_to + cline + 2]; } /* if(c_BRI>0 && c_BRI<100) // decrease brightness { if(c_pixelB_AVG>c_BRI) c_pixelB_AVG-=c_BRI; else c_pixelB_AVG=0; if(c_pixelG_AVG>c_BRI) c_pixelG_AVG-=c_BRI; else c_pixelG_AVG=0; if(c_pixelR_AVG>c_BRI) c_pixelR_AVG-=c_BRI; else c_pixelR_AVG=0; }*/ if(c_BRI>0) // increase brightnes by percent (101+=1%+) { c_pixelB_AVG=(uint32_t) (c_pixelB_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelB_AVG>0xff) c_pixelB_AVG=0xff; c_pixelG_AVG=(uint32_t) (c_pixelG_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelG_AVG>0xff) c_pixelG_AVG=0xff; c_pixelR_AVG=(uint32_t) (c_pixelR_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelR_AVG>0xff) c_pixelR_AVG=0xff; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { buffer_to[pos_to + cline ]= c_pixelB_AVG; buffer_to[pos_to + cline + 1]= c_pixelG_AVG; buffer_to[pos_to + cline + 2]= c_pixelR_AVG; } } else { c_pixelB_AVG = buffer_to[pos_to + cline + 0]; c_pixelG_AVG = buffer_to[pos_to + cline + 1]; c_pixelR_AVG = buffer_to[pos_to + cline + 2]; if(c_BRI>0) // increase brightnes by percent (101+=1%+) { c_pixelB_AVG=(uint32_t) (c_pixelB_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelB_AVG>0xff) c_pixelB_AVG=0xff; c_pixelG_AVG=(uint32_t) (c_pixelG_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelG_AVG>0xff) c_pixelG_AVG=0xff; c_pixelR_AVG=(uint32_t) (c_pixelR_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelR_AVG>0xff) c_pixelR_AVG=0xff; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { buffer_to[pos_to + cline ]= c_pixelB_AVG; buffer_to[pos_to + cline + 1]= c_pixelG_AVG; buffer_to[pos_to + cline + 2]= c_pixelR_AVG; } } if(use_grayscale && !use_blur) { // convert to grayscale only c_pixel = buffer_to[pos_to + cline + 0]; c_pixel+= buffer_to[pos_to + cline + 1]; c_pixel+= buffer_to[pos_to + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline, (uint8_t) (c_pixel/3), 3); } // keep alpha // memset(buffer_to + pos_to + cline + 3, buffer_to[pos_to + cline + 3], 1); //if(sub_menu_open) //buffer_to[pos_to + cline + 3] = 0x80; } pos_to+=line; } }//iterations } void draw_list_text( uint8_t *buffer, uint32_t width, uint32_t height, t_menu_list *menu, int menu_size, int selected, int _dir_mode, int _display_mode, int _cover_mode, int opaq, int to_draw ) { //uint8_t *buffer = NULL; //buffer=(uint8_t*)(color_base_addr)+video_buffer*frame_index; if(to_draw && (_cover_mode==0)) memset(buffer, 0x00, FB(1)); float y = 0.1f, yb; int i = 0, c=0; char str[256]; char ansi[256]; char is_split[8]; float len=0; u32 color, color2; game_sel_last+=0; int flagb= selected & 0x10000; int max_entries=14; yb=y; selected&= 0xffff; if(!to_draw) { while( (c<max_entries && i < menu_size) ) { if( (_display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (_display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { { len=1.18f; if(i==selected){ u32 b_color=0x0080ffd0; b_box_opaq+=b_box_step; if(_cover_mode==2){ if(b_box_opaq>0xfb) b_box_step=-4; if(b_box_opaq<0x20) b_box_step= 8; } else{ if(b_box_opaq>0xc0) b_box_step=-2; if(b_box_opaq<0x30) b_box_step= 1; } b_color = (b_color & 0xffffff00) | (b_box_opaq-20); if(_cover_mode==2) { draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.006f, -0.5f, b_color); b_color = (b_color & 0xffffff00) | b_box_opaq; draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y-0.038)*2.0f , len+0.04f, 0.006f, -0.5f, b_color); } else draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.1f, 0.0f, b_color); break; } y += 0.05f; c++; } } i++; } // bottom device icon if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( buffer, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0x0080ff80); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( buffer, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( buffer, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } return; } CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; int ret; int i_offset=0; surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, width*4, 4, width, height ); if(_cover_mode==2 || _cover_mode==0) cellFontRenderSurfaceSetScissor( surf, 0, 0, (int)(0.62f*width)+(int)((0.05f)*width), height ); else cellFontRenderSurfaceSetScissor( surf, 0, 0, width, height ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; /* if(user_font==0) fn = FONT_USER_FONT0; if(user_font==5) fn = FONT_SYSTEM_5; if(user_font==6) fn = FONT_SYSTEM_6; if(user_font==7) fn = FONT_SYSTEM_7; if(user_font==8) fn = FONT_SYSTEM_8; if(user_font==9) fn = FONT_SYSTEM_9; */ // fn = FONT_SYSTEM_GOTHIC_LATIN; // fn = FONT_SYSTEM_SANS_SERIF; // fn = FONT_SYSTEM_SERIF; // fn = FONT_USER_FONT0; ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float weight = 1.04f; static float slant = 0.08f; float scale; float step; float lineH, baseY; step = 0.f; scale = 24.f; ret = Fonts_SetFontScale( cf, scale ); ret = Fonts_SetFontEffectWeight( cf, weight ); ret = Fonts_SetFontEffectSlant( cf, slant ); ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); Fonts_BindRenderer( cf, renderer ); int it; for(it=0;it<2;it++) { y=yb; i = 0; c=0; while( (c<max_entries && i < menu_size) ) { if( (_display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (_display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { int grey=0; is_split[0]=0; if(i<menu_size) { grey=0; if(menu[i].title[0]=='_') { sprintf(ansi, "%s", menu[i].title+1); grey=1; sprintf(is_split, " (Split)");} else sprintf(ansi, "%s", menu[i].title); if(_dir_mode==0 && (_cover_mode==0 || _cover_mode==2)) { ansi[64]=0; } if(_dir_mode!=0 && (_cover_mode==0 || _cover_mode==2)) { ansi[64]=0; } if(_dir_mode==0 && _cover_mode==3) { ansi[47]=0; } if(_dir_mode!=0 && _cover_mode==3) { ansi[62]=0; } if( (_cover_mode==1 || _cover_mode==4 || _cover_mode==7)) { ansi[128]=0; } sprintf(str, "%s%s", ansi, is_split ); } else { sprintf(str, " "); } // color= 0xffffffff; if(i==selected) color= (flagb && i==0) ? COL_PS3DISCSEL : ((grey==0) ? COL_SEL : 0xff008080); else { color= (flagb && i==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT);// 0xd0ffffff if(strstr(menu[i].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[i].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[i].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[i].content,"DVD")!=NULL) color=COL_DVD; } // color2=( (color & 0x00ffffff) | (opaq<<24)); color2=color; // color= opaq<<16 | opaq<<8 | opaq; if(i==selected) color2 = 0xffffffff;// else color2 = 0x17e8e8e8; // color2 = 0x00fefefe; // if(i!=selected && _cover_mode==0) color2 = 0x17e8e8e8; // color = (color & 0x00ffffff) | (((color>>24)/2)<<24); color = 0xff101010; ret = Fonts_SetFontEffectSlant( cf, 0.1f ); if(strstr(menu[i].content, "PS3")!=NULL) i_offset=100; else i_offset=0; if(_dir_mode!=0) { len=0.023f*(float)(strlen(str)+2); { if(_dir_mode==1) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+1+i_offset, (int)((y-0.005f)*1080)+1, (uint8_t*) str, scale*1.1f, scale, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y-0.005f)*1080), (uint8_t*) str, scale*1.1f, scale, slant, step, color2 ); } else { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+2+i_offset, (int)((y+0.001f)*1080)+2, (uint8_t*) str, scale*1.3f, scale, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y+0.001f)*1080), (uint8_t*) str, scale*1.3f, scale, slant, step, color2 ); } } } else { len=0.03f*(float)(strlen(str)); if(opaq>0x020 || i==selected) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+2+i_offset, (int)((y-0.005f)*1080)+2, (uint8_t*) str, scale*1.5f, scale*1.4f, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y-0.005f)*1080), (uint8_t*) str, scale*1.5f, scale*1.4f, slant, step, color2 ); } } if(strlen(str)>1 && _dir_mode==1) { sprintf(str, "%s", menu[i].path); if(strstr(menu[i].content,"AVCHD")!=NULL || strstr(menu[i].content,"BDMV")!=NULL) sprintf(str, "(%s) %s", menu[i].entry, menu[i].details); str[102]=0; if(0.01125f*(float)(strlen(str))>len) len=0.01125f*(float)(strlen(str)); if(opaq>0x020 || i==selected) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+1+i_offset, (int)((y+0.022f)*1080)+1, (uint8_t*) str, scale/1.4f, scale/2.0f, 0.0f, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y+0.022f)*1080), (uint8_t*) str, scale/1.4f, scale/2.0f, 0.0f, step, color2 ); } } if((_cover_mode==0 || it==1) && strstr(menu[i].content, "PS3")!=NULL && strstr(menu[i].title_id, "NO_ID")==NULL) { sprintf(str, "%s/%s_80.RAW", cache_dir, menu[i].title_id); if(load_raw_texture( (u8*)text_TEMP, str, 80)) put_texture( buffer, (u8*)text_TEMP, 80, 45, 80, (int)((0.08f)*1920), (int)((y-0.005f)*1080), 1, 0x80808080); } len=1.18f; y += 0.05f; c++; } i++; } if(_cover_mode==0) break; if((_cover_mode==2 && it==0)) { if(menu[selected].title[0]=='_' || menu_list[selected].split) { gray_texture(buffer, 1920, 1080, 1); blur_texture(buffer, 1920, 1080, (int)((0.05f)*1920), (int) ((0.1f-0.025f)*1080), 1250, (int)((0.05f*max_entries+0.025f)*1080), 55, 0, 0, 2); } else blur_texture(buffer, 1920, 1080, (int)((0.05f)*1920), (int) ((0.1f-0.025f)*1080), 1250, (int)((0.05f*max_entries+0.025f)*1080), 60, 0, 0, 2); // int it; // for(it=3;it<21;it+=3) // blur_texture(buffer, 1920, 1080, (int)((0.05f+_overscan)*1920)+it, (int) ((_overscan+0.1f-0.025f)*1080)+it, 1250-(it*2), (int)((0.05f*max_entries+0.025f)*1080)-(it*2), 1, 0, 1); // for(it=3;it<12;it+=3) // it=12; // blur_texture(buffer, 1920, 1080, (int)((0.05f+_overscan)*1920)+it, (int) ((_overscan+0.1f-0.025f)*1080)+it, 1250-(it*2), (int)((0.05f*max_entries+0.025f)*1080)-(it*2), 1, 0, 1); } /* ClearSurface(); set_texture( buffer, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); */ } if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( buffer, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0x0080ff80); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( buffer, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( buffer, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } Fonts_UnbindRenderer( cf ); Fonts_DetachFont( cf ); } } //FONTS void put_label(uint8_t *buffer, uint32_t width, uint32_t height, char *str1p, char *str2p, char *str3p, uint32_t color) //uint8_t *texture, { if(game_details==3) return; CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, width*4, 4, width, height ); cellFontRenderSurfaceSetScissor( surf, 0, 0, width, height ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; int ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float textScale = 1.00f; static float weight = 1.04f; static float slant = 0.00f; float surfW = (float)width; float surfH = (float)height; float textX, textW = surfW; float textY, textH = surfW; float scale; float step; float lineH, baseY; uint8_t* utf8Str0 = (uint8_t*) str1p; uint8_t* utf8Str1 = (uint8_t*) str2p; uint8_t* utf8Str2 = (uint8_t*) str3p; float x, y, x2, x3; float w1,w2,w3; float w; if(str1p[0]=='_') utf8Str0++; step = 0.f; scale=28.f; textX = 0.5f * ( surfW - surfW * textScale ); textY = 0.03f * ( surfH - surfH * textScale ); textW = surfW * textScale; textH = surfH * textScale; ret = Fonts_SetFontScale( cf, scale ); if ( ret == CELL_OK ) { ret = Fonts_SetFontEffectWeight( cf, weight ); } if ( ret == CELL_OK ) { ret = Fonts_SetFontEffectSlant( cf, slant ); } ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); if ( ret == CELL_OK ) { w1 = Fonts_GetPropTextWidth( cf, utf8Str0, scale, scale, slant, step, NULL, NULL )*1.2f; w2 = Fonts_GetPropTextWidth( cf, utf8Str1, scale, scale, slant, step, NULL, NULL )*0.8f; w3 = Fonts_GetPropTextWidth( cf, utf8Str2, scale, scale, slant, step, NULL, NULL )*0.8f; w = (( w1 > w2 )? w1:w2); if ( w > textW ) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, textW, &ratio ); w1 *= ratio; w2 *= ratio; w3 *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } Fonts_BindRenderer( cf, renderer ); x = 0.5f*(textW-w1);//+mouseXP; //textX-0.7f;// x2 = 0.5f*(textW-w2);//+mouseXP; //textX-0.7f;// x3 = 0.5f*(textW-w3);//+mouseXP; //textX-0.7f;// y=legend_y;//+mouseYP; if(game_details!=3) { if(game_details==0) y+=25; if(game_details==1) y+=12; Fonts_RenderPropText( cf, surf, x+1, y+1, utf8Str0, scale*1.2, scale, slant, step, 0xf0101010 );//f01010e0 //0xff404040 blur_texture(buffer, 1920, (int)(lineH+5), (int)x-2, (int)y-2, (int)(w1+15), (int)lineH+5, 0, 0, 3, 1); Fonts_RenderPropText( cf, surf, x, y, utf8Str0, scale*1.2f, scale, slant, step, color );//(color & 0x00ffffff) if(game_details>0) { Fonts_RenderPropText( cf, surf, x3+1, y+42, utf8Str2, scale*0.8f, scale*0.57f, slant, step, 0xff101010); blur_texture(buffer, 1920, (int)(lineH*0.8+5), (int)x3-2, (int)y+40, (int)w3+15, (int)(lineH*0.57+5), 0, 0, 1, 1); Fonts_RenderPropText( cf, surf, x3, y+41, utf8Str2, scale*0.8f, scale*0.57f, slant, step, 0xffd0d0ff ); } if(game_details>1) { Fonts_RenderPropText( cf, surf, x2+1, y+68, utf8Str1, scale*0.8f, scale*0.8f, slant, step, 0xff101010); blur_texture(buffer, 1920, (int)(lineH*0.8+5), (int)x2-2, (int)y+65, (int)w2+15, (int)(lineH*0.8+5), 0, 0, 1, 1); Fonts_RenderPropText( cf, surf, x2, y+67, utf8Str1, scale*0.8f, scale*0.8f, slant, step, 0xc000ffff ); } } Fonts_UnbindRenderer( cf ); } Fonts_DetachFont( cf ); } } void print_label(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = 1.0f; ttf_label[max_ttf_label].vscale = 1.0f; ttf_label[max_ttf_label].centered = 0; ttf_label[max_ttf_label].cut = 0.0f; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void print_label_width(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont, float cut) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = 1.0f; ttf_label[max_ttf_label].vscale = 1.0f; ttf_label[max_ttf_label].centered = 0; ttf_label[max_ttf_label].cut = cut; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont, float hscale, float vscale, int centered) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = hscale; ttf_label[max_ttf_label].vscale = vscale; ttf_label[max_ttf_label].centered = centered; ttf_label[max_ttf_label].cut = 0.0f; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT) { if(!max_ttf_label) return; uint32_t color; CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; // uint8_t *buffer = NULL; // buffer=(uint8_t*)(color_base_addr)+video_buffer*(c_frame_index); surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, _V_WIDTH*4, 4, _V_WIDTH, _V_HEIGHT ); cellFontRenderSurfaceSetScissor( surf, 0, 0, _V_WIDTH, _V_HEIGHT ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; int ret; if(ttf_label[0].font!=0) fn=ttf_label[0].font; ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float textScale = 1.00f; static float weight = 1.00f; static float slant = 0.00f; float surfW = (float)_V_WIDTH; float surfH = (float)_V_HEIGHT; float textW;// = surfW; float textH;// = surfH; float step = 0.f; float lineH, baseY; float w; textW = surfW * textScale; textH = surfH * textScale; uint8_t* utf8Str0; float scale, scaley, x, y; int cl=0; for(cl=0; cl<max_ttf_label; cl++) { weight = ttf_label[cl].weight; scale = 30.0f * ttf_label[cl].scale * ((float)_V_WIDTH/1920.0f) * ttf_label[cl].hscale; scaley = 29.0f * ttf_label[cl].scale * ((float)_V_HEIGHT/1080.0f) * ttf_label[cl].vscale; slant = ttf_label[cl].slant; ret = Fonts_SetFontScale( cf, scale ); if ( ret == CELL_OK ) ret = Fonts_SetFontEffectWeight( cf, weight ); if ( ret == CELL_OK ) ret = Fonts_SetFontEffectSlant( cf, slant ); ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); utf8Str0 = (uint8_t*) ttf_label[cl].label; x = ttf_label[cl].x; y = ttf_label[cl].y; color = ttf_label[cl].color; //0x80ffffff;// if ( ret == CELL_OK ) { w = Fonts_GetPropTextWidth( cf, utf8Str0, scale, scaley, slant, step, NULL, NULL ); if ( (w+x+16.f) > textW && ttf_label[cl].cut==0.0f ) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, textW-x-16.f, &ratio ); w *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } else if ( ttf_label[cl].cut>0.0f && w>((int)(ttf_label[cl].cut*(float)V_WIDTH))) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, ((int)(ttf_label[cl].cut*(float)V_WIDTH)), &ratio ); w *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } if(ttf_label[cl].centered==1) x=(ttf_label[cl].x - (w/2.0f)/(float)_V_WIDTH); else if(ttf_label[cl].centered==2) x=(ttf_label[cl].x - (w)/(float)_V_WIDTH); //right justified if(cl==0) Fonts_BindRenderer( cf, renderer ); if(cover_mode!=8 && cover_mode!=5) Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH)+1, (int)(y *(float)_V_HEIGHT)+1, utf8Str0, scale, scaley, slant, step, 0xff000000 ); if(cover_mode==8) Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH)+2, (int)(y *(float)_V_HEIGHT)+2, utf8Str0, scale, scaley, slant, step, 0x10101010 ); // && cover_mode!=8 Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH), (int)(y*(float)_V_HEIGHT), utf8Str0, scale, scaley, slant, step, color );//(color & 0x00ffffff) } } Fonts_UnbindRenderer( cf ); Fonts_DetachFont( cf ); } max_ttf_label=0; } void draw_boot_flags(u32 gflags, bool is_locked, int selected) { //boot flags if(gflags & IS_DBOOT) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 580, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 580, 695, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 695, 0, 0); } if(gflags & IS_BDMIRROR) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 735, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 735, 0, 0); } if(gflags & IS_PATCHED) { if(is_locked || c_firmware!=3.41f) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 775, 0, 0); } else { if(is_locked || c_firmware!=3.41f) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 775, 0, 0); } if(gflags & IS_EXTGD) { if(is_locked || payload!=1) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 815, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 815, 0, 0); } else { if(is_locked || payload!=1) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 815, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 815, 0, 0); } if(gflags & IS_FAV) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 855, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 855, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 855, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 855, 0, 0); } if(selected) { // if(selected<4) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 580, 695+((selected-1)*40), 0, 0); // else // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 580, 695+((selected)*40), 0, 0); } } void draw_reqd_flags(u32 gflags, bool is_locked, int selected) { //required flags if(gflags & IS_DISC) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 240, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 240, 695, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 695, 0, 0); } if(gflags & IS_HDD) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 240, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 240, 735, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 735, 0, 0); } if(gflags & IS_USB) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 240, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 240, 775, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 775, 0, 0); } if(selected) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 240, 695+((selected-1)*40), 0, 0); } int open_submenu(uint8_t *buffer, int *_game_sel) { xmb_bg_show=0; xmb_bg_counter=200; memcpy(text_FONT, buffer, FB(1)); u8 _menu_font=15; float y_scale=0.5; if(mm_locale) { _menu_font=mui_font; y_scale=0.4f; } reload_submenu: char label[256]; float x, y, top_o; int m; get_game_flags(*_game_sel); if(menu_list[*_game_sel].user & IS_BDMIRROR) {menu_list[*_game_sel].user &= ~(IS_HDD | IS_DBOOT); menu_list[*_game_sel].user|= IS_USB;} u32 gflags=menu_list[*_game_sel].user; set_game_flags(*_game_sel); u32 oflags=0; bool is_locked = (gflags & IS_LOCKED) || (gflags & IS_PROTECTED) || (strstr(menu_list[*_game_sel].path,"/pvd_usb")!=NULL || strstr(menu_list[*_game_sel].path,"/dev_bdvd")!=NULL); bool is_game = (strstr(menu_list[*_game_sel].content,"PS3")!=NULL); //(gflags & IS_PS3) || top_o=40.0f; // sub_menu_open=1; //blur_texture(text_FONT, 1920, 1080, 46, 52, 1828, 976, 35, 0, 1, 2); blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 25, 0, 1, 1); // sprintf(label, "%s/GLO.PNG", app_usrdir); // load_texture(text_bmp, label, 1920); // put_texture_with_alpha( text_FONT, text_bmp, 1920, 1080, 1920, 0, 0, 0, 0); /*for(m=100; m<200; m+=10) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); }*/ draw_box( text_FONT, 1920, 2, 0, (int)top_o+75, 0xa0a0a0ff); draw_box( text_FONT, 1920, 2, 0, 964, 0x808080ff); sprintf(label, "%s/%s_640.RAW", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)){ load_texture(text_bmp, label, 640); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; gray_texture(text_bmp, 640, 360, 0); } put_texture(text_FONT, text_bmp, 640, 360, 640, 105, 110+(int)top_o, 2, 0xc0c0c080); } sprintf(label, "%s/%s.JPG", covers_dir, menu_list[*_game_sel].title_id); if(!exist(label)) sprintf(label, "%s/%s.PNG", covers_dir, menu_list[*_game_sel].title_id); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/COVER.JPG", menu_list[*_game_sel].path); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/COVER.PNG", menu_list[*_game_sel].path); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/NOID.JPG", app_usrdir); else goto gs_cover; if(exist(label)){ gs_cover: load_texture(text_bmp, label, 260); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; gray_texture(text_bmp, 260, 300, 0); } put_texture(text_FONT, text_bmp, 260, 300, 260, 295, 566+(int)top_o, 2, 0xc0c0c080); sprintf(label, "%s/GLC.PNG", app_usrdir); if(exist(label)) { load_texture(text_bmp+312000, label, 260); put_texture_with_alpha( text_FONT, text_bmp+312000, 260, 300, 260, 295, 566+(int)top_o, 0, 0); } } put_texture_with_alpha( text_FONT, text_DOX+(dox_pad_x *4 + dox_pad_y * dox_width*4), dox_pad_w, dox_pad_h, dox_width, 70, 968, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 1140, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_square_x *4 + dox_square_y * dox_width*4), dox_square_w, dox_square_h, dox_width, 1340, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_circle_x *4 + dox_circle_y * dox_width*4), dox_circle_w, dox_circle_h, dox_width, 1540, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_triangle_x*4 + dox_triangle_y * dox_width*4), dox_triangle_w, dox_triangle_h, dox_width, 1700, 975, 0, 0); float game_app_ver=0.00f; float ps3_sys_ver=0.00f; char temp_val[32]; temp_val[0]=0; if(is_game) { draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); sprintf(label, "/dev_hdd0/game/%s/PARAM.SFO", menu_list[*_game_sel].title_id); if(!exist(label))sprintf(label, "%s/PS3_GAME/PARAM.SFO", menu_list[*_game_sel].path); if(!exist(label)) sprintf(label, "%s/PARAM.SFO", menu_list[*_game_sel].path); if(get_param_sfo_field(label, (char *)"APP_VER", (char *)temp_val)) game_app_ver=strtof(temp_val, NULL); else if(get_param_sfo_field(label, (char *)"VERSION", (char *)temp_val)) game_app_ver=strtof(temp_val, NULL); if(get_param_sfo_field(label, (char *)"PS3_SYSTEM_VER", (char *)temp_val)) ps3_sys_ver=strtof(temp_val, NULL); temp_val[0]=0; if(game_app_ver && ps3_sys_ver) sprintf(temp_val, " ver. %4.2f (PS3 firmware %4.2f)", game_app_ver, ps3_sys_ver); else if(game_app_ver && !ps3_sys_ver) sprintf(temp_val, " ver. %4.2f", game_app_ver); else if(ps3_sys_ver) sprintf(temp_val, " (PS3 firmware %4.2f)", ps3_sys_ver); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 580, 695, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 735, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 580, 775, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 695, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 240, 735, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 775, 0, 0); } // put_texture_with_alpha( text_FONT, text_DOX+(dox_att_x *4 + dox_att_y * dox_width*4), dox_att_w, dox_att_h, dox_width, 950, 1000, 0, 0); max_ttf_label=0; char *game_title = menu_list[*_game_sel].title[0]=='_' ? menu_list[*_game_sel].title+1 : menu_list[*_game_sel].title; x=860.0f; y=top_o+155.0f; u32 title_color=0xffc0c0c0; int x_icon=(int)(x-50); int y_icon=(int) (top_o + 158.0f); int option_number=0; // + (120.f * (option_number-1)) if(disable_options==2 || disable_options==3) {title_color=0xd0808080;} else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); oflags|=(1<<0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_COPY, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, (int)x-50, (int)y+3, 0, 0); y+=120.0f; if(is_locked || disable_options==1 || disable_options==3) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); oflags|=(1<<1);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_DELETE, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); y+=120.0f; if(is_locked || !is_game) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<2);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_RENAME, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); y+=120.0f; if(!is_game) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<3);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_UPDATE, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); title_color=0xffc0c0c0; y+=120.0f; oflags|=(1<<4); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_TEST, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); // title_color=0xd0808080; y+=120.0f; if(is_locked) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<5);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_GM_PERM, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); u32 info_color=0xffa0a0a0; sprintf(label, " %s", (char*) STR_BUT_NAV); print_label_ex( ((70.f+dox_pad_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_SELECT); print_label_ex( ((1140.f+dox_cross_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_GENRE); print_label_ex( ((1340.f+dox_square_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_BACK); print_label_ex( ((1540.f+dox_circle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_CANCEL); print_label_ex( ((1700.f+dox_triangle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); info_color=0xffa0a0a0; x+=20; if(disable_options==2 || disable_options==3) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 1.0f) + 77.0f; sprintf(label, (const char*) STR_GM_COPY_L1, game_title); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, label, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_COPY_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_COPY_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(is_locked || disable_options==1 || disable_options==3) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 2.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(is_locked || !is_game) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 3.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(!is_game) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 4.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; info_color=0xffa0a0a0; y=top_o+(120.0f * 5.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; // info_color=0xc0707070; if(is_locked) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 6.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if((*_game_sel)) sprintf(label, "%s", (char*) STR_BUT_PREV); else sprintf(label, "%s", (char*) STR_BUT_LAST); print_label_ex( ((750.f)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 2); put_texture_with_alpha( text_FONT, text_DOX+(dox_l1_x*4 + dox_l1_y * dox_width*4), dox_l1_w, dox_l1_h, dox_width, 770, 982, 0, 0); if((*_game_sel)!=(max_menu_list-1)) sprintf(label, " %s", (char*) STR_BUT_NEXT); else sprintf(label, " %s", (char*) STR_BUT_FIRST); print_label_ex( ((840.f+dox_r1_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_r1_x*4 + dox_r1_y * dox_width*4), dox_r1_w, dox_r1_h, dox_width, 840, 982, 0, 0); if(!(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_' || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL)) { sprintf(label, " %s", (char*) STR_BUT_LOAD); print_label_ex( ((375.f+dox_start_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_start_x*4 + dox_start_y * dox_width*4), dox_start_w, dox_start_h, dox_width, 375, 972, 0, 0); } else put_texture_with_alpha( text_FONT, text_DOX+(dox_att_x*4 + dox_att_y * dox_width*4), dox_att_w, dox_att_h, dox_width, 400, 972, 0, 0); sprintf(label, "%s: %s", (char*) STR_BUT_GENRE, genre[ (menu_list[*_game_sel].user>>16)&0x0f ]); print_label_ex( (420.0f/1920.f), ((538.0f+top_o)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 1); put_texture_with_alpha( text_FONT, text_DOX+(dox_start_x*4 + dox_start_y * dox_width*4), dox_start_w, dox_start_h, dox_width, 375, 972, 0, 0); flush_ttf(text_FONT, 1920, 1080); info_color=0xffa0a0a0; u32 dev_color=0xffe0e0e0; if(is_game) { if(is_locked) dev_color=0xc0808080; print_label_ex( (225.f/1920.f), ((top_o+657.f)/1080.f), 1.5f, dev_color, (char*)"Game disc", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (225.f/1920.f), ((top_o+697.f)/1080.f), 1.5f, dev_color, (char*)"Internal", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (225.f/1920.f), ((top_o+737.f)/1080.f), 1.5f, dev_color, (char*)"External", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (620.f/1920.f), ((top_o+660.f)/1080.f), 1.5f, dev_color, (char*)"Direct boot", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); print_label_ex( (620.f/1920.f), ((top_o+700.f)/1080.f), 1.5f, dev_color, (char*)"BD mirror", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); if(payload!=1) dev_color=0xc0808080; print_label_ex( (620.f/1920.f), ((top_o+780.f)/1080.f), 1.5f, dev_color, (char*)"Ext Game Data", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0);dev_color=0xffe0e0e0; print_label_ex( (620.f/1920.f), ((top_o+820.f)/1080.f), 1.5f, dev_color, (char*)"Favorite", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); if(c_firmware!=3.41) dev_color=0xc0808080; print_label_ex( (620.f/1920.f), ((top_o+740.f)/1080.f), 1.5f, dev_color, (char*)"USB patch", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); } time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); else sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); print_label_ex( (1690.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); sprintf(label, "%s%s", game_title, temp_val); print_label_ex( (70.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_bdvd")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1460.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Blu", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_hdd")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1530.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Hdd", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_usb")!=NULL || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1600.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Usb", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); flush_ttf(text_FONT, 1920, 1080); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; sprintf(label, "%s (Split)", game_title); print_label_ex( (425.0f/1920.f), ((478.0f+top_o)/1080.f), 1.0f, COL_SPLIT, label, 1.04f, 0.0f, 1, 0.6f, 0.6f, 1); } else { sprintf(label, "%s", game_title); print_label_ex( (425.0f/1920.f), ((478.0f+top_o)/1080.f), 1.0f, 0xc0e0e0e0, label, 1.04f, 0.0f, 1, 0.6f, 0.6f, 1); } flush_ttf(text_FONT, 1920, 1080); sprintf(label, "[%s]", menu_list[*_game_sel].path+5); if(strlen(label)>64) {label[64]=0x2e;label[65]=0x2e;label[66]=0x0;} print_label_ex( (425.0f/1920.f), ((507.0f+top_o)/1080.f), 1.0f, 0xc0808080, label, 1.00f, 0.0f, 17, 0.7f, 0.7f, 1); flush_ttf(text_FONT, 1920, 1080); sprintf(label, "%s", menu_list[*_game_sel].title_id); print_label_ex( (425.0f/1920.f), ((873.0f+top_o)/1080.f), 1.0f, 0xc0c0c0c0, label, 1.00f, 0.0f, 18, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); if(V_WIDTH<1280) blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); for(m=200; m>100; m-=10) { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } int result=0; int main_options=1; //1-main 2-gameboot, 3-gamereq int options_req=1; int options_boot=1; u32 b_color = 0x0080ffff; while (1) { pad_read(); if ( (new_pad & BUTTON_L1)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); (*_game_sel)--; if((*_game_sel)<0) (*_game_sel)=(max_menu_list-1); sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } if ( (new_pad & BUTTON_R1)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); (*_game_sel)++; if((*_game_sel)>=max_menu_list) (*_game_sel)=0; sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } if ( (new_pad & BUTTON_SQUARE)) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; for (int n=0;n<16;n++ ) { sprintf(opt_list[n].label, "%s", genre[n]); sprintf(opt_list[n].value, "%i", n); } opt_list_max=16; int ret_f=open_select_menu((char*) STR_SEL_GENRE, 600, opt_list, opt_list_max, text_FONT, 16, 1); use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { menu_list[*_game_sel].user=(gflags & (u32)(~(15<<16))) | ((u32)(strtod(opt_list[ret_f].value, NULL))<<16); set_game_flags(*_game_sel); sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } else new_pad=0; } if ( (new_pad & BUTTON_START)) { if(!(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_' || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); result=7; break; } } if ( (new_pad & BUTTON_TRIANGLE)) {result=0; break;} //quit sub-menu if ( (new_pad & BUTTON_CIRCLE)) { if(is_locked || !is_game) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_TITLE_LOCKED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } else { menu_list[*_game_sel].user=gflags; if(!set_game_flags(*_game_sel)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_TITLE_RO, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } } result=0; break; } //save changes and quit sub-menu if ( (new_pad & BUTTON_LEFT) && is_game && !is_locked) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); main_options++; if(main_options>3) main_options=1; if(main_options<1) main_options=3; if(main_options==1) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0);} if(main_options==2) {draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0);} if(main_options==3) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req);} } if ( (new_pad & BUTTON_RIGHT) && is_game && !is_locked) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); main_options--; if(main_options<1) main_options=3; if(main_options==1) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0);} if(main_options==2) {draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0);} if(main_options==3) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req);} } if(main_options==1) { if ( (new_pad & BUTTON_DOWN)) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); int oloop; for(oloop=option_number; oloop<7; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>6) option_number=0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); } if ( (new_pad & BUTTON_UP)) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); int oloop; if(option_number==0) option_number=7; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); } if ( (new_pad & BUTTON_CROSS) ) { result=option_number+1; if(!is_locked && is_game) { menu_list[*_game_sel].user=gflags;set_game_flags(*_game_sel); } //save changed options on main options activation break; } } if (main_options==2){ if (new_pad & BUTTON_DOWN) { options_boot++; if(options_boot>5) options_boot=1; draw_boot_flags(gflags, is_locked, options_boot); } if (new_pad & BUTTON_UP) { options_boot--; if(options_boot<1) options_boot=5; draw_boot_flags(gflags, is_locked, options_boot); } if ( (new_pad & BUTTON_CROSS)) { if(options_boot<4) gflags ^= ( 1 << (options_boot+4) ); else { if(options_boot==4) gflags ^= ( 1 << (options_boot+5) ); if(options_boot==5) gflags ^= ( 1 << (options_boot+3) ); } if(gflags & IS_BDMIRROR) {gflags &= ~(IS_HDD | IS_DBOOT); gflags|= IS_USB;} draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0); } } if (main_options==3){ if (new_pad & BUTTON_DOWN) { options_req++; if(options_req>3) options_req=1; draw_reqd_flags(gflags, is_locked, options_req); } if (new_pad & BUTTON_UP) { options_req--; if(options_req<1) options_req=3; draw_reqd_flags(gflags, is_locked, options_req); } if ( (new_pad & BUTTON_CROSS) ) { gflags ^= ( 1 << (options_req-1) ); if(gflags & IS_BDMIRROR) {gflags &= ~(IS_HDD | IS_DBOOT); gflags|= IS_USB;} draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req); } } ClearSurface(); b_box_opaq+=b_box_step; if(b_box_opaq>0xfe) b_box_step=-1; if(b_box_opaq<0x20) b_box_step= 2; b_color = (b_color & 0xffffff00) | (b_box_opaq); //105, 120+(int)top_o, draw_square(((0.054f-0.5f)*2.0f)-0.005f, ((0.5f-(110.f+top_o)/1080.f)+0.005f)*2.0f , 0.675f, 0.68f, -0.4f, b_color); set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); } old_fi=-1; game_last_page=-1; new_pad=0; ss_timer=0; return result; } int open_mm_submenu(uint8_t *buffer) // system settings menu { xmb_bg_show=0; xmb_bg_counter=200; char label[256]; float x, y, top_o; int m; u8 _menu_font=15; float y_scale=0.5f; float x_scale=0.5f; if(mm_locale) { _menu_font=mui_font; y_scale=0.42f; x_scale=0.48f; } u32 oflags=1; top_o=40.0f; if(cover_mode!=8) { memcpy(text_FONT, buffer, 0x7E9000); blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 25, 0, 1, 1); for(m=100; m<200; m+=10) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } } else memset(text_FONT, 0, 0x7E9000); draw_box( text_FONT, 1920, 2, 0, (int)top_o+75, 0xa0a0a0ff); draw_box( text_FONT, 1920, 2, 0, 964, 0x808080ff); put_texture_with_alpha( text_FONT, text_DOX+(dox_pad_x *4 + dox_pad_y * dox_width*4), dox_pad_w, dox_pad_h, dox_width, 70, 968, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 1450, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_circle_x *4 + dox_circle_y * dox_width*4), dox_circle_w, dox_circle_h, dox_width, 1700, 975, 0, 0); max_ttf_label=0; x=150.0f; y=top_o+95.0f; u32 title_color=0xffc0c0c0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_UPDATE, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, (int)x-50, (int)y, 0, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_REFRESH, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<6); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; if(lock_fileman) title_color=0xd0808080; else {title_color=0xffc0c0c0;oflags|=(1<<1);put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_FILEMAN, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); title_color=0xffc0c0c0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SHOW_ST, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<7); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); oflags|=(1<<2); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_NTFS, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SHOW_LK, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<8); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; if(cover_mode==3 or cover_mode==4) title_color=0xd0808080; else {title_color=0xffc0c0c0;oflags|=(1<<3);put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SCRSHOT, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); title_color=0xffc0c0c0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_SCRSAVE, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<9); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); title_color=0xffc0c0c0; y+=135.0f; oflags|=(1<<4); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_RESTART, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_SETUP, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<10); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); // title_color=0xd0808080; y+=135.0f; title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); oflags|=(1<<5); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_QUIT, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_HELP, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<11); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); u32 info_color=0xffa0a0a0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); else sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); print_label_ex( (1690.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, "multiMAN %s", current_version); label[17]=0; print_label_ex( (70.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_NAV); print_label_ex( ((70.f+dox_pad_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_SELECT); print_label_ex( ((1450.f+dox_cross_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_BACK); print_label_ex( ((1700.f+dox_circle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); info_color=0xffa0a0a0; x+=20; info_color=0xffa0a0a0; y=top_o+(135.0f * 1.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 2.0f); if(lock_fileman) info_color=0xc0707070; else info_color=0xffa0a0a0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; info_color=0xffa0a0a0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 3.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 4.0f); if(cover_mode==3 or cover_mode==4) info_color=0xc0707070; else info_color=0xffa0a0a0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; info_color=0xffa0a0a0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; info_color=0xffa0a0a0; y=top_o+(135.0f * 5.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; // info_color=0xc0707070; y=top_o+(135.0f * 6.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; flush_ttf(text_FONT, 1920, 1080); if(V_WIDTH<1280) blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); for(m=200; m>100; m-=10) { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } int result=0; int main_options=1; //1-main 2-gameboot, 3-gamereq int x_icon=(int)(100); int y_icon=(int) (top_o + 95.0f); int option_number=0; int c_option_number=0; while (1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) {result=0; break;} //quit sub-menu if(main_options==1) { if ( (new_pad & BUTTON_UP) || (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_LEFT) || (new_pad & BUTTON_RIGHT)) { x_icon=100; c_option_number=option_number; if(option_number>5) { c_option_number=option_number-6; x_icon=1060;} put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (135.f * (c_option_number))), 0, 0); } if ( (new_pad & BUTTON_DOWN)) { int oloop; for(oloop=option_number; oloop<12; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>11) option_number=0; } if ( (new_pad & BUTTON_RIGHT)) { int oloop; option_number+=5; for(oloop=option_number; oloop<12; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>11) option_number=0; } if ( (new_pad & BUTTON_UP)) { int oloop; if(option_number==0) option_number=12; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; } if ( (new_pad & BUTTON_LEFT)) { int oloop; option_number-=5; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; } if ( (new_pad & BUTTON_UP) || (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_LEFT) || (new_pad & BUTTON_RIGHT)) { x_icon=100; c_option_number=option_number; if(option_number>5) { c_option_number=option_number-6; x_icon=1060;} put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (135.f * (c_option_number))), 0, 0); } } if ( (new_pad & BUTTON_CROSS)){ result=option_number+1; break; } ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); } old_fi=-1; game_last_page=-1; new_pad=0; counter_png=0; if(result==4) //take screenshot { char string1[64]; ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); sys_timer_usleep(250000); time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); if(exist((char*)"/dev_usb000")) { sprintf(string1, "/dev_usb000/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); } else if(exist((char*)"/dev_usb001")) { sprintf(string1, "/dev_usb001/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); } } ss_timer=0; return result; } /****************************************************/ /* UTILS */ /****************************************************/ void fix_perm_recursive(const char* start_path) { new_pad=0; old_pad=0; if(abort_rec==1) return; if(strstr(start_path,"/pvd_usb")!=NULL) return; int dir_fd; uint64_t nread; char f_name[CELL_FS_MAX_FS_FILE_NAME_LENGTH+1]; CellFsDirent dir_ent; CellFsErrno err; cellFsChmod(start_path, 0777); flip(); if (cellFsOpendir(start_path, &dir_fd) == CELL_FS_SUCCEEDED) { cellFsChmod(start_path, 0777); while (1) { pad_read(); if ( (old_pad & BUTTON_CIRCLE) || (old_pad & BUTTON_TRIANGLE) || dialog_ret==3) { abort_rec=1; new_pad=0; old_pad=0; break; } // err = cellFsReaddir(dir_fd, &dir_ent, &nread); if (nread != 0) { if (!strcmp(dir_ent.d_name, ".") || !strcmp(dir_ent.d_name, "..")) continue; sprintf(f_name, "%s/%s", start_path, dir_ent.d_name); if (dir_ent.d_type == CELL_FS_TYPE_DIRECTORY) { cellFsChmod(f_name, CELL_FS_S_IFDIR | 0777); fix_perm_recursive(f_name); if(abort_rec==1) break; } else if (dir_ent.d_type == CELL_FS_TYPE_REGULAR) { cellFsChmod(f_name, 0666); } } else { break; } } err = cellFsClosedir(dir_fd); } } int parse_ps3_disc(char *path, char * id) { FILE *fp; int n; fp = fopen(path, "rb"); if (fp != NULL) { unsigned len; unsigned char *mem=NULL; fseek(fp, 0, SEEK_END); len=ftell(fp); mem= (unsigned char *) malloc(len+16); if(!mem) {fclose(fp);return -2;} memset(mem, 0, len+16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); for(n=0x20;n<0x200;n+=0x20) { if(!strcmp((char *) &mem[n], "TITLE_ID")) { n= (mem[n+0x12]<<8) | mem[n+0x13]; memcpy(id, &mem[n], 16); id[4]=id[5];id[5]=id[6];id[6]=id[7];id[7]=id[8];id[8]=id[9];id[9]=0; return 0; } } } return -1; } static double get_system_version(void) { FILE *fp; float base=3.41f; fp = fopen("/dev_flash/vsh/etc/version.txt", "rb"); if (fp != NULL) { char bufs[1024]; fgets(bufs, 1024, fp); fclose(fp); base = strtod(bufs + 8, NULL); // this is either the spoofed or actual version } fp = fopen("/dev_flash/sys/external/libfs.sprx", "rb"); if (fp != NULL) { fseek(fp, 0, SEEK_END); uint32_t len = ftell(fp); unsigned char *mem = NULL; mem= (unsigned char *) memalign(16, len+16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); uint32_t crc=0, crc_c; for(crc_c=0; crc_c<len; crc_c++) crc+=mem[crc_c]; // sprintf(status_info, "%x", crc); if(crc==0x416bbaULL) base=3.15; else //ignore spoofers by crcing libfs if(crc==0x41721eULL) base=3.41; else if(crc==0x41655eULL) base=3.55; free(mem); } return base; } void change_param_sfo_field(char *file, char *field, char *value) { if(!exist(file) || strstr(file, "/dev_bdvd")!=NULL) return; FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], field) && mem[str+strlen(field)]==0) { memcpy(&mem[pos], value, strlen(value)); mem[pos+strlen(value)]=0; fp = fopen(file, "wb"); fwrite(mem, len, 1, fp); fclose(fp); } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } } int get_param_sfo_field(char *file, char *field, char *value) { if(!exist(file)) return 0; // || strstr(file, "/dev_bdvd")!=NULL FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return 0; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], field) && mem[str+strlen(field)]==0) { // memcpy(&mem[pos], value, strlen(value)); memcpy(value, &mem[pos], strlen(field)); value[strlen(field)]=0; free(mem); return 1; } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } return 0; } void change_param_sfo_version(const char *file) //parts from drizzt { if(!exist_c(file) || strstr(file, "/dev_bdvd")!=NULL) return; FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], "ATTRIBUTE")) { if ( (mem[pos] & 0x25) != 0x25) { mem[pos] |= 0x25; fp = fopen(file, "wb"); if (fp != NULL) { fwrite(mem, len, 1, fp); fclose(fp); } } } if (!strcmp((char *) &mem[str], "PS3_SYSTEM_VER")) { float ver; ver = strtod((char *) &mem[pos], NULL); if (c_firmware < ver) { char msg[170]; snprintf(msg, sizeof(msg), (const char*) STR_PARAM_VER, ver, c_firmware); int t_dialog_ret=dialog_ret; dialog_ret = 0; cellMsgDialogAbort(); cellMsgDialogOpen2(type_dialog_yes_no, msg, dialog_fun1, (void *) 0x0000aaaa, NULL); wait_dialog(); if (dialog_ret == 1) { char ver_patch[10]; //format the version to be patched so it is xx.xxx snprintf(ver_patch, sizeof(ver_patch), "%06.3f", c_firmware); memcpy(&mem[pos], ver_patch, 6); fp = fopen(file, "wb"); if (fp != NULL) { fwrite(mem, len, 1, fp); fclose(fp); } } dialog_ret=t_dialog_ret; } break; } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } } int parse_param_sfo(char *file, char *title_name, char *title_id, int *par_level) { // if(strstr(file, "/pvd_usb")!=NULL) return -1; *par_level=0; FILE *fp = NULL; unsigned len, pos, str; unsigned char *mem = NULL; #if (CELL_SDK_VERSION>0x210001) int pfsm=0; if(strstr(file, "/pvd_usb")!=NULL) pfsm=1; PFS_HFILE fh = PFS_FILE_INVALID; if (pfsm) { uint64_t size; if ((fh = PfsFileOpen(file)) == PFS_FILE_INVALID) return -1; if (PfsFileGetSizeFromHandle(fh, &size) != 0) { PfsFileClose(fh); return -1; } len = (unsigned)size; } else #endif { if ((fp = fopen(file, "rb")) == NULL) return -1; fseek(fp, 0, SEEK_END); len = ftell(fp); } mem = (unsigned char *) malloc(len + 16); if (!mem) { #if (CELL_SDK_VERSION>0x210001) if (pfsm) { PfsFileClose(fh); } else #endif { fclose(fp); } return -2; } memset(mem, 0, len+16); #if (CELL_SDK_VERSION>0x210001) if (pfsm) { int32_t r; r = PfsFileRead(fh, mem, len, NULL); PfsFileClose(fh); if (r != 0) return -1; } else #endif { fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); } str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); int indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "TITLE")) { memset(title_name, 0, 63); strncpy(title_name, (char *) &mem[pos], 63); // free(mem); goto scan_for_PL; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } scan_for_PL: str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "PARENTAL_LEVEL")) { (*par_level)=mem[pos]; goto scan_for_id; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } scan_for_id: str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "TITLE_ID")) { memset(title_id, 0, 10); strncpy(title_id, (char *) &mem[pos], 10); title_id[9]=0; free(mem); return 0; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } if(mem) free(mem); return -1; } void sort_pane(t_dir_pane *list, int *max) { int n,m; int fi= (*max); if(fi<2) return; t_dir_pane swap; for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(strcasecmp(list[n].entry, list[m].entry)>0) { swap=list[n];list[n]=list[m];list[m]=swap; } } } /* void delete_entries_content(t_menu_list *list, int *max, char *content_type) { int n; n=0; while(n<(*max) ) { if(list[n].content == content_type) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } */ int ps3_home_scan(char *path, t_dir_pane *list, int *max) { if((*max)>=MAX_PANE_SIZE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; struct CellFsStat s; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan(d1f, list, max); free(d1f); } else { f=(char *) malloc(512); if(!f) {return -1;} sprintf(f,"%s/%s", path, entry->d_name); if( (search_mmiso==1 && strstr(f, ".mmiso.")!=NULL) || search_mmiso==0) { sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", f); sprintf(list[*max ].entry, "__1%s", entry->d_name); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=1; if(cellFsStat(list[*max ].path, &s)==CELL_FS_SUCCEEDED) { list[*max].size=s.st_size; list[*max].time=s.st_ctime; } (*max) ++; } if(f) free(f); } } closedir (dir); return 0; } int ps3_home_scan_ext(char *path, t_dir_pane *list, int *max, char *_ext) { if((*max)>=MAX_PANE_SIZE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_ext(d1f, list, max, _ext); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); if(strstr(entry->d_name, _ext)==NULL) continue; sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE) break; } } closedir (dir); return 0; } int ps3_home_scan_ext_bare(char *path, t_dir_pane_bare *list, int *max, char *_ext) { if((*max)>=MAX_PANE_SIZE_BARE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_ext_bare(d1f, list, max, _ext); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); if(strstr(entry->d_name, _ext)==NULL) continue; sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE_BARE) break; } } closedir (dir); return 0; } int ps3_home_scan_bare(char *path, t_dir_pane_bare *list, int *max) { if((*max)>=MAX_PANE_SIZE_BARE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_bare(d1f, list, max); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE_BARE) break; } } closedir (dir); return 0; } int ps3_home_scan_bare2(char *path, t_dir_pane *list, int *max) { if((*max)>=MAX_PANE_SIZE) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_bare2(d1f, list, max); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE) break; } } closedir (dir); return 0; } void read_dir(char *path, t_dir_pane *list, int *max) { // DIR *dir; struct CellFsStat s; *max =0; FILE *fp; int n=0, foundslash=0, slashpos=0; char net_host_file[512], net_host_file2[512], tempname[512], tempname2[512], tempname3[8]; char net_path_bare [512], title[512], date2[10], timeC[10], type[1], net_path[512], parent[512]; char path2[512], path3[512], path4[512]; char temp[3], length[128]; time_t c_time = time(NULL); if(strstr(path,"/net_host")==NULL) goto regular_FS_PS; sprintf(net_host_file2, "%s", path); net_host_file2[10]=0; // strncpy(net_host_file2, path, 10); net_host_file2[10]=0; sprintf(net_host_file,"%s%s", app_usrdir, net_host_file2); // add root shortcut to regular file system // in case something is wrong with the net_host list[*max].type=0; sprintf(list[*max ].name, "/"); sprintf(list[*max ].path, "/"); sprintf(list[*max ].entry, " "); list[*max].size=0; list[*max].time=time(NULL); timeinfo = localtime ( &c_time ); if(date_format==0) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(list[*max].datetime, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); (*max) ++; fp = fopen ( net_host_file, "r" ); if ( fp != NULL ) { sprintf(path2, "%s/", path); sprintf(path3, "%s/0", path); while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeC, date2, type, parent, tempname3)>=7) { sprintf(net_path, "%s%s", net_host_file2, net_path_bare); sprintf(path4, "%s%s%s", net_host_file2, parent, type); if(strcmp(path3, path4)==0) { list[*max].type=0; strncpy(tempname, net_path_bare+1, strlen(net_path_bare)-2); tempname[strlen(net_path_bare)-2]=0; foundslash=0; slashpos=0; int pl=strlen(tempname); for(n=pl;n>1;n--) { if(tempname[n]==0x2F) { foundslash=n; break; } } for(n=0;n<pl;n++) { if(n>foundslash && foundslash>0) { tempname2[slashpos]=tempname[n]; slashpos++; tempname2[slashpos]=0; } } if(foundslash==0) sprintf(tempname2, "%s%c", tempname, 0); // utf8_to_ansi(tempname2, list[*max ].name, 128); sprintf(list[*max ].name, "%s", tempname2); strncpy(list[*max ].path, net_path, strlen(net_path)-1); list[*max ].path[strlen(net_path)-1]=0; sprintf(list[*max ].entry, "__0%s", net_path_bare); list[*max].size=0; list[*max].time=0; list[*max].mode=0; list[*max].selected=0; sprintf(list[*max].datetime, "%s%c", " ", 0); (*max) ++; if(*max >=2048) break; } //subfolder if(strcmp(net_path, path2)==0) { list[*max].type=strtol(type, NULL, 10); // utf8_to_ansi(title, list[*max ].name, 128); sprintf(list[*max ].name, "%s%c", title, 0); // strncpy(list[*max ].name, title, 128); list[*max ].name[128]=0; sprintf(list[*max ].path, "%s/%s", path, title); temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)==0) { sprintf(list[*max ].path, "%s", path); char *pch=list[*max ].path; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; list[*max ].path[lastO]=0; } sprintf(list[*max ].entry, "__%i%s", list[*max].type, title); list[*max].size=strtoull(length, NULL, 10); list[*max].time=0; list[*max].mode=0; list[*max].selected=0; sprintf(list[*max].datetime, "%s", date2); if(strlen(date2)>9 && date_format>0) { if(date_format==1) // 01/34/6789 sprintf(list[*max].datetime, "%c%c/%c%c/%c%c%c%c", date2[3], date2[4], date2[0], date2[1], date2[6], date2[7], date2[8], date2[9]); else if(date_format==2) // 01/34/6789 sprintf(list[*max].datetime, "%c%c%c%c/%c%c/%c%c", date2[6], date2[7], date2[8], date2[9], date2[3], date2[4], date2[0], date2[1]); } // sprintf(filename, "Path: [%s]\nInfo [%f] [%s] [%f]", list[*max].path, list[*max].size/1.0f, length, strtol(length, NULL, 10)/1.0f); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL );wait_dialog(); (*max) ++; if(*max >=2048) break; } } //while fclose(fp); } goto finalize; regular_FS_PS: if(strstr(path,"/ps3_home")==NULL) goto regular_FS_NTFS; if(strcmp(path,"/ps3_home")==0){ sprintf(list[*max ].name, ".."); sprintf(list[*max ].path, "/"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, " "); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "music"); sprintf(list[*max ].path, "/ps3_home/music"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0music"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "photo"); sprintf(list[*max ].path, "/ps3_home/photo"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0photo"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "video"); sprintf(list[*max ].path, "/ps3_home/video"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0video"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "archive"); sprintf(list[*max ].path, "/ps3_home/mmiso"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0archive"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } if(strstr(path,"/ps3_home/")!=NULL){ sprintf(list[*max ].name, ".."); sprintf(list[*max ].path, "/ps3_home"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, " "); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } search_mmiso=0; if(strstr(path,"/ps3_home/music")!=NULL) ps3_home_scan((char *)"/dev_hdd0/music", list, max); if(strstr(path,"/ps3_home/video")!=NULL) ps3_home_scan((char *)"/dev_hdd0/video", list, max); if(strstr(path,"/ps3_home/photo")!=NULL) ps3_home_scan((char *)"/dev_hdd0/photo", list, max); if(strstr(path,"/ps3_home/mmiso")!=NULL) {search_mmiso=1; ps3_home_scan((char *)"/dev_hdd0/video", list, max); search_mmiso=0;} goto finalize; regular_FS_NTFS: char *pch; char *pathpos; int lastO; #if (CELL_SDK_VERSION>0x210001) if(strstr(path,"/pvd_usb")==NULL) goto regular_FS; PFS_HFIND dir; PFS_FIND_DATA entryP; sprintf(list[*max ].path, "%s", path); pch=list[*max ].path; pathpos=strrchr(pch,'/'); lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); sprintf(list[*max ].name, ".."); list[*max].type=0; (*max) ++; dir = PfsFileFindFirst(path, &entryP); if (!dir) goto regular_FS; do { if (!strcmp(entryP.FileName, ".") || !strcmp(entryP.FileName, "..")) continue; if (entryP.FileAttributes & PFS_FIND_DIR) list[*max].type=0; else list[*max].type=1; strncpy(list[*max ].name, entryP.FileName, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entryP.FileName); else sprintf(list[*max ].path, "%s/%s", path, entryP.FileName); sprintf(list[*max ].entry, "__%i%s", list[*max].type, entryP.FileName); list[*max].time=time(NULL);; list[*max].size=entryP.FileSize; list[*max].mode=entryP.FileAttributes; list[*max].selected=0; /* if (list[*max].type==1) { PFS_HFILE fh = PFS_FILE_INVALID; uint64_t size; list[*max].size=0; if ((fh = PfsFileOpen(list[*max].path)) != PFS_FILE_INVALID) { if (PfsFileGetSizeFromHandle(fh, &size) == 0) { list[*max].size=size; } } if (fh != PFS_FILE_INVALID) PfsFileClose(fh); } */ //list[*max].time=s.st_ctime; //if(s.st_mtime>0) list[*max].time=s.st_mtime; if(list[*max ].name[0]!=0x24 && strstr(list[*max ].name, "System Volume")==NULL) (*max) ++; if(*max >=2048) break; } while (PfsFileFindNext(dir, &entryP) == 0); PfsFileFindClose(dir); goto finalize; regular_FS: #endif int dir_fd; uint64_t nread; CellFsDirent entry; // dir=opendir (path); if (cellFsOpendir(path, &dir_fd) == CELL_FS_SUCCEEDED){ while(1) { // while(dir) { // struct dirent *entry=readdir (dir); cellFsReaddir(dir_fd, &entry, &nread); if(nread==0) break; // if(!entry) break; if(entry.d_name[0]=='.' && entry.d_name[1]==0) continue; if(strstr(entry.d_name,"host_root")!=NULL) continue; if(!(entry.d_type & DT_DIR)) { list[*max].type=1; } else { list[*max].type=0; } list[*max].mode=0; list[*max].selected=0; // utf8_to_ansi(entry.d_name, list[*max ].name, 128); strncpy(list[*max ].name, entry.d_name, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entry.d_name); else sprintf(list[*max ].path, "%s/%s", path, entry.d_name); if(entry.d_name[0]=='.' && entry.d_name[1]=='.' && entry.d_name[2]==0) { sprintf(list[*max ].path, "%s", path); pch=list[*max ].path; pathpos=strrchr(pch,'/'); lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); } else sprintf(list[*max ].entry, "__%i%s", list[*max].type, entry.d_name); /* if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(!(entry->d_type & DT_DIR)) { list[*max].type=1; } else { list[*max].type=0; } strncpy(list[*max ].name, entry->d_name, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entry->d_name); else sprintf(list[*max ].path, "%s/%s", path, entry->d_name); if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) { sprintf(list[*max ].path, "%s", path); char *pch=list[*max ].path; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); } else sprintf(list[*max ].entry, "__%i%s", list[*max].type, entry->d_name); */ if(cellFsStat(list[*max ].path, &s)==CELL_FS_SUCCEEDED) { list[*max].size=s.st_size; list[*max].time=s.st_ctime; if(s.st_mtime>0) list[*max].time=s.st_mtime; list[*max].mode=s.st_mode; } (*max) ++; if(*max >=2048) break; } //while } // closedir(dir); cellFsClosedir(dir_fd); finalize: if(*max==0) { sprintf(list[*max ].name, "/"); sprintf(list[*max ].path, "/"); sprintf(list[*max ].entry, " "); list[*max ].time=0; list[*max ].size=0; list[*max ].type=0; (*max) ++; } temp[0]=0x2f; temp[1]=0x00; temp[2]=0; if(strcmp(temp, path)==0) { for(n=0;n<max_hosts;n++) { sprintf(list[*max ].name, "net_host%i %s - %s:%i", n, host_list[n].friendly, host_list[n].host, host_list[n].port); sprintf(list[*max ].path, "/net_host%i",n); sprintf(list[*max ].entry, "__0net_host%i", n); list[*max ].time=time(NULL); list[*max ].size=0; timeinfo = localtime ( &c_time ); if(date_format==0) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(list[*max].datetime, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); list[*max ].type=0; (*max) ++; } sprintf(list[*max ].name, "ps3_home"); sprintf(list[*max ].path, "/ps3_home"); sprintf(list[*max ].entry, "__0ps3_home"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; #if (CELL_SDK_VERSION>0x210001) if(pfs_enabled) { int fsVol=0; for(fsVol=0;fsVol<(max_usb_volumes);fsVol++) { if (PfsmVolStat(fsVol) == 0) { sprintf(list[*max ].name, "pvd_usb%i", fsVol); sprintf(list[*max ].path, "/pvd_usb00%i", fsVol); sprintf(list[*max ].entry, "__0pvd_usb00%i", fsVol); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } } } #endif /* sprintf(list[*max ].name, "sys_cache"); sprintf(list[*max ].path, "%s", sys_cache); sprintf(list[*max ].entry, "__0sys_cache"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; */ } sort_pane(list, max ); } #if (CELL_SDK_VERSION>0x210001) void fill_entries_from_device_pfs(char *path, t_menu_list *list, int *max, u32 flag, int sel) { if(!pfs_enabled || is_reloaded) return; is_game_loading=1; if(sel!=2) delete_entries(list, max, flag); load_texture(text_bmpIC, blankBG, 320); //reset_xmb(1); PFS_HFIND dir; PFS_FIND_DATA entry; char file[1024]; int skip_entry=0; char string2[1024]; (void) sel; if ((*max) < 0) *max = 0; // sprintf(string2, "Will check dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); // if (PfsFileGetInfo(path, &info) != 0) return; // sprintf(string2, "Will read dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); dir = PfsFileFindFirst(path, &entry); // sprintf(string2, "READ dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); if (!dir) { is_game_loading=0; return; } do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if (!(entry.FileAttributes & PFS_FIND_DIR)) continue; if(skip_entry==0 && cover_mode!=8) { sprintf(string2, "Scanning, please wait!\n\n[%s/%s]",path, entry.FileName); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.89f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); //if(first_launch) cellDbgFontPrintf( 0.30f, 0.80f, 1.0f, 0x90909090, multi_loading); flip(); } skip_entry++; if( skip_entry>10) skip_entry=0; //(first_launch && skip_entry>3 ) || list[*max].flags = flag; strncpy(list[*max].title, entry.FileName, 63); list[*max].title[63] = 0; sprintf(list[*max].path, "%s/%s", path, entry.FileName); sprintf(list[*max ].content, "%s", "PS3"); sprintf(list[*max ].title_id, "%s", "NO_ID"); list[*max ].split=0; list[*max ].user=IS_PS3; sprintf(file, "%s/PS3_GAME/PARAM.SFO", list[*max].path); parse_param_sfo(file, list[*max ].title+1*(list[*max ].title[0]=='_'), list[*max ].title_id, &list[*max ].plevel); // move +1 with '_' list[*max ].title[63]=0; sprintf(file, "%s/PS3_GAME/PIC1.PNG", list[*max].path); sprintf(string2, "%s/%s_320.PNG", cache_dir, list[*max ].title_id); if(!exist(string2)) {cache_png(file, list[*max ].title_id);} (*max)++; if (*max >= MAX_LIST) break; } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); //reset_xmb(1); is_game_loading=0; } #endif void check_usb_ps3game(const char *path) { if(strstr(path,"/dev_usb")!=NULL) { //check for PS3_GAME mount on external USB char usb_mount1[512], usb_mount2[512], path_bup[512], tempname[512]; int pl, n; FILE *fpA; strncpy(tempname, path, 11); tempname[11]=0; sprintf(usb_mount1, "%s/PS3_GAME", tempname); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fpA==NULL) goto continue_scan; if(fgets ( usb_mount2, 512, fpA )==NULL) goto cancel_move; fclose(fpA); strncpy(usb_mount2, path, 11); //always use current device if(!exist(usb_mount2)) { pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } rename (usb_mount1, usb_mount2); } goto continue_scan; cancel_move: fclose(fpA); } } } continue_scan: return; } void fill_entries_from_device(const char *path, t_menu_list *list, int *max, u32 flag, int sel) { is_game_loading=1; check_usb_ps3game(path); is_game_loading=0; if((is_reloaded==2) || (is_reloaded==1 && strstr(path, "/dev_hdd")==NULL) ) return; is_game_loading=1; DIR *dir;//, *dir2, *dir3; char file[1024], string2[1024]; char path2[1024], path3[1024], avchd_path[12], detailsfile[512]; int skip_entry=0; FILE *fp; char BDtype[6]; if(sel!=2) delete_entries(list, max, flag); if((*max) <0) *max =0; char title[256], length[24], video[24], audio[24], web[256]; sprintf(string2, "%s/AVCHD_240.RAW", cache_dir); if(!exist(string2)) { sprintf(string2, "%s", "AVCHD"); cache_png(string2, string2); } if(first_launch) { sprintf(string2, "%s/PRB.PNG", app_usrdir); load_texture(text_FMS, string2, 858);} if(scan_avchd==1 && strstr(path,"/dev_usb")!=NULL && sel==0 && (display_mode==0 || display_mode==2)) { // strncpy(avchd_path, path, 11); avchd_path[11]=0; dir=opendir (avchd_path); while(dir) { if(*max >=MAX_LIST-1) break; pb_step-=10; if(pb_step<1) pb_step=429; if(first_launch) { ClearSurface(); put_texture( text_BOOT, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); } struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.') continue; if(!(entry->d_type & DT_DIR)) continue; if(skip_entry==0 && !first_launch) { if(cover_mode!=8) { ClearSurface(); sprintf(string2, "Scanning for AVCHD content, please wait!\n\n[%s/%s]",avchd_path, entry->d_name); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); cellDbgFontDrawGcm(); flip(); } } skip_entry++; if(skip_entry>20) skip_entry=0; sprintf(path2, "%s/%s", avchd_path, entry->d_name); //dev_usb00x/AVCHD_something sprintf(file, "%s/BDMV/INDEX.BDM", path2); // /dev_usb00x/AVCHD_something/BDMV/INDEX.BDM sprintf(BDtype,"AVCHD"); if(!exist(file)) { sprintf(file, "%s/BDMV/index.bdmv", path2); // /dev_usb00x/something/BDMV/index.bdmv if(exist(file)) sprintf(BDtype,"BDMV");} if(exist(file)) { char is_multiAVCHD[13];is_multiAVCHD[0]=0; sprintf(detailsfile, "%s/multiAVCHD.mpf", path2); if(exist(detailsfile)) sprintf(is_multiAVCHD, "%s", " (multiAVCHD)"); is_multiAVCHD[13]=0; sprintf(path3, "[Video] %s%s", entry->d_name, is_multiAVCHD); path3[63]=0; sprintf(list[*max ].title, "%s", path3); list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); list[*max ].cover=-1; list[*max ].split=0; list[*max ].user=0; sprintf(detailsfile, "%s/details.txt", path2); fp = fopen ( detailsfile, "r" ); if ( fp != NULL ) { fseek (fp, 0, SEEK_SET); char lines[2048]="/"; lines[1]=0; int cline=0; while (fscanf(fp,"%[^;];%[^;];%[^;];%[^;];%s\n", title, length, video, audio, web)==5) { cline++; if(expand_avchd==1) { sprintf(list[*max].title, "[Video] %s", title); // utf8_to_ansi(string2, list[*max].title, 63); list[*max].title[63]=0; list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); sprintf(list[*max ].details, "Duration: %s, Video: %s, Audio: %s", length, video, audio); list[*max ].cover=-1; (*max) ++; } else { if(cline==1) { is_multiAVCHD[13]=0; sprintf(string2, "[Video] %s%s", title, is_multiAVCHD); string2[62]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 58);list[*max].title[58]=0; } else sprintf(lines, "%s %s /", lines, title); } if(*max >=MAX_LIST-1) break; } lines[100]=0; if(expand_avchd==0) {lines[90]=0; sprintf(list[*max].details, "%s", lines);} // {utf8_to_ansi(lines, list[*max].details, 90);list[*max].details[90]=0;} else {if(cline>0) (*max) --;} fclose ( fp ); } (*max) ++; if(*max >=MAX_LIST-1) break; } // INDEX.BDM found } // while closedir (dir); } // scan AVCHD dir=opendir (path); if(!dir) {is_game_loading=0; return;} if(sel==2) sel=0; while(1) { if(*max >=MAX_LIST-1) break; pb_step-=10; if(pb_step<1) pb_step=429; if(first_launch) { ClearSurface(); put_texture( text_BOOT, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); } struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.') continue; if(!(entry->d_type & DT_DIR)) continue; sprintf(path2, "%s/%s", path, entry->d_name); sprintf(file, "%s/PS3_GAME/ICON0.PNG", path2); if(strcmp(path, "/dev_hdd0/game")==0) { sprintf(file, "%s/ICON0.PNG", path2); } /* if(skip_entry==0 || first_launch) { ClearSurface(); if(first_launch) { put_texture( text_bmpUBG, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_bmpUBG, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); // sprintf(string2, "Scanning [%s/%s], please wait...", path, entry->d_name); // cellDbgFontPrintf( (1.0f-(strlen(string2)*0.00625f))/2.0f, 0.80f, 0.5f, 0x90909090, string2); // cellDbgFontDrawGcm(); // max_ttf_label=0; // cellDbgFontPrintf( 0.98f, 0.98f, 0.5f, 0x80808080, "G"); // print_label_ex( 0.5f, 0.8, 0.5f, 0x90909090, string2, 1.0f, 0.0f, 15, 1.0f, 1.0f, 1); } else */ if(skip_entry==0 && !first_launch) { if(strstr(path, "/dev_hdd0")!=NULL && exist(file) && cover_mode!=8) load_texture(text_bmpIC, file, 320); if(cover_mode!=8) //draw_whole_xmb(1); //draw_xmb_bare(xmb_icon, 2, 0, 0); //max_ttf_label+=0; //else { sprintf(string2, "Scanning, please wait!\n\n[%s/%s]", path, entry->d_name); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); //if(first_launch) cellDbgFontPrintf( 0.30f, 0.80f, 1.0f, 0x90909090, multi_loading); cellDbgFontDrawGcm(); flip(); } } skip_entry++; if(skip_entry>10) skip_entry=0; // (first_launch && skip_entry>3 ) || // sprintf(file, "%s/PS3_GAME/USRDIR/EBOOT.BIN", path2); sprintf(file, "%s/PS3_GAME/PARAM.SFO", path2); if(strcmp(path, "/dev_hdd0/game")==0) { // sprintf(file, "%s/USRDIR/MM_NON_NPDRM_EBOOT.BIN", path2); // if(stat(file, &s)>=0) sprintf(file, "%s/PARAM.SFO", path2); // else // { sprintf(file, "%s/USRDIR/RELOAD.SELF", path2); if(exist(file) && strstr(file, app_usrdir)==NULL) sprintf(file, "%s/PARAM.SFO", path2); else continue; // } } /* if(sel==1) { sprintf(file, "%s/EBOOT.BIN", path2); if(stat(file, &s)<0) sprintf(file, "%s/USRDIR/EBOOT.BIN", path2); if(stat(file, &s)<0) continue; } */ // if(display_mode==0 || display_mode==1) if(display_mode!=2 && exist(file)) { list[*max ].flags=flag; strncpy(list[*max ].title, entry->d_name, 63); list[*max ].title[63]=0; list[*max ].cover=0; sprintf(list[*max ].path, "%s/%s", path, entry->d_name); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "PS3"); sprintf(list[*max ].title_id, "%s", "NO_ID"); list[*max ].split=0; list[*max ].user=IS_PS3; if(sel==0) { parse_param_sfo(file, list[*max ].title+1*(list[*max ].title[0]=='_'), list[*max ].title_id, &list[*max ].plevel); // move +1 with '_' list[*max ].title[63]=0; if(strcmp(path, "/dev_hdd0/game")==0) sprintf(file, "%s/PIC1.PNG", path2); else sprintf(file, "%s/PS3_GAME/PIC1.PNG", path2); sprintf(string2, "%s/%s_320.PNG", cache_dir, list[*max ].title_id); if(!exist(string2)) {cache_png(file, list[*max ].title_id);} } get_game_flags((*max)); (*max) ++; continue; } else // check for PS2 games { list[*max ].split=0; sprintf(file, "%s/SYSTEM.CNF", path2); if(!exist(file)) sprintf(file, "%s/system.cnf", path2); if(exist(file)) { list[*max ].flags=flag; sprintf(file, "[PS2] %s", entry->d_name); strncpy(list[*max ].title, file, 63); list[*max ].title[63]=0; list[*max ].cover=-1; sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "PS2"); sprintf(list[*max ].title_id, "%s", "NO_ID"); (*max) ++; continue; } else { sprintf(file, "%s/VIDEO_TS/VIDEO_TS.IFO", path2); if(display_mode!=1 && exist(file)) { list[*max ].flags=flag; sprintf(file, "[DVD Video] %s", entry->d_name); strncpy(list[*max ].title, file, 63); list[*max ].title[63]=0; list[*max ].cover=-1; sprintf(file, "%s/VIDEO_TS", path2); sprintf(list[*max ].path, "%s", file); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "DVD"); sprintf(list[*max ].title_id, "%s", "NO_ID"); (*max) ++; continue; } else //check for AVCHD on internal HDD { char ext_int[5]; ext_int[0]=0; if(strstr(path2, "dev_hdd0")!=NULL) sprintf(ext_int, "%s", "HDD "); sprintf(file, "%s/BDMV/INDEX.BDM", path2); // /dev_usb00x/AVCHD_something/BDMV/INDEX.BDM sprintf(BDtype,"AVCHD"); if(!exist(file)) { sprintf(file, "%s/BDMV/index.bdmv", path2); // /dev_usb00x/something/BDMV/index.bdmv if(exist(file)) sprintf(BDtype,"BDMV");} if(display_mode!=1 && exist(file)) { char is_multiAVCHD[13];is_multiAVCHD[0]=0; sprintf(detailsfile, "%s/multiAVCHD.mpf", path2); if(exist(detailsfile)) sprintf(is_multiAVCHD,"%s", " (multiAVCHD)"); is_multiAVCHD[13]=0; sprintf(path3, "[%sVideo] %s%s", ext_int, entry->d_name, is_multiAVCHD); path3[64]=0; sprintf(list[*max ].title, "%s", path3); list[*max ].flags=flag; list[*max ].title[63]=0; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); list[*max ].cover=-1; sprintf(detailsfile, "%s/details.txt", path2); fp = fopen ( detailsfile, "r" ); if ( fp != NULL ) { fseek (fp, 0, SEEK_SET); char lines[2048]="/"; lines[1]=0; int cline=0; while (fscanf(fp,"%[^;];%[^;];%[^;];%[^;];%s\n", title, length, video, audio, web)==5) { cline++; if(expand_avchd==1) { sprintf(string2, "[%sVideo] %s", ext_int, title); string2[63]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 63); list[*max].title[63]=0; list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); sprintf(list[*max ].details, "Duration: %s, Video: %s, Audio: %s", length, video, audio); list[*max ].cover=-1; (*max) ++; } else { if(cline==1) { is_multiAVCHD[13]=0; sprintf(string2, "[%sVideo] %s%s", ext_int, title, is_multiAVCHD); string2[58]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 58);list[*max].title[58]=0; } else sprintf(lines, "%s %s /", lines, title); } if(*max >=MAX_LIST) break; } lines[100]=0; if(expand_avchd==0) { lines[90]=0; sprintf(list[*max].details, "%s", lines); //utf8_to_ansi(lines, list[*max].details, 90);list[*max].details[90]=0; } else { if(cline>0) (*max) --;} fclose ( fp ); } (*max) ++; } // INDEX.BDM found } } } if(*max >=MAX_LIST) break; } closedir (dir); load_texture(text_bmpIC, blankBG, 320); is_game_loading=0; } /****************************************************/ /* FILE UTILS */ /****************************************************/ //char string1[1024]; int copy_mode=0; // 0- normal 1-> pack files >= 4GB int copy_is_split=0; // return 1 if files is split //uint64_t global_device_bytes=0; typedef struct _t_fast_files { int64_t readed; // global bytes readed int64_t writed; // global bytes writed int64_t off_readed; // offset correction for bigfiles_mode == 2 (joining) int64_t len; // global len of the file (value increased in the case of bigfiles_ mode == 2) int giga_counter; // counter for split files to 1GB for bigfiles_mode == 1 (split) u32 fl; // operation control int bigfile_mode; int pos_path; // filename position used in bigfiles char pathr[1024]; // read path char pathw[1024]; // write path int use_doublebuffer; // if files >= 4MB use_doblebuffer =1; void *mem; // buffer for read/write files ( x2 if use_doublebuffer is fixed) int size_mem; // size of the buffer for read int number_frag; // used to count fragments files i bigfile_mode CellFsAio t_read; // used for async read CellFsAio t_write; // used for async write } t_fast_files __attribute__((aligned(8))); t_fast_files *fast_files=NULL; int fast_num_files=0; int fast_used_mem=0; int current_fast_file_r=0; int current_fast_file_w=0; int fast_read=0, fast_writing=0; int files_opened=0; int fast_copy_async(char *pathr, char *pathw, int enable) { fast_num_files=0; fast_read=0; fast_writing=0; fast_used_mem=0; files_opened=0; current_fast_file_r= current_fast_file_w= 0; if(enable) { if(cellFsAioInit(pathr)!=CELL_FS_SUCCEEDED) return -1; if(cellFsAioInit(pathw)!=CELL_FS_SUCCEEDED) return -1; fast_files = (t_fast_files *) memalign(8, sizeof(t_fast_files)*MAX_FAST_FILES); // fast_files = (t_fast_files *) fast_files_mem; if(!fast_files) return -2; return 0; } else { if(fast_files) free(fast_files); fast_files=NULL; cellFsAioFinish(pathr); cellFsAioFinish(pathw); } return 0; } int fast_copy_process(); int fast_copy_add(char *pathr, char *pathw, char *file) { int size_mem; int strl= strlen(file); struct stat s; if(fast_num_files>=MAX_FAST_FILES || fast_used_mem>=0x2000000)//1000000)//C00000)//800000) { int ret=fast_copy_process(); if(ret<0 || abort_copy) return ret; } if(fast_num_files>= MAX_FAST_FILES) {return -1;} fast_files[fast_num_files].bigfile_mode=0; if(strl>6)// && strstr(pathw, "/dev_hdd0")!=NULL) { char *p= file; p+= strl-6; // adjust for .666xx .x.part if(p[0]== '.' && p[1]== '6' && p[2]== '6' && p[3]== '6') { if(p[4]!='0' || p[5]!='0') {return 0;} // ignore this file fast_files[fast_num_files].bigfile_mode=2; // joining split files } /* else if(strl>7) { p+= strl-7; // adjust for .666xx .x.part if(p[0]== '.' && p[1]!='1' && p[2]== '.' && p[3]== 'p' && p[4]== 'a' && p[5]== 'r' && p[6]== 't') fast_files[fast_num_files].bigfile_mode=2; // joining split files else return 0; // ignore } */ } sprintf(fast_files[fast_num_files].pathr, "%s/%s", pathr, file); if(stat(fast_files[fast_num_files].pathr, &s)<0) {abort_copy=1;return -1;} sprintf(fast_files[fast_num_files].pathw, "%s/%s", pathw, file); // zero files if((int64_t) s.st_size==0LL) { int fdw; if(cellFsOpen(fast_files[fast_num_files].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", fast_files[current_fast_file_r].pathw); abort_copy=1; return -1; } cellFsClose(fdw); cellFsChmod(fast_files[fast_num_files].pathw, CELL_FS_S_IFMT | 0777); DPrintf("Copying:\n%s\nwWritten: 0 B\n", fast_files[current_fast_file_r].pathr); file_counter++; return 0; } if(fast_files[fast_num_files].bigfile_mode==2) { /* if(fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-1]=='t') { fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-7]=0; // truncate the .x.part extension fast_files[fast_num_files].pos_path=strlen(fast_files[fast_num_files].pathr)-7; } else { */ fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-6]=0; // truncate the .666xx extension fast_files[fast_num_files].pos_path=strlen(fast_files[fast_num_files].pathr)-6; // } fast_files[fast_num_files].pathr[fast_files[fast_num_files].pos_path]=0; // truncate the extension } if(copy_mode==1) { if(((uint64_t) s.st_size)>= 0x100000000ULL) { fast_files[fast_num_files].bigfile_mode=1; fast_files[fast_num_files].pos_path= strlen(fast_files[fast_num_files].pathw); fast_files[fast_num_files].giga_counter=0; copy_is_split=1; } } fast_files[fast_num_files].number_frag=0; fast_files[fast_num_files].fl=1; fast_files[fast_num_files].len= (int64_t) s.st_size; fast_files[fast_num_files].use_doublebuffer=0; fast_files[fast_num_files].readed= 0LL; fast_files[fast_num_files].writed= 0LL; fast_files[fast_num_files].t_read.fd= -1; fast_files[fast_num_files].t_write.fd= -1; if(((uint64_t) s.st_size)>=MAX_FAST_FILE_SIZE) { size_mem= MAX_FAST_FILE_SIZE; fast_files[fast_num_files].use_doublebuffer=1; } else size_mem= ((int) s.st_size); fast_files[fast_num_files].mem = memalign(32, size_mem + size_mem*(fast_files[fast_num_files].use_doublebuffer!=0)+1024); fast_files[fast_num_files].size_mem = size_mem; if(!fast_files[fast_num_files].mem) {abort_copy=1;return -1;} fast_used_mem+= size_mem; fast_num_files++; return 0; } void fast_func_read(CellFsAio *xaio, CellFsErrno error, int , uint64_t size) { t_fast_files* fi = (t_fast_files *) xaio->user_data; if(error!=0 || size!= xaio->size) { fi->readed=-1;return; } else fi->readed+=(int64_t) size; fast_read=0;fi->fl=3; } void fast_func_write(CellFsAio *xaio, CellFsErrno error, int , uint64_t size) { t_fast_files* fi = (t_fast_files *) xaio->user_data; if(error!=0 || size!= xaio->size) { fi->writed=-1; } else { fi->writed+=(int64_t) size; fi->giga_counter+= (int) size; global_device_bytes+=(int64_t) size; } fast_writing=2; } int fast_copy_process() { int n; int seconds2= (int) time(NULL); int fdr, fdw; char string1[1024]; static int id_r=-1, id_w=-1; int error=0; int i_reading=0; int64_t write_end=0, write_size=0; while(current_fast_file_w<fast_num_files || fast_writing) { if(abort_copy) break; // open read if(current_fast_file_r<fast_num_files && fast_files[current_fast_file_r].fl==1 && !i_reading && !fast_read) { fast_files[current_fast_file_r].readed= 0LL; fast_files[current_fast_file_r].writed= 0LL; fast_files[current_fast_file_r].off_readed= 0LL; fast_files[current_fast_file_r].t_read.fd= -1; fast_files[current_fast_file_r].t_write.fd= -1; if(fast_files[current_fast_file_r].bigfile_mode==1) { DPrintf("Split file >= 4GB\n %s\n", fast_files[current_fast_file_r].pathr); sprintf(&fast_files[current_fast_file_r].pathw[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); } if(fast_files[current_fast_file_r].bigfile_mode==2) { DPrintf("Joining file >= 4GB\n %s\n", fast_files[current_fast_file_r].pathw); sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); } if(cellFsOpen(fast_files[current_fast_file_r].pathr, CELL_FS_O_RDONLY, &fdr, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (read):\n%s\n\n", fast_files[current_fast_file_r].pathr); error=-1; break; }else files_opened++; if(cellFsOpen(fast_files[current_fast_file_r].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", fast_files[current_fast_file_r].pathw); error=-2; break; }else files_opened++; if(fast_files[current_fast_file_r].bigfile_mode==0) { DPrintf("Copying %s\n", fast_files[current_fast_file_r].pathr); file_counter++;} if(fast_files[current_fast_file_r].bigfile_mode) { DPrintf(" -> Split part #%i\n", fast_files[current_fast_file_r].number_frag);} //file_counter++; fast_files[current_fast_file_r].t_read.fd= fdr; fast_files[current_fast_file_r].t_read.offset= 0LL; fast_files[current_fast_file_r].t_read.buf= fast_files[current_fast_file_r].mem; fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].t_read.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_files[current_fast_file_r].t_write.fd= fdw; fast_files[current_fast_file_r].t_write.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_files[current_fast_file_r].t_write.offset= 0LL; if(fast_files[current_fast_file_r].use_doublebuffer) fast_files[current_fast_file_r].t_write.buf= ((char *) fast_files[current_fast_file_r].mem) + fast_files[current_fast_file_r].size_mem; else fast_files[current_fast_file_r].t_write.buf= fast_files[current_fast_file_r].mem; fast_read=1;fast_files[current_fast_file_r].fl=2; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } i_reading=1; } // fast read end if(current_fast_file_r<fast_num_files && fast_files[current_fast_file_r].fl==3 && !fast_writing) { id_r=-1; //fast_read=0; if(fast_files[current_fast_file_r].readed<0LL) { DPrintf("Error Reading %s\n", fast_files[current_fast_file_r].pathr); error=-3; break; } // double buffer if(fast_files[current_fast_file_r].use_doublebuffer) { //DPrintf("Double Buff Write\n"); current_fast_file_w=current_fast_file_r; memcpy(((char *) fast_files[current_fast_file_r].mem)+fast_files[current_fast_file_r].size_mem, fast_files[current_fast_file_r].mem, fast_files[current_fast_file_r].size_mem); fast_files[current_fast_file_w].t_write.size= fast_files[current_fast_file_r].t_read.size; if(fast_files[current_fast_file_w].bigfile_mode==1) fast_files[current_fast_file_w].t_write.offset= (int64_t) fast_files[current_fast_file_w].giga_counter; else fast_files[current_fast_file_w].t_write.offset= fast_files[current_fast_file_w].writed; fast_writing=1; if(cellFsAioWrite(&fast_files[current_fast_file_w].t_write, &id_w, fast_func_write)!=0) { id_w=-1; error=-4; DPrintf("Fail to perform Async Write\n\n"); fast_writing=0; break; } if(fast_files[current_fast_file_r].readed<fast_files[current_fast_file_r].len) { fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].fl=2; fast_files[current_fast_file_r].t_read.offset= fast_files[current_fast_file_r].readed-fast_files[current_fast_file_r].off_readed; fast_read=1; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } } else { if(fast_files[current_fast_file_r].bigfile_mode==2) { struct stat s; fast_files[current_fast_file_r].number_frag++; fast_files[current_fast_file_r].off_readed= fast_files[current_fast_file_r].readed; DPrintf(" -> .666%2.2i\n", fast_files[current_fast_file_r].number_frag); sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); /* if(stat(fast_files[current_fast_file_r].pathr, &s)<0) sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".%i.part", fast_files[current_fast_file_r].number_frag); */ if(stat(fast_files[current_fast_file_r].pathr, &s)<0) {current_fast_file_r++;i_reading=0;} else { if(fast_files[current_fast_file_r].t_read.fd>=0) {cellFsClose(fast_files[current_fast_file_r].t_read.fd);files_opened--;}fast_files[current_fast_file_r].t_read.fd=-1; if(cellFsOpen(fast_files[current_fast_file_r].pathr, CELL_FS_O_RDONLY, &fdr, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (read):\n%s\n\n", fast_files[current_fast_file_r].pathr); error=-1; break; }else files_opened++; fast_files[current_fast_file_r].t_read.fd= fdr; fast_files[current_fast_file_r].len += (int64_t) s.st_size; fast_files[current_fast_file_r].t_read.offset= 0LL; fast_files[current_fast_file_r].t_read.buf= fast_files[current_fast_file_r].mem; fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].t_read.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_read=1; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } fast_files[current_fast_file_r].fl=2; } } else {fast_files[current_fast_file_r].fl=5;current_fast_file_r++;i_reading=0;} } } else // single buffer { current_fast_file_w=current_fast_file_r; fast_files[current_fast_file_w].t_write.size= fast_files[current_fast_file_r].t_read.size; fast_files[current_fast_file_w].t_write.offset= fast_files[current_fast_file_w].writed; fast_writing=1; if(cellFsAioWrite(&fast_files[current_fast_file_w].t_write, &id_w, fast_func_write)!=0) { id_w=-1; error=-4; DPrintf("Fail to perform Async Write\n\n"); fast_writing=0; break; } current_fast_file_r++; i_reading=0; } } // fast write end if(fast_writing>1) { fast_writing=0; id_w=-1; if(fast_files[current_fast_file_w].writed<0LL) { DPrintf("Error Writing %s\n", fast_files[current_fast_file_w].pathw); error=-4; break; } write_end=fast_files[current_fast_file_w].writed; write_size=fast_files[current_fast_file_w].len; if(fast_files[current_fast_file_w].writed>=fast_files[current_fast_file_w].len) { if(fast_files[current_fast_file_w].t_read.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_read.fd);files_opened--;}fast_files[current_fast_file_w].t_read.fd=-1; if(fast_files[current_fast_file_w].t_write.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_write.fd);files_opened--;}fast_files[current_fast_file_w].t_write.fd=-1; cellFsChmod(fast_files[current_fast_file_w].pathw, CELL_FS_S_IFMT | 0777); if(fast_files[current_fast_file_w].bigfile_mode==1) { fast_files[current_fast_file_w].pathw[fast_files[current_fast_file_w].pos_path]=0; } fast_files[current_fast_file_w].fl=4; //end of proccess fast_files[current_fast_file_w].writed=-1LL; current_fast_file_w++; //if(current_fast_file_r<current_fast_file_w) current_fast_file_w=current_fast_file_r; //file_counter++; } else // split big files if(fast_files[current_fast_file_w].bigfile_mode==1 && fast_files[current_fast_file_w].giga_counter>=0x40000000) { if(fast_files[current_fast_file_w].t_write.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_write.fd);files_opened--;}fast_files[current_fast_file_w].t_write.fd=-1; cellFsChmod(fast_files[current_fast_file_w].pathw, CELL_FS_S_IFMT | 0777); fast_files[current_fast_file_w].giga_counter=0; fast_files[current_fast_file_w].number_frag++; sprintf(&fast_files[current_fast_file_w].pathw[fast_files[current_fast_file_w].pos_path],".666%2.2i", fast_files[current_fast_file_w].number_frag); DPrintf(" -> .666%2.2i\n", fast_files[current_fast_file_w].number_frag); if(cellFsOpen(fast_files[current_fast_file_w].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening2 (write):\n%s\n\n", fast_files[current_fast_file_w].pathw); error=-2; break; }else files_opened++; fast_files[current_fast_file_w].t_write.fd=fdw; } } int seconds= (int) (time(NULL)-time_start); int eta=0; lastINC3=0; if(use_symlinks==1 || no_real_progress==1) { eta=(copy_file_counter-file_counter)/(file_counter/seconds); if( ( ((int)(file_counter*100ULL/copy_file_counter)) - lastINC2)>0) { lastINC2=(int) (file_counter*100ULL / copy_file_counter); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} // if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } else { eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } if(lastINC3>0 || (time(NULL)-seconds2)!=0 || use_symlinks==1) { if(join_copy==1) sprintf(string1,"Installed %.0f of %.0f MB. Remaining: %i:%2.2i min", ((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); else { if(use_symlinks==1) { if(no_real_progress==1) sprintf(string1,"Files linked: %i. Elapsed time: %i:%2.2i min", file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Files linked: %i/%i. Remaining: %i:%2.2i min", file_counter, copy_file_counter, (eta/60), eta % 60); } else { if(no_real_progress==1) sprintf(string1,"Copied %.0f MB (%i of %i files). Elapsed: %2.2i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter+1, copy_file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Copied %.0f / %.0f MB (%i/%i) Remaining: %i:%2.2i min", ((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), file_counter+1, copy_file_counter, (eta/60), eta % 60); } } ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); flip(); } pad_read(); if ( new_pad & BUTTON_TRIANGLE ) { abort_copy=1; DPrintf("Copy process aborted by user. \n"); error=-666; break; } } if(error && error!=-666) { DPrintf("Error!\nFiles Opened %i\n Waiting 2 seconds to display fatal error\n", files_opened); ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xffffffff, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press /\\ to abort"); cellDbgFontDrawGcm(); flip(); sys_timer_usleep(2*1000000); } if(fast_writing==1 && id_w>=0) { cellFsAioCancel(id_w); id_w=-1; sys_timer_usleep(200000); } fast_writing=0; if(fast_read==1 && id_r>=0) { cellFsAioCancel(id_r); id_r=-1; sys_timer_usleep(200000); } fast_read=0; for(n=0;n<fast_num_files;n++) { if(fast_files[n].t_read.fd>=0) { cellFsClose(fast_files[n].t_read.fd);fast_files[n].t_read.fd=-1; files_opened--; } if(fast_files[n].t_write.fd>=0) { cellFsClose(fast_files[n].t_write.fd);fast_files[n].t_write.fd=-1; files_opened--; } if(fast_files[n].mem) free(fast_files[n].mem); fast_files[n].mem=NULL; } fast_num_files=0; fast_writing=0; fast_used_mem=0; current_fast_file_r= current_fast_file_w= 0; if(error) abort_copy=666+100+error; return error; } void file_copy(char *path, char *path2, int progress) { if((strstr(path, "/pvd_usb")!=NULL && !pfs_enabled) || (strstr(path2, "/pvd_usb")!=NULL)) return; if(progress){ ClearSurface(); flip(); ClearSurface(); flip(); } dialog_ret=0; char rdr[255]; time_start=time(NULL); int fs; int fd; uint64_t fsiz = 0; uint64_t msiz = 0; sprintf(rdr, "%s", path); int seconds2=0; char string1[1024]; #if (CELL_SDK_VERSION>0x210001) PFS_HFILE fdr = PFS_FILE_INVALID; if(strstr(path, "/pvd_usb")!=NULL) { if ((fdr = PfsFileOpen(path)) == PFS_FILE_INVALID) return; if (PfsFileGetSizeFromHandle(fdr, &msiz) != 0) { PfsFileClose(fdr); return; } } else #endif { cellFsOpen(path, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); } // uint64_t chunk = 16*1024; uint64_t chunk = BUF_SIZE; if(msiz<chunk && msiz>0) chunk=msiz; // char w[chunk]; lastINC2=0;lastINC=0; uint64_t written=0; remove(path2); abort_copy=0; #if (CELL_SDK_VERSION>0x210001) fdr = PFS_FILE_INVALID; uint32_t size; if (strstr(path, "/pvd_usb")!=NULL) { if((fdr = PfsFileOpen(path)) == PFS_FILE_INVALID) {return;} } else #endif cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); copy_file_counter=1; copy_global_bytes=msiz; lastINC=0; lastINC3=0; lastINC2=0; void* buf = (void *) memalign(128, chunk+16); sprintf(rdr, "%s", path2); cellFsOpen(rdr, CELL_FS_O_CREAT|CELL_FS_O_RDWR|CELL_FS_O_APPEND, &fd, NULL, 0); while(fsiz < msiz && abort_copy==0) { //if(to_reboot) {abort_copy=1; break;} if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz); #if (CELL_SDK_VERSION>0x210001) if (strstr(path, "/pvd_usb")!=NULL) { if(PfsFileRead(fdr, buf, chunk, &size) != 0) {abort_copy=1;break;} } else #endif { if(cellFsRead(fs, (void *)buf, chunk, NULL)!=CELL_FS_SUCCEEDED) {abort_copy=1;break;} } { if(cellFsWrite(fd, (const void *)buf, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} global_device_bytes+=chunk; break; } } else { #if (CELL_SDK_VERSION>0x210001) if (strstr(path, "/pvd_usb")!=NULL) { if(PfsFileRead(fdr, buf, chunk, &size) != 0) {abort_copy=1;break;} } else #endif { if(cellFsRead(fs, (void *)buf, chunk, NULL)!=CELL_FS_SUCCEEDED){abort_copy=1;break;} } if(cellFsWrite(fd, (const void *)buf, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;} if(written!=chunk){abort_copy=1;break;} fsiz = fsiz + chunk; global_device_bytes=fsiz; } int seconds= (int) (time(NULL)-time_start); lastINC3=0; int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); if( ( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0 || (time(NULL)-seconds2)>0) && progress!=0) { // sprintf(string1,"%1.3f of %1.3f MB copied (elapsed: %2.2i:%2.2i:%2.2i) Remaining: %imin %2.2isec",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), seconds/3600, (seconds/60) % 60, seconds % 60, (eta/60), eta % 60); sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg( CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); seconds2= (int) (time(NULL)); flip(); } pad_read(); if ( old_pad & BUTTON_TRIANGLE || new_pad & BUTTON_CIRCLE || dialog_ret==3) {abort_copy=1; new_pad=0; old_pad=0; break;} } cellFsClose(fd); #if (CELL_SDK_VERSION>0x210001) if(strstr(path, "/pvd_usb")==NULL) cellFsClose(fs); else PfsFileClose(fdr); #else cellFsClose(fs); #endif cellFsChmod(rdr, 0666); if( global_device_bytes != copy_global_bytes) abort_copy=1; if(abort_copy==1) remove(path2); if(progress!=0){ cellMsgDialogAbort();sys_timer_usleep(100000); flip(); } free(buf); } void write_last_play( const char *gamebin, const char *path, const char *tname, const char *tid, int dboot) { (void) tid; (void) tname; char last_play[128]; char last_play_dir[128]; char last_play_sfo[128]; char last_play_id[10]; last_play_id[0]=0x42; //B last_play_id[1]=0x4C; //L last_play_id[2]=0x45; //E last_play_id[3]=0x53; //S last_play_id[4]=0x38; last_play_id[5]=0x30; last_play_id[6]=0x36; last_play_id[7]=0x31; last_play_id[8]=0x30; last_play_id[9]=0x00; sprintf(last_play, "/dev_hdd0/game/%s/LASTPLAY.BIN", last_play_id); sprintf(last_play_dir, "/dev_hdd0/game/%s", last_play_id); sprintf(last_play_sfo, "/dev_hdd0/game/%s/PARAM.SFO", last_play_id); if(!exist(last_play_dir)) return; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_LP_DATA, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char org_param_sfo[512], sldir[512];//, dldir[512]; char PIC1[512], PIC0[512], ICON0[512], ICON1_PAM[512], EBOOT[512];; char _PIC1[512], _PIC0[512], _ICON0[512], _ICON1_PAM[512], _EBOOT[512]; if(strstr( gamebin, "/PS3_GAME/")!=NULL){ sprintf( org_param_sfo, "%s/PS3_GAME/PARAM.SFO", path); sprintf( EBOOT, "%s/PS3_GAME/USRDIR/EBOOT.BIN", path); // PIC1.PNG PIC0.PNG ICON0.PNG ICON1.PAM sprintf( PIC0, "%s/PS3_GAME/PIC0.PNG", path); sprintf( PIC1, "%s/PS3_GAME/PIC1.PNG", path); sprintf( ICON0, "%s/PS3_GAME/ICON0.PNG", path); sprintf( ICON1_PAM, "%s/PS3_GAME/ICON1.PAM", path); sprintf (sldir, "%s/PS3_GAME/USRDIR", path); if(dboot&1) { char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/TROPDIR", path); sprintf(s_destination, "%s/TROPDIR", last_play_dir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/TROPDIR", last_play_dir); my_game_copy((char*)s_source, (char*)s_destination); sprintf(s_source, "%s/PS3_GAME/LICDIR/LIC.DAT", path); sprintf(s_destination, "%s/LICDIR", last_play_dir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/LICDIR/LIC.DAT", last_play_dir); file_copy((char*)s_source, (char*)s_destination, 0); } } else { sprintf( org_param_sfo, "%s/PARAM.SFO", path); sprintf( EBOOT, "%s/USRDIR/EBOOT.BIN", path); sprintf( PIC0, "%s/PIC0.PNG", path); sprintf( PIC1, "%s/PIC1.PNG", path); sprintf( ICON0, "%s/ICON0.PNG", path); sprintf( ICON1_PAM, "%s/ICON1.PAM", path); sprintf (sldir, "%s/USRDIR", path); } /* if(strstr(path, "/dev_hdd0")!=NULL && (c_firmware>3.54f || payload==0)){ //create shadow copy sprintf (dldir, "%s/USRDIR", last_play_dir); use_symlinks=1; my_game_copy(sldir, dldir); } */ sprintf( _PIC0, "%s/PIC0.PNG", last_play_dir); sprintf( _PIC1, "%s/PIC1.PNG", last_play_dir); sprintf( _ICON0, "%s/ICON0.PNG", last_play_dir); sprintf( _EBOOT, "%s/USRDIR/MM_EBOOT.BIN", last_play_dir); sprintf( _ICON1_PAM, "%s/ICON1.PAM", last_play_dir); if(exist(PIC0)) file_copy( PIC0, _PIC0, 0); else remove(_PIC0); if(exist(PIC1)) file_copy( PIC1, _PIC1, 0); else remove(_PIC1); if(exist(EBOOT)) file_copy( EBOOT, _EBOOT, 0); if(exist(ICON0)) file_copy( ICON0, _ICON0, 0); flip(); if(exist(ICON1_PAM)) file_copy( ICON1_PAM, _ICON1_PAM, 0); else remove(_ICON1_PAM); char LASTGAME[512], SELF_NAME[512], SELF_PATH[512], SELF_USBP[16], SELF_BOOT[8]; sprintf(LASTGAME, "%s/LASTPLAY.BIN", last_play_dir); sprintf(SELF_NAME, "SELF=%s", gamebin); sprintf(SELF_PATH, "PATH=%s", path); sprintf(SELF_USBP, "USBP=%i", patchmode); if(c_firmware==3.55f) sprintf(SELF_BOOT, "BOOT=%i", dboot+2); else sprintf(SELF_BOOT, "BOOT=%i", dboot); char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; FILE *fpA; remove(LASTGAME); fpA = fopen ( LASTGAME, "w" ); fputs (SELF_NAME, fpA );fputs ( CrLf, fpA ); fputs (SELF_PATH, fpA );fputs ( CrLf, fpA ); fputs (SELF_USBP, fpA );fputs ( CrLf, fpA ); fputs (SELF_BOOT, fpA );fputs ( CrLf, fpA ); fclose(fpA); flip(); // change_param_sfo_field( last_play_sfo, (char*)"TITLE", tname); flip(); // change_param_sfo_field( last_play_sfo, (char*)"TITLE_ID", tid); flip(); file_copy( org_param_sfo, last_play_sfo, 0); change_param_sfo_field( last_play_sfo, (char*)"CATEGORY", (char*)"HG"); cellMsgDialogAbort(); } void cache_png(char *path, char *title_id) { char src[512], dst[255], tmp1[512], tmp2[512]; if(strstr (title_id, "AVCHD")!=NULL || strstr (title_id,"NO_ID")!=NULL) sprintf(src, "%s/BOOT.PNG", app_usrdir); else sprintf(src, "%s", path); mkdir(cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); FILE *fpA; char raw_texture[512]; sprintf(raw_texture, "%s/%s_320.PNG", cache_dir, title_id); if(exist(raw_texture)) return; if(!(strstr (title_id, "AVCHD")!=NULL || strstr (title_id,"NO_ID")!=NULL)) { sprintf(tmp1, "%s", path); tmp1[strlen(tmp1)-9]=0; sprintf(tmp2, "%s/ICON0.PNG", tmp1); sprintf(dst, "%s/%s_320.PNG", cache_dir, title_id); file_copy((char *)tmp2, (char*)dst, 0); } memset(text_bmp, 0x50, FB(1)); if(strstr(path, "/pvd_usb")!=NULL) { sprintf(dst, "%s/%s_1920.PNG", cache_dir, title_id); file_copy((char *)src, (char*)dst, 0); if(strstr(src, "/PIC1.PNG")!=NULL && !exist(dst)) { src[strlen(src)-5]=0x30; file_copy((char *)src, (char*)dst, 0); } if(exist(dst) && strstr(src, "/PIC0.PNG")!=NULL) { load_texture( text_FONT, dst, 1000); put_texture( text_bmp, text_FONT, 1000, 560, 1000, 460, 260, 0, 0); } else load_texture( text_bmp, dst, 1920); //remove(dst); } else { if(strstr(src, "/PIC1.PNG")!=NULL && !exist(src)) { src[strlen(src)-5]=0x30; if(exist(src)) { load_texture( text_FONT, src, 1000); put_texture( text_bmp, text_FONT, 1000, 560, 1000, 460, 260, 0, 0); } else { src[strlen(src)-5]=0x32; if(exist(src)) { load_texture( text_bmp, src, 310); mip_texture( text_FONT, text_bmp, 310, 250, 2); //scale to 620x500 memset(text_bmp, 0x00, FB(1)); put_texture( text_bmp, text_FONT, 620, 500, 620, 650, 290, 0, 0); } else { // goto just_leave; sprintf(src, "%s/AVCHD.JPG", app_usrdir); load_texture( text_bmp, src, 1920); } } } else { if(exist(src)) { sprintf(dst, "%s/%s_1920.PNG", cache_dir, title_id); file_copy((char *)src, (char*)dst, 0); load_texture( text_bmp, dst, 1920); } else memset(text_bmp, 0x50, FB(1)); src[strlen(src)-5]=0x30; if(exist(src)) { // use_png_alpha=1; load_texture( text_FONT, src, 1000); put_texture_with_alpha( text_bmp, text_FONT, 1000, 560, 1000, 640, 380, 0, 0); } } } sprintf(raw_texture, "%s/%s_960.RAW", cache_dir, title_id); remove(raw_texture); /* if(stat(raw_texture, &s3)<0) { blur_texture(text_bmp, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); mip_texture( text_FONT, text_bmp, 1920, 1080, -2); //scale to 960x540 blur_texture(text_FONT, 960, 540, 0, 0, 960, 540, 90, 0, 1, 1); fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (960*540*4), 1, fpA); fclose(fpA); } */ sprintf(raw_texture, "%s/%s_640.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -3); //scale to 640x360 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (640*360*4), 1, fpA); fclose(fpA); } /* sprintf(raw_texture, "%s/%s_480.RAW", cache_dir, title_id); remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -4); //scale to 480x270 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (480*270*4), 1, fpA); fclose(fpA); */ sprintf(raw_texture, "%s/%s_320.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -6); //scale to 320x180 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (320*180*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_240.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -8); //scale to 240x135 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (240*135*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_160.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -12); //scale to 160x90 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (160*90*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_80.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -24); //scale to 80x45 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (80*45*4), 1, fpA); fclose(fpA); } //just_leave: return; } static void del_temp(char *path) { DIR *dir; char tr[512]; dir=opendir (path); if(!dir) return; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s/%s", path, entry->d_name); remove(tr); } } closedir(dir); return; } #if (CELL_SDK_VERSION>0x210001) static int my_game_test_pfsm(char *path, int to_abort) { PFS_HFIND dir; PFS_FIND_DATA entry; dir = PfsFileFindFirst(path, &entry); if (!dir) return -1; do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if ((entry.FileAttributes & PFS_FIND_DIR)) { char *d1f= (char *) malloc(512); if (!d1f) { PfsFileFindClose(dir); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; return -1; } sprintf(d1f, "%s/%s", path, entry.FileName); num_directories++; my_game_test_pfsm(d1f, to_abort); free(d1f); } else { PFS_HFILE fdr; uint64_t write_size; sprintf(d1, "%s/%s", path, entry.FileName); if(to_abort!=2){ if ((fdr = PfsFileOpen(d1)) == PFS_FILE_INVALID) { DPrintf("Error Opening (read):\n%s\n\n", d1); abort_copy = 1; PfsFileFindClose(dir); return -1; } PfsFileGetSizeFromHandle(fdr, &write_size); if(write_size>=0x100000000LL) {num_files_big++;} global_device_bytes += write_size; PfsFileClose(fdr); } file_counter++; int seconds= (int) (time(NULL)-time_start); if((seconds>10) && to_abort==1) {abort_copy=1; break;}//if(f) free(f); //file_counter>4000 || pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); return 0; } static int _my_game_copy_pfsm(char *path, char *path2) { PFS_HFIND dir; PFS_FIND_DATA entry; int seconds2=0; dir = PfsFileFindFirst(path, &entry); if (!dir) return -1; do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if ((entry.FileAttributes & PFS_FIND_DIR)) { char *d1f= (char *) malloc(512); char *d2f= (char *) malloc(512); if (!d1f || !d2f) { if (d1f) free(d1f); if (d2f) free(d2f); PfsFileFindClose(dir); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; return -1; } sprintf(d1f, "%s/%s", path, entry.FileName); sprintf(d2f, "%s/%s", path2, entry.FileName); mkdir(d2f, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); _my_game_copy_pfsm(d1f, d2f); free(d1f); free(d2f); } else { PFS_HFILE fdr; uint64_t write_size, write_end = 0; uint32_t size; int fdw; char *f1 = (char *) malloc(1024); char *f2 = (char *) malloc(1024); if (!f1 || !f2) { if (f1) free(f1); if (f2) free(f2); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; PfsFileFindClose(dir); return -1; } sprintf(f1, "%s/%s", path, entry.FileName); sprintf(f2, "%s/%s", path2, entry.FileName); char *string1 = (char *) malloc(1024); if (cellFsOpen(f2, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0, 0) != CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", f2); abort_copy = 1; free(f1); free(f2); free(string1); PfsFileFindClose(dir); return -1; } if ((fdr = PfsFileOpen(f1)) == PFS_FILE_INVALID) { DPrintf("Error Opening (read):\n%s\n\n", f1); abort_copy = 1; free(f1); free(f2); free(string1); cellFsClose(fdw); PfsFileFindClose(dir); return -1; } PfsFileGetSizeFromHandle(fdr, &write_size); file_counter++; DPrintf("Copying %s\n\n", f1); while (write_end < write_size) { if (PfsFileRead(fdr, buf2, BUF_SIZE2, &size) != 0) { DPrintf("Error Read:\n%s\n\n", f1); abort_copy = 1; } else if (cellFsWrite(fdw, buf2, size, NULL) != CELL_FS_SUCCEEDED) { DPrintf("Error Write:\n%s\n\n", f1); abort_copy = 1; } if (abort_copy) { free(f1); free(f2); cellFsClose(fdw); PfsFileClose(fdr); PfsFileFindClose(dir); free(string1); return -1; } pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } global_device_bytes += size; write_end += size; int seconds = (int) (time(NULL) - time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if(no_real_progress==1) { eta=(copy_file_counter-file_counter)/(file_counter/seconds); if( ( ((int)(file_counter*100ULL/copy_file_counter)) - lastINC2)>0) { lastINC2=(int) (file_counter*100ULL / copy_file_counter); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } else { if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); if(lastINC3>0 || (time(NULL)-seconds2)!=0 ) { if(no_real_progress==1) //sprintf(string1,"Copied %1.2f MB (file %i). Elapsed: %i %2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter, (seconds/60), seconds % 60); sprintf(string1,"Copied %.0f MB (%i of %i files). Elapsed: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter, copy_file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); flip(); } } cellFsClose(fdw); cellFsChmod(f2, CELL_FS_S_IFMT | 0777); PfsFileClose(fdr); free(f1); free(f2); free(string1); } if (abort_copy) break; pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); return 0; } int my_game_copy_pfsm(char *path, char *path2) { global_device_bytes=0x00ULL; lastINC=0, lastINC3=0, lastINC2=0; BUF_SIZE2=(MAX_FAST_FILES)*MAX_FAST_FILE_SIZE; buf2 = (u8*)memalign(128, BUF_SIZE2); _my_game_copy_pfsm(path, path2); free(buf2); return 0; } #endif static int _my_game_copy(char *path, char *path2) { DIR *dir; dir=opendir (path); if(!dir) {abort_copy=7;return -1;} while(1) { //if(to_reboot) {abort_copy=1; break;} struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { if(abort_copy) break; char *d1f= (char *) malloc(512); char *d2f= (char *) malloc(512); if(!d1f || !d2f) {if(d1f) free(d1f); if(d2f) free(d2f);closedir (dir);DPrintf("malloc() Error!!!\n\n");abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); sprintf(d2f,"%s/%s", path2, entry->d_name); mkdir(path2, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); mkdir(d2f, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); _my_game_copy(d1f, d2f); free(d1f);free(d2f); if(abort_copy) break; } else { // char *d1= (char *) malloc(512); // char *d2= (char *) malloc(512); sprintf(d1,"%s/%s", path, entry->d_name); sprintf(d2,"%s/%s", path2, entry->d_name); if(use_symlinks==1) { if(strstr(d1, "/dev_hdd0/game/")!=NULL && strstr(d2, "/dev_hdd0/G/")!=NULL) { if(strstr(entry->d_name, "MM_NPDRM_")!=NULL) { sprintf(d1, "%s", entry->d_name); sprintf(d2, "%s/%s", path2, d1+9); sprintf(d1, "%s/%s", path, entry->d_name); remove(d2); rename(d1, d2); } file_counter++; } else { if(strstr(entry->d_name, ".PNG")==NULL && strstr(entry->d_name, "ICON1")==NULL && strstr(entry->d_name, "PIC1")==NULL && strstr(entry->d_name, ".PAM")==NULL && strstr(entry->d_name, "SND0.AT3")==NULL && strstr(entry->d_name, "ICON0")==NULL && strstr(entry->d_name, "PIC0")==NULL) { // if(strstr(entry->d_name, "EBOOT.BIN")!=NULL) sprintf(d2,"%s/MM_EBOOT.BIN", path2); // else if(strstr(entry->d_name, ".self")!=NULL) sprintf(d2,"%s/MM_%s", path2, entry->d_name); if(strstr(entry->d_name, "EBOOT.BIN")==NULL && strstr(entry->d_name, ".SELF")==NULL && strstr(entry->d_name, ".self")==NULL && strstr(entry->d_name, ".SPRX")==NULL && strstr(entry->d_name, ".sprx")==NULL && strstr(entry->d_name, "PARAM.SFO")==NULL) { unlink(d2); remove(d2); link(d1, d2); } file_counter++; } else { if(fast_copy_add(path, path2, entry->d_name)<0) {abort_copy=666; closedir(dir);return -1;} } } } else { if(join_copy==0 || (join_copy==1 && strstr(entry->d_name, ".666")!=NULL)) { if(strstr(entry->d_name, ".66600")!=NULL && max_joined<10) { sprintf(file_to_join[max_joined].split_file, "%s/%s", path2, entry->d_name); file_to_join[max_joined].split_file[strlen(file_to_join[max_joined].split_file)-6]=0; max_joined++; } if(fast_copy_add(path, path2, entry->d_name)<0) {abort_copy=666; closedir(dir);return -1;}//free(d1);free(d2); } } // free(d1);free(d2); } if(abort_copy) break; } closedir(dir); if(abort_copy) return -1; return 0; } // test if files >= 4GB int my_game_test(char *path, int to_abort) { struct stat s3; #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled) { my_game_test_pfsm(path, to_abort); return 0; } #endif DIR *dir; if(abort_copy==1) return -1; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); num_directories++; if(!d1f) {closedir (dir);abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); my_game_test((char*)d1f, to_abort); free(d1f); if(abort_copy) break; } else { // char *f= (char *) malloc(512); // struct stat s; // off64_t size=0LL; // if(!f) {abort_copy=2;closedir (dir);return -1;} sprintf(df,"%s/%s", path, entry->d_name); if(strlen(entry->d_name)>6 && to_abort!=3) { char *p= df; p+= strlen(df)-6; // adjust for .666xx if(p[0]== '.' && p[1]== '6' && p[2]== '6' && p[3]== '6') { num_files_split++; if(p[4]=='0' && p[5]=='0') num_files_big++; if(to_abort==2 || join_copy==1) { if(stat(df, &s3)>=0) { if(s3.st_size>=0x100000000LL) num_files_big++; global_device_bytes+=s3.st_size; } if(strstr(df, ".66600")!=NULL && join_copy==1 && max_joined<10) { sprintf(file_to_join[max_joined].split_file, "%s", df); file_to_join[max_joined].split_file[strlen(file_to_join[max_joined].split_file)-6]=0; max_joined++; //abort_copy=1; break; } if(to_abort==2 && join_copy==0) {abort_copy=1; break;} } } } if(to_abort!=2 && to_abort!=3 && join_copy==0){ if(stat(df, &s3)<0) {abort_copy=3;break;}//if(f) free(f);break;} if(s3.st_size>=0x100000000LL) num_files_big++; global_device_bytes+=s3.st_size; } file_counter++; int seconds= (int) (time(NULL)-time_start); if((seconds>10) && to_abort==1) {abort_copy=1; break;}//if(f) free(f); //file_counter>4000 || pad_read(); if (new_pad & BUTTON_TRIANGLE) abort_copy=1; if(abort_copy) break; } } closedir (dir); return 0; } int my_game_copy(char *path, char *path2) { int ret3, flipF; disable_sc36(); char string1[1024]; if(progress_bar==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Verifying source data, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); } else { for(flipF = 0; flipF<60; flipF++) { sprintf(string1, "Preparing, please wait!");ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } } file_counter=0; global_device_bytes=0ULL;abort_copy=0; #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled) { my_game_test_pfsm(path, 1); if(abort_copy==1) { abort_copy=0; file_counter=0; my_game_test_pfsm(path, 2); abort_copy=1; } } else #endif { abort_copy=0; if(strstr(path,"/dev_hdd0")!=NULL) my_game_test(path, 0); else { max_joined=0; time_start= time(NULL); my_game_test(path, 1); if(abort_copy==1) { abort_copy=0; file_counter=0; max_joined=0; time_start= time(NULL); my_game_test(path, 3); abort_copy=1; } } } if(progress_bar==1) cellMsgDialogAbort(); char just_drive[16]; just_drive[0]=0; char *pathpos=strchr(path2+1,'/'); if(pathpos!=NULL) { strncpy(just_drive, path2, 15); just_drive[pathpos-path2]=0; } else sprintf(just_drive, "%s", path2); cellFsGetFreeSize(just_drive, &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); if((uint64_t)global_device_bytes>(uint64_t)freeSpace && use_symlinks!=1 && freeSpace!=0) { sprintf(string1, (const char*) STR_ERR_NOSPACE1, (double) ((freeSpace)/1048576.00f), (double) ((global_device_bytes-freeSpace)/1048576.00f) ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); abort_copy=1; goto return_error; } copy_file_counter=file_counter; if(copy_file_counter==0) copy_file_counter=1; file_counter=0; copy_global_bytes=global_device_bytes; lastINC=0; lastINC3=0; lastINC2=0; if(join_copy==1) sprintf(string1, "%s", STR_COPY3); else { if(abort_copy==1) sprintf(string1, (const char*) STR_COPY1, copy_file_counter); else { if(use_symlinks==1) sprintf(string1, (const char*) STR_COPY2, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); else sprintf(string1, (const char*)STR_COPY0, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); } } if(progress_bar==1) // && abort_copy==0 { ret3=cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flipc(60); } no_real_progress=0; if(abort_copy==1) no_real_progress=1; abort_copy=0; global_device_bytes=0; time_start= time(NULL); #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled){ my_game_copy_pfsm(path, path2); } else #endif { if(fast_copy_async(path, path2, 1)<0) {abort_copy=665;goto return_error;}//ret3=cellMsgDialogAbort(); int ret=_my_game_copy(path, path2); int ret2= fast_copy_process(); fast_copy_async(path, path2, 0); if(ret<0 || ret2<0) goto return_error; } join_copy=0; if(progress_bar==1) cellMsgDialogClose(60.0f);//cellMsgDialogAbort(); enable_sc36(); flip(); return 0; return_error: join_copy=0; if(progress_bar==1) cellMsgDialogClose(60.0f); //cellMsgDialogAbort(); enable_sc36(); flip(); return -1; } int my_game_delete(char *path) { DIR *dir; // char *f= NULL; char string1[1024]; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *f= (char *) malloc(512); if(!f) {closedir (dir);DPrintf("malloc() Error!!!\n\n");abort_copy=2;return -1;} sprintf(f,"%s/%s", path, entry->d_name); my_game_delete(f); // DPrintf("Deleting <%s>\n\n", path); if(rmdir(f)) {abort_copy=3;DPrintf("Delete error!\n -> <%s>\n\n", entry->d_name);}//break; if(d1) free(d1); free(f); if(abort_copy) break; file_counter--; goto display_message; } else { // f=(char *) malloc(512); // if(!f) {DPrintf("malloc() Error!!!\n\n");abort_copy=2;closedir (dir);return -1;} sprintf(df,"%s/%s", path, entry->d_name); remove(df);//if(remove(f)) {abort_copy=3;DPrintf("Delete error!\n -> %s\n\n", f);break;} //if(f) free(f); // free(f); // DPrintf("Deleted: %s\n\n", f); // if(f) free(f); display_message: int seconds= (int) (time(NULL)-time_start); file_counter++; if(file_counter % 32==0) { sprintf(string1,"Deleting files: %i [Elapsed: %2.2i:%2.2i:%2.2i]\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60); ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x200020ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); } pad_read(); if (new_pad & BUTTON_TRIANGLE) abort_copy=1; if(abort_copy) break; } } closedir (dir); return 0; } static int _copy_nr(char *path, char *path2, char *path_name) { DIR *dir; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { if(abort_copy) break; char *f= (char *) malloc(512); if(!d1) {closedir (dir); abort_copy=2; return -1;} sprintf(f,"%s/%s", path, entry->d_name); _copy_nr(f, path2, path_name); free(f); if(abort_copy) break; } else { int seconds2= (int) (time(NULL)); char rdr[255], pathTO[512]; int fs; int fd; uint64_t fsiz = 0; uint64_t msiz = 0; sprintf(rdr, "%s/%s", path, entry->d_name); sprintf(pathTO, "%s/%s", path2, entry->d_name); cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); uint64_t chunk = 16*1024; if(msiz<chunk && msiz>0) chunk=msiz; if(msiz<1) continue; char w[chunk]; uint64_t written=0; cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); remove(pathTO); abort_copy=0; lastINC3=0; lastINC=lastINC2; cellFsOpen(pathTO, CELL_FS_O_CREAT|CELL_FS_O_RDWR|CELL_FS_O_APPEND, &fd, NULL, 0); char *string1= (char *) malloc(512); while(fsiz < msiz && abort_copy==0) { if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz); char x[chunk]; cellFsLseek(fs,fsiz,CELL_FS_SEEK_SET, NULL); if(cellFsRead(fs, (void *)x, chunk, NULL)!=CELL_FS_SUCCEEDED) {abort_copy=1;break;} else { if(cellFsWrite(fd, (const void *)x, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} global_device_bytes+=chunk; break; } } else { cellFsLseek(fs,fsiz,CELL_FS_SEEK_SET, NULL); if(cellFsRead(fs, (void *)w, chunk, NULL)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(cellFsWrite(fd, (const void *)w, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} fsiz = fsiz + chunk; global_device_bytes+=chunk; } int seconds= (int) (time(NULL)-time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } if(lastINC3>0 || (time(NULL)-seconds2)!=0 ) { if(no_real_progress==1) sprintf(string1,"Copied %1.2fMB. Elapsed time: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), (seconds/60), seconds % 60); else sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); cellDbgFontDrawGcm(); flip(); seconds2= (int) (time(NULL)); } pad_read(); if ( old_pad & BUTTON_TRIANGLE || new_pad & BUTTON_CIRCLE) {abort_copy=1; new_pad=0; old_pad=0; break;} } free(string1); cellFsClose(fd); cellFsClose(fs); cellFsChmod(pathTO, 0666); if(abort_copy) break; } } closedir(dir); if(abort_copy) return -1; return 0; } int copy_nr(char *path, char *path_new, char *path_name) // recursive to single folder copy { int ret3; char path2[512]; char string1[1024]; if(strstr(path_new,"/ps3_home/video")!=NULL || strstr(path_new,"/ps3_home/music")!=NULL || strstr(path_new,"/ps3_home/photo")!=NULL) { sprintf(path2, "%s", app_temp); del_temp(app_temp); } else sprintf(path2, "%s", path_new); sprintf(string1, "Preparing, please wait!"); ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); file_counter=0; global_device_bytes=0;abort_copy=0; if(strstr(path,"/dev_hdd0")!=NULL) my_game_test(path, 0); else my_game_test(path, 1); copy_file_counter=file_counter; copy_global_bytes=global_device_bytes; lastINC=0; lastINC3=0; lastINC2=0; if(abort_copy==1) sprintf(string1, (const char*)STR_COPY4, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); else sprintf(string1, (const char*)STR_COPY0, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); ret3=cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); no_real_progress=0; if(abort_copy==1) no_real_progress=1; abort_copy=0; global_device_bytes=0; lastINC=0; lastINC3=0; lastINC2=0; time_start= time(NULL); file_counter=0; _copy_nr((char*)path, (char*)path2, (char*)path_name); ret3=cellMsgDialogAbort(); flip(); if(strstr(path_new, "/ps3_home")!=NULL) { DIR *dir; char tr[512]; int n=0; for (n=0;n<256;n++ ) { dir=opendir (app_temp); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s", entry->d_name); cellDbgFontDrawGcm(); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); if((strstr(tr, ".avi")!=NULL || strstr(tr, ".AVI")!=NULL || strstr(tr, ".m2ts")!=NULL || strstr(tr, ".M2TS")!=NULL || strstr(tr, ".mts")!=NULL || strstr(tr, ".MTS")!=NULL || strstr(tr, ".m2t")!=NULL || strstr(tr, ".M2T")!=NULL || strstr(tr, ".divx")!=NULL || strstr(tr, ".DIVX")!=NULL || strstr(tr, ".mpg")!=NULL || strstr(tr, ".MPG")!=NULL || strstr(tr, ".mpeg")!=NULL || strstr(tr, ".MPEG")!=NULL || strstr(tr, ".mp4")!=NULL || strstr(tr, ".MP4")!=NULL || strstr(tr, ".vob")!=NULL || strstr(tr, ".VOB")!=NULL || strstr(tr, ".wmv")!=NULL || strstr(tr, ".WMV")!=NULL || strstr(tr, ".ts")!=NULL || strstr(tr, ".TS")!=NULL || strstr(tr, ".mov")!=NULL || strstr(tr, ".MOV")!=NULL) ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to video library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); video_export(tr, path_name, 0); } if(strstr(tr, ".mp3")!=NULL || strstr(tr, ".MP3")!=NULL || strstr(tr, ".wav")!=NULL || strstr(tr, ".WAV")!=NULL || strstr(tr, ".aac")!=NULL || strstr(tr, ".AAC")!=NULL) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to music library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); music_export(tr, path_name, 0); } if(strstr(tr, ".jpg")!=NULL || strstr(tr, ".JPG")!=NULL || strstr(tr, ".jpeg")!=NULL || strstr(tr, ".JPEG")!=NULL || strstr(tr, ".png")!=NULL || strstr(tr, ".PNG")!=NULL) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to photo library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); photo_export(tr, path_name, 0); } sprintf(tr, "%s/%s", app_temp, entry->d_name); if(exist(tr)) remove(tr); } } closedir(dir); } video_finalize(); music_finalize(); photo_finalize(); del_temp(app_temp); } return 0; } void open_osk(int for_what, char *init_text) { char orig[512]; if(for_what==1) sprintf(orig, (const char*) STR_RENAMETO, init_text); if(for_what==2) sprintf(orig, "%s", (const char*) STR_CREATENEW); if(for_what==3) sprintf(orig, "%s", init_text); if(for_what==4) sprintf(orig, "%s", init_text); wchar_t my_message[((strlen(orig) + 1)*2)]; mbstowcs(my_message, orig, (strlen(orig) + 1)); wchar_t INIT_TEXT[((strlen(init_text) + 1)*2)]; mbstowcs(INIT_TEXT, init_text, (strlen(init_text) + 1)); if(for_what==2 || for_what==3) INIT_TEXT[0]=0; inputFieldInfo.message = (uint16_t*)my_message; inputFieldInfo.init_text = (uint16_t*)INIT_TEXT; inputFieldInfo.limit_length = 128; CellOskDialogPoint pos; pos.x = 0.0; pos.y = 0.5; int32_t LayoutMode = CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER; CellOskDialogParam dialogParam; if(for_what==3) { inputFieldInfo.limit_length = 4; cellOskDialogSetKeyLayoutOption (CELL_OSKDIALOG_10KEY_PANEL); cellOskDialogAddSupportLanguage (CELL_OSKDIALOG_PANELMODE_PASSWORD | CELL_OSKDIALOG_PANELMODE_NUMERAL); dialogParam.allowOskPanelFlg = ( CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_PASSWORD); dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_NUMERAL; } else { cellOskDialogSetKeyLayoutOption (CELL_OSKDIALOG_10KEY_PANEL | CELL_OSKDIALOG_FULLKEY_PANEL); cellOskDialogAddSupportLanguage (CELL_OSKDIALOG_PANELMODE_ALPHABET | CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_ENGLISH | CELL_OSKDIALOG_PANELMODE_DEFAULT | CELL_OSKDIALOG_PANELMODE_SPANISH | CELL_OSKDIALOG_PANELMODE_FRENCH | CELL_OSKDIALOG_PANELMODE_RUSSIAN | CELL_OSKDIALOG_PANELMODE_JAPANESE | CELL_OSKDIALOG_PANELMODE_CHINA_TRADITIONAL); dialogParam.allowOskPanelFlg = (CELL_OSKDIALOG_PANELMODE_ALPHABET | CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_ENGLISH | CELL_OSKDIALOG_PANELMODE_DEFAULT | CELL_OSKDIALOG_PANELMODE_SPANISH | CELL_OSKDIALOG_PANELMODE_FRENCH | CELL_OSKDIALOG_PANELMODE_RUSSIAN | CELL_OSKDIALOG_PANELMODE_JAPANESE | CELL_OSKDIALOG_PANELMODE_CHINA_TRADITIONAL); dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ALPHABET_FULL_WIDTH; } cellOskDialogSetLayoutMode( LayoutMode ); dialogParam.controlPoint = pos; dialogParam.prohibitFlgs = CELL_OSKDIALOG_NO_RETURN; cellOskDialogSetInitialInputDevice(CELL_OSKDIALOG_INPUT_DEVICE_PAD ); osk_dialog=0; cellOskDialogLoadAsync(memory_container, &dialogParam, &inputFieldInfo); osk_open=for_what; }; //register photo void cb_export_finish_p( int result, void *userdata) //export callback { // int callback_type = (int)userdata; (void) userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); pe_result = result; sys_timer_usleep (1000 * 1000); } void cb_export_finish2_p( int result, void *userdata) { pe_result = result; (void) userdata; } int photo_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(pe_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_PHOTO_EXPORT); ret = cellPhotoExportInitialize( CELL_PHOTO_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2_p, (void*)callback_type ); return ret; } int photo_register( int callback_type, char* filenape_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filenape_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filenape_v); char filenape_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "PEXPORT.ext"); temp_vf0[10]=filenape_v[fnl-1]; temp_vf0[ 9]=filenape_v[fnl-2]; temp_vf0[ 8]=filenape_v[fnl-3]; temp_vf0[ 7]=filenape_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filenape_v); rename(temp_vf2, temp_vf); CellPhotoExportSetParam param; sprintf(filenape_v2, "%s", filenape_v); filenape_v2[128]=0; char *pch=filenape_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filenape_v2[pathpos-pch]=0; //remove extension param.photo_title = (char*)filenape_v2; param.game_title = (char*)album; param.game_comment = (char*)"Transferred by multiMAN"; param.reserved = NULL; ret = cellPhotoExportFromFile( app_temp, temp_vf0,//filenape_v &param, cb_export_finish2_p, (void*)callback_type ); return ret; } int photo_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(pe_initialized==1) ret = cellPhotoExportFinalize( cb_export_finish_p, (void*)callback_type ); pe_initialized=0; return ret; } void photo_export( char *filenape_v, char *album, int to_unregister ) { int ret = 0; pe_result = 0xDEAD; if(pe_initialized==0) { ret = photo_initialize(); while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; } if(pe_result != CELL_PHOTO_EXPORT_UTIL_RET_CANCEL) pe_initialized=1; } if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_OK || pe_result==0 || pe_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; pe_result = 0xDEAD; ret = photo_register(callback_type1, filenape_v, album); // else { while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { pe_result = 0xDEAD; ret = photo_finalize(); while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; sys_timer_usleep (50 * 1000); // flip(); } } } } //register music void cb_export_finish_m( int result, void *userdata) //export callback { // int callback_type = (int)userdata; (void) userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); me_result = result; sys_timer_usleep (1000 * 1000); } void cb_export_finish2_m( int result, void *userdata) { me_result = result; (void) userdata; } int music_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(me_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_MUSIC_EXPORT); ret = cellMusicExportInitialize( CELL_MUSIC_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2_m, (void*)callback_type ); return ret; } int music_register( int callback_type, char* filename_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filename_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filename_v); char filename_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "MEXPORT.ext"); temp_vf0[10]=filename_v[fnl-1]; temp_vf0[ 9]=filename_v[fnl-2]; temp_vf0[ 8]=filename_v[fnl-3]; temp_vf0[ 7]=filename_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filename_v); rename(temp_vf2, temp_vf); // sprintf(filename, "REGISTER INIT [%s] [%s]", temp_vf, temp_vf0 ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); CellMusicExportSetParam param; sprintf(filename_v2, "%s", filename_v); filename_v2[128]=0; char *pch=filename_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filename_v2[pathpos-pch]=0; //remove extension /* for(ret = 0; ret<fnl; ret++) { if(filename_v[ret]==0x2e) filename_v2[ret]=0x20; else filename_v2[ret]=filename_v[ret]; if(filename_v2[ret]==0x20) filename_v2[ret]=0x5f; filename_v2[ret+1]=0; } filename_v2[fnl]=0; */ param.title = (char*)filename_v2;//(char*)"Test music sample"; param.artist = NULL; param.genre = NULL; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; //#if (CELL_SDK_VERSION<=0x210001) param.reserved1 = NULL; //#else // param.editable = 1; //#endif param.reserved2 = NULL; ret = cellMusicExportFromFile( app_temp, temp_vf0,//filename_v &param, cb_export_finish2_m, (void*)callback_type ); // sprintf(filename, "REGISTER INITATED [%i]", ret ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); /* if( ret != CELL_MUSIC_EXPORT_UTIL_RET_OK && ret != CELL_OK) { ret = sys_memory_container_destroy( memory_container ); }*/ return ret; } int music_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(me_initialized==1) ret = cellMusicExportFinalize( cb_export_finish_m, (void*)callback_type ); me_initialized=0; return ret; } void music_export( char *filename_v, char *album, int to_unregister ) { int ret = 0; me_result = 0xDEAD; if(me_initialized==0) { ret = music_initialize(); while (1) { cellSysutilCheckCallback(); sys_timer_usleep (500 * 1000); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; } if(me_result != CELL_MUSIC_EXPORT_UTIL_RET_CANCEL) me_initialized=1; } if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_OK || me_result==0 || me_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; me_result = 0xDEAD; ret = music_register(callback_type1, filename_v, album); // else { while (1) { cellSysutilCheckCallback(); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { me_result = 0xDEAD; ret = music_finalize(); while (1) { cellSysutilCheckCallback(); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; sys_timer_usleep (50 * 1000); // flip(); } } } } //register video void cb_export_finish( int result, void *userdata) //export callback { int callback_type = (int)userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); ve_result = result; sys_timer_usleep (1000 * 1000); switch(result) { case CELL_VIDEO_EXPORT_UTIL_RET_OK: break; case CELL_VIDEO_EXPORT_UTIL_RET_CANCEL: // ret = sys_memory_container_destroy( memory_container ); break; default: break; } if( callback_type == CALLBACK_TYPE_FINALIZE ) { // ret = sys_memory_container_destroy( memory_container ); } } void cb_export_finish2( int result, void *userdata) { ve_result = result; (void) userdata; } int video_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(ve_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_VIDEO_EXPORT); ret = cellVideoExportInitialize( CELL_VIDEO_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2, (void*)callback_type ); // if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK ) { // sys_memory_container_destroy( memory_container ); // } return ret; } int video_register( int callback_type, char* filename_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filename_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filename_v); char filename_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "VEXPOR..ext"); temp_vf0[10]=filename_v[fnl-1]; temp_vf0[ 9]=filename_v[fnl-2]; temp_vf0[ 8]=filename_v[fnl-3]; temp_vf0[ 7]=filename_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filename_v); rename(temp_vf2, temp_vf); // sprintf(filename, "REGISTER INIT [%s] [%s]", temp_vf, temp_vf0 ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); CellVideoExportSetParam param; sprintf(filename_v2, "%s", filename_v); filename_v2[128]=0; char *pch=filename_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filename_v2[pathpos-pch]=0; //remove extension /* for(ret = 0; ret<fnl; ret++) { if(filename_v[ret]==0x2e) filename_v2[ret]=0x20; else filename_v2[ret]=filename_v[ret]; if(filename_v2[ret]==0x20) filename_v2[ret]=0x5f; filename_v2[ret+1]=0; } filename_v2[fnl]=0; */ param.title = (char*)filename_v2;//(char*)"Test video sample"; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; #if (CELL_SDK_VERSION<=0x210001) param.reserved1 = NULL; #else param.editable = 1; #endif param.reserved2 = NULL; /* param.title = (char*)filename_v;//(char*)"Test video sample"; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; param.editable = 0; param.reserved2 = NULL; */ ret = cellVideoExportFromFile( app_temp, temp_vf0,//filename_v &param, cb_export_finish2, (void*)callback_type ); // sprintf(filename, "REGISTER INITATED [%i]", ret ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); /* if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK && ret != CELL_OK) { ret = sys_memory_container_destroy( memory_container ); }*/ return ret; } int video_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(ve_initialized==1) ret = cellVideoExportFinalize( cb_export_finish, (void*)callback_type ); ve_initialized=0; // if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK ) // { // ret = sys_memory_container_destroy( memory_container ); // } return ret; } void video_export( char *filename_v, char *album, int to_unregister ) { int ret = 0; ve_result = 0xDEAD; if(ve_initialized==0) { ret = video_initialize(); while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); } if(ve_result != CELL_VIDEO_EXPORT_UTIL_RET_CANCEL) ve_initialized=1; } if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_OK || ve_result==0 || ve_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; ve_result = 0xDEAD; ret = video_register(callback_type1, filename_v, album); // sys_timer_usleep (2 * 1000 * 1000); //2sec wait // if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_OK) // ret = video_finalize(); // else { while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { ve_result = 0xDEAD; ret = video_finalize(); while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); } } } } //MP3 void set_channel_vol(int Channel, float vol, float vol2) { cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FL, CELL_MS_CHANNEL_0, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FR, CELL_MS_CHANNEL_1, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FC, CELL_MS_CHANNEL_0, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_RL, CELL_MS_CHANNEL_0, vol-vol2); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_RR, CELL_MS_CHANNEL_1, vol-vol2); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_LFE, CELL_MS_CHANNEL_1, vol2); } void stop_audio(float attn) { while(audio_sub_proc); audio_sub_proc=true; if(mm_is_playing) { if(attn) // attentuate softly { for(float vstep=0; vstep<(attn*30); vstep++) { set_channel_vol(nChannel, mp3_volume-(mp3_volume/(attn*30))*vstep, 0); sys_timer_usleep(3336); } } cellMSStreamClose(nChannel); cellMSCoreStop(nChannel, 0); } mm_is_playing=false; audio_sub_proc=false; xmb_info_drawn=0; } void stop_mp3(float _attn) { stop_audio(_attn); current_mp3=0; max_mp3=0; xmb_info_drawn=0; } void prev_mp3() { if(max_mp3!=0){ current_mp3--; if(current_mp3==0) current_mp3=max_mp3; main_mp3((char*) mp3_playlist[current_mp3].path); } xmb_info_drawn=0; } void next_mp3() { if(max_mp3!=0){ current_mp3++; if(current_mp3>max_mp3 || current_mp3>=MAX_MP3) current_mp3=1; main_mp3((char*) mp3_playlist[current_mp3].path); } xmb_info_drawn=0; } sys_ppu_thread_t ms_thread; static void MS_update_thread(uint64_t param) { (void)param; while(!mm_shutdown) { sys_timer_usleep(50); if(mm_is_playing && update_ms) cellMSSystemSignalSPU(); cellMSSystemGenerateCallbacks(); //sprintf(status_info, "%i", (int)time(NULL)); } cellAudioPortStop(portNum); sys_ppu_thread_exit(0); } int StartMultiStream() { float fBusVols[64] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; InitialiseAudio(MAX_STREAMS, MAX_SUBS, portNum, audioParam, portConfig); sizeNeeded=cellMSMP3GetNeededMemorySize(4); // Maximum 256 mono MP3's playing at one time mp3Memory=(int*)malloc(sizeNeeded); if(mp3Memory==NULL) return -1; if((cellMSMP3Init(4, (void*)mp3Memory)) != 0 ) return -1; cellMSCoreSetVolume64(CELL_MS_BUS_FLAG | 1, CELL_MS_WET, fBusVols); cellMSCoreSetVolume64(CELL_MS_MASTER_BUS, CELL_MS_DRY, fBusVols); cellMSSystemConfigureLibAudio(&audioParam, &portConfig); cellAudioPortStart(portNum); sys_ppu_thread_create(&ms_thread, MS_update_thread, NULL, 50, 0x4000, 0, "MultiStream PU Thread"); (void) cellMSSystemSetGlobalCallbackFunc(mp3_callback); return 1; } /********************************************************************************** Starts the streaming of the passed sample data as a one shot sfx. nFrequency Required playback frequency (in Hz) Returns: nChannel Stream channel number **********************************************************************************/ long TriggerStream(const long nFrequency) { CellMSInfo MS_Info; MS_Info.SubBusGroup = CELL_MS_MASTER_BUS; MS_Info.FirstBuffer = pDataB; //64KB buffer split in two 32KB chunks MS_Info.FirstBufferSize = KB(MP3_BUF); MS_Info.SecondBuffer = pDataB+KB(MP3_BUF); MS_Info.SecondBufferSize = KB(MP3_BUF); // Set pitch and number of channels MS_Info.Pitch = nFrequency; MS_Info.numChannels = 2; MS_Info.flags = 0; // Initial delay (in samples) before playback starts. Allows for sample accurate playback MS_Info.initialOffset = 0; MS_Info.inputType = CELL_MS_MP3; int nCh = cellMSStreamOpen(); cellMSCoreInit(nCh); cellMSStreamSetInfo(nCh, &MS_Info); cellMSStreamPlay(nCh); return nCh; } int LoadMP3(const char *mp3filename, int *_mp3_freq, float skip) { unsigned int tSize=0; // total size float tTime=0; // total time (void) skip; CellMSMP3FrameHeader Hdr; pData=pDataB; if(force_mp3_fd!=-1) cellFsClose(force_mp3_fd); if(CELL_FS_SUCCEEDED!=cellFsOpen (mp3filename, CELL_FS_O_RDONLY, &force_mp3_fd, NULL, 0)) return -1; cellFsLseek(force_mp3_fd, 0, CELL_FS_SEEK_END, &force_mp3_size); cellFsLseek(force_mp3_fd, 0, CELL_FS_SEEK_SET, &force_mp3_offset); if(CELL_FS_SUCCEEDED!=cellFsRead(force_mp3_fd, pDataB, (force_mp3_size<_mp3_buffer?force_mp3_size:_mp3_buffer), &force_mp3_offset)) { force_mp3_offset=0; force_mp3_size=0; cellFsClose (force_mp3_fd); force_mp3_fd=-1; return -1; } if(!force_mp3_offset) force_mp3_offset=_mp3_buffer; pData=pDataB; while(1) { if(-1==cellMSMP3GetFrameInfo(pData,&Hdr)) return (-1); // Invalid MP3 header tSize+=Hdr.PacketSize; // Update total file size if ((Hdr.ID3==0)&&(Hdr.Tag==0)) tTime+=Hdr.PacketTime; // Update total playing time (in seconds) pData+=Hdr.PacketSize; // Move forward to next packet if (tSize>=_mp3_buffer || tSize>=force_mp3_size) { *_mp3_freq=Hdr.Frequency; mp3_durr=(int)tTime; mp3_packet=Hdr.PacketSize; mp3_packet_time=Hdr.PacketTime+0.001f; return 1; } } } //sprintf(mp3_now_playing,"%d Hz, (%imin %2.2isec) [%s]", Hdr.Frequency, ((int) tTime / 60), ((int) tTime % 60), mp3filename); // ** Display packet information ** // Using the packet size and packet time information, it is possible to build "Seek Tables". // Then, by knowing approximately what time (in seconds) you require to playback from, // you can start playback from the closest data packet by searching for the closest record in the table. /* if (Hdr.ID3!=0) { printf("Found ID3 Info\n"); printf("Version: %x.%x\n",Hdr.ID3>>8, Hdr.ID3&255); } else if (Hdr.Tag!=0) { printf("Found Tag info\n"); } else { printf("Sync: 0x%x\n",Hdr.Sync); printf("ID: 0x%x\n",Hdr.ID); printf("Layer: 0x%x\n",Hdr.Layer); printf("ProtBit: 0x%x\n",Hdr.ProtBit); printf("BitRate: %d\n",Hdr.BitRate); printf("Frequency: %d\n",Hdr.Frequency); printf("PadBit: 0x%x\n",Hdr.PadBit); printf("PrivBit: 0x%x\n",Hdr.PrivBit); printf("Mode: 0x%x\n",Hdr.Mode); printf("Copy: 0x%x\n",Hdr.Copy); printf("Home: 0x%x\n",Hdr.Home); printf("Emphasis: 0x%x\n",Hdr.Emphesis); printf("Packet Time (secs): %f\n",Hdr.PacketTime); } */ //printf("Packet Size (bytes): 0x%x\n",Hdr.PacketSize); void main_mp3( char *temp_mp3) { if(force_mp3_fd!=-1) cellFsClose (force_mp3_fd); force_mp3_fd=-1; sprintf(force_mp3_file, "%s", temp_mp3); force_mp3=true; is_theme_playing=false; if(strstr(temp_mp3, "SOUND.BIN")!=NULL) { is_theme_playing=true; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", temp_mp3); } } int main_mp3_th( char *temp_mp3, float skip) { char my_mp3[1024]; sprintf (my_mp3, "%s", temp_mp3); if(strstr(my_mp3, "/pvd_usb")!=NULL) { sprintf(my_mp3, "%s/TEMP/MUSIC.TMP", app_usrdir); file_copy(temp_mp3, my_mp3, 0); } mp3_freq=44100; stop_audio(5); update_ms=false; memset(pDataB, 0, _mp3_buffer); if(1 == LoadMP3((char*) my_mp3, &mp3_freq, skip)) { nChannel = TriggerStream(mp3_freq); mm_is_playing=true; update_ms=true; float attn=5.0f; for(float vstep=(attn*20); vstep>0; vstep--) { set_channel_vol(nChannel, mp3_volume-(mp3_volume/(attn*20))*vstep, 0); sys_timer_usleep(3336); } set_channel_vol(nChannel, mp3_volume, 0.1f); return 1; } else mp3_skip=0.0f; //if(cellMSStreamGetStatus(nChannel)==CELL_MS_STREAM_OFF); return 0; } int readmem(unsigned char *_x, uint64_t _fsiz, uint64_t _chunk) //read lv2 memory chunk { uint64_t n, m; uint64_t val; for(n = 0; n < _chunk; n += 8) { if((_fsiz + n)>0x7ffff8ULL) return (int)(n-8); val = peekq(0x8000000000000000ULL + _fsiz + n); for(m = 0; m<8; m++) { _x[n+7-m] = (unsigned char) ((val >> (m*8)) & 0x00000000000000ffULL); } } return _chunk; } //replacemem( 0x6170705F686F6D65UUL, 0x6465765F62647664UUL); //app_home -> dev_bdvd /*void replacemem(uint64_t _val_search1, uint64_t _val_replace1) { uint64_t n; for(n = 0; n < 0x7ffff8ULL; n ++) { if( peekq(0x8000000000000000ULL + n) == _val_search1 ) { pokeq(0x8000000000000000ULL + n, _val_replace1); n+=8; } } return; } */ int mod_mount_table(const char *new_path, int _mode) //mode 0/1 = reset/change { if(c_firmware!=3.41f && c_firmware!=3.55f && c_firmware!=3.15f) return 0; uint64_t dev_table; // mount table vector uint64_t c_addr; if(c_firmware==3.15f) dev_table=peekq(0x80000000002ED750ULL); if(c_firmware==3.41f) dev_table=peekq(0x80000000002EDEF0ULL); if(c_firmware==3.55f) dev_table=peekq(0x80000000002DFC60ULL); int dev_table_len = 0x1400, n=0, found=0; uint64_t dev_bdvd_val=0x6465765F62647664ULL; // dev_bdvd uint64_t tmp_bdvd_val=0x746D705F62647664ULL; // tmp_bdvd uint64_t bdvd_val =0x765F626476640000ULL; // v_bdvd // uint64_t host_root_val0=0x686F73745F726F6FULL; // host_roo // uint64_t host_root_val1=0x7400000000000000ULL; // t // uint64_t app_home_val=0x6170705F686F6D65ULL; // app_home uint64_t dev_usb0_val_0=0x6465765F75736230ULL; // dev_usb000 uint64_t dev_usb0_val_1=0x0000000000000000ULL; if(_mode==0) //reset mount table { for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if(peekq( c_addr ) == tmp_bdvd_val) { pokeq( c_addr, dev_bdvd_val ); //restore dev_bdvd n+=8; found=1; } else if(peekq( c_addr ) == dev_bdvd_val && peekq ( c_addr + 16 ) == dev_usb0_val_0) { pokeq( c_addr , peekq ( c_addr + 16 ) ); //restore dev_usb pokeq( c_addr + 8, peekq ( c_addr + 24 ) ); pokeq( c_addr + 16, 0x00ULL ); //Clear dev_usb backup string pokeq( c_addr + 24, 0x00ULL ); n+=32; found=1; } /* else if(peekq( c_addr ) == dev_bdvd_val && peekq ( c_addr + 16 ) == app_home_val) { pokeq( c_addr , app_home_val ); //restore app_home pokeq( c_addr + 16, 0x00ULL); n+=24; found=1; } */ //else if(peekq( c_addr ) == dev_bdvd_val) found=1; } return 1;//found; } if(_mode==1) //change mount table { unsigned char v1, v2; v1 = new_path[9]; v2 = new_path[10]; dev_usb0_val_1 = 0x0000000000000000ULL | ( ((uint64_t) v1 ) << 56 ) | ( (uint64_t) v2 << 48 ); for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if( (peekq( c_addr ) == dev_usb0_val_0) && (peekq( c_addr + 8ULL ) == dev_usb0_val_1)) { pokeq( c_addr + 2ULL, bdvd_val ); //change v_usb00x to v_bdvd pokeq( c_addr + 16ULL, dev_usb0_val_0 ); // and backup dev_usb pokeq( c_addr + 24ULL, dev_usb0_val_1 ); // for later restore n+=32; if(peekq( c_addr + 2ULL) != bdvd_val ) found=0; else found=1; } else if(peekq( c_addr ) == dev_bdvd_val) { pokeq( c_addr , tmp_bdvd_val ); // map dev_bdvd to tmp_bdvd n+=8; found=1; } } return found; } /* if(_mode==2) //change app_home to dev_bdvd only { for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if( (peekq( c_addr ) == app_home_val) ) { pokeq( c_addr , dev_bdvd_val ); // change app_home to dev_bdvd pokeq( c_addr + 8ULL, 0x0ULL ); pokeq( c_addr + 16ULL, app_home_val ); // for later restore n+=24; found=1; return found; } } } */ return 1; } void draw_dir_pane( t_dir_pane *list, int pane_size, int first_to_show, int max_lines, float x_offset) { float y_offset=0.12f+0.025f; int e=first_to_show; float e_size=0.0f; char str[128], e_stype[8], e_name[256], e_sizet[16], this_dev[128], other_dev[128], e_date[16], str_date[16], temp_pane[1024], entry_name[512], e_attributes[16], e_attributes2[48]; char filename[1024]; char string1[1024]; u32 color=0xc0c0c0c0; if(x_offset>=0.54f) { sprintf(this_pane, "%s", current_right_pane); sprintf(other_pane, "%s", current_left_pane);} else { sprintf(this_pane, "%s", current_left_pane); sprintf(other_pane, "%s", current_right_pane);} char temp[256]="*"; sprintf(temp, "%s/", this_pane); temp[0]=0x30; char *pch=strchr(temp,'/'); if(pch!=NULL) {temp[pch-temp]=0; temp[0]=0x2f;} temp[127]=0; strncpy(this_dev, temp, 128); sprintf(temp, "%s/", other_pane); temp[0]=0x30; pch=strchr(temp,'/'); if(pch!=NULL) {temp[pch-temp]=0; temp[0]=0x2f;} temp[127]=0; strncpy(other_dev, temp, 128); if(first_to_show>pane_size || first_to_show<0) first_to_show=0; for(e=first_to_show; (e<pane_size && (e-first_to_show)<max_lines);e++) { if(list[e].size<2048) {e_size=list[e].size; sprintf(e_stype, "%s", "B ");} if(list[e].size>=2048 && list[e].size<2097152) {e_size=list[e].size/1024.f; sprintf(e_stype, "%s", "KB");} //KB if(list[e].size>=2097152 && list[e].size<2147483648U) {e_size=list[e].size/1048576.f; sprintf(e_stype, "%s", "MB");}//MB if(list[e].size>=2147483648U) {e_size=list[e].size/1073741824.f; sprintf(e_stype, "%s", "GB");} //GB strncpy(e_name, list[e].path, 10); if(strstr (e_name,"/net_host")!=NULL) sprintf(e_date, "%s", list[e].datetime); else { timeinfo = localtime ( &list[e].time ); if(date_format==0) sprintf(e_date,"%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(e_date, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(e_date, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); } //utf8_to_ansi(list[e].name, entry_name, 128); strncpy(entry_name, list[e].name, 128); entry_name[128]=0; // if(user_font<2) // { if(x_offset>=0.54f) { sprintf(e_name,"%s", entry_name); e_name[55]=0;} else { sprintf(e_name,"%s", entry_name); e_name[60]=0; } // } // else // { // if(x_offset>=0.54f) // { sprintf(e_name,"%-24s", entry_name); e_name[24]=0;} // else // { sprintf(e_name,"%-42s", entry_name); e_name[42]=0; } // } if(list[e].type==0) sprintf(e_sizet, "%s", " <dir>"); else { if(e_stype[0]=='B') sprintf(e_sizet,"%.0f %s", e_size, e_stype); else sprintf(e_sizet,"%.2f %s", e_size, e_stype); } e_sizet[11]=0; //sprintf(str, "%s %s %s", e_name, e_sizet, e_date); //((list[e].type==0) ? "D" : "F"), sprintf(str, "%s", e_name); sprintf(str_date, "%s", e_date); //str[49]=0; color=((list[e].type==0) ? (COL_FMDIR) : (COL_FMFILE)); if(strstr(list[e].name, ".mp3")!=NULL || strstr(list[e].name, ".MP3")!=NULL) color=COL_FMMP3; else if(strstr(list[e].name, ".ac3")!=NULL || strstr(list[e].name, ".AC3")!=NULL || strstr(list[e].name, ".FLAC")!=NULL || strstr(list[e].name, ".flac")!=NULL) color=COL_FMMP3; else if(strstr(list[e].name, ".jpg")!=NULL || strstr(list[e].name, ".jpeg")!=NULL || strstr(list[e].name, ".png")!=NULL || strstr(list[e].name, ".JPG")!=NULL || strstr(list[e].name, ".JPEG")!=NULL || strstr(list[e].name, ".PNG")!=NULL) color=COL_FMJPG;//1133cc; else if(strstr(list[e].name, "EBOOT.BIN")!=NULL || strstr(list[e].name, "INDEX.BDM")!=NULL || strstr(list[e].name, "index.bdmv")!=NULL || strstr(list[e].name, ".self")!=NULL || strstr(list[e].name, ".SELF")!=NULL || strstr(list[e].name, ".pkg") || strstr(list[e].name, ".PKG")!=NULL) color=COL_FMEXE; else if(strstr(list[e].name, ".MMT")!=NULL || strstr(list[e].name, ".mmt")!=NULL) color=0xffe0d0c0; else if(is_video(list[e].name)) color=0xff1070f0; color=( (color & 0x00ffffff) | (c_opacity2<<24)); if(list[e].selected)// && x_offset>=0.54f) //c_opacity2>0x20 && { if(x_offset>=0.54f) draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.82f, 0.048f, 0.5f, 0x1080ff30); else draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.92f, 0.048f, 0.5f, 0x1080ff30); } if(mouseX>=x_offset && mouseX<=x_offset+0.430f && mouseY>=y_offset && mouseY<=y_offset+0.026f) { e_attributes2[0]=0; if(list[e].mode>0){ //012 456 789 sprintf(e_attributes, "%s", "--- --- ---"); if(list[e].type==1) { if(list[e].mode & S_IXOTH) e_attributes[0]='x'; if(list[e].mode & S_IXGRP) e_attributes[4]='x'; if(list[e].mode & S_IXUSR) e_attributes[8]='x'; } else { e_attributes[0]='d'; e_attributes[4]='d'; e_attributes[8]='d'; } if(list[e].mode & S_IWOTH) e_attributes[1]='w'; if(list[e].mode & S_IROTH) e_attributes[2]='r'; if(list[e].mode & S_IWGRP) e_attributes[5]='w'; if(list[e].mode & S_IRGRP) e_attributes[6]='r'; if(list[e].mode & S_IWUSR) e_attributes[9]='w'; if(list[e].mode & S_IRUSR) e_attributes[10]='r'; sprintf(e_attributes2," | Attr: %s", e_attributes); } u32 select_color=0x0080ff60; // if(c_opacity2<0x80) { select_color=select_color & 0xffffff00 | c_opacity2;} //if(c_opacity2>0x20) { if(x_offset>=0.54f) draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.82f, 0.048f, 0.5f, select_color); else draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.92f, 0.048f, 0.5f, select_color); } if((strlen(list[e].name)>25 || strlen(e_attributes2)>0) && !(strlen(list[e].name)==2 && list[e].name[0]==0x2e && list[e].name[1]==0x2e) ) { //display hint if(list[e].type==0) sprintf(e_name,"Dir : %s", list[e].name); else sprintf(e_name,"File: %s", list[e].name); e_name[86]=0; cellDbgFontPrintf( 0.04f+0.025f, 0.895f, 0.7f , COL_HEXVIEW, e_name); sprintf(e_name,"Date: %s %s:%02d:%02d%s", e_date, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec, e_attributes2); cellDbgFontPrintf( 0.04f+0.025f, 0.916f, 0.7f , COL_HEXVIEW, e_name); } //color=0xc01010a0; sprintf(fm_func, "%s", "none"); if ((new_pad & BUTTON_CIRCLE)) { int fmret=-1; int m_copy_total=0; for(int m_copy=0; m_copy<pane_size; m_copy++) m_copy_total+=list[m_copy].selected; if(m_copy_total>1) { if(list[e].type==0) fmret=context_menu((char*) STR_CM_MULDIR, list[e].type, this_pane, other_pane); else fmret=context_menu((char*) STR_CM_MULFILE, list[e].type, this_pane, other_pane); } else fmret=context_menu(list[e].name, list[e].type, this_pane, other_pane); new_pad=0; if(fmret!=-1) { sprintf(fm_func, "%s", opt_list[fmret].value); } } if ( !strcmp(fm_func, "test") && viewer_open==0 ) { sprintf(my_txt_file, "%s/%s", this_pane, list[e].name); sprintf(fm_func, "%s", "none"); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; sprintf(string1,"Checking, please wait...\n\n%s", my_txt_file); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); my_game_test( my_txt_file, 0); DPrintf("Directories: %i Files: %i\nBig files: %i Split files: %i\n\n", num_directories, file_counter, num_files_big, num_files_split); int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy==2) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else if(abort_copy==1) sprintf(string1,"Folder contains over %i files. Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB+\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); else sprintf(string1,"Files tested: %i Time: %2.2i:%2.2i:%2.2i Size: %1.2f GB\nActual size : %.f bytes", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0),(double) global_device_bytes); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f,0xc0c0c0c0,string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } // if ( ((new_pad & BUTTON_R3) && (list[e].type==1)) && viewer_open==0 ) if ( !strcmp(fm_func, "view") && viewer_open==0 ) { //fm HEX view sprintf(fm_func, "%s", "none"); sprintf(my_txt_file, "%s", list[e].path); new_pad=0; old_pad=0; if(strstr(list[e].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[e].path); chost=list[e].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[e].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_txt_file, "%s/TEMP/hex_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_txt_file, 0); } if(strstr(list[e].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_txt_file, "%s/TEMP/hex_view.bin", app_usrdir); file_copy(list[e].path, my_txt_file, 0); } viewer_open=1; //txt viewer uint64_t fsiz = 0, readb=0; uint64_t msiz = 0; uint64_t msiz1 = 0; uint64_t msiz2 = 0x800000; FILE *fp; unsigned int chunk = 512; int view_mode=0; // 0=file 1=mem fp = fopen(my_txt_file, "rb"); if(fp==NULL) goto quit_viewer; fseek(fp, 0, SEEK_END); msiz=ftell(fp); msiz1=msiz; if(msiz<chunk && msiz>0) chunk=msiz; unsigned char x[chunk]; fseek(fp, 0, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; else { memset(text_bmpUPSR, 0x50, V_WIDTH*V_HEIGHT*4); unsigned int li, chp, cfp, hp; char cchar[512]; char clin[512]; char clintxt[32]; while(1) { pad_read(); if ((old_pad & BUTTON_START) && view_mode==1) //dump lv2 { //old_pad=0; new_pad=0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char lv2file[64]; sprintf(lv2file, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-LV2-FW%1.2f.BIN", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, c_firmware); sprintf(string1, "Exporting GameOS memory to file:\n\n%s\n\nPlease wait...", lv2file); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, string1, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); FILE *fpA; remove(lv2file); fpA = fopen ( lv2file, "wb" ); readb=readmem((unsigned char *) text_FONT, 0, msiz2); fwrite(text_FONT, readb, 1, fpA); fclose(fpA); //load_texture(text_bmpBG, userBG, 1920); cellMsgDialogAbort(); sprintf(string1, "GameOS memory exported successfully to file:\n\n%s", lv2file); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if ((new_pad & BUTTON_SELECT)) { //old_pad=0;// new_pad=0; view_mode = 1-view_mode; if(view_mode==0) { msiz=msiz1; if(msiz<chunk && msiz>0) chunk=msiz; fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } else { msiz=msiz2; chunk=512; fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); } } if (view_mode==1) //view mem { if ((new_pad & BUTTON_L1)) { new_pad=0; fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R1) && msiz>=512) { new_pad=0; fsiz=msiz-512; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_L2) && fsiz>=16) { //old_pad=0; fsiz-=16; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R2) && ((fsiz+16)<msiz) ) { //old_pad=0; fsiz+=16; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_UP)) { //old_pad=0; if(fsiz>=512) fsiz-=512; else fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_DOWN) && ((fsiz+512)<msiz) ) { //old_pad=0; fsiz+=512; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_LEFT)) { //old_pad=0; if(fsiz>=8192) fsiz-=8192; else fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_RIGHT) && ( (fsiz+8192)<msiz) ) { //old_pad=0; fsiz+=8192; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } } //view mem if (view_mode==0) //view file { if ((new_pad & BUTTON_L1)) { //old_pad=0; fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R1) && msiz>=512) { //old_pad=0; fsiz=msiz-512; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_L2) && fsiz>=16) { //old_pad=0; fsiz-=16; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R2) && ((fsiz+16)<msiz) ) { //old_pad=0; fsiz+=16; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_UP)) { //old_pad=0; if(fsiz>=512) fsiz-=512; else fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_DOWN) && ((fsiz+512)<msiz) ) { //old_pad=0; fsiz+=512; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_LEFT)) { //old_pad=0; if(fsiz>=8192) fsiz-=8192; else fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_RIGHT) && ( (fsiz+8192)<msiz) ) { //old_pad=0; fsiz+=8192; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } } ClearSurface(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f , COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); if(view_mode==1) sprintf(e_name,"GameOS memory | Press [START] to export GameOS memory to file"); else sprintf(e_name,"File: %s", list[e].name); e_name[86]=0; cellDbgFontPrintf( 0.04f+0.025f, 0.895f, 0.7f , COL_HEXVIEW, e_name); if(view_mode==1) sprintf(e_name,"Memory offset: 0x%08X / 0x%08X | [SELECT] for file view", (int)fsiz, (int)msiz); else sprintf(e_name,"Offset: 0x%X (%.0f) / 0x%X (%.0f) | [SELECT] for LV2 view", (int)fsiz, (double)fsiz, (int)msiz, (double)msiz); //Date: %s | e_date, cellDbgFontPrintf( 0.04f+0.025f, 0.916f, 0.7f , COL_HEXVIEW, e_name); for(li=0; li<32; li++) { chp=0; sprintf(clin, "%-48s | -16%s", " ", " "); clin[0]=0; clintxt[0]=0; clintxt[16]=0; for(hp=0; hp<16; hp++) { cfp = li*16+hp; clintxt[hp]=0; clin[chp]=0; clin[chp+(hp*3)]=0; if( (cfp) < readb) { sprintf(cchar, "%02X", x[cfp]); if(x[cfp]>0x19 && x[cfp]<0x7f) clintxt[hp]=x[cfp]; else clintxt[hp]=0x2e; clin[chp+0]=cchar[0]; clin[chp+1]=cchar[1]; clin[chp+2]=0x20; clin[chp+3]=0x00; chp+=3; } else break; } if(strlen(clintxt)==0 || chp==0) break; sprintf(clin, "%-48s | %-16s", clin, clintxt); if(mouseX>=0.11f && mouseX<=0.89f && mouseY>=(0.07f+li*0.024f) && mouseY<=(0.07f+li*0.024f)+0.026f) { draw_square((0.11f+0.025f-0.015f-0.5f)*2.0f, (0.5f-(0.07f+li*0.024f))*2.0f, 1.52f, 0.048f, 0.0f, 0x0080ff80); select_color=0xc0e0e0e0; } else select_color=COL_HEXVIEW; cellDbgFontPrintf( 0.11f+0.025f, 0.07f+li*0.024f, 0.7f ,select_color, "0x%04X%04X: %s |", (unsigned int)((fsiz+li*16)/0x10000), (unsigned int)((fsiz+li*16)%0x10000), clin, clintxt); } set_texture( text_FMS, 1920, 48); // display_img(0, 47, 1920, 60, 1920, 48, -0.15f); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48); if(animation==2 || animation==3) { BoffX-=1; if(BoffX<= -3840) BoffX=0; set_texture( text_bmpUPSR, 1920, 1080); if(BoffX>= -1920) { display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } display_img(1920+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); if(BoffX<= -1920) { display_img(3840+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } } else { set_texture( text_bmpUPSR, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } cellDbgFontDrawGcm(); draw_mouse_pointer(0); flip(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE)) break; } } close_viewer: fclose(fp); quit_viewer: viewer_open=0; new_pad=0; state_draw=1; state_read=1; } // if ( ((new_pad & BUTTON_L3) || osk_open==2) && strstr(this_pane,"/ps3_home")==NULL) if ( (!strcmp(fm_func, "newfolder") || osk_open==2) )// && strstr(this_pane,"/ps3_home")==NULL) { //fm new folder new_pad=0; old_pad=0; if(osk_open!=2) { OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(2, (char*) list[e].name); } if(osk_dialog!=0) { sprintf(new_file_name, "%S", (wchar_t*)OutputInfo.pResultString); if(strlen(new_file_name)>0) { sprintf(new_file_name, "%s/%S", this_pane, (wchar_t*)OutputInfo.pResultString); if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=this_pane[9]-0x30; if(this_pane[10]==0) sprintf(cpath2, "/%S/", (wchar_t*)OutputInfo.pResultString); else sprintf(cpath2, "/%s/%S/", this_pane+11, (wchar_t*)OutputInfo.pResultString); network_del((char*)"PUT", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } else mkdir(new_file_name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(new_file_name, 0777); if(x_offset>=0.54f) state_read=3; else state_read=2; } osk_open=0; } } // if ( ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_CROSS) && (list[e].name[0]!=0x2e) && strlen(list[e].path)>8 && strstr(this_pane, "/ps3_home")==NULL) || osk_open==1) if ( (!strcmp(fm_func, "nethost"))) { int n=0; // if SELECT-X for network file - perform HOST file update n=list[e].path[9]-0x30; network_com((char*)"GET!", (char*)host_list[n].host, host_list[n].port, (char*)"/", (char*) host_list[n].name, 1);//host_list[n].root if(x_offset>=0.54f) state_read=3; else state_read=2; } if (!strcmp(fm_func, "rename") || osk_open==1) { //fm rename join_copy=0; new_pad=0; old_pad=0; //osk_rename: if(osk_open!=1) { OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; /* Result on-screen keyboard dialog termination */ OutputInfo.numCharsResultString = 128; /* Specify number of characters for returned text */ OutputInfo.pResultString = Result_Text_Buffer; /* Buffer storing returned text */ ; open_osk(1, (char*) list[e].name); } if(osk_dialog!=0) { sprintf(new_file_name, "%S", (wchar_t*)OutputInfo.pResultString); if(strlen(new_file_name)>0) { sprintf(new_file_name, "%s/%S", this_pane, (wchar_t*)OutputInfo.pResultString); rename(list[e].path, new_file_name); if(x_offset>=0.54f) state_read=3; else state_read=2; if(!strcmp(this_pane, other_pane)) state_read=1; } osk_open=0; } //osk_end: } if (((new_pad & BUTTON_CROSS) && (list[e].type==0)) || ((new_pad & BUTTON_TRIANGLE) && strcmp(list[0].path, "/app_home"))) { //open_folder: if((new_pad & BUTTON_TRIANGLE)) e=0; first_to_show=0; mouseY=0.12f+0.025f+0.013f; //move mouse to top of folder list if(strstr (list[e].path,"/net_host")!=NULL) { int n=list[e].path[9]-0x30; if(!exist(host_list[n].name)) network_com((char*)"GET", (char*)host_list[n].host, host_list[n].port, (char*)"/", (char*) host_list[n].name, 1);//host_list[n].root } state_draw=1; if(x_offset>=0.54f) { first_right=0; sprintf(current_right_pane, "%s", list[e].path); state_read=3; } else { first_left=0; sprintf(current_left_pane, "%s", list[e].path); state_read=2; } new_pad=0; } if (( (new_pad & BUTTON_CROSS) || !strcmp(fm_func, "view")) && (list[e].type==1)) { //fm execute view sprintf(fm_func, "%s", "none"); join_copy=0; new_pad=0; sprintf(my_mp3_file, "%s", list[e].path); char just_path[256], just_title[128], just_title_id[16]; if(strstr(list[e].name, ".CNF")!=NULL || strstr(list[e].name, ".cnf")!=NULL) { strncpy(just_path, list[e].path, 11); just_path[11]=0; mod_mount_table(just_path, 1); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_PS2DISC, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } if(strstr(list[e].name, ".pkg")!=NULL || strstr(list[e].name, ".PKG")!=NULL) { syscall_mount(this_pane, mount_bdvd); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*)STR_PKGXMB, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) {reset_mount_points(); goto cancel_exit;} unload_modules(); sys_process_exit(1); } if(strstr(my_mp3_file, "/USRDIR/EBOOT.BIN")!=NULL && strstr(my_mp3_file, "/net_host")==NULL) { sprintf(just_path, "%s", my_mp3_file); pch=just_path; if(strstr(my_mp3_file, "/PS3_GAME/USRDIR/EBOOT.BIN")!=NULL) { char *pathpos=strstr(pch,"/PS3_GAME/USRDIR/EBOOT.BIN"); just_path[pathpos-pch]=0; sprintf(filename, "%s/PS3_GAME/PARAM.SFO", just_path); } else { char *pathpos=strstr(pch,"/USRDIR/EBOOT.BIN"); just_path[pathpos-pch]=0; sprintf(filename, "%s/PARAM.SFO", just_path); } change_param_sfo_version(filename); int plevel=0; parse_param_sfo(filename, just_title, just_title_id, &plevel); num_files_split=0; abort_copy=0; my_game_test(just_path, 2); if(num_files_split && payload!=1){ dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit; } if(parental_level<plevel && parental_level>0) { sprintf(string1, (const char*) STR_GAME_PIN, plevel ); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ sprintf(string1, "::: %s :::\n\n\nSelected game is restricted with parental level %i.\n\nPlease enter four alphanumeric parental password code:", just_title, plevel); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.9f, 0xd0000080); cellDbgFontPrintf( 0.10f, 0.10f, 1.0f, 0xffffffff, string1); setRenderColor(); cellDbgFontDrawGcm(); flip(); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { goto pass_ok_2; } } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit; } pass_ok_2: if(payload==0 && sc36_path_patch==0 && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PS3DISC, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } dialog_ret=0; if(direct_launch==1) { cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_TO_DBOOT, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==3) {reset_mount_points(); goto cancel_exit;} if(dialog_ret==1) { write_last_play( my_mp3_file, just_path, just_title, (char *) just_title_id, 1); unload_modules(); // if(payload==0) syscall_mount(just_path, mount_bdvd); sys_game_process_exitspawn2((char *) my_mp3_file, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); // else sys_game_process_exitspawn2((char *) "/app_home/PS3_GAME/USRDIR/EBOOT.BIN", NULL, NULL, NULL, 0, 3071, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } write_last_play( my_mp3_file, just_path, just_title, (char *) just_title_id, 0); unload_modules(); syscall_mount(just_path, mount_bdvd); sys_process_exit(1); break; } else if( (strstr(my_mp3_file, "/BDMV/INDEX.BDM")!=NULL || strstr(my_mp3_file, "/BDMV/index.bdmv")!=NULL) && strstr(my_mp3_file, "/net_host")==NULL)// && strstr(my_mp3_file, "/dev_hdd0")!=NULL) { sprintf(just_path, "%s", my_mp3_file); pch=just_path; char *pathpos; if(strstr(my_mp3_file, "/BDMV/INDEX.BDM")!=NULL) { pathpos=strstr(pch,"/BDMV/INDEX.BDM"); just_path[pathpos-pch]=0; } else if(strstr(my_mp3_file, "/BDMV/index.bdmv")!=NULL) { pathpos=strstr(pch,"/BDMV/index.bdmv"); just_path[pathpos-pch]=0; sprintf(filename, (const char*) STR_BD2AVCHD, just_path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_BD2AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); DIR *dir; char path[512], cfile[512], ffile[512], cfile0[16];int n; for(n=0;n<64;n++){ sprintf(path, "%s/BDMV/CLIPINF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/CLIPINF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/PLAYLIST", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/PLAYLIST", just_path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".m2ts")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MTS", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM/SSIF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".ssif")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.SSI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); } sprintf(path, "%s/BDMV/index.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/INDEX.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/BACKUP/index.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/BACKUP/INDEX.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/MovieObject.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/MOVIEOBJ.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/BACKUP/MovieObject.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/BACKUP/MOVIEOBJ.BDM", just_path); remove(cfile); rename(path, cfile);} cellMsgDialogAbort(); } else goto skip_BD; } dialog_ret=0; sprintf(string1, (const char*) STR_ACT_AVCHD, just_path); cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_ACT_AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char usb_save[32]="/none"; usb_save[5]=0; sprintf(filename, "/dev_sd"); if(exist(filename)) { sprintf(usb_save, "/dev_sd/PRIVATE"); if(!exist(usb_save)) mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } if(!exist(usb_save)) { sprintf(filename, "/dev_ms"); if(exist(filename)) { sprintf(usb_save, "/dev_ms"); } } if(!exist(usb_save)) { for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } } if(exist(usb_save)) { sprintf(filename, "%s/AVCHD", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV/INDEX.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdIN, (char *) filename, 0); sprintf(filename, "%s/AVCHD/BDMV/MOVIEOBJ.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdMV, (char *) filename, 0); sprintf(filename, "%s/AVCHD", usb_save); sprintf(usb_save, "%s", filename); cellMsgDialogAbort(); syscall_mount2((char *)usb_save, (char *)just_path); unload_modules(); sys_process_exit(1); break; } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ATT_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else if( (is_video(my_mp3_file) || strstr(my_mp3_file, ".self")!=NULL || strstr(my_mp3_file, ".SELF")!=NULL || strstr(my_mp3_file, ".FLAC")!=NULL || strstr(my_mp3_file, ".flac")!=NULL || strstr(my_mp3_file, ".DTS")!=NULL || strstr(my_mp3_file, ".dts")!=NULL || strstr(my_mp3_file, "EBOOT.BIN")!=NULL) && strstr(my_mp3_file, "/net_host")==NULL && strstr(my_mp3_file, ".jpg")==NULL && strstr(my_mp3_file, ".JPG")==NULL && net_used_ignore() ) { if(strstr(my_mp3_file, ".SELF")==NULL && strstr(my_mp3_file, ".self")==NULL && strstr(my_mp3_file, "EBOOT.BIN")==NULL) { retry_showtime: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { FILE *flist; sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", my_mp3_file);fputs (filename, flist ); fclose(flist); // sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); // sys_game_process_exitspawn2((char *) filename, NULL, NULL, NULL, 0, 3070, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); cellFsGetFreeSize(app_usrdir, &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); if(strstr(my_mp3_file,"/pvd_usb")!=NULL && (uint64_t)list[e].size<freeSpace) { // && stat((char*)"/dev_hdd1", &s3)>=0 && sprintf(string1, "%s", (const char*) STR_CACHE_FILE); cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE|CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,string1,NULL,NULL,NULL); cellFsGetFreeSize((char*)"/dev_hdd1", &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); if((uint64_t)list[e].size<freeSpace) { sprintf(filename, "%s", "/dev_hdd1/multiMAN"); file_copy(my_mp3_file, filename, 1); if(my_mp3_file[strlen(my_mp3_file)-4]=='.') my_mp3_file[strlen(my_mp3_file)-4]=0; else if(my_mp3_file[strlen(my_mp3_file)-5]=='.') my_mp3_file[strlen(my_mp3_file)-5]=0; char imgfile2[512]; sprintf(imgfile2, "%s.srt", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.srt");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SRT", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.srt");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ssa", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ssa");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SSA", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ssa");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ass", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ass");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ASS", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ass");file_copy(imgfile2, filename, 0);} sprintf(my_mp3_file, "%s", "/dev_hdd1/multiMAN"); } else { sprintf(filename, "%s/TEMP/multiMAN", app_usrdir); file_copy(my_mp3_file, filename, 1); if(my_mp3_file[strlen(my_mp3_file)-4]=='.') my_mp3_file[strlen(my_mp3_file)-4]=0; else if(my_mp3_file[strlen(my_mp3_file)-5]=='.') my_mp3_file[strlen(my_mp3_file)-5]=0; char imgfile2[512]; sprintf(imgfile2, "%s.srt", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.srt", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SRT", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.srt", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ssa", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ssa", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SSA", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ssa", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ass", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ass", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ASS", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ass", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(my_mp3_file, "%s/TEMP/multiMAN", app_usrdir); } cellMsgDialogAbort(); sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", my_mp3_file);fputs (filename, flist ); fclose(flist); } if(!exist(my_mp3_file)) { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime; } } } else { unload_modules(); sys_game_process_exitspawn2((char *) my_mp3_file, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); sys_process_exit(1); } } else if(is_snes9x(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_snes_emu(my_mp3_file); } else if(is_genp(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_genp_emu(my_mp3_file); } else if(is_fceu(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_fceu_emu(my_mp3_file); } else if(is_vba(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_vba_emu(my_mp3_file); } else if(is_fba(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_fba_emu(my_mp3_file); } else if(strstr(my_mp3_file, ".mmt")!=NULL || strstr(my_mp3_file, ".MMT")!=NULL && strstr(my_mp3_file, "/net_host")==NULL) { apply_theme(my_mp3_file, this_pane); } skip_BD: if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL || strstr(my_mp3_file, "SOUND.BIN")!=NULL) { if(strstr(list[e].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[e].path); chost=list[e].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[e].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_mp3_file, "%s/TEMP/%s", app_usrdir, list[e].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); main_mp3((char*) my_mp3_file); max_mp3=0; current_mp3=0; remove(my_mp3_file); } else { int ci2=e+1; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); //add the rest of the files as a playlist for(ci2=e+1; ci2<pane_size; ci2++) { sprintf(my_mp3_file, "%s", list[ci2].path); if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); } } for(ci2=1; ci2<(e-1); ci2++) { sprintf(my_mp3_file, "%s", list[ci2].path); if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); } } main_mp3((char*) mp3_playlist[1].path); } } sprintf(my_mp3_file, "%s", list[e].path); int current_image=e; long slide_time=0; int slide_show=0; int show_info=0; sprintf(my_mp3_file, "%s", list[current_image].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { int to_break=0, slide_dir=0; float pic_zoom=1.0f; int pic_reload=1, pic_posY=0, pic_posX=0, pic_X=0, pic_Y=0; char pic_info[512]; use_analog=1; mouseYDR=mouseXDR=mouseYDL=mouseXDL=0.0000f; while(1) { // Picture Viewer Mode sprintf(my_mp3_file, "%s", list[current_image].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL) { //cellDbgFontDrawGcm(); ClearSurface(); if(pic_reload!=0){ cellDbgFontDrawGcm(); pic_zoom=-1.0f; if(strstr(list[current_image].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[current_image].path); chost=list[current_image].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[current_image].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root,, sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); } if(strstr(list[current_image].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(list[current_image].path, my_mp3_file, 0); } load_jpg_texture(text_FONT, my_mp3_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; //if(png_w==1280 && png_h==720) pic_zoom=1920.0f/1280.0f; //if(png_w==640 && png_h==360) pic_zoom=3.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { cellDbgFontDrawGcm(); if(pic_reload!=0){ if(strstr(list[current_image].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[current_image].path); chost=list[current_image].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[current_image].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); } if(strstr(list[current_image].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(list[current_image].path, my_mp3_file, 0); } load_png_texture(text_FONT, my_mp3_file, 1920); slide_time=0; //if(png_w>1920 || png_h>1080) goto cancel_exit; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; //if(png_w==1280 && png_h==720) pic_zoom=1920.0f/1280.0f; //if(png_w==640 && png_h==360) pic_zoom=3.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); pic_X=(int)((1920-png_w2)/2)+pic_posX; pic_Y=(int)((1080-png_h2)/2)+pic_posY; if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } //flip(); int ci=current_image; to_break=0; char ss_status[8]; while(1){ pad_read(); ClearSurface(); set_texture( text_FONT, 1920, 1080); if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); else display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); if(show_info==1){ if(slide_show) sprintf(ss_status, "%s", "Stop"); else sprintf(ss_status, "%s", "Start"); sprintf(pic_info," Name: %s", list[current_image].name); pic_info[95]=0; draw_text_stroke( 0.04f+0.025f, 0.867f, 0.7f ,0xc0a0a0a0, pic_info); timeinfo = localtime ( &list[current_image].time ); if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) sprintf(pic_info," Info: PNG %ix%i (Zoom: %3.0f)\n Date: %02d/%02d/%04d\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, ss_status); else sprintf(pic_info," Info: JPEG %ix%i (Zoom: %3.0f)\n Date: %02d/%02d/%04d\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, ss_status); draw_text_stroke( 0.04f+0.025f, 0.89f, 0.7f ,0xc0a0a0a0, pic_info); cellDbgFontDrawGcm(); } flip(); if ( new_pad & BUTTON_SELECT ) {show_info=1-show_info; pic_reload=0; break;}// new_pad=0; old_pad=0; if ( new_pad & BUTTON_START ) { slide_time=0; //new_pad=0; old_pad=0; slide_show=1-slide_show; slide_dir=0; } if(slide_show==1) slide_time++; if ( ( new_pad & BUTTON_TRIANGLE ) || ( new_pad & BUTTON_CIRCLE ) ) {new_pad=0; to_break=1;break;} if ( ( new_pad & BUTTON_RIGHT ) || ( new_pad & BUTTON_R1 ) || ( new_pad & BUTTON_CROSS ) || (slide_show==1 && slide_time>600) ) { //find next image in the list int one_time3=1; check_from_start3: for(ci=current_image+1; ci<pane_size; ci++) { sprintf(my_mp3_file, "%s", list[ci].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { current_image=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_time=0; slide_dir=0; break; } } if((current_image>pane_size || ci>=pane_size) && one_time3) {one_time3=0; current_image=-1; goto check_from_start3;}//to_break=1; // || current_image==e break; } if ( ( new_pad & BUTTON_LEFT ) || ( new_pad & BUTTON_L1 ) ) { //find previous image in the list if(current_image==0) current_image=pane_size; int one_time=1; check_from_start: for(ci=current_image-1; ci>=0; ci--) { sprintf(my_mp3_file, "%s", list[ci].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { current_image=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_show=0; slide_dir=1; break; } } if((current_image<0 || ci<0) && one_time) {one_time=0; current_image=pane_size; goto check_from_start;}// to_break=1; // || current_image==e break; } if (( new_pad & BUTTON_L3 ) || ( new_pad & BUTTON_DOWN )) { if(png_w!=0 && pic_zoom==1.0f) pic_zoom=float (1920.0f / png_w); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (( new_pad & BUTTON_R3 ) || ( new_pad & BUTTON_UP )) { if(png_h!=0 && pic_zoom==1.0f) pic_zoom=float (1080.0f / png_h); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (mouseXDL!=0.0f && png_w2>1920) { pic_posX-=(int) (mouseXDL*1920.0f); pic_reload=0; if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0-(int)((1920-png_w2)/2); break; } if (mouseYDL!=0.0f && png_h2>1080) { pic_posY-=(int) (mouseYDL*1080.0f); if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0-(int)((1080-png_h2)/2); pic_reload=0; break; } if (( new_pad & BUTTON_L2 ) || mouseXDR> 0.003f || mouseYDR> 0.003f) { if ( new_pad & BUTTON_L2 ) pic_zoom-=0.045f; else pic_zoom-=0.010f; if(pic_zoom<1.0f) pic_zoom=1.000f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } if (( new_pad & BUTTON_R2 ) || mouseXDR< -0.003f || mouseYDR< -0.003f) { if (new_pad & BUTTON_R2) pic_zoom+=0.045f; else pic_zoom+=0.010f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } } new_pad=0;//old_pad=0; if(to_break==1) break; } //picture viewer new_pad=0; use_analog=0; // load_texture(text_MSC_5, iconMSC, 320); } state_draw=1; } cancel_exit: // if ((new_pad & BUTTON_SQUARE) && (list[e].type==1) && strstr(this_pane,"/ps3_home")==NULL) if (!strcmp(fm_func, "delete") && (list[e].type==1)) { //fm delete file int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==1) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(m_copy_total==1) sprintf(filename, (const char*) STR_DEL_FILE, list[e].path); else sprintf(filename, (const char*) STR_DEL_FILES, m_copy_total); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==1) { if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=list[m_copy].path[9]-0x30; if(strlen(list[m_copy].path)>11) { sprintf(cpath2, "/%s", list[e].path+11); network_del((char*)"DEL", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } } else remove(list[m_copy].path); } if(x_offset>=0.54f) state_read=3; else state_read=2; if(!strcmp(this_pane, other_pane)) state_read=1; } } // if ((new_pad & BUTTON_SQUARE) && (list[e].type==0) && (list[e].name[0]!=0x2e) && strlen(list[e].path)>12 && strstr(this_pane, "/ps3_home")==NULL && disable_options!=1 && disable_options!=3) if (!strcmp(fm_func, "delete") && (list[e].type==0) && strstr(list[e].path, "net_host")==NULL) { //fm delete folder sprintf(fm_func, "%s", "none"); new_pad=0; old_pad=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==0) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} if(m_copy_total==1) sprintf(filename, (const char*) STR_DEL_DIR, list[e].path); else sprintf(filename, (const char*) STR_DEL_DIRS, m_copy_total); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==0) { if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=list[m_copy].path[9]-0x30; if(strlen(list[m_copy].path)>11) { sprintf(cpath2, "/%s/", list[m_copy].path+11); network_del((char*)"DEL", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } } else { abort_copy=0; time_start= time(NULL); file_counter=0; my_game_delete((char *) list[m_copy].path); rmdir((char *) list[m_copy].path); if(strstr(list[m_copy].path, "/dev_hdd")!=NULL) forcedevices|=0x0001; if(strstr(list[m_copy].path, "/dev_usb")!=NULL) forcedevices|=0xFFFE; } if(x_offset>=0.54f) state_read=3; else state_read=2; } } } // if ( ((new_pad & BUTTON_CIRCLE) || (new_pad & BUTTON_R3)) && (list[e].type==0) && (list[e].name[0]!=0x2e) && ((strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0) || ((new_pad & BUTTON_R3) && strstr(list[e].name, "PS3_GAME")!=NULL) ) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane, "/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) if (!strcmp(fm_func, "shortcut") && (list[e].type==1)) { sprintf(fm_func, "%s", "none"); //fm shortcut file sprintf(filename, "%s/%s", other_pane, list[e].name); sprintf(string1, "%s", list[e].path); unlink(filename); link(string1, filename); state_read=1; state_draw=1; } if ( (!strcmp(fm_func, "copy") || !strcmp(fm_func, "move") || !strcmp(fm_func, "bdmirror") || !strcmp(fm_func, "pkgshortcut") || !strcmp(fm_func, "shortcut")) && (list[e].type==0)) { //fm copy folder use_symlinks=0; do_move=0; int ret, net_copy=0; // if((old_pad & BUTTON_SELECT)) do_move=1; // if(new_pad & BUTTON_R3) { use_symlinks=1; do_move=0; } if(!strcmp(fm_func, "move")) do_move=1; if(!strcmp(fm_func, "shortcut") || !strcmp(fm_func, "pkgshortcut") || !strcmp(fm_func, "bdmirror")) { use_symlinks=1; do_move=0; } if(strstr(list[e].path, "/net_host")!=NULL) {do_move=0; net_copy=1;} if(strstr(this_pane, "/ps3_home")!=NULL) do_move=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==0) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(do_move==1) sprintf(filename, (const char*) STR_MOVE0, list[e].path, other_pane); else { if(use_symlinks==1) { if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_hdd0")!=NULL && !strcmp(fm_func, "pkgshortcut")) sprintf(filename, (const char*) STR_COPY7, list[e].path); else if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_usb")!=NULL && (c_firmware==3.41f || c_firmware==3.55f || c_firmware==3.15f) && !strcmp(fm_func, "bdmirror")) sprintf(filename, (const char*) STR_COPY10, list[e].path); else sprintf(filename, (const char*) STR_COPY8, list[e].path, other_pane, list[e].name); } else sprintf(filename, (const char*) STR_COPY9, list[e].path, other_pane); } dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); // if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_usb")!=NULL && dialog_ret==1 && use_symlinks==1) if(!strcmp(fm_func, "bdmirror") && dialog_ret==1 && use_symlinks==1) { sprintf(fm_func, "%s", "none"); if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount; } char just_drive[32]; char usb_mount0[512], usb_mount1[512], usb_mount2[512]; char path_backup[512], path_bup[512]; FILE *fpA; strncpy(just_drive, list[e].path, 11); just_drive[11]=0; ret = mod_mount_table(just_drive, 0); //restore if(ret) { sprintf(usb_mount1, "%s/PS3_GAME", just_drive); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fgets ( usb_mount2, 512, fpA )==NULL) sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); fclose(fpA); strncpy(usb_mount2, just_drive, 11); //always use current device } else sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); int pl, n; char tempname[512]; pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } if(!exist(usb_mount2)) rename (usb_mount1, usb_mount2); } if(!exist(usb_mount1)) { sprintf(usb_mount0, "%s", list[e].path); sprintf(path_backup, "%s/PS3PATH.BUP", usb_mount0); remove(path_backup); fpA = fopen ( path_backup, "w" ); fputs ( list[e].path, fpA ); fclose(fpA); rename (usb_mount0, usb_mount1); if(!exist((char*)"/dev_bdvd/PS3_GAME/PARAM.SFO")) sprintf(string1, "%s", (const char*) STR_START_BD1); else sprintf(string1, "%s", (const char*) STR_START_BD2); ret = mod_mount_table(just_drive, 1); //modify if(ret) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } else { ret = mod_mount_table((char *) "reset", 0); //reset rename (usb_mount1, usb_mount0); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL );; wait_dialog(); goto cancel_mount; } } else { ret = mod_mount_table((char *) "reset", 0); //reset dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MVGAME, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = mod_mount_table((char *) "reset", 0); //reset ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } cancel_mount: dialog_ret=0; } if(dialog_ret==1) { char m_other_pane[512]; sprintf(m_other_pane, "%s", other_pane); for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==0) { time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; if(strstr(other_pane,"/dev_usb")!=NULL || strstr(other_pane,"/dev_sd")!=NULL || strstr(other_pane,"/dev_ms")!=NULL || strstr(other_pane,"/dev_cf")!=NULL) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; sprintf(temp_pane, "%s", other_pane); sprintf(other_pane,"%s/%s", m_other_pane, list[m_copy].name); if(strstr(list[m_copy].name, "PS3_GAME")!=NULL && !strcmp(fm_func, "pkgshortcut") && use_symlinks==1) { sprintf(fm_func, "%s", "none"); sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); char just_title[128], just_title_id[64]; just_title[0]=0; just_title_id[0]=0; int plevel; parse_param_sfo(filename, just_title, just_title_id, &plevel); // sprintf(other_pane,"%s/%s", temp_pane, just_title_id); sprintf(other_pane,"/dev_hdd0/G"); mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); char just_title_id2[7]; //just_title_id[0]=0x5A;//Z just_title_id2[0]=just_title_id[2]; if(just_title_id[1]!=0x4C) just_title_id2[0] = (just_title_id[2] | 0x20); just_title_id2[1]=just_title_id[4]; just_title_id2[2]=just_title_id[5]; just_title_id2[3]=just_title_id[6]; just_title_id2[4]=just_title_id[7]; just_title_id2[5]=just_title_id[8]; just_title_id2[6]=0; sprintf(other_pane,"/dev_hdd0/game/%s", just_title_id); /* if(stat(other_pane, &s3)>=0) { dialog_ret=0; sprintf(filename, "Destination already contains folder with the same name!\n\nContinue and overwrite?\n\n[%s]", other_pane ); cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) goto overwrite_cancel_3; } */ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) list[m_copy].path, (char *) other_pane); cellMsgDialogAbort(); sprintf(other_pane,"/dev_hdd0/G/%s", just_title_id2); mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) list[m_copy].path, (char *) other_pane); sprintf(filename, "/dev_hdd0/game/%s", just_title_id); sprintf(other_pane, "/dev_hdd0/G/%s", just_title_id2); my_game_copy((char *) filename, (char *) other_pane); sprintf(filename, "/dev_hdd0/game/%s/USRDIR/MM_NON_NPDRM_EBOOT.BIN", just_title_id); sprintf(other_pane, "/dev_hdd0/G/%s/USRDIR/EBOOT.BIN", just_title_id2); if(exist(filename)) { unlink(other_pane); remove(other_pane); rename(filename, other_pane); //file_copy(filename, other_pane, 0); } // sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); // sprintf(string1 ,"/dev_hdd0/game/%s/PARAM.SFO", just_title_id); // file_copy(filename, string1, 0); // sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); // sprintf(string1,"/dev_hdd0/G/%s/PARAM.SFO", just_title_id2); // file_copy(filename, string1, 0); cellMsgDialogAbort(); sprintf(fm_func, "%s", "none"); goto all_prompts_done; } if(strcmp(other_dev, this_dev)==0 && do_move==1 && !strcmp(fm_func, "move")) rename ( list[m_copy].path, other_pane ); else { sprintf(fm_func, "%s", "none"); if(strstr(other_pane,"/net_host")!=NULL){ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); net_folder_copy_put((char *) list[m_copy].path, (char *) temp_pane, (char *) list[m_copy].name); } else if(net_copy==1){ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); net_folder_copy((char *) list[m_copy].path, (char *) temp_pane, (char *) list[m_copy].name); } else { char tmp_path[512]; sprintf(tmp_path, "%s", list[m_copy].path); if(strstr("/ps3_home", tmp_path)!=NULL) {mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777);} if(strstr("/ps3_home/music", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/music"); if(strstr("/ps3_home/video", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/video"); if(strstr("/ps3_home/photo", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/photo"); if(strstr(other_pane, "/ps3_home/video")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); // recursive to single folder copy else if(strstr(other_pane, "/ps3_home/music")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); else if(strstr(other_pane, "/ps3_home/photo")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); else { dialog_ret=1; if(exist(other_pane)) { dialog_ret=0; sprintf(filename, (const char*) STR_OVERWRITE, other_pane ); cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret!=1) goto overwrite_cancel_3; mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) tmp_path, (char *) other_pane); } } ret=cellMsgDialogAbort(); if(do_move==1 && abort_copy==0) { my_game_delete((char *) list[m_copy].path); rmdir((char *) list[m_copy].path); } } all_prompts_done: if(x_offset>=0.54f) state_read=2; else state_read=3; if(do_move==1) state_read=1; termConsole(); cellMsgDialogAbort(); if( (do_move==1 && strstr(list[m_copy].path, "/dev_hdd")!=NULL) || (strstr(other_pane, "/dev_hdd")!=NULL)) forcedevices|=0x0001; if( (do_move==1 && strstr(list[m_copy].path, "/dev_usb")!=NULL) || (strstr(other_pane, "/dev_usb")!=NULL)) forcedevices|=0xFFFE; if(abort_copy!=0) break; } sprintf(fm_func, "%s", "none"); } sprintf(fm_func, "%s", "none"); } overwrite_cancel_3: // if ((new_pad & BUTTON_CIRCLE) && (list[e].type==1) && (list[e].name[0]!=0x2e) && strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0 && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL) && disable_options!=2 && disable_options!=3) if ((!strcmp(fm_func, "copy") || !strcmp(fm_func, "move")) && (list[e].type==1) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) { //fm copy file do_move=0; // if((old_pad & BUTTON_SELECT)) do_move=1; if(!strcmp(fm_func, "move")) do_move=1; sprintf(fm_func, "%s", "none"); if(strstr(list[e].path, "/net_host")!=NULL) do_move=0; if(strstr(this_pane, "/ps3_home")!=NULL) do_move=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==1) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(m_copy_total==1) { if(do_move==1) sprintf(filename, (const char*) STR_MOVE1, list[e].path, other_pane, list[e].name); else sprintf(filename, (const char*) STR_COPY11, list[e].path, other_pane, list[e].name); } else { if(do_move==1) sprintf(filename, (const char*) STR_MOVE2, m_copy_total, this_pane, other_pane); else sprintf(filename, (const char*) STR_COPY12, m_copy_total, this_pane, other_pane); } dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { time_start= time(NULL); abort_copy=0; file_counter=0; new_pad=0; if(strstr(other_pane,"/dev_usb")!=NULL || strstr(other_pane,"/dev_sd")!=NULL || strstr(other_pane,"/dev_ms")!=NULL || strstr(other_pane,"/dev_cf")!=NULL) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; char m_other_pane[512]; sprintf(m_other_pane, "%s", other_pane); for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==1) { list[m_copy].selected=0; sprintf(other_pane,"%s/%s", m_other_pane, list[m_copy].name); if(strcmp(other_dev, this_dev)==0 && do_move==1) rename ( list[m_copy].path, other_pane ); else { if(do_move==1) sprintf(string1, "%s", STR_MOVE3); else sprintf(string1, "%s", STR_COPY5); ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); if(do_move==1) sprintf(string1, "%s", STR_MOVE4); else sprintf(string1, "%s", STR_COPY6); if(strstr(other_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=other_pane[9]-0x30; if(strlen(other_pane)>11) sprintf(cpath2, "/%s", other_pane+11); else sprintf(cpath2, "/%s", list[m_copy].name); char put_cmd[1024]; sprintf(put_cmd, "PUT-%.f", (double) list[m_copy].size); network_put((char*)put_cmd, (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) list[m_copy].path, 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); // network_put(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) } else if(strstr(list[m_copy].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[m_copy].path); chost=list[m_copy].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[m_copy].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, if(strstr(other_pane, "/ps3_home/video")!=NULL && (strstr(list[m_copy].path, ".avi")!=NULL || strstr(list[m_copy].path, ".AVI")!=NULL || strstr(list[m_copy].path, ".m2ts")!=NULL || strstr(list[m_copy].path, ".M2TS")!=NULL || strstr(list[m_copy].path, ".mts")!=NULL || strstr(list[m_copy].path, ".MTS")!=NULL || strstr(list[m_copy].path, ".m2t")!=NULL || strstr(list[m_copy].path, ".M2T")!=NULL || strstr(list[m_copy].path, ".divx")!=NULL || strstr(list[m_copy].path, ".DIVX")!=NULL || strstr(list[m_copy].path, ".mpg")!=NULL || strstr(list[m_copy].path, ".MPG")!=NULL || strstr(list[m_copy].path, ".mpeg")!=NULL || strstr(list[m_copy].path, ".MPEG")!=NULL || strstr(list[m_copy].path, ".mp4")!=NULL || strstr(list[m_copy].path, ".MP4")!=NULL || strstr(list[m_copy].path, ".vob")!=NULL || strstr(list[m_copy].path, ".VOB")!=NULL || strstr(list[m_copy].path, ".wmv")!=NULL || strstr(list[m_copy].path, ".WMV")!=NULL || strstr(list[m_copy].path, ".ts")!=NULL || strstr(list[m_copy].path, ".TS")!=NULL || strstr(list[m_copy].path, ".mov")!=NULL || strstr(list[m_copy].path, ".MOV")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) video_export((char *) list[m_copy].name, (char*) "My video", 1); } else if(strstr(other_pane, "/ps3_home/music")!=NULL && (strstr(list[m_copy].path, ".mp3")!=NULL || strstr(list[m_copy].path, ".MP3")!=NULL || strstr(list[m_copy].path, ".wav")!=NULL || strstr(list[m_copy].path, ".WAV")!=NULL || strstr(list[m_copy].path, ".aac")!=NULL || strstr(list[m_copy].path, ".AAC")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) music_export((char *) list[m_copy].name, (char*) "My music", 1); } else if(strstr(other_pane, "/ps3_home/photo")!=NULL && (strstr(list[m_copy].path, ".jpg")!=NULL || strstr(list[m_copy].path, ".JPG")!=NULL || strstr(list[m_copy].path, ".jpeg")!=NULL || strstr(list[m_copy].path, ".JPEG")!=NULL || strstr(list[m_copy].path, ".png")!=NULL || strstr(list[m_copy].path, ".PNG")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) photo_export((char *) list[m_copy].name, (char*) "My photos", 1); } else if(strstr(other_pane, "/ps3_home")==NULL) network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); } else { cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE|CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,string1,NULL,NULL,NULL); flip(); if(strstr(other_pane, "/ps3_home/video")!=NULL && (strstr(list[m_copy].path, ".avi")!=NULL || strstr(list[m_copy].path, ".AVI")!=NULL || strstr(list[m_copy].path, ".m2ts")!=NULL || strstr(list[m_copy].path, ".M2TS")!=NULL || strstr(list[m_copy].path, ".mts")!=NULL || strstr(list[m_copy].path, ".MTS")!=NULL || strstr(list[m_copy].path, ".m2t")!=NULL || strstr(list[m_copy].path, ".M2T")!=NULL || strstr(list[m_copy].path, ".divx")!=NULL || strstr(list[m_copy].path, ".DIVX")!=NULL || strstr(list[m_copy].path, ".mpg")!=NULL || strstr(list[m_copy].path, ".MPG")!=NULL || strstr(list[m_copy].path, ".mpeg")!=NULL || strstr(list[m_copy].path, ".MPEG")!=NULL || strstr(list[m_copy].path, ".mp4")!=NULL || strstr(list[m_copy].path, ".MP4")!=NULL || strstr(list[m_copy].path, ".vob")!=NULL || strstr(list[m_copy].path, ".VOB")!=NULL || strstr(list[m_copy].path, ".wmv")!=NULL || strstr(list[m_copy].path, ".WMV")!=NULL || strstr(list[m_copy].path, ".ts")!=NULL || strstr(list[m_copy].path, ".TS")!=NULL || strstr(list[m_copy].path, ".mov")!=NULL || strstr(list[m_copy].path, ".MOV")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) video_export((char *) list[m_copy].name, (char*) "My video", 1); } else if(strstr(other_pane, "/ps3_home/music")!=NULL && (strstr(list[m_copy].path, ".mp3")!=NULL || strstr(list[m_copy].path, ".MP3")!=NULL || strstr(list[m_copy].path, ".wav")!=NULL || strstr(list[m_copy].path, ".WAV")!=NULL || strstr(list[m_copy].path, ".aac")!=NULL || strstr(list[m_copy].path, ".AAC")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) music_export((char *) list[m_copy].name, (char*) "My music", 1); } else if(strstr(other_pane, "/ps3_home/photo")!=NULL && (strstr(list[m_copy].path, ".jpg")!=NULL || strstr(list[m_copy].path, ".JPG")!=NULL || strstr(list[m_copy].path, ".jpeg")!=NULL || strstr(list[m_copy].path, ".JPEG")!=NULL || strstr(list[m_copy].path, ".png")!=NULL || strstr(list[m_copy].path, ".PNG")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) photo_export((char *) list[m_copy].name, (char*) "My photos", 1); } else if(strstr(other_pane, "/ps3_home")==NULL) { file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(do_move==1 && abort_copy==0) remove(list[m_copy].path); cellMsgDialogAbort(); } } } } if(x_offset>=0.54f) state_read=2; else state_read=3; if(do_move==1) state_read=1; } sprintf(fm_func, "%s", "none"); } if( ((new_pad & BUTTON_SQUARE)) && (list[e].name[0]!=0x2e) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) //&& strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0 { list[e].selected=1-list[e].selected; //new_pad=0; } } // if(c_opacity2>0x20) { if(x_offset>=0.54f) { print_label_width( x_offset, y_offset, 0.7f, color, str, 1.0f, 0.0f, 0, 0.225f); // print_label( x_offset+0.240f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0); print_label_ex( x_offset+0.295f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0, 1.0f, 1.0f, 2); print_label( x_offset+0.305f, y_offset, 0.7f, color, str_date, 1.0f, 0.0f, 0); } else { // print_label( x_offset+0.290f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0); print_label_width( x_offset, y_offset, 0.7f, color, str, 1.0f, 0.0f, 0, 0.27f); print_label_ex( x_offset+0.345f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0, 1.0f, 1.0f, 2); print_label( x_offset+0.355f, y_offset, 0.7f, color, str_date, 1.0f, 0.0f, 0); } } // cellDbgFontPrintf( x_offset, y_offset, 0.7f, color, str); y_offset+=0.026f; } } void parse_color_ini() { FILE *fp; th_device_list=1; th_device_separator=1; th_device_separator_y=956; th_legend=1; th_legend_y=853; th_drive_icon=1; th_drive_icon_x=1790; th_drive_icon_y=964; if(exist(color_ini)) { char col[16], line[128]; int len=0, i=0; fp = fopen ( color_ini, "r" ); while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"PS3DISC=")!=NULL) { len = strlen(line)-2; for(i = 8; i < len; i++) {col[i-8] = line[i];} col[i-8]=0; COL_PS3DISC=strtoul(col, NULL, 16); } if(strstr (line,"PS3DISCSEL=")!=NULL) { len = strlen(line)-2; for(i = 11; i < len; i++) {col[i-11] = line[i];} col[i-11]=0; COL_PS3DISCSEL=strtoul(col, NULL, 16); } if(strstr (line,"SEL=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_SEL=strtoul(col, NULL, 16); } if(strstr (line,"PS3=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_PS3=strtoul(col, NULL, 16); } if(strstr (line,"PS2=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_PS2=strtoul(col, NULL, 16); } if(strstr (line,"DVD=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_DVD=strtoul(col, NULL, 16); } if(strstr (line,"BDMV=")!=NULL) { len = strlen(line)-2; for(i = 5; i < len; i++) {col[i-5] = line[i];} col[i-5]=0; COL_BDMV=strtoul(col, NULL, 16); } if(strstr (line,"AVCHD=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_AVCHD=strtoul(col, NULL, 16); } if(strstr (line,"LEGEND=")!=NULL) { len = strlen(line)-2; for(i = 7; i < len; i++) {col[i-7] = line[i];} col[i-7]=0; COL_LEGEND=strtoul(col, NULL, 16); } if(strstr (line,"FMFILE=")!=NULL) { len = strlen(line)-2; for(i = 7; i < len; i++) {col[i-7] = line[i];} col[i-7]=0; COL_FMFILE=strtoul(col, NULL, 16); } if(strstr (line,"FMDIR=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMDIR=strtoul(col, NULL, 16); } if(strstr (line,"FMJPG=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMJPG=strtoul(col, NULL, 16); } if(strstr (line,"FMMP3=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMMP3=strtoul(col, NULL, 16); } if(strstr (line,"FMEXE=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMEXE=strtoul(col, NULL, 16); } if(strstr (line,"HEXVIEW=")!=NULL) { len = strlen(line)-2; for(i = 8; i < len; i++) {col[i-8] = line[i];} col[i-8]=0; COL_HEXVIEW=strtoul(col, NULL, 16); } if(strstr (line,"SPLIT=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_SPLIT=strtoul(col, NULL, 16); } if(strstr (line,"XMB_CLOCK=")!=NULL) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; COL_XMB_CLOCK=strtoul(col, NULL, 16); } if(strstr (line,"XMB_COLUMN=")!=NULL) { len = strlen(line)-2; for(i = 11; i < len; i++) {col[i-11] = line[i];} col[i-11]=0; COL_XMB_COLUMN=strtoul(col, NULL, 16); } if(strstr (line,"XMB_TITLE=")!=NULL) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; COL_XMB_TITLE=strtoul(col, NULL, 16); } if(strstr (line,"XMB_SUBTITLE=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; COL_XMB_SUBTITLE=strtoul(col, NULL, 16); } if(strstr (line,"XMB_SPARK_SIZE=")!=NULL) { len = strlen(line)-2; for(i = 15; i < len; i++) {col[i-15] = line[i];} col[i-15]=0; XMB_SPARK_SIZE=strtoul(col, NULL, 10); } if(strstr (line,"XMB_SPARK_COLOR=")!=NULL) { len = strlen(line)-2; for(i = 16; i < len; i++) {col[i-16] = line[i];} col[i-16]=0; XMB_SPARK_COLOR=strtoul(col, NULL, 16); } if(strstr (line,"device_list=0")!=NULL) th_device_list=0; if(strstr (line,"device_separator=0")!=NULL) th_device_separator=0; if(strstr (line,"legend=0")!=NULL) th_legend=0; if(strstr (line,"drive_icon=0")!=NULL) th_drive_icon=0; if(strstr (line,"device_separator_y=")!=NULL) { len = strlen(line)-2; for(i = 19; i < len; i++) {col[i-19] = line[i];} col[i-19]=0; th_device_separator_y=strtoul(col, NULL, 10); } if(strstr (line,"legend_y=")!=NULL) { len = strlen(line)-2; for(i = 9; i < len; i++) {col[i-9] = line[i];} col[i-9]=0; th_legend_y=strtoul(col, NULL, 10); } if(strstr (line,"drive_icon_x=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; th_drive_icon_x=strtoul(col, NULL, 10); } if(strstr (line,"drive_icon_y=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; th_drive_icon_y=strtoul(col, NULL, 10); } if(strstr (line,"user_font=")!=NULL && !mm_locale) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; if(strtoul(col, NULL, 10)!=0) user_font=strtoul(col, NULL, 10); if(user_font<0 || user_font>19) user_font=1; } if(strstr (line,"game_bg_overlay=0")!=NULL) game_bg_overlay=0; if(strstr (line,"game_bg_overlay=1")!=NULL) game_bg_overlay=1; } fclose(fp); } } void write_last_state() { char filename2[1024], filename3[64]; sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); sprintf(filename2, "%s/STATE.BIN", app_usrdir); if(!exist(app_usrdir)) return; FILE *fpA; // remove(filename2); fpA = fopen ( filename2, "w" ); char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; filename3[0]=0; sprintf(filename3, "game_sel=%i\r\n", game_sel); fputs (filename3, fpA ); sprintf(filename3, "user_font=%i\r\n", user_font); fputs (filename3, fpA ); fclose(fpA); } void parse_last_state() { char string1[1024]; char filename2[1024]; sprintf(filename2, "%s/STATE.BIN", app_usrdir); if(!exist(filename2)) return; FILE *fp = fopen ( filename2, "r" ); int i; if ( fp != NULL ) { char line [1024]; while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"user_font=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {string1[i-10] = line[i];} string1[i-10]=0; user_font=strtol(string1, NULL, 10); if(game_sel<0 || game_sel>19) user_font=1; } if(strstr (line,"game_sel=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {string1[i-9] = line[i];} string1[i-9]=0; game_sel=strtol(string1, NULL, 10); if(game_sel<0 || game_sel>max_menu_list-1) game_sel=0; } } fclose ( fp ); } } int parse_ini(char * file, int skip_bin) { int i; max_hosts=0; game_last_page=-1; old_fi=-1; char line [ 256 ]; FILE *fp; if(!exist(file)) goto op_bin; fp = fopen ( file, "r" ); if ( fp != NULL ) { while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"hdd_dir=")!=NULL) { int len = strlen(line)-2; for(i = 8; i < len; i++) {ini_hdd_dir[i-8] = line[i];} ini_hdd_dir[i-8]=0; // DPrintf("Game backup folder (HDD): [%s]\n", ini_hdd_dir); } if(strstr (line,"usb_dir=")!=NULL) { int len = strlen(line)-2; for(i = 8; i < len; i++) {ini_usb_dir[i-8] = line[i];} ini_usb_dir[i-8]=0; // DPrintf("Game backup folder (USB): [%s]\n", ini_usb_dir); } if(strstr (line,"hdd_home=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {hdd_home[i-9] = line[i];} hdd_home[i-9]=0; // DPrintf("Game search folder (HDD): [%s]\n", hdd_home); } if(strstr (line,"hdd_home2=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_2[i-10] = line[i];} hdd_home_2[i-10]=0; // DPrintf("Game search folder (HDD) (aux#1): [%s]\n", hdd_home_2); } if(strstr (line,"hdd_home3=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_3[i-10] = line[i];} hdd_home_3[i-10]=0; // DPrintf("Game search folder (HDD) (aux#2): [%s]\n", hdd_home_3); } if(strstr (line,"hdd_home4=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_4[i-10] = line[i];} hdd_home_4[i-10]=0; // DPrintf("Game search folder (HDD) (aux#3): [%s]\n", hdd_home_4); } if(strstr (line,"hdd_home5=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_5[i-10] = line[i];} hdd_home_5[i-10]=0; // DPrintf("Game search folder (HDD) (aux#4): [%s]\n", hdd_home_5); } if(strstr (line,"usb_home=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {usb_home[i-9] = line[i];} usb_home[i-9]=0; // DPrintf("Game search folder (USB): [%s]\n", usb_home); } if(strstr (line,"usb_home2=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_2[i-10] = line[i];} usb_home_2[i-10]=0; // DPrintf("Game search folder (USB) (aux#1): [%s]\n", usb_home_2); } if(strstr (line,"usb_home3=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_3[i-10] = line[i];} usb_home_3[i-10]=0; // DPrintf("Game search folder (USB) (aux#2): [%s]\n", usb_home_3); } if(strstr (line,"usb_home4=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_4[i-10] = line[i];} usb_home_4[i-10]=0; // DPrintf("Game search folder (USB) (aux#3): [%s]\n", usb_home_4); } if(strstr (line,"usb_home5=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_5[i-10] = line[i];} usb_home_5[i-10]=0; // DPrintf("Game search folder (USB) (aux#4): [%s]\n", usb_home_5); } if(strstr (line,"covers_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {covers_dir[i-11] = line[i];} covers_dir[i-11]=0; // DPrintf("Game covers folder (HDD): [%s]\n", covers_dir); } if(strstr (line,"themes_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {themes_dir[i-11] = line[i];} themes_dir[i-11]=0; // DPrintf("Themes folder: [%s]\n", themes_dir); } if(strstr (line,"themes_web_dir=")!=NULL) { int len = strlen(line)-2; for(i = 15; i < len; i++) {themes_web_dir[i-15] = line[i];} themes_web_dir[i-15]=0; // DPrintf("Themes folder: [%s]\n", themes_dir); } if(strstr (line,"update_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {update_dir[i-11] = line[i];} update_dir[i-11]=0; // DPrintf("Update save folder: [%s]\n", update_dir); } if(strstr (line,"download_dir=")!=NULL) { int len = strlen(line)-2; for(i = 13; i < len; i++) {download_dir[i-13] = line[i];} download_dir[i-13]=0; // DPrintf("Web browser downloads save folder: [%s]\n", download_dir); } if(strstr (line,"snes_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {snes_roms[i-10] = line[i];} snes_roms[i-10]=0; } if(strstr (line,"snes_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {snes_self[i-10] = line[i];} snes_self[i-10]=0; } if(strstr (line,"genp_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {genp_roms[i-10] = line[i];} genp_roms[i-10]=0; } if(strstr (line,"genp_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {genp_self[i-10] = line[i];} genp_self[i-10]=0; } if(strstr (line,"fceu_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {fceu_roms[i-10] = line[i];} fceu_roms[i-10]=0; } if(strstr (line,"fceu_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {fceu_self[i-10] = line[i];} fceu_self[i-10]=0; } if(strstr (line,"vba_roms=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {vba_roms[i-9] = line[i];} vba_roms[i-9]=0; } if(strstr (line,"vba_self=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {vba_self[i-9] = line[i];} vba_self[i-9]=0; } if(strstr (line,"fba_roms=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {fba_roms[i-9] = line[i];} fba_roms[i-9]=0; } if(strstr (line,"fba_self=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {fba_self[i-9] = line[i];} fba_self[i-9]=0; } //nethost:10.20.2.208:11222:/downloads/ char n_prefix[32], n_host[128], n_port[6], n_friendly[64], n_em[64]; if(sscanf(line,"%[^*]*%[^*]*%[^*]*%[^*]*%s\n", n_prefix, n_host, n_port, n_friendly, n_em)>=4) //, n_root //%[^:]: if(strcmp(n_prefix, "nethost")==0 && max_hosts<9) { sprintf(host_list[max_hosts].host, "%s", n_host); host_list[max_hosts].port=strtol(n_port, NULL, 10); // sprintf(host_list[max_hosts].root, "%s", n_root); sprintf(host_list[max_hosts].friendly, "%s", n_friendly); sprintf(host_list[max_hosts].name,"%s/net_host%i", app_usrdir, max_hosts); DPrintf("[Host PC#%i] %s:%s * Friendly name: %s\n", max_hosts+1, n_host, n_port, n_friendly); //, n_root // Serve path: %s max_hosts++; } } fclose ( fp ); // if(strstr(mp3_now_playing, "SOUND.BIN")==NULL) DPrintf("Now playing: %s", mp3_now_playing ); } op_bin: if(skip_bin) goto out_ini; fp = fopen ( options_bin, "r" ); if ( fp != NULL ) { while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"ftpd_on=1")!=NULL) {ftp_on(); ftp_service=1;} // int bpcm=cover_mode; if(strstr (line,"fullpng=0")!=NULL) cover_mode=0; if(strstr (line,"fullpng=1")!=NULL) cover_mode=1; if(strstr (line,"fullpng=2")!=NULL) cover_mode=2; if(strstr (line,"fullpng=3")!=NULL) cover_mode=3; if(strstr (line,"fullpng=4")!=NULL) cover_mode=4; if(strstr (line,"fullpng=6")!=NULL) cover_mode=6; if(strstr (line,"fullpng=5")!=NULL) cover_mode=5; if(strstr (line,"fullpng=7")!=NULL) cover_mode=7; if(strstr (line,"fullpng=8")!=NULL) cover_mode=8; initial_cover_mode=cover_mode; if(strstr (line,"game_bg_overlay=0")!=NULL) game_bg_overlay=0; if(strstr (line,"game_bg_overlay=1")!=NULL) game_bg_overlay=1; if(strstr (line,"gray_poster=0")!=NULL) gray_poster=0; if(strstr (line,"gray_poster=1")!=NULL) gray_poster=1; if(strstr (line,"confirm_with_x=0")!=NULL) confirm_with_x=0; if(strstr (line,"confirm_with_x=1")!=NULL) confirm_with_x=1; set_xo(); if(strstr (line,"hide_bd=0")!=NULL) hide_bd=0; if(strstr (line,"hide_bd=1")!=NULL) hide_bd=1; if(strstr (line,"theme_sound=0")!=NULL) theme_sound=0; if(strstr (line,"theme_sound=1")!=NULL) theme_sound=1; if(strstr (line,"display_mode=0")!=NULL && line[0]=='d') display_mode=0; if(strstr (line,"display_mode=1")!=NULL && line[0]=='d') display_mode=1; if(strstr (line,"display_mode=2")!=NULL && line[0]=='d') display_mode=2; if(strstr (line,"showdir=0")!=NULL) dir_mode=0; if(strstr (line,"showdir=1")!=NULL) dir_mode=1; if(strstr (line,"showdir=2")!=NULL) dir_mode=2; if(strstr (line,"game_details=0")!=NULL) game_details=0; if(strstr (line,"game_details=1")!=NULL) game_details=1; if(strstr (line,"game_details=2")!=NULL) game_details=2; if(strstr (line,"game_details=3")!=NULL) game_details=3; if(strstr (line,"use_pad_sensor=0")!=NULL) use_pad_sensor=0; if(strstr (line,"use_pad_sensor=1")!=NULL) use_pad_sensor=1; if(strstr (line,"bd_emulator=0")!=NULL) bd_emulator=0; if(strstr (line,"bd_emulator=1")!=NULL) bd_emulator=1; if(strstr (line,"bd_emulator=2")!=NULL) bd_emulator=2; if(c_firmware==3.41f && bd_emulator>1) bd_emulator=1; if(strstr (line,"scan_avchd=0")!=NULL) scan_avchd=0; if(strstr (line,"scan_avchd=1")!=NULL) scan_avchd=1; if(strstr (line,"clear_activity_logs=0")!=NULL) clear_activity_logs=0; if(strstr (line,"clear_activity_logs=1")!=NULL) clear_activity_logs=1; if(strstr (line,"lock_display_mode=0")!=NULL) lock_display_mode=0; if(strstr (line,"lock_display_mode=1")!=NULL) lock_display_mode=1; if(strstr (line,"lock_display_mode=2")!=NULL) lock_display_mode=2; if(strstr (line,"lock_display_mode=3")!=NULL) lock_display_mode=3; if(strstr (line,"lock_display_mode=4")!=NULL) lock_display_mode=4; if(strstr (line,"lock_display_mode=5")!=NULL) lock_display_mode=5; if(strstr (line,"lock_display_mode=6")!=NULL) lock_display_mode=6; if(strstr (line,"lock_display_mode=7")!=NULL) lock_display_mode=7; if(strstr (line,"lock_display_mode=8")!=NULL) lock_display_mode=8; if(strstr (line,"expand_avchd=0")!=NULL) expand_avchd=0; if(strstr (line,"expand_avchd=1")!=NULL) expand_avchd=1; if(strstr (line,"lock_fileman=0")!=NULL) lock_fileman=0; if(strstr (line,"lock_fileman=1")!=NULL) lock_fileman=1; if(strstr (line,"progress_bar=0")!=NULL) progress_bar=0; if(strstr (line,"progress_bar=1")!=NULL) progress_bar=1; if(strstr (line,"verify_data=0")!=NULL) verify_data=0; if(strstr (line,"verify_data=1")!=NULL) verify_data=1; if(strstr (line,"verify_data=2")!=NULL) verify_data=2; if(strstr (line,"scan_for_apps=0")!=NULL) scan_for_apps=0; if(strstr (line,"scan_for_apps=1")!=NULL) scan_for_apps=1; if(strstr (line,"xmb_sparks=0")!=NULL) xmb_sparks=0; if(strstr (line,"xmb_sparks=1")!=NULL) xmb_sparks=1; if(strstr (line,"xmb_sparks=2")!=NULL) xmb_sparks=2; if(strstr (line,"xmb_popup=0")!=NULL) xmb_popup=0; if(strstr (line,"xmb_popup=1")!=NULL) xmb_popup=1; if(strstr (line,"xmb_game_bg=0")!=NULL) xmb_game_bg=0; if(strstr (line,"xmb_game_bg=1")!=NULL) xmb_game_bg=1; if(strstr (line,"xmb_cover=0")!=NULL) xmb_cover=0; if(strstr (line,"xmb_cover=1")!=NULL) xmb_cover=1; if(strstr (line,"xmb_cover_column=0")!=NULL) xmb_cover_column=0; if(strstr (line,"xmb_cover_column=1")!=NULL) xmb_cover_column=1; if(strstr (line,"date_format=0")!=NULL) date_format=0; if(strstr (line,"date_format=1")!=NULL) date_format=1; if(strstr (line,"date_format=2")!=NULL) date_format=2; if(strstr (line,"time_format=0")!=NULL) time_format=0; if(strstr (line,"time_format=1")!=NULL) time_format=1; if(strstr (line,"mount_hdd1=0")!=NULL) mount_hdd1=0; if(strstr (line,"mount_hdd1=1")!=NULL) mount_hdd1=1; if(strstr (line,"animation=0")!=NULL) animation=0; if(strstr (line,"animation=1")!=NULL) animation=1; if(strstr (line,"animation=2")!=NULL) animation=2; if(strstr (line,"animation=3")!=NULL) animation=3; if(strstr (line,"disable_options=0")!=NULL) disable_options=0;// DPrintf("Disable options: [none]\n");} if(strstr (line,"disable_options=1")!=NULL) disable_options=1;// DPrintf("Disable options: [delete]\n");} if(strstr (line,"disable_options=2")!=NULL) disable_options=2;// DPrintf("Disable options: [copy/backup]\n");} if(strstr (line,"disable_options=3")!=NULL) disable_options=3;// DPrintf("Disable options: [copy/backup/delete]\n");} if(strstr (line,"download_covers=0")!=NULL) download_covers=0; if(strstr (line,"download_covers=1")!=NULL) download_covers=1; if(strstr (line,"overscan=")!=NULL) { overscan=(strtod(((char*)line)+9, NULL)/100.f); if(overscan>0.10f) overscan=0.10f; if(overscan<0.00f) overscan=0.00f; } char dimS[8]; if(strstr (line,"dim_titles=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; dim_setting=strtoul(dimS, NULL, 10); if(dim_setting>10) dim_setting=10; } if(strstr (line,"ss_timeout=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; ss_timeout=strtoul(dimS, NULL, 10); if(ss_timeout>10) ss_timeout=0; } if(strstr (line,"user_font=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {dimS[i-10] = line[i];} dimS[i-10]=0; user_font=strtoul(dimS, NULL, 10); if(user_font<0 || user_font>19) user_font=1; } if(strstr (line,"mm_locale=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {dimS[i-10] = line[i];} dimS[i-10]=0; mm_locale=strtoul(dimS, NULL, 10); if(mm_locale>=MAX_LOCALES) mm_locale=0; } if(strstr (line,"deadzone_x=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; xDZ=strtoul(dimS, NULL, 10); if(xDZ>90) xDZ=90; xDZa=(int) (xDZ*128/100); } if(strstr (line,"deadzone_y=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; yDZ=strtoul(dimS, NULL, 10); if(yDZ>90) yDZ=90; yDZa=(int) (yDZ*128/100); } if(strstr (line,"repeat_init_delay=")!=NULL) { int len = strlen(line)-2; for(i = 18; i < len; i++) {dimS[i-18] = line[i];} dimS[i-18]=0; repeat_init_delay=strtoul(dimS, NULL, 10); } if(strstr (line,"repeat_key_delay=")!=NULL) { int len = strlen(line)-2; for(i = 17; i < len; i++) {dimS[i-17] = line[i];} dimS[i-17]=0; repeat_key_delay=strtoul(dimS, NULL, 10); } if(strstr (line,"parental_level=")!=NULL) { int len = strlen(line)-2; for(i = 15; i < len; i++) {dimS[i-15] = line[i];} dimS[i-15]=0; parental_level=strtoul(dimS, NULL, 10); if(parental_level<0 || parental_level>11) parental_level=0; } if(strstr (line,"parental_pass=")!=NULL) { int len = strlen(line)-2; for(i = 14; i < len; i++) {dimS[i-14] = line[i];} dimS[i-14]=0; strncpy(parental_pass, dimS, 4); parental_pass[4]=0; if(strlen(parental_pass)<4) {sprintf(parental_pass, "0000"); parental_pass[4]=0;} } } fclose ( fp ); } out_ini: return 0; } void get_www_themes(theme_def *list, u8 *max) { int ret=0; (*max)=0; if(cellNetCtlGetInfo(16, &net_info)<0) { //net_avail=-1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } //dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); //flipc(60); char update_url[128]=" "; char local_file[64]=" "; char line[2048]; char update_server[256]; sprintf(update_server, "%s/themes_web/", url_base); if(c_firmware>3.30f) sprintf(update_url,"%sthemes.bin", update_server); if(c_firmware<3.40f) sprintf(update_url,"%sthemes315.bin", update_server); if(c_firmware>3.54f) sprintf(update_url,"%sthemes355.bin", update_server); sprintf(local_file, "%s/themes_check.bin", app_temp); remove(local_file); ret = download_file(update_url, local_file, 0); cellMsgDialogAbort(); if(ret==0) { dialog_ret=0; //net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); remove(local_file); // sprintf(local_file, "%s/themes_check.bin", app_temp); // sprintf(line, "%s/THEME.BIN" // remove(local_file); return; } ret=0; fpV = fopen ( local_file, "r" ); if ( fpV != NULL ) { char t_prefix[8], t_name[64], t_pkg[512], t_img[512], t_author[32], t_ver[16], t_free[64], t_em[128]; while ( fgets ( line, sizeof line, fpV ) != NULL ) { if(sscanf(line,"%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%s\n", t_prefix, t_name, t_pkg, t_img, t_author, t_ver, t_free, t_em)>=7) if(strcmp(t_prefix, "theme")==0 && (*max)< (MAX_WWW_THEMES-1)) { sprintf(list[*max].name, "%s", t_name); sprintf(list[*max].pkg, "%s", t_pkg); sprintf(list[*max].img, "%s", t_img); sprintf(list[*max].author, "%s", t_author); sprintf(list[*max].mmver, "%s", t_ver); sprintf(list[*max].info, "%s", t_free); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, t_name, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, t_pkg, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); (*max)++; } } fclose(fpV); } if ((*max)==0) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_ERR_SRV0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } remove(local_file); } void check_for_update() { int ret=0; force_update_check=0; if(cellNetCtlGetInfo(16, &net_info)<0)//net_avail<0 || { net_avail=-1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char filename[1024]; char update_url[128]=" "; char local_file[64]=" "; char line[128]; char usb_save[128]="/skip"; if(exist(update_dir)) sprintf(usb_save, "%s", update_dir); else for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } // } if(!exist(usb_save) && payload>-1) sprintf(usb_save,"%s/TEMP", app_usrdir); // && c_firmware<3.55f char update_server[256]; sprintf(update_server, "%s/", url_base); if(c_firmware>3.30f) sprintf(update_url,"%sversion.txt", update_server); if(c_firmware<3.40f) sprintf(update_url,"%sversion315.txt", update_server); if(c_firmware>3.54f) sprintf(update_url,"%sversion355.txt", update_server); sprintf(local_file, "%s", versionUP); remove(local_file); ret = download_file(update_url, local_file, 0); cellMsgDialogAbort(); if(ret==0) { dialog_ret=0; net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char new_version[9]; ret=0; fpV = fopen ( versionUP, "r" ); if ( fpV != NULL ) { while ( fgets ( line, sizeof line, fpV ) != NULL ) { if(strlen(line)==8) {sprintf(new_version, "%s", line); ret=1;} break; } fclose(fpV); } if (ret==1) { char whatsnew[512]; whatsnew[0]=0; sprintf(local_file, "%s/whatsnew.txt", app_temp); remove(local_file); sprintf(update_url,"%swn.txt", update_server); ret = download_file(update_url, local_file, 0); if (ret==1) { fpV = fopen ( local_file, "r" ); if ( fpV != NULL ) { while ( fgets ( line, sizeof line, fpV ) != NULL ) { sprintf(whatsnew, "%s%s", whatsnew, line); } fclose(fpV); remove(local_file); whatsnew[511]=0; sprintf(filename, (const char*)STR_WHATS_NEW, new_version, whatsnew); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } if(exist(usb_save)) { if(strcmp(current_version, new_version)!=0) { // if(c_firmware>3.30f) sprintf(filename, "New version found (FW 3.40-3.42): %s\n\nYour current version: %s\n\nDo you want to download the update?", new_version, current_version); // if(c_firmware<3.40f) sprintf(filename, "New version found: %s\n\nYour current version: %s\n\nDo you want to download the update?", new_version, current_version); // if(c_firmware>3.30f) sprintf(filename, (const char*)STR_NEW_VER, new_version, current_version); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { if(c_firmware<=3.30f) sprintf(update_url,"%smultiMAN2_315.bin", update_server); if(c_firmware> 3.39f) sprintf(update_url,"%smultiMAN2_340.bin", update_server); if(c_firmware> 3.54f) sprintf(update_url,"%smultiMAN2_355.bin", update_server); sprintf(local_file,"%s/multiMAN_%s.pkg", usb_save, new_version); ret = download_file(update_url, local_file, 1); dialog_ret=0; if(ret==1) { if(strstr(local_file, "USRDIR/TEMP")!=NULL) sprintf(local_file, "/app_home/multiMAN_%s.pkg", new_version); sprintf(filename, (const char*)STR_NEW_VER_DL, local_file, STR_QUIT); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) if(net_used_ignore()){ syscall_mount2( (char *) "/app_home", (char *) usb_save); unload_modules(); sys_process_exit(1); } } else { ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else { sprintf(filename, (const char*)STR_NEW_VER_NN, current_version); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else //no usb/card connected { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NEW_VER_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } remove(versionUP); } void check_for_game_update(char *game_id, char *game_title) { int ret=0; if(net_avail<0 || cellNetCtlGetInfo(16, &net_info)<0) { dialog_ret=0; net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char filename[1024]; char update_url[256]=" "; char local_file[512]=" "; char line[512]; char usb_save[512]="/skip"; char versionGAME[256]; char temp_val[32]; float param_ver=0.0f; char game_param_sfo[512]; sprintf(game_param_sfo, "/dev_hdd0/game/%s/PARAM.SFO", game_id); if(get_param_sfo_field((char *)game_param_sfo, (char *)"APP_VER", (char *)temp_val)) { param_ver=strtof(temp_val, NULL); } typedef struct { char pkg_ver[8]; uint64_t pkg_size; char ps3_ver[8]; char pkg_url[1024]; } pkg_update; pkg_update pkg_list[32]; int max_pkg=0; if(exist(update_dir)) sprintf(usb_save, "%s", update_dir); else for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } // } if(!exist(usb_save) && payload>-1) { sprintf(usb_save,"%s/PKG", app_usrdir); mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } sprintf(versionGAME,"%s/TEMP/%s.UPD", app_usrdir, game_id); sprintf(update_url, "%s/ps3u/?ID=%s", url_base, game_id); remove(versionGAME); ret = download_file(update_url, versionGAME, 0); char new_version[511]; new_version[0]=0; ret=0; char g_title[256], g_ver[256], g_url[1024], g_ps3[8]; sprintf(g_title, "%s", game_title); uint64_t all_pkg=0;//g_size=0, int lc=0, first_pkg=-1; fpV = fopen ( versionGAME, "r" ); if ( fpV != NULL ) { while ( fscanf (fpV, "%[^|]|%[^|]|%[^|]|%s\n", g_ver, line, g_ps3, g_url )>3) { lc++; if(lc==1 && strlen(g_ver)>2) sprintf(g_title, "[%s]: %s", game_id, g_ver); if(lc>1) { sprintf(pkg_list[max_pkg].pkg_ver, "%s", g_ver); sprintf(pkg_list[max_pkg].ps3_ver, "%s", g_ps3); sprintf(pkg_list[max_pkg].pkg_url, "%s", g_url); pkg_list[max_pkg].pkg_size = strtoull(line, NULL, 10); all_pkg+=pkg_list[max_pkg].pkg_size; if(param_ver<strtof(g_ver, NULL) && first_pkg==-1) first_pkg=max_pkg; max_pkg++; } } fclose(fpV); } if (max_pkg>0) { if(param_ver>=strtof(pkg_list[max_pkg-1].pkg_ver, NULL)) first_pkg=max_pkg; if(param_ver==0.0f) first_pkg=-1; if(max_pkg==1) sprintf(filename, (const char*) STR_GAME_UPD1, g_title, pkg_list[0].pkg_ver, max_pkg, (double)(all_pkg/1024/1024)); else sprintf(filename, (const char*) STR_GAME_UPD2, g_title, pkg_list[0].pkg_ver, pkg_list[max_pkg-1].pkg_ver, max_pkg, (double)(all_pkg/1024/1024)); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if( (first_pkg!=-1) && dialog_ret==1) { sprintf(filename, (const char*) STR_GAME_UPD3, g_title, param_ver ); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) first_pkg=0; if(dialog_ret==3) goto just_quit; dialog_ret=1; } if(first_pkg<0) first_pkg=0; if(dialog_ret==1) { if(exist(usb_save)) { int lc2; ret=0; for(lc=first_pkg;lc<max_pkg;lc++) { sprintf(local_file, "%s/%s_[UPDATE_%02i_PS3FW_%s]_VER_%s.pkg", usb_save, game_id, lc+1, pkg_list[lc].ps3_ver, pkg_list[lc].pkg_ver); ret=0; for(lc2=0;lc2<3;lc2++){ ret = download_file(pkg_list[lc].pkg_url, local_file, 1); if(ret>0) break; } if(ret!=1) break; } dialog_ret=0; if(ret==1) { if(max_pkg==1) sprintf(filename, (const char*) STR_NEW_VER_DL, local_file, STR_QUIT); else sprintf(filename, (const char*) STR_GAME_UPD5, usb_save, STR_QUIT); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) if(net_used_ignore()) { syscall_mount2( (char *) "/app_home", (char *) usb_save); unload_modules(); sys_process_exit(1); } } else { if(first_pkg>=max_pkg) ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_GAME_UPD6, dialog_fun2, (void*)0x0000aaab, NULL ); else ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else //no usb/card connected { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NEW_VER_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_GAME_UPD7, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } just_quit: ret=1; } void clean_up() { char cleanup[48]=" "; if(clear_activity_logs==1) { sprintf(cleanup, "/dev_hdd0/vsh/pushlist/patch.dat"); remove(cleanup); sprintf(cleanup, "/dev_hdd0/vsh/pushlist/game.dat"); remove(cleanup); for(int n2=0;n2<20;n2++) {sprintf(cleanup, "/dev_hdd0/home/000000%02i/etc/boot_history.dat", n2); remove(cleanup);} } for(int n2=0;n2<20;n2++) { sprintf(cleanup, "/dev_hdd0/home/000000%02i", n2); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); sprintf(cleanup, "/dev_hdd0/home/000000%02i/savedata", n2); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); } sprintf(cleanup, "%s", "/dev_hdd0/game"); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); } void slide_xmb_left(int _xmb_icon) { xmb_sublevel=0; xmb_slide=0; xmb_slide_step=-15; for(int n=0; n<14; n++) { xmb_slide+=xmb_slide_step; ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); flip(); } xmb_sublevel=1; xmb_slide=0; xmb_slide_step=0; draw_xmb_bare(_xmb_icon, 1, 0, 1); } void slide_xmb_right() { xmb_slide=0; xmb_slide_step=15; xmb_sublevel=1; for(int n=0; n<14; n++) { xmb_slide+=xmb_slide_step; ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); flip(); } xmb_slide=0; xmb_slide_step=0; xmb_sublevel=0; } void select_theme() { slide_xmb_left(1); t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; ps3_home_scan_ext_bare(themes_dir, pane, &max_dir, (char*)".mmt"); opt_list_max=0; for(int n=0; n<max_dir; n++) { if(pane[n].name[0]=='_') sprintf(opt_list[opt_list_max].label, "%s", pane[n].name+1); else sprintf(opt_list[opt_list_max].label, "%s", pane[n].name); opt_list[opt_list_max].label[strlen(opt_list[opt_list_max].label)-4]=0; sprintf(opt_list[opt_list_max].value, "%s", pane[n].path); opt_list_max++; if(opt_list_max>=MAX_LIST_OPTIONS) break; } if(opt_list_max) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; int ret_f=open_list_menu((char*) STR_SEL_THEME, 600, opt_list, opt_list_max, 660, 225, 16, 1); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { char tmp_thm[64]; sprintf(tmp_thm, "skip/_%s.mmt", opt_list[ret_f].label); apply_theme(tmp_thm, opt_list[ret_f].value); free_text_buffers(); for(int n=0; n<xmb[1].size; n++) xmb[1].member[n].data=-1; free_all_buffers(); init_xmb_icons(menu_list, max_menu_list, game_sel ); draw_xmb_clock(xmb_clock, 1); draw_xmb_icon_text(xmb_icon); memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); } } slide_xmb_right(); // draw_xmb_bare(1, 1, 0, 1); free(pane); } int select_language() { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; slide_xmb_left(2); for (int n=0;n<MAX_LOCALES;n++ ) { sprintf(opt_list[n].label, "%s", locales[n].loc_name); sprintf(opt_list[n].value, "%i", locales[n].val); } opt_list_max=MAX_LOCALES; int ret_f=open_select_menu((char*) STR_SEL_LANG, 600, opt_list, opt_list_max, text_FONT, 16, 1); use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { mm_locale = (int)(strtod(opt_list[ret_f].value, NULL)); load_localization(mm_locale); for(int n=0; n<MAX_XMB_ICONS; n++) redraw_column_texts(n); xmb_legend_drawn=0; xmb_info_drawn=0; add_home_column(); mod_xmb_member(xmb[6].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH2); mod_xmb_member(xmb[8].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3); mod_xmb_member(xmb[5].member, 0, (char*)STR_XC5_LINK, (char*)STR_XC5_LINK1); mod_xmb_member(xmb[5].member, 1, (char*)STR_XC5_ST, (char*)STR_XC5_ST1); draw_xmb_icon_text(xmb_icon); } slide_xmb_right(); return mm_locale; } int delete_game_cache() { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; int ret_f=-1; slide_xmb_left(2); ; char string1[1024]; ps3_home_scan_ext_bare(game_cache_dir, pane, &max_dir, (char*)"PS3NAME.DAT"); if(max_dir==0) { abort_copy=0; //fix_perm_recursive(game_cache_dir); my_game_delete(game_cache_dir); mkdir(game_cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); slide_xmb_right(); return 0; } opt_list_max=0; char tmp_n[512]; FILE *fpA; for(int n=0; n<max_dir; n++) { sprintf(string1, "%s/%s", pane[n].path, pane[n].name); if(exist(string1)) { fpA = fopen ( string1, "r" ); if(fpA!=NULL) { if(fgets( tmp_n, sizeof tmp_n, fpA ) != NULL) { tmp_n[32]=0x2e; tmp_n[33]=0x2e; tmp_n[34]=0x2e; tmp_n[35]=00; sprintf(opt_list[opt_list_max].label, "%s", tmp_n); sprintf(opt_list[opt_list_max].value, "%s", pane[n].path); opt_list_max++; } fclose(fpA); if(opt_list_max>=MAX_LIST_OPTIONS) break; } } } if(opt_list_max) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; ret_f=open_list_menu((char*) STR_DEL_GAME_CACHE, 600, opt_list, opt_list_max, 660, 225, 16, 0); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { if(strstr(opt_list[ret_f].value, game_cache_dir)!=NULL) { abort_copy=0; //fix_perm_recursive(opt_list[ret_f].value); my_game_delete(opt_list[ret_f].value); rmdir(opt_list[ret_f].value); } } } slide_xmb_right(); free(pane); return ret_f; } void update_fm_stripe() { if(fm_sel==fm_sel_old) return; fm_sel_old=fm_sel; memcpy(text_FMS+737280, text_FMS, 368640); max_ttf_label=0; print_label_ex( 0.104f, 0.13f, 1.0f, (fm_sel&1 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_GAMES, 1.04f, 0.0f, mui_font, (fm_sel&1 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.230f, 0.13f, 1.0f, (fm_sel&2 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_UPDATE, 1.04f, 0.0f, mui_font, (fm_sel&2 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.359f, 0.13f, 1.0f, (fm_sel&4 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_ABOUT, 1.04f, 0.0f, mui_font, (fm_sel&4 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.479f, 0.13f, 1.0f, (fm_sel&8 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_HELP, 1.04f, 0.0f, mui_font, (fm_sel&8 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.609f, 0.13f, 1.0f, (fm_sel&16 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_THEMES, 1.04f, 0.0f, mui_font, (fm_sel&16 ? 1.1f : 0.75f), 21.f, 1); flush_ttf(text_FMS+737280, 1920, 48); } void set_fm_stripes() { fm_sel=0; fm_sel_old=15; load_texture(text_FMS, playBG, 1920); memcpy(text_FMS+368640, text_FMS, 368640); memcpy(text_FMS+737280, text_FMS, 368640); update_fm_stripe(); } void draw_fileman() { //if(c_opacity2<0x01) return; set_texture( text_OFF_2, 320, 320); display_img(1775-(int)(1920.0f*0.025f), 24+(int)(1080.0f*0.025f), 48, 48, 96, 96, -0.2f, 320, 320); update_fm_stripe(); set_texture( text_FMS+737280, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, 0.0f, 1920, 48); set_texture( text_FMS, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, 0.0f, 1920, 48); set_texture( text_bmpUPSR+V_WIDTH*4*(int)((107.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT));//V_HEIGHT-); display_img_nr(0, (int)((107.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT), 0.0f, V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT)); draw_xmb_info(); } int context_menu(char *_capt, int _type, char *c_pane, char *o_pane) { char _cap[512]; sprintf(_cap, "%s", _capt); _cap[32]='.';_cap[33]='.';_cap[34]='.';_cap[35]=0; opt_list_max=0; u8 multiple_entries=0; if(!strcmp(_cap, "..")) goto skip_dd; if(!strcmp(_cap, (const char*) STR_CM_MULDIR) || !strcmp(_cap, (const char*) STR_CM_MULFILE)) multiple_entries=1; if(strstr(o_pane, "/dev_bdvd")==NULL && strstr(o_pane, "/pvd_usb")==NULL && strstr(o_pane, "/app_home")==NULL && strlen(o_pane)>1 && strstr(_cap, "net_host")==NULL && strcmp(c_pane, o_pane)) { if( (strstr(c_pane, "/dev_bdvd")==NULL && strcmp(_cap, "dev_bdvd")) || (strstr(c_pane, "/dev_bdvd")!=NULL && exist((char*)"/dev_bdvd/PS3_GAME"))) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_COPY); sprintf(opt_list[opt_list_max].value, "%s", "copy"); opt_list_max++; } if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1 && strlen(o_pane)>1 && !(!strcmp(c_pane, "/dev_hdd0") && (!strcmp(_cap, "game") || !strcmp(_cap, "vsh") || !strcmp(_cap, "home") || !strcmp(_cap, "mms") || !strcmp(_cap, "vm") || !strcmp(_cap, "etc") || !strcmp(_cap, "drm"))) ) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_MOVE); sprintf(opt_list[opt_list_max].value, "%s", "move"); opt_list_max++; } } if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1 && !(!strcmp(c_pane, "/dev_hdd0") && (!strcmp(_cap, "game") || !strcmp(_cap, "vsh") || !strcmp(_cap, "home") || !strcmp(_cap, "mms") || !strcmp(_cap, "vm") || !strcmp(_cap, "etc") || !strcmp(_cap, "drm")))) { if(strstr(c_pane, "/net_host")==NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_RENAME); sprintf(opt_list[opt_list_max].value, "%s", "rename"); opt_list_max++; } if(strstr(c_pane, "/net_host")==NULL || (strstr(c_pane, "/net_host")!=NULL && _type==1)) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_DELETE); sprintf(opt_list[opt_list_max].value, "%s", "delete"); opt_list_max++; } } if(strcmp(c_pane, o_pane) && strstr(c_pane, "/dev_hdd0")!=NULL && strstr(o_pane, "/dev_hdd0")!=NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_SHORTCUT); sprintf(opt_list[opt_list_max].value, "%s", "shortcut"); opt_list_max++; } if(!strcmp(_cap, "PS3_GAME") && !multiple_entries) { if(strstr(c_pane, "/dev_hdd0")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_SHADOWPKG); sprintf(opt_list[opt_list_max].value, "%s", "pkgshortcut"); opt_list_max++; } if(strstr(c_pane, "/dev_usb")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_BDMIRROR); sprintf(opt_list[opt_list_max].value, "%s", "bdmirror"); opt_list_max++; } } if(strstr(c_pane, "/net_host")!=NULL || strstr(_cap, "net_host")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_NETHOST); sprintf(opt_list[opt_list_max].value, "%s", "nethost"); opt_list_max++; } if(_type==1 && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_HEXVIEW); sprintf(opt_list[opt_list_max].value, "%s", "view"); opt_list_max++; } if(_type==0 && strstr(c_pane, "/ps3_home")==NULL && strstr(c_pane, "/net_host")==NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_PROPS); sprintf(opt_list[opt_list_max].value, "%s", "test"); opt_list_max++; } skip_dd: if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_NEWDIR); sprintf(opt_list[opt_list_max].value, "%s", "newfolder"); opt_list_max++; } if(opt_list_max) { use_analog=0; //use_depth=0; float b_mX=mouseX; float b_mY=mouseY; if(mouseX>0.84f) mouseX=0.84f; if(mouseY>0.60f) mouseY=0.60f; int ret_f=open_dd_menu( _cap, 300, opt_list, opt_list_max, 660, 225, 16); //use_depth=1; use_analog=0; mouseX=b_mX; mouseY=b_mY; return ret_f; } //just_leave_dd: new_pad=0; return -1; } void apply_theme (const char *theme_file, const char *theme_path) { char theme_name[1024]; sprintf(theme_name, "%s", theme_file); theme_name[strlen(theme_name)-4]=0; char *pch=theme_name; char *pathpos=strrchr(pch,'/'); char temp_text[512]; char filename[1024]; sprintf(temp_text, (const char*) STR_APPLY_THEME, pathpos+(pathpos[1]=='_' ? 2 : 1)); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, temp_text, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char th_file[32], th2_file[64]; sprintf(th_file, "%s", "AVCHD.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, avchdBG, 0); sprintf(th_file, "%s", "PICBG.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, userBG, 0); sprintf(th_file, "%s", "ICON0.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, blankBG, 0); sprintf(th_file, "%s", "PICPA.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, playBGR, 0); sprintf(th_file, "%s", "XMB0.PNG"); sprintf(th2_file, "%s/%s", theme_path, th_file); sprintf(filename, "%s/PIC0.PNG", app_homedir); if(exist(th2_file)) { sprintf(filename, "%s/PIC0.PNG", app_homedir); file_copy(th2_file, filename, 0); } else remove(filename); sprintf(th_file, "%s", "XMB1.PNG"); sprintf(th2_file, "%s/%s", theme_path, th_file); if(exist(th2_file)) { sprintf(filename, "%s/PIC1.PNG", app_homedir); file_copy(th2_file, filename, 0); } sprintf(th_file, "%s", "SND0.AT3"); sprintf(th2_file, "%s/%s", theme_path, th_file); sprintf(filename, "%s/SND0.AT3", app_homedir); if(exist(th2_file)) { file_copy(th2_file, filename, 0); } else remove(filename); sprintf(th_file, "%s", "FMS.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, playBG, 0); sprintf(th_file, "%s", "HDD.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconHDD, 0); sprintf(th_file, "%s", "USB.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconUSB, 0); sprintf(th_file, "%s", "BLU.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconBLU, 0); sprintf(th_file, "%s", "NET.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconNET, 0); sprintf(th_file, "%s", "OFF.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconOFF, 0); sprintf(th_file, "%s", "CFC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconCFC, 0); sprintf(th_file, "%s", "SDC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconSDC, 0); sprintf(th_file, "%s", "MSC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconMSC, 0); int flipF; for(flipF = 0; flipF<9; flipF++){ sprintf(th_file, "AUR%i.JPG", flipF); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) {sprintf(th2_file, "%s/%s", app_usrdir, th_file); file_copy(filename, th2_file, 0);} } for(flipF = 0; flipF<9; flipF++){ sprintf(th_file, "font%i.ttf", flipF); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) {sprintf(th2_file, "%s/fonts/user/%s", app_usrdir, th_file); file_copy(filename, th2_file, 0);} } sprintf(th_file, "%s", "BOOT.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "LEGEND2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB64.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMBBG.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "DROPS.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "PRB.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLO.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC3.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "NOID.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "DOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } load_texture(text_DOX, th2_file, dox_width); sprintf(th_file, "%s", "LBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "LBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "SBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX3.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX4.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "MP_HR.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "MP_LR.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } if(V_WIDTH>1280) sprintf(filename, "%s/MP_HR.PNG",app_usrdir); else { sprintf(filename, "%s/MP_LR.PNG",app_usrdir); mp_WIDTH=15, mp_HEIGHT=21; //mouse icon LR } if(exist(filename)) {load_texture((unsigned char *) mouse, filename, mp_WIDTH);} sprintf(th_file, "%s", "SOUND.BIN"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } if((exist(th2_file) && is_theme_playing) && theme_sound) main_mp3((char*)th2_file); else { if(is_theme_playing) stop_audio(5); } sprintf(th_file, "%s", "COLOR.INI"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) file_copy(filename, th2_file, 0); else { sprintf(filename, "%s/COLOR.BIN", app_usrdir); sprintf(th2_file, "%s/COLOR.INI", app_usrdir); if(exist(filename)) file_copy(filename, th2_file, 0) ; } load_texture(text_bmpIC, blankBG, 320); if(cover_mode!=8) { load_texture(text_bmpUBG, avchdBG, 1920); load_texture(text_bmpUPSR, playBGR, 1920); set_fm_stripes(); } load_texture(text_HDD, iconHDD, 320); load_texture(text_USB, iconUSB, 320); load_texture(text_BLU_1, iconBLU, 320); load_texture(text_NET_6, iconNET, 320); load_texture(text_OFF_2, iconOFF, 320); load_texture(text_CFC_3, iconCFC, 320); load_texture(text_SDC_4, iconSDC, 320); load_texture(text_MSC_5, iconMSC, 320); parse_color_ini(); cellMsgDialogAbort(); state_read=1; state_draw=1; } void draw_xmb_title(u8 *buffer, xmbmem *member, int cn, u32 col1, u32 col2, u8 _xmb_col) { memset(buffer, 0, XMB_TEXT_WIDTH*XMB_TEXT_HEIGHT*4); //flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); if((_xmb_col==6 || _xmb_col==7) && xmb_game_bg) { print_label_ex( 0.005f, 0.03f, 0.75f, 0x80101010, member[cn].name, 1.04f, 0.0f, 0, 3.0f, 22.0f, 0); } if(_xmb_col==2 && member[cn].option_size) //settings print_label_ex( 0.93f, 0.2f, 0.45f, col1, member[cn].option[member[cn].option_selected].label, 1.04f, 0.0f, 0, 3.0f, 22.0f, 2); if(!((_xmb_col>3 && _xmb_col<8 && member[cn].type<6) || (_xmb_col==8 && member[cn].type>7))) print_label_ex( 0.0f, 0.57f, 0.5f, col2, member[cn].subname, 1.02f, 0.0f, 0, 3.0f, 23.0f, 0); flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); print_label_ex( 0.004f, 0.02f, 0.75f, col1, member[cn].name, 1.04f, 0.0f, 0, 3.0f, 22.0f, 0); flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); u8 *xmb_dev_icon1=xmb_icon_dev; u8 *xmb_dev_icon2=xmb_icon_dev; if( (_xmb_col>3 && _xmb_col<8 && member[cn].type<6) || (_xmb_col==8 && member[cn].type>7 && member[cn].type<13)) { if(_xmb_col==6 || _xmb_col==7) xmb_dev_icon1=xmb_icon_dev; else if(_xmb_col==5) xmb_dev_icon1=xmb_icon_dev+(1*8192); else if(_xmb_col==4) xmb_dev_icon1=xmb_icon_dev+(2*8192); else if(_xmb_col==8) xmb_dev_icon1=xmb_icon_dev+(16*8192);//retro if(_xmb_col==8) { xmb_dev_icon2=xmb_icon_dev+((17+(member[cn].type-8))*8192); } else { if(strstr(member[cn].file_path, "/dev_hdd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(4*8192); else if(strstr(member[cn].file_path, "/dev_usb")!=NULL) xmb_dev_icon2=xmb_icon_dev+(5*8192); else if(strstr(member[cn].file_path, "/dev_bdvd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(6*8192); else if(strstr(member[cn].file_path, "/pvd_usb")!=NULL) xmb_dev_icon2=xmb_icon_dev+(7*8192); else if(strstr(member[cn].file_path, "/dev_sd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(13*8192); else if(strstr(member[cn].file_path, "/dev_ms")!=NULL) xmb_dev_icon2=xmb_icon_dev+(14*8192); else if(strstr(member[cn].file_path, "/dev_cf")!=NULL) xmb_dev_icon2=xmb_icon_dev+(15*8192); } int nip=0; put_texture_with_alpha_gen( buffer, xmb_dev_icon1, 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; if(_xmb_col==5) { if(!strcmp(member[cn].subname, "AVCHD")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(10*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } else if(!strcmp(member[cn].subname, "BDMV")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(11*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } else if(!strcmp(member[cn].subname, "DVD")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(12*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } } put_texture_with_alpha_gen( buffer, xmb_dev_icon2, 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; if(_xmb_col==6 && member[cn].game_id>=0 && member[cn].game_id<max_menu_list) { if(member[cn].game_user_flags & IS_FAV) {put_texture_with_alpha_gen( buffer, xmb_icon_dev+(8*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64;} } if((_xmb_col==6 || _xmb_col==7) && member[cn].game_id>=0 && member[cn].game_id<max_menu_list) { if(member[cn].game_split==1) {put_texture_with_alpha_gen( buffer, xmb_icon_dev+(9*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64;} } } } void mod_xmb_member(xmbmem *_member, u16 size, char *_name, char *_subname) { snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; } void add_xmb_member(xmbmem *_member, u16 *_size, char *_name, char *_subname, /*type*/u8 _type, /*status*/u8 _status, /*game_id*/int _game_id, /*icon*/u8 *_data, u16 _iconw, u16 _iconh, /*f_path*/char *_file_path, /*i_path*/ char *_icon_path, int _u_flags, int _split) { if( (*_size)>=(MAX_XMB_MEMBERS-1) || strlen(_file_path)>sizeof(_member[0].file_path) || strlen(_icon_path)>sizeof(_member[0].icon_path) ) return; u16 size=(*_size); _member[size].is_checked = true; _member[size].type =_type; _member[size].status =_status; _member[size].game_id =_game_id; _member[size].game_user_flags =_u_flags; _member[size].game_split =_split; snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; _member[size].option_size=0; _member[size].option_selected=0; _member[size].data=-1; _member[size].icon =_data; _member[size].icon_buf = -1; _member[size].iconw =_iconw; _member[size].iconh =_iconh; snprintf(_member[size].file_path, sizeof(_member[size].file_path), "%s", _file_path); snprintf(_member[size].icon_path, sizeof(_member[size].icon_path), "%s", _icon_path); (*_size)++; } void add_xmb_suboption(xmbopt *_option, u8 *_size, u8 _type, char *_label, char *_value) { (void) _type; if((*_size)>=MAX_XMB_OPTIONS) return; u8 size=(*_size); //_option[size].type = _type; sprintf(_option[size].label, "%s", _label); sprintf(_option[size].value, "%s", _value); (*_size)++; } void add_xmb_option(xmbmem *_member, u16 *_size, char *_name, char *_subname, char *_optionini) { if((*_size)>=(MAX_XMB_MEMBERS-1)) return; u16 size=(*_size); _member[size].type = 7;//option _member[size].status = 2;//loaded _member[size].game_id = -1; _member[size].game_user_flags = 0; _member[size].game_split = 0; snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; _member[size].option_size=0; _member[size].option_selected=0; sprintf(_member[size].optionini, "%s", _optionini); _member[size].data=-1; _member[size].icon = xmb_icon_tool; _member[size].icon_buf = -1; _member[size].iconw = 128; _member[size].iconh = 128; sprintf(_member[size].file_path, "%s", (char*)"/"); sprintf(_member[size].icon_path, "%s", (char*)"/"); (*_size)++; } void reset_xmb_checked() { for(int n=0;n<MAX_XMB_ICONS;n++) for(int m=0;m<xmb[n].size;m++) xmb[n].member[m].is_checked=false; } void free_text_buffers() { for(int n=0; n<MAX_XMB_TEXTS; n++) { xmb_txt_buf[n].used=0; xmb_txt_buf[n].data=text_bmpUPSR+(n*XMB_TEXT_WIDTH*XMB_TEXT_HEIGHT*4); } xmb_txt_buf_max=0; for(int c=0; c<MAX_XMB_ICONS; c++) for(int n=0; n<xmb[c].size; n++) xmb[c].member[n].data=-1; } void free_all_buffers() { while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} int n; for(n=0; n<MAX_XMB_THUMBS; n++) xmb_icon_buf[n].used=-1; for(n=((xmb[6].member[1].icon==xmb_icon_blu) ? 2 : 1); n<xmb[6].size; n++) { xmb[6].member[n].icon_buf=-1; xmb[6].member[n].status=0; } for(n=0; n<xmb[7].size; n++) { xmb[7].member[n].icon_buf=-1; xmb[7].member[n].status=0; } for(n=1; n<xmb[8].size; n++) //if(xmb[8].member[n].icon!=xmb_icon_retro)//xmb[8].member[n].icon!=xmb[0].data && { xmb[8].member[n].icon_buf=-1; xmb[8].member[n].status=0; xmb[8].member[n].icon=xmb_icon_retro; } for(n=0; n<xmb[5].size; n++) { if(xmb[5].member[n].icon!=xmb_icon_film && xmb[5].member[n].icon!=xmb_icon_showtime) { xmb[5].member[n].icon_buf=-1; xmb[5].member[n].status=0; xmb[5].member[n].icon=xmb_icon_film; } } for(n=0; n<xmb[3].size; n++) { if(xmb[3].member[n].icon!=xmb_icon_photo) { xmb[3].member[n].icon_buf=-1; xmb[3].member[n].status=0; xmb[3].member[n].icon=xmb_icon_photo; } } } void reset_xmb(u8 _flag) { for(int n=0; n<MAX_XMB_ICONS; n++) { if(_flag && n!=8) //skip retro when resetting xmmb { xmb[n].size=0; xmb[n].first=0; xmb[n].init=0; } xmb[n].data=text_FMS+(n*65536); } xmb[8].data=xmb_icon_retro; xmb[9].data=text_FMS+(8*65536); } int find_free_buffer(const int _col) { (void) _col; int n; for(n=0; n<MAX_XMB_THUMBS; n++) { if(xmb_icon_buf[n].used==-1) return n; } if(xmb_icon==3) { for(n=0; n<xmb[3].size; n++) { if(xmb[3].member[n].icon!=xmb_icon_photo && (n<(xmb[3].first-3) || n>(xmb[3].first+7))) { xmb[3].member[n].icon_buf=-1; xmb[3].member[n].status=0; xmb[3].member[n].icon=xmb_icon_photo; } } for(n=0; n<MAX_XMB_THUMBS; n++) xmb_icon_buf[n].used=-1; return 0; } else free_all_buffers(); return 0; } // Draws the cross MM bar (XMMB) void draw_xmb_icons(xmb_def *_xmb, const int _xmb_icon_, int _xmb_x_offset, int _xmb_y_offset, const bool _recursive, int sub_level) { int _xmb_icon = _xmb_icon_; int first_xmb=_xmb_icon-2; int xpos, _xpos; u8 subicons = (sub_level!=-1); if(sub_level<0) sub_level=0; _xpos=-90+_xmb_x_offset - (200*sub_level); int ypos=0, tw=0, th=0; u16 icon_x=0; u16 icon_y=0; int mo_of=0; float mo_of2=0.0f; bool one_done=false; if(_xmb_icon>3 && _xmb_x_offset>0) {first_xmb--; _xpos-=200;} for(int n=first_xmb; n<MAX_XMB_ICONS; n++) { _xpos+=200; xpos = _xpos; _xmb_icon = _xmb_icon_; if(_xmb_x_offset>=100 && _xmb_icon>1 && !subicons) {_xmb_icon--; } if(_xmb_x_offset<=-100 && _xmb_icon<MAX_XMB_ICONS-1 && !subicons) {_xmb_icon++;} if(n<1) continue; if(sub_level && n!=xmb_icon) continue; set_texture(_xmb[n].data, 128, 128); //icon mo_of=abs((int)(_xmb_x_offset*0.18f)); if(_xmb[_xmb_icon].first>=_xmb[_xmb_icon].size) _xmb[_xmb_icon].first=0; if(n==_xmb_icon_) { /*if(egg) // :) display_img_angle(xpos-(36-mo_of)/2, 230-(36-mo_of), 164-mo_of, 164-mo_of, 128, 128, 0.8f, 128, 128, angle); else*/ display_img(xpos-(36-mo_of)/2, 230-(36-mo_of), 164-mo_of, 164-mo_of, 128, 128, 0.8f, 128, 128); set_texture(xmb_col, 300, 30); //column name display_img(xpos-86, 340, 300, 30, 300, 30, 0.7f, 300, 30); if(_xmb[_xmb_icon].size>0 && subicons && !(key_repeat && ( (old_pad & BUTTON_LEFT) || (old_pad & BUTTON_RIGHT)) && (xmb_icon!=1 && xmb_icon!=MAX_XMB_ICONS-1)) && (abs(_xmb_x_offset)<100 || _xmb_icon != _xmb_icon_)) { xpos = _xpos; if(_xmb_x_offset>=100 && !subicons) xpos-=200; if(_xmb_x_offset<=-100 && !subicons) xpos+=200; int cn; int cn3=1; int first_xmb_mem = _xmb[_xmb_icon].first; int cnmax=3; if(_xmb[_xmb_icon].first>2 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(int m=0;m<4;m++) // make it pleasureable to watch while loading column { if(m==1) { cn3=0; first_xmb_mem = _xmb[_xmb_icon].first-1; cnmax=1; } if(m==2) { cn3=-1; first_xmb_mem = _xmb[_xmb_icon].first-2; cnmax=0; } if(m==3) { cn3=3; first_xmb_mem = _xmb[_xmb_icon].first+2; cnmax=8; } if(_xmb[_xmb_icon].first>2 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(cn=first_xmb_mem; (cn<_xmb[_xmb_icon].size && cn3<cnmax); cn++) { /*if(egg && cn>=0) { if(_xmb[_xmb_icon].member[cn].name[0]!='L') continue; else if(cn3==2) _xmb[_xmb_icon].first=cn; }*/ cn3++; if(cn<0) continue; if(sub_level && cn3!=2) continue; if(!_xmb[_xmb_icon].member[cn].is_checked && !key_repeat) { // check for missing/orphan entries in photo/music/video/retro columns if( ( (_xmb_icon>2 && _xmb_icon<6) || _xmb_icon==8) && (_xmb[_xmb_icon].member[cn].type>7 || (_xmb[_xmb_icon].member[cn].type>1 && _xmb[_xmb_icon].member[cn].type<6) ) && (!exist(_xmb[_xmb_icon].member[cn].file_path)) ) { delete_xmb_member(_xmb[_xmb_icon].member, &_xmb[_xmb_icon].size, cn); if(cn>=_xmb[_xmb_icon].size) break; sort_xmb_col(_xmb[_xmb_icon].member, _xmb[_xmb_icon].size, cn); } else _xmb[_xmb_icon].member[cn].is_checked=true; } tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } if(cn3!=2) {tw/=2; th/=2;} mo_of2=2.f-(abs(_xmb_y_offset)/90.0f); if( (_xmb_y_offset!=0) ) { if( (_xmb_y_offset>0 && cn3==1) || (_xmb_y_offset<0 && cn3==3) ) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } tw=(int)(tw/mo_of2); th=(int)(th/mo_of2); } else if( (_xmb_y_offset!=0 && cn3==2)) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } tw=(int)(tw/(3.f-mo_of2)); th=(int)(th/(3.f-mo_of2)); } } if(cn3<1) ypos=cn3*90+_xmb_y_offset; else if(cn3==1) ypos=cn3*90 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*3.566f) : (_xmb_y_offset) ); else if(cn3==2) {ypos = 411 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*2.377f) : (int)(_xmb_y_offset*3.566f) );} else if(cn3==3) ypos=(cn3-3)*90 + 625 + ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*2.377f) ); else if(cn3 >3) ypos=(cn3-3)*90 + 625 + _xmb_y_offset; if(_xmb[_xmb_icon].member[cn].data==-1 && _xmb_x_offset==0 && !one_done) { one_done=true; if(xmb_txt_buf_max>=MAX_XMB_TEXTS) {redraw_column_texts(_xmb_icon); xmb_txt_buf_max=0;} _xmb[_xmb_icon].member[cn].data=xmb_txt_buf_max; draw_xmb_title(xmb_txt_buf[xmb_txt_buf_max].data, _xmb[_xmb_icon].member, cn, COL_XMB_TITLE, COL_XMB_SUBTITLE, _xmb_icon); xmb_txt_buf_max++; } if(_xmb[_xmb_icon].member[cn].data!=-1 && ((ss_timer<dim_setting && dim_setting) || _xmb[_xmb_icon].first==cn || dim_setting==0) && abs(_xmb_x_offset)<100) { u8 xo1=(_xmb_y_offset>0 ? 1 : 0); u8 xo2=1-xo1; if( ((_xmb_icon==6 || _xmb_icon==7) && ((cn>=_xmb[_xmb_icon].first-xo1 && cn<=_xmb[_xmb_icon].first+xo2 && _xmb_y_offset!=0) || cn==_xmb[_xmb_icon].first) ) || (_xmb_icon!=6 && _xmb_icon!=7)) { set_texture(xmb_txt_buf[_xmb[_xmb_icon].member[cn].data].data, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //text if(_xmb_icon!=6 && _xmb_icon!=7) display_img(xpos+((_xmb_icon==3 || _xmb_icon==5 || _xmb_icon==8)?(230+(((V_WIDTH==720)?60:0))):(128+tw/2)), ypos+th/2-XMB_TEXT_HEIGHT/2, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, 0.5f, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //(int)(XMB_TEXT_WIDTH*(1.f-abs((float)_xmb_x_offset)/200.f)) else display_img(xpos+128+tw/2, ypos+th/2-XMB_TEXT_HEIGHT/2, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, 0.5f, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //(int)(XMB_TEXT_WIDTH*(1.f-abs((float)_xmb_x_offset)/200.f)) } } if((_xmb[_xmb_icon].member[cn].status==1 || _xmb[_xmb_icon].member[cn].status==0) && !_recursive && !key_repeat)// || (c_opacity_delta!=0 && dim==1 && c_opacity2>0x30 && c_opacity2<0x42)) { if(_xmb[_xmb_icon].member[cn].status==0) { _xmb[_xmb_icon].member[cn].status=1; xmb_icon_buf_max=find_free_buffer(_xmb_icon); xmb_icon_buf[xmb_icon_buf_max].used=cn; xmb_icon_buf[xmb_icon_buf_max].column=_xmb_icon; _xmb[_xmb_icon].member[cn].icon = xmb_icon_buf[xmb_icon_buf_max].data; _xmb[_xmb_icon].member[cn].icon_buf=xmb_icon_buf_max; } // load_png_partial( _xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].icon_path, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh/2, 0); if(_xmb_icon==5 || _xmb_icon==3 || _xmb_icon==8) { if(_xmb_icon==8 && (strstr(_xmb[_xmb_icon].member[cn].icon_path,".png")!=NULL || strstr(_xmb[_xmb_icon].member[cn].icon_path,".PNG")!=NULL)) load_png_threaded( _xmb_icon, cn); else load_jpg_threaded( _xmb_icon, cn); } else { if(strstr(_xmb[_xmb_icon].member[cn].icon_path,".JPG")!=NULL) load_jpg_threaded( _xmb_icon, cn); else load_png_threaded( _xmb_icon, cn); } } if(_xmb[_xmb_icon].member[cn].status==1 || (_xmb[_xmb_icon].member[cn].status==0 && (_recursive || key_repeat))) { tw=128; th=128; if(cn3!=2) {tw/=2; th/=2;} icon_x=xpos+64-tw/2; icon_y=ypos; set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x, icon_y, tw, th, 128, 128, 0.5f, 128, 128, angle); } if(_xmb[_xmb_icon].member[cn].status==2) { icon_x=xpos+64-tw/2; icon_y=ypos; set_texture(_xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh); if( ((is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) && ( (_xmb_icon==1 && cn==2) || (_xmb_icon==6 && cn==0) || (_xmb_icon==8 && cn==0) )) ) display_img_angle(icon_x, icon_y, tw, th, tw, th, 0.5f, tw, th, angle); else { display_img(icon_x, icon_y, tw, th, tw, th, 0.5f, tw, th); if( (_xmb_icon==4 && current_mp3 && current_mp3<MAX_MP3 && !is_theme_playing && !strcmp(mp3_playlist[current_mp3].path, _xmb[_xmb_icon].member[cn].file_path) ) ) { if(update_ms || (!update_ms && (time(NULL)&1))) { set_texture(_xmb[4].data, 128, 128); //icon display_img(icon_x-48, icon_y-16, 32, 32, 128, 128, 0.45f, 128, 128); } set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x-64, icon_y-32, 64, 64, 128, 128, 0.4f, 128, 128, angle); } } } } } } } else { /*if(egg) { if(n==xmb_icon-1 && _xmb_x_offset>0) display_img_angle(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128, angle); else if(n==xmb_icon+1 && _xmb_x_offset<0) display_img_angle(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128, angle); else display_img_angle(xpos, 230, 128, 128, 128, 128, 0.0f, 128, 128, angle); } else */ { if(n==xmb_icon-1 && _xmb_x_offset>0) display_img(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128); else if(n==xmb_icon+1 && _xmb_x_offset<0) display_img(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128); else display_img(xpos, 230, 128, 128, 128, 128, 0.0f, 128, 128); } } } if(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) { if(is_any_xmb_column) set_texture(xmb_icon_help, 128, 128); else set_texture(_xmb[0].data, 128, 128); display_img_angle(1770, 74, 64, 64, 128, 128, 0.6f, 128, 128, angle); if(time(NULL)&1) { if(is_any_xmb_column) set_texture(_xmb[is_any_xmb_column].data, 128, 128); else if(is_game_loading) set_texture(_xmb[6].data, 128, 128); else if(is_video_loading) set_texture(_xmb[5].data, 128, 128); else if(is_music_loading) set_texture(_xmb[4].data, 128, 128); else if(is_photo_loading) set_texture(_xmb[3].data, 128, 128); else if(is_retro_loading) set_texture(_xmb[8].data, 128, 128); display_img(1834, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } else if((ftp_clients && time(NULL)&2) || (http_active && time(NULL)&1) ) { set_texture((http_active?xmb[9].data:xmb_icon_ftp), 128, 128); display_img(1770, 74, 64, 64, 128, 128, 0.0f, 128, 128); /*u8 pZ=32; // icon pulsing if(angle<180.f) pZ=(int)((angle/180.f) * 48.f); else pZ=(int)(((360.f/angle) - 1.f) * 48.f); display_img(1770+(48-pZ)/2, 74+(48-pZ)/2, 16+pZ, 16+pZ, 128, 128, 0.6f, 128, 128);*/ //set_texture(_xmb[0].data, 128, 128); //display_img_angle(1770, 74, 64, 64, 128, 128, 0.0f, 128, 128, angle); } } void load_coverflow_legend() { if(cover_mode!=4 || !xmb[6].init) return; if((xmb_icon==6) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; // || xmb_icon==8 int grey=(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split); u32 color= (menu_list[game_sel].flags && game_sel==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu_list[game_sel].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu_list[game_sel].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu_list[game_sel].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu_list[game_sel].content,"DVD")!=NULL) color=COL_DVD; int tmp_legend_y=legend_y; legend_y=0; memset(text_bmp, 0, 737280); if(xmb[6].first) { if(!key_repeat) { char str[256]; sprintf(str, "%i of %i", xmb[6].first, xmb[6].size-1); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)str, (char*)menu_list[game_sel].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)str, (char*)menu_list[game_sel].title_id, color); } else put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)" ", (char*)" ", color); } else put_label(text_bmp, 1920, 1080, (char*)"Refresh Game List", (char*)" ", (char*)" ", COL_PS3); legend_y=tmp_legend_y; xmb_bg_show=0; } void draw_xmb_bare(u8 _xmb_icon, u8 _all_icons, bool recursive, int _sub_level) { ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, (_all_icons!=2 ? _xmb_icon : -1)); if(_all_icons==1) draw_xmb_icons(xmb, _xmb_icon, xmb_slide, xmb_slide_y, recursive, _sub_level); else if(_all_icons==2) draw_xmb_icons(xmb, _xmb_icon, xmb_slide, xmb_slide_y, recursive, -1); flip(); } void draw_coverflow_icons(xmb_def *_xmb, const int _xmb_icon_, int __xmb_y_offset) { if(is_game_loading) return; int _xmb_icon = _xmb_icon_; u16 xpos=350; int ypos=0, tw=0, th=0; u16 icon_x=0; u16 icon_y=0; int _xmb_y_offset=(int) ((float)__xmb_y_offset*16.0/9.0f); float mo_of=abs((float)_xmb_y_offset)/160.0f; float mo_of2=0.0f; char filename[1024]; u32 pixel, delta2; float delta, delta3; float c_persp=45.f; float c_persp2=35.f; if(xmb_bg_counter>0 && !xmb_bg_show && !key_repeat && _xmb_y_offset==0) xmb_bg_counter--; if(xmb_bg_counter==0 && !xmb_bg_show && _xmb_y_offset==0 && xmb_game_bg==1 && !key_repeat && (_xmb_icon==6 && _xmb[_xmb_icon].first && _xmb[_xmb_icon].member[_xmb[_xmb_icon].first].type==1) && !is_game_loading) //show poster for games only { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].title_id); if(exist(filename) && xmb_game_bg==1) { load_png_texture(text_FONT, filename, 1920); if(menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].split==1 || menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].title[0]=='_') gray_texture(text_FONT, 1920, 1080, 0); //change_opacity(text_FONT, -60, 8294400); delta=100.f; delta3=0.f; for(u32 fsr=0; fsr<3840000; fsr+=4) //dim the center of the screen-out { if(fsr%7680==0) {delta-=0.2f; delta3+=0.2f;} pixel=*(uint32_t*) ((uint8_t*)(text_FONT+fsr)); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta)/100.f))); pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(text_FONT)+fsr)= pixel; pixel=*(uint32_t*) ((uint8_t*)(text_FONT+fsr+3840000)); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta3)/100.f))); pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(text_FONT)+fsr+3840000)= pixel; } xmb_bg_show=1; } else { xmb_bg_counter=200; xmb_bg_show=0; } } if(_xmb_y_offset!=0) {offX=0; offY=0;} if(xmb_bg_show && _xmb_y_offset==0 && !key_repeat) { set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } else { //draw sliding background if(animation==2 || animation==3) { BoffX--; if(BoffX<= -1920) BoffX=0; set_texture( text_bmpUPSR, 1920, 1080); if(BoffX>= -1920) display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); display_img(1920+(int)BoffX, 0, abs((int)BoffX), 1080, abs((int)BoffX), 1080, 0.9f, 1920, 1080); } else { set_texture( text_bmpUPSR, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } } if(_xmb[_xmb_icon].first>=_xmb[_xmb_icon].size) _xmb[_xmb_icon].first=0; if(_xmb[_xmb_icon].size>0) { int cn; int cn3=-2; int first_xmb_mem = _xmb[_xmb_icon].first-6; int cnmax=10; if(_xmb_y_offset==0) cnmax--; if(_xmb[_xmb_icon].first>4 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(cn=first_xmb_mem; (cn<_xmb[_xmb_icon].size && cn3<cnmax); cn++) { cn3++; if(cn<0) continue; if(!_xmb[_xmb_icon].member[cn].is_checked) { if( ( (_xmb_icon>2 && _xmb_icon<6) || _xmb_icon==8) && (_xmb[_xmb_icon].member[cn].type>7 || (_xmb[_xmb_icon].member[cn].type>1 && _xmb[_xmb_icon].member[cn].type<6) ) && (!exist(_xmb[_xmb_icon].member[cn].file_path)) ) { delete_xmb_member(_xmb[_xmb_icon].member, &_xmb[_xmb_icon].size, cn); if(cn>=_xmb[_xmb_icon].size) break; sort_xmb_col(_xmb[_xmb_icon].member, _xmb[_xmb_icon].size, cn); } else _xmb[_xmb_icon].member[cn].is_checked=true; } tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } if(cn3!=5) {tw/=2; th/=2;} mo_of2=2.f-mo_of; if( (_xmb_y_offset!=0) ) { if( (_xmb_y_offset>0 && cn3==4) || (_xmb_y_offset<0 && cn3==6) ) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } tw=(int)(tw/mo_of2); th=(int)(th/mo_of2); } else if( (_xmb_y_offset!=0 && cn3==5)) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } tw=(int)(tw/(3.f-mo_of2)); th=(int)(th/(3.f-mo_of2)); } } if(cn3<=1) ypos=cn3*160+ ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ) -130; if(cn3>1 && cn3<4) ypos=cn3*160+_xmb_y_offset-130; else if(cn3==4) ypos=cn3*160 -130 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*1.8125f) : (_xmb_y_offset) ); else if(cn3==5) {ypos = 800 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*1.8125f) : (int)(_xmb_y_offset*1.8125f) );} else if(cn3==6) ypos=(cn3-6)*160 + 1090 + ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ); else if(cn3 >6 && cn3<9) ypos=(cn3-6)*160 + 1090 + _xmb_y_offset; else if(cn3>8) ypos=(cn3-6)*160 + 1090 + ( (_xmb_y_offset<0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ); ypos+=30; if((_xmb[_xmb_icon].member[cn].status==1 || _xmb[_xmb_icon].member[cn].status==0) && !key_repeat)// || (c_opacity_delta!=0 && dim==1 && c_opacity2>0x30 && c_opacity2<0x42)) { if(_xmb[_xmb_icon].member[cn].status==0) { _xmb[_xmb_icon].member[cn].status=1; xmb_icon_buf_max=find_free_buffer(_xmb_icon); xmb_icon_buf[xmb_icon_buf_max].used=cn; xmb_icon_buf[xmb_icon_buf_max].column=_xmb_icon; _xmb[_xmb_icon].member[cn].icon = xmb_icon_buf[xmb_icon_buf_max].data; _xmb[_xmb_icon].member[cn].icon_buf=xmb_icon_buf_max; } // load_png_partial( _xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].icon_path, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh/2, 0); if(_xmb_icon==5 || _xmb_icon==3 || _xmb_icon==8) { if(_xmb_icon==8 && (strstr(_xmb[_xmb_icon].member[cn].icon_path,".png")!=NULL || strstr(_xmb[_xmb_icon].member[cn].icon_path,".PNG")!=NULL)) load_png_threaded( _xmb_icon, cn); else load_jpg_threaded( _xmb_icon, cn); } else { if(strstr(_xmb[_xmb_icon].member[cn].icon_path,".JPG")!=NULL) load_jpg_threaded( _xmb_icon, cn); else load_png_threaded( _xmb_icon, cn); } } if(_xmb[_xmb_icon].member[cn].status==1 || (_xmb[_xmb_icon].member[cn].status==0 && (key_repeat))) { tw=128; th=128; if(cn3!=5) {tw/=2; th/=2;} icon_y=xpos+150-th/2; icon_x=ypos+130-tw/2; set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x, icon_y, tw, th, 128, 128, 0.5f, 128, 128, angle); } if(_xmb[_xmb_icon].member[cn].status==2) { icon_y=xpos+150-th/2; icon_x=ypos+130-tw/2; set_texture(_xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh); //icon if((is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) && ( (_xmb_icon==1 && cn==2) || (_xmb_icon==6 && cn==0) || (_xmb_icon==8 && cn==0)) ) display_img_angle(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, angle); else { if( _xmb_y_offset!=0 && ( cn3==5 || (cn3==4 && _xmb_y_offset>0) || (cn3==6 && _xmb_y_offset<0) ) ) { if(cn3==5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (_xmb_y_offset>0 ? ((int)(c_persp2*mo_of)) : ((int)(c_persp*mo_of))), (_xmb_y_offset>0 ? ((int)(c_persp*mo_of)) : ((int)(c_persp2*mo_of))) ); } else if(cn3==4) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)(c_persp - c_persp*mo_of), (int)(c_persp2 - c_persp2*mo_of) ); } else if(cn3==6) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)(c_persp2 - c_persp2*mo_of), (int)(c_persp - c_persp*mo_of)); } } else if (cn3==5) { if(offX<0 || offY<0 || offX>31 || animation==0 || animation==2) {offX=0; offY=0;} // offY>31 || if(animation==0 || animation==2) incZ=0; if(tw<320) offY=(float)(offX*1.1538f); else offY=(float)(offX*0.5500f); display_img(icon_x-(int)offX, icon_y-(int)offY, tw+(int)(offX*2.0f), th+(int)(offY*2.0f), tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th); offX+=incZ; if(offX>30) {incZ=-0.3f;};if(offX<1) {incZ=0.6f;}; } else if(cn3<5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)c_persp, (int)c_persp2); } else if(cn3>5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)c_persp2, (int)c_persp); } } } } if((xmb_icon==6 || xmb_icon==8) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; } if(xmb_slide_step_y!=0) //sliding horizontally (inverted XMMB) { xmb_slide_y+=xmb_slide_step_y; if(xmb_slide_y == 10) xmb_slide_step_y = 5; else if(xmb_slide_y ==-10) xmb_slide_step_y =-5; // else if(xmb_slide_y == 50) xmb_slide_step_y = 2; // else if(xmb_slide_y ==-50) xmb_slide_step_y =-2; else if(xmb_slide_y == 80) xmb_slide_step_y = 2; else if(xmb_slide_y ==-80) xmb_slide_step_y =-2; else if(xmb_slide_y >= 90) {xmb_slide_step_y= 0; if(_xmb[_xmb_icon].first>0) _xmb[_xmb_icon].first--; xmb_slide_y=0; load_coverflow_legend();} else if(xmb_slide_y <=-90) {xmb_slide_step_y= 0; if(_xmb[_xmb_icon].first<_xmb[_xmb_icon].size-1) _xmb[_xmb_icon].first++; xmb_slide_y=0;load_coverflow_legend();} if(xmb_slide_step_y==0) xmb_bg_counter=200; } } int open_theme_menu(char *_caption, int _width, theme_def *list, int _max, int _x, int _y, int _max_entries, int _centered) { (void) _x; (void) _y; char filename[1024]; if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; u8 *text_LIST2 = NULL; text_LIST = text_FONT; text_LIST2 = text_FONT + 3024000; int line_h = 30; int _height = (_max_entries+5) * line_h; char tdl[512]; int last_sel=-1; int first=0; int sel=0; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); sprintf(filename, "%s/LBOX2.PNG", app_usrdir); load_texture(text_LIST2+1713600, filename, 680); //4737600 while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); memcpy(text_LIST2, text_LIST2+1713600, 1713600); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, (mm_locale ? mui_font : 15), 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); flush_ttf(text_LIST, _width, _height); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].name, 1.04f, 0.0f, 15, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].name, 1.00f, 0.0f, 15, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].name, 1.04f, 0.0f, 15, 0.8f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].name, 1.00f, 0.0f, 15, 0.8f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 0 ); } flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*)STR_BUT_DOWNLOAD, 1.00f, 0.0f, mui_font, 0.5f/((float)(_width/1920.f)), 0.4f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); sprintf(tdl, "%s/%s.jpg", themes_web_dir, list[sel].name); if(!exist(tdl)) download_file(list[sel].img, tdl, 0); if(exist(tdl)) { load_jpg_texture(text_LIST2+20*4+145*680*4, tdl, 680); } print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, list[sel].name, 1.04f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); print_label_ex( 0.5f, 0.10f, 1.0f, COL_XMB_SUBTITLE, (char*)"by", 1.00f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); print_label_ex( 0.5f, 0.15f, 1.0f, COL_XMB_SUBTITLE, list[sel].author, 1.00f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); sprintf(tdl, "%s", list[sel].info); if(strlen(tdl)>1) print_label_ex( 0.05f, 0.85f, 1.0f, COL_XMB_SUBTITLE, tdl, 0.50f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 0); sprintf(tdl, "multiMAN version: %s", list[sel].mmver); print_label_ex( 0.05f, 0.90f, 1.0f, COL_XMB_SUBTITLE, tdl, 0.50f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST2, 680, _height); last_sel=sel; } ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); set_texture(text_LIST+3024000, 680, 630); display_img((int)(mouseX*1920.f)+_width+(V_WIDTH==1920?20:70), (int)(mouseY*1080.f), 680, _height, 680, _height, 0.0f, 680, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } void change_opacity(u8 *buffer, int delta, u32 size) { u32 pixel; u32 delta2; if(delta>0) { for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); delta2 = ((u32)((float)(pixel&0xff)*(1.0f+(float)delta/100.f))); if(delta2>0xff) delta2=0xff; pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= pixel; } } else { for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta)/100.f))); if(delta2>0xff) delta2=0xff; pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= pixel; } } } int open_select_menu(char *_caption, int _width, t_opt_list *list, int _max, u8 *buffer, int _max_entries, int _centered) { if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_bmpUBG + (FB(1)); int line_h = 30; int _height = (_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; char filename[1024]; int _menu_font = mui_font; //15; float _y_scale = 0.7f; //1.0f; bool is_lang = (strstr(_caption, (const char*) STR_SEL_LANG)!=NULL); if(is_lang) { sel=mm_locale; first=sel-_max_entries+2; if(first<0) first=0; } sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, mui_font, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(is_lang) _menu_font = ( (locales[n].font_id>4 && locales[n].font_id<10) ? (locales[n].font_id+5) : locales[n].font_id); else _menu_font = mui_font; if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xffe0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 0 ); } if(is_lang) flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_APPLY, 1.00f, 0.0f, mui_font, 0.5f/((float)(_width/1920.f)), 0.4f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); last_sel=sel; } ClearSurface(); if(cover_mode==8 && xmb_icon==2) { if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); } else { set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } int open_list_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries, int _centered) { (void) _x; (void) _y; char filename[1024]; if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_FONT; int line_h = 30; int _height = (_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); float y_scale=1.0f; u8 _menu_font=15; if(mm_locale) { _menu_font=mui_font; y_scale=0.8f; } while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.00f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.00f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 0 ); } } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_APPLY, 1.00f, 0.0f, _menu_font, 0.5f/((float)(_width/1920.f)), (y_scale/2.f)/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); last_sel=sel; } ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); set_texture(text_LIST, _width, _height); // display_img(_x, _y, _width, _height, _width, _height, 0.0f, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } int open_dd_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries) { (void) _x; (void) _y; u8 _menu_font=17; float y_scale=0.85f; if(mm_locale) {_menu_font=mui_font; y_scale=0.7f;} if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_FONT; int line_h = 26; int _height = 315;//(_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; char filename[1024]; char string1[1024]; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+756000, filename, 600); mip_texture(text_LIST+756000, text_LIST+756000, 600, 630, -2); while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+756000, 756000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 0.7f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, 0, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); flush_ttf(text_LIST, _width, _height); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(n==sel) print_label_ex( 0.055f, ((float)((n-first+2.2f)*line_h)/(float)_height)-0.007f, 1.2f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.68f/((float)(_width/1920.f)), (y_scale)/((float)(_height/1080.f)), 0); else print_label_ex( 0.120f, ((float)((n-first+2.2f)*line_h)/(float)_height), 0.85f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), (y_scale+0.1f)/((float)(_height/1080.f)), 0 ); flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.6f, ((float)(_height-line_h*2)/(float)_height)+0.0326f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_CONFIRM, 1.04f, 0.0f, _menu_font, 0.5f/((float)(_width/1920.f)), 0.5f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.6f*_width)-dox_cross_w-5), _height-line_h*2+4); last_sel=sel; } ClearSurface(); // setRenderColor(); draw_fileman(); set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, -0.3f, _width, _height); time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.70f ,COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } static void add_video_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_video_loading && xmb[5].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; char linkfile[512]; char imgfile[512]; char imgfile2[512]; char filename[1024]; sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else del_temp(filename); ps3_home_scan_bare((char*)"/dev_hdd0/video", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_hdd0/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/DCIM", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/VIDEO", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/VIDEO", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) if(is_video(pane[ret_f].name)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(strstr(linkfile, "/dev_hdd0")!=NULL) { sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane[ret_f].name); link(linkfile, filename); } if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; sprintf(imgfile2, "%s.jpg", linkfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.JPG", linkfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; if(imgfile[strlen(imgfile)-5]=='.') imgfile[strlen(imgfile)-5]=0; sprintf(imgfile2, "%s.STH", imgfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.JPG", imgfile); //if(stat(imgfile2, &s3)>=0) goto thumb_ok; thumb_ok: if(exist(imgfile2)) { add_xmb_member(xmb[5].member, &xmb[5].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Video" : (char*)"HDD Video"), /*type*/3, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_film, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[5].member, &xmb[5].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Video" : (char*)"HDD Video"), /*type*/3, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_film, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[5].size<9) draw_xmb_bare(5, 1, 0, 0); if(xmb[5].size>=MAX_XMB_MEMBERS) break; sort_xmb_col(xmb[5].member, xmb[5].size, 2); delete_xmb_dubs(xmb[5].member, &xmb[5].size); sort_xmb_col(xmb[5].member, xmb[5].size, 2); sys_timer_usleep(250); //let other threads run, too } free_all_buffers(); free(pane); } if(xmb_icon_last==5 && (xmb_icon_last_first<xmb[5].size)) { xmb[5].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(5); is_video_loading=0; sys_ppu_thread_exit(0); } static void add_photo_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_photo_loading && xmb[3].init) { char linkfile[512]; xmb[3].first=0; xmb[3].size=0; xmb[3].init=1; char t_ip[512]; int i_status; t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; ps3_home_scan_bare((char*)"/dev_hdd0/photo", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/PICTURE", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } ps3_home_scan_bare((char*)"/dev_sd/PICTURE", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/DCIM", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/PICTURE", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/PICTURE", pane, &max_dir); for(int ret_f=0; ret_f<max_dir; ret_f++) { if(strstr(pane[ret_f].name, ".jpg")!=NULL || strstr(pane[ret_f].name, ".JPG")!=NULL || strstr(pane[ret_f].name, ".png")!=NULL || strstr(pane[ret_f].name, ".PNG")!=NULL) { i_status=2; sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(strstr(linkfile, ".JPG")!=NULL || strstr(linkfile, ".JPEG")!=NULL || strstr(linkfile, ".jpg")!=NULL || strstr(linkfile, ".jpeg")!=NULL) {sprintf(t_ip, "%s", linkfile); i_status=0;} else {sprintf(t_ip, "%s", "/");i_status=2;} if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; add_xmb_member(xmb[3].member, &xmb[3].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Photo" : pane[ret_f].path+16), /*type*/5, /*status*/i_status, /*game_id*/-1, /*icon*/xmb_icon_photo, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)t_ip, 0, 0); //if(xmb[3].size<12) draw_xmb_bare(3, 1, 0, 0); if(xmb[3].size>=MAX_XMB_MEMBERS) break; sys_timer_usleep(250); //let other threads run, too } } sort_xmb_col(xmb[3].member, xmb[3].size, 0); delete_xmb_dubs(xmb[3].member, &xmb[3].size); sort_xmb_col(xmb[3].member, xmb[3].size, 0); free_all_buffers(); free(pane); } if(xmb_icon_last==3 && (xmb_icon_last_first<xmb[3].size)) { xmb[3].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(3); is_photo_loading=0; sys_ppu_thread_exit(0); } static void add_music_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_music_loading && xmb[4].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; char linkfile[512]; xmb[4].first=0; xmb[4].size=0; xmb[4].init=1; xmb[4].group=0; u8 skip_first=0; ps3_home_scan_bare((char*)"/dev_hdd0/music", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_hdd0/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/MUSIC", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/MUSIC", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { if(strstr(pane[ret_f].name, ".mp3")!=NULL || strstr(pane[ret_f].name, ".MP3")!=NULL || strstr(pane[ret_f].name, ".ac3")!=NULL || strstr(pane[ret_f].name, ".AC3")!=NULL || strstr(pane[ret_f].name, ".FLAC")!=NULL || strstr(pane[ret_f].name, ".flac")!=NULL) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; skip_first=0; for(u8 c=0; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]>0x40) {skip_first=c; break;} for(u8 c=skip_first; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]=='(' || pane[ret_f].name[c]=='[') {pane[ret_f].name[c]=0; break;} for(u8 c=skip_first; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]=='_') {pane[ret_f].name[c]=0x20;} if(pane[ret_f].name[skip_first]==' ') skip_first++; add_xmb_member(xmb[4].member, &xmb[4].size, pane[ret_f].name+skip_first, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Music" : (char*)"HDD Music"), /*type*/4, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_note, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[4].size<9) draw_xmb_bare(4, 1, 0, 0); if(xmb[4].size>=MAX_XMB_MEMBERS) break; sort_xmb_col(xmb[4].member, xmb[4].size, 0); delete_xmb_dubs(xmb[4].member, &xmb[4].size); sort_xmb_col(xmb[4].member, xmb[4].size, 0); sys_timer_usleep(250); //let other threads run, too } } free(pane); } if(xmb_icon_last==4 && (xmb_icon_last_first<xmb[4].size)) { xmb[4].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(4); is_music_loading=0; sys_ppu_thread_exit(0); } static void add_retro_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_retro_loading && xmb[8].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; xmb[8].size=0; add_xmb_member(xmb[8].member, &xmb[8].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); xmb[8].init=1; xmb[8].group=0; char linkfile[512]; char imgfile[512]; char imgfile2[512]; ps3_home_scan_bare(snes_roms, pane, &max_dir); if(strcmp(snes_roms, "/dev_hdd0/ROMS/snes")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/snes", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/snes", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_snes9x(linkfile)) { if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; sprintf(imgfile2, "%s/snes/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s.png", imgfile); //if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; //sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; //sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; /*sprintf(imgfile2, "%s/snes/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/NO_COVER.JPG", covers_retro);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; */ thumb_ok_snes: if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"SNES9x Game ROM", /*type*/8, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"SNES9x Game ROM", /*type*/8, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //genp max_dir=0; ps3_home_scan_bare(genp_roms, pane, &max_dir); if(strcmp(genp_roms, "/dev_hdd0/ROMS/gen")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/gen", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/gen", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_genp(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/gen/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; */ thumb_ok_genp: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/11, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/11, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //fceu+ max_dir=0; ps3_home_scan_bare(fceu_roms, pane, &max_dir); if(strcmp(fceu_roms, "/dev_hdd0/ROMS/fceu")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/fceu", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/fceu", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_fceu(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-5]=='.') imgfile[strlen(imgfile)-5]=0; sprintf(imgfile2, "%s/fceu/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s.png", imgfile); /* if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; */ thumb_ok_fceu: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/9, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/9, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //vba max_dir=0; ps3_home_scan_bare(vba_roms, pane, &max_dir); if(strcmp(vba_roms, "/dev_hdd0/ROMS/vba")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/vba", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/vba", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_vba(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/vba/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; */ thumb_ok_vba: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"GameBoy Game ROM", /*type*/10, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"GameBoy Game ROM", /*type*/10, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //fba max_dir=0; ps3_home_scan_bare(fba_roms, pane, &max_dir); if(strcmp(fba_roms, "/dev_hdd0/ROMS/fba")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/fba", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/fba", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_fba(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/fba/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; */ thumb_ok_fba: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"FBA Game ROM", /*type*/12, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"FBA Game ROM", /*type*/12, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>2) xmb[8].first=1; free_all_buffers(); free(pane); } if(xmb_icon_last==8 && (xmb_icon_last_first<xmb[8].size)) { xmb[8].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } xmb[8].group=0; save_xmb_column(8); is_retro_loading=0; sys_ppu_thread_exit(0); } void add_photo_column() { if(is_photo_loading || xmb[3].init) return; is_photo_loading=1; xmb[3].init=1; sys_ppu_thread_create( &addpic_thr_id, add_photo_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_photo" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_music_column() { if(is_music_loading || xmb[4].init) return; is_music_loading=1; xmb[4].init=1; sys_ppu_thread_create( &addmus_thr_id, add_music_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_music" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_video_column() { if(is_video_loading || xmb[5].init || !xmb[6].init) return; // if(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading) return; is_video_loading=1; xmb[5].init=1; sys_ppu_thread_create( &addvid_thr_id, add_video_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_video" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_emulator_column() { mod_xmb_member(xmb[8].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3); redraw_column_texts(8); if(is_retro_loading || xmb[8].init) return; is_retro_loading=1; if(is_retro_loading) { xmb[8].init=1; sys_ppu_thread_create( &addret_thr_id, add_retro_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_retro" ); } } void save_options() { seconds_clock=0; remove(options_bin); FILE *fpA; fpA = fopen ( options_bin, "w" ); if(fpA!=NULL) { fprintf(fpA, "download_covers=%i\r\n", download_covers); fprintf(fpA, "date_format=%i\r\n", date_format); fprintf(fpA, "time_format=%i\r\n", time_format); fprintf(fpA, "clear_activity_logs=%i\r\n", clear_activity_logs); fprintf(fpA, "ftpd_on=%i\r\n", ftp_service); fprintf(fpA, "disable_options=%i\r\n", disable_options); fprintf(fpA, "mount_hdd1=%i\r\n", mount_hdd1); fprintf(fpA, "scan_avchd=%i\r\n", scan_avchd); fprintf(fpA, "expand_avchd=%i\r\n", expand_avchd); fprintf(fpA, "xmb_sparks=%i\r\n", xmb_sparks); fprintf(fpA, "xmb_popup=%i\r\n", xmb_popup); fprintf(fpA, "xmb_game_bg=%i\r\n", xmb_game_bg); fprintf(fpA, "xmb_cover=%i\r\n", xmb_cover); fprintf(fpA, "xmb_cover_column=%i\r\n", xmb_cover_column); fprintf(fpA, "verify_data=%i\r\n", verify_data); fprintf(fpA, "scan_for_apps=%i\r\n", scan_for_apps); fprintf(fpA, "fullpng=%i\r\n", initial_cover_mode); fprintf(fpA, "user_font=%i\r\n", user_font); fprintf(fpA, "mm_locale=%i\r\n", mm_locale); fprintf(fpA, "lock_display_mode=%i\r\n", lock_display_mode); fprintf(fpA, "lock_fileman=%i\r\n", lock_fileman); fprintf(fpA, "overscan=%i\r\n", (int)(overscan*100.f)); fprintf(fpA, "display_mode=%i\r\n", display_mode); fprintf(fpA, "showdir=%i\r\n", dir_mode); fprintf(fpA, "game_details=%i\r\n", game_details); fprintf(fpA, "bd_emulator=%i\r\n", bd_emulator); fprintf(fpA, "animation=%i\r\n", animation); fprintf(fpA, "game_bg_overlay=%i\r\n", game_bg_overlay); fprintf(fpA, "progress_bar=%i\r\n", progress_bar); fprintf(fpA, "dim_titles=%i\r\n", dim_setting); fprintf(fpA, "ss_timeout=%i\r\n", ss_timeout); fprintf(fpA, "deadzone_x=%i\r\n", xDZ); fprintf(fpA, "deadzone_y=%i\r\n", yDZ); fprintf(fpA, "use_pad_sensor=%i\r\n", use_pad_sensor); fprintf(fpA, "parental_level=%i\r\n", parental_level); fprintf(fpA, "parental_pass=%s\r\n", parental_pass); fprintf(fpA, "theme_sound=%i\r\n", theme_sound); fprintf(fpA, "gray_poster=%i\r\n", gray_poster); fprintf(fpA, "confirm_with_x=%i\r\n", confirm_with_x); fprintf(fpA, "hide_bd=%i\r\n", hide_bd); fprintf(fpA, "repeat_init_delay=%i\r\n", repeat_init_delay); fprintf(fpA, "repeat_key_delay=%i\r\n", repeat_key_delay); // fprintf(fpA, "%i\n", ); fclose( fpA); } } void parse_settings() { seconds_clock=0; char oini[32]; for(int n=0;n<xmb[2].size;n++ ) { if(!xmb[2].member[n].option_size) continue; sprintf(oini, "%s", xmb[2].member[n].optionini); if(!strcmp(oini, "download_covers")) download_covers =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "date_format")) date_format =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "time_format")) time_format =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "clear_activity_logs")) clear_activity_logs =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "ftpd_on")) ftp_service =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "disable_options")) disable_options =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "mount_hdd1")) mount_hdd1 =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "scan_avchd")) scan_avchd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "expand_avchd")) expand_avchd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_sparks")) xmb_sparks =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_popup")) xmb_popup =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_game_bg")) xmb_game_bg =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_cover")) xmb_cover =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_cover_column")) xmb_cover_column=(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "verify_data")) verify_data =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "scan_for_apps")) scan_for_apps =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "full_png")) initial_cover_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "user_font")) user_font =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "theme_sound")) theme_sound =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "lock_display_mode")) lock_display_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "lock_fileman")) lock_fileman =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "overscan")) overscan =(float)((float)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10)/100.f); else if(!strcmp(oini, "display_mode")) display_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "showdir")) dir_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "game_details")) game_details =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "animation")) animation =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "game_bg_overlay")) game_bg_overlay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "gray_poster")) gray_poster =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "confirm_with_x")) confirm_with_x =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "hide_bd")) hide_bd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "progress_bar")) progress_bar =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "dim_titles")) dim_setting =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "ss_timeout")) ss_timeout =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "deadzone_x")) xDZ =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "deadzone_y")) yDZ =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "use_pad_sensor")) use_pad_sensor =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "parental_level")) parental_level =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "bd_emulator")) bd_emulator =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "repeat_init_delay")) repeat_init_delay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "repeat_key_delay")) repeat_key_delay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); // else if(!strcmp(oini, "parental_pass")) sprintf(parental_pass, "%s", xmb[2].member[n].option[xmb[2].member[n].option_selected].value); xDZa=(int) (xDZ*128/100); yDZa=(int) (yDZ*128/100); } // save_options(); } void add_settings_column() { // add_xmb_member(xmb[2].member, &xmb[2].size, (char*)"Edit multiMAN options", (char*)"Not implemented yet", // /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); sprintf(xmb[2].name, "%s", xmb_columns[2]); xmb[2].first=0; xmb[2].size=0; add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_SI, (char*)STR_XC2_SI1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_IL, (char*)STR_XC2_IL1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_GC, (char*)STR_XC2_GC1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Download Game Covers", (char*)"Adjusts whether to download missing game covers.", (char*)"download_covers");//, (char*)"Internet connection required.") add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=download_covers; xmb[2].member[xmb[2].size-1].icon=xmb[9].data; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"FTP Service", (char*)"Sets FTP startup mode.", (char*)"ftpd_on"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disabled", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto start", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=ftp_service; xmb[2].member[xmb[2].size-1].icon=xmb_icon_ftp; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Sparks", (char*)"Changes display setting for sparks overlay in XMMB display mode.", (char*)"xmb_sparks"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show always", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto hide", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=xmb_sparks; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Poster", (char*)"Changes display setting for game poster images in XMMB mode.", (char*)"xmb_game_bg"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_game_bg; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Cover", (char*)"Changes display setting for game cover images in XMMB display mode.", (char*)"xmb_cover"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_cover; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Icon Swap", (char*)"Switches display of icon and cover in Game column.", (char*)"xmb_cover_column"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show Icon", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show Cover", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_cover_column; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Info Pop-up", (char*)"Changes display setting for information pop-up boxes.", (char*)"xmb_popup"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_popup; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Parental Control PIN Code", (char*)"Sets the parental control level PIN code.", (char*)"parental_pass"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 1, (char*)"****", (char*)parental_pass); xmb[2].member[xmb[2].size-1].option_selected=0; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Parental Control Level", (char*)"Sets the parental control level for rated titles.", (char*)"parental_level"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 1", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 2", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 3", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 4", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 5", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 6", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 7", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 8", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 9", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 10", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 11", (char*)"11"); xmb[2].member[xmb[2].size-1].option_selected=parental_level; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Function Control", (char*)"Adjusts which functions will be enabled or disabled.", (char*)"disable_options"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable Copy and Delete", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Delete", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Copy", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Copy and Delete", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=disable_options; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"File Manager Access", (char*)"Sets whether to restrict access to File Manager.", (char*)"lock_fileman"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Allow", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Deny", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=lock_fileman; xmb[2].member[xmb[2].size-1].icon=xmb_icon_desk; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Verify USB Games", (char*)"Sets whether to check titles on USB for compatibility.", (char*)"verify_data"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Always", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=verify_data; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Scan for Homebrew Applications", (char*)"Sets whether to scan for applications with RELOAD.SELF boot file.", (char*)"scan_for_apps"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=scan_for_apps; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Scan for AVCHD\xE2\x84\xA2 and Blu-ray\xE2\x84\xA2", (char*)"Sets whether to scan USB devices for AVCHD\xE2\x84\xA2 and Blu-ray\xE2\x84\xA2 content.", (char*)"scan_avchd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=scan_avchd; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Expand Contents of AVCHD\xE2\x84\xA2", (char*)"Sets whether to show one entry per title or all AVCHD\xE2\x84\xA2 playlists.", (char*)"expand_avchd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Do not expand", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Expand", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=expand_avchd; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Hide BD-ROM Disc from Game List", (char*)"Sets appearance of BD-ROM disc entry in the game list.", (char*)"hide_bd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=hide_bd; xmb[2].member[xmb[2].size-1].icon=xmb_icon_blu; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Content Filter", (char*)"Changes default content filter (key shortcut SELECT+R1).", (char*)"display_mode"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No filtering", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"PS3\xE2\x84\xA2 titles only", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"AVCHD\xE2\x84\xA2 titles only", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=display_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Clean Activity Logs", (char*)"Adjusts whether to remove push list and boot history.", (char*)"clear_activity_logs"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=clear_activity_logs; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Date Format", (char*)"Sets the order of display for year, month and day.", (char*)"date_format"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"DD/MM/YYYY", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"MM/DD/YYYY", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"YYYY/MM/DD", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=date_format; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Time Format", (char*)"Sets the time display to either a 12-hour or 24-hour clock.", (char*)"time_format"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"12-Hour Clock", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"24-Hour Clock", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=time_format; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Button Assignment", (char*)"Sets which buttons are used for Accept/Enter and Cancel/Back.", (char*)"confirm_with_x"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Circle is [Accept]", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Cross is [Accept]", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=confirm_with_x; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Default Display Mode", (char*)"Sets default startup display mode. Switch modes with L1/R1.", (char*)"full_png"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (plain)", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4x2 game list", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (poster)", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (user background)", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slide cover flow", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"File Manager mode", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Box-art", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8x4 game list", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"XMMB (XMB\xE2\x84\xA2 clone)", (char*)"8"); xmb[2].member[xmb[2].size-1].option_selected=initial_cover_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Display Mode Lock", (char*)"Locks multiMAN to pre-selected display mode.", (char*)"lock_display_mode"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"-1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (plain)", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4x2 game list", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (poster)", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (user background)", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slide cover flow", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"File Manager mode", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Box-art", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8x4 game list", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"XMMB (XMB\xE2\x84\xA2 clone)", (char*)"8"); xmb[2].member[xmb[2].size-1].option_selected=lock_display_mode+1; if(user_font<10) { add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Font Preference", (char*)"Sets default font (key shortcut R3).", (char*)"user_font"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Default", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Pop" , (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"New Rodin", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Matisse", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Rounded", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #1 (font0)", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #2 (font1)", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #3 (font2)", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #4 (font3)", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #5 (font4)", (char*)"9"); xmb[2].member[xmb[2].size-1].option_selected=user_font; } add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Theme Audio", (char*)"Sets whether to play theme music in the background.", (char*)"theme_sound"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=theme_sound; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"TV Overscan", (char*)"Sets TV overscan zone in percents (key shortcut SELECT+L2/R2).", (char*)"overscan"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1%", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2%", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3%", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4%", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5%", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6%", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7%", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8%", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9%", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); if(overscan<0.00f) overscan=0.00f; if(overscan>0.10f) overscan=0.10f; xmb[2].member[xmb[2].size-1].option_selected=(u8) ((float)overscan * 100.f); xmb[2].member[xmb[2].size-1].icon=xmb_icon_ss; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Title Name Appearance", (char*)"Changes size and appearance of title names and paths.", (char*)"showdir"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Large size title", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title and path", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Medium size title", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=dir_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Title Details", (char*)"Adjusts level of displayed details for selected display modes.", (char*)"game_details"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title Only", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title and ID", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Full", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"None", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=game_details; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Animation", (char*)"Adjusts animation options for some display modes.", (char*)"animation"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable all animations", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable background slide", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable icon animation", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"All animations On", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=animation; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Poster Overlay", (char*)"Sets whether to show poster in [Game list (poster)] display mode.", (char*)"game_bg_overlay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=game_bg_overlay; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Poster and Cover Alteration", (char*)"Sets whether to grayscale game poster and cover when required.", (char*)"gray_poster"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Never", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=gray_poster; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Progress Bar", (char*)"Sets whether to show progress bar during copy operations.", (char*)"progress_bar"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=progress_bar; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Inactivity Timeout", (char*)"Dim and hide title names after specified amount of time.", (char*)"dim_titles"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1 sec", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2 sec", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3 sec", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4 sec", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5 sec", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6 sec", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7 sec", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8 sec", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9 sec", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10 sec", (char*)"10"); if(dim_setting<0) dim_setting=0; if(dim_setting>10) dim_setting=10; xmb[2].member[xmb[2].size-1].option_selected=dim_setting; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Screensaver", (char*)"Turn on screensaver after specified amount of time.", (char*)"ss_timeout"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1 min", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2 min", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3 min", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4 min", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5 min", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6 min", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7 min", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8 min", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9 min", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10 min", (char*)"10"); xmb[2].member[xmb[2].size-1].option_selected=ss_timeout; xmb[2].member[xmb[2].size-1].icon=xmb_icon_ss; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Motion Sensor", (char*)"Sets whether to use sensor information from SIXAXIS\xE2\x84\xA2 controller.", (char*)"use_pad_sensor"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disabled", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enabled", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=use_pad_sensor; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Mouse Sensitivity (X)", (char*)"Sets analogue sticks horizontal sensitivity (dead zone).", (char*)"deadzone_x"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"20%", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"30%", (char*)"30"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"40%", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"50%", (char*)"50"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"60%", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"70%", (char*)"70"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"80%", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"90%", (char*)"90"); if(xDZ>90) xDZ=90; xmb[2].member[xmb[2].size-1].option_selected=(int) (xDZ/10); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Mouse Sensitivity (Y)", (char*)"Sets analogue sticks vertical sensitivity (dead zone).", (char*)"deadzone_y"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"20%", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"30%", (char*)"30"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"40%", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"50%", (char*)"50"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"60%", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"70%", (char*)"70"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"80%", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"90%", (char*)"90"); if(yDZ>90) yDZ=90; xmb[2].member[xmb[2].size-1].option_selected=(int) (yDZ/10); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Key Repeat Delay", (char*)"Sets initial delay before key repeat.", (char*)"repeat_init_delay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Short", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Short", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Normal", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Long", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Long", (char*)"100"); xmb[2].member[xmb[2].size-1].option_selected=(int) ((repeat_init_delay/20)-1); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Key Repeat Speed", (char*)"Sets key repeat speed.", (char*)"repeat_key_delay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Fast", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Fast", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Normal", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slow", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slower", (char*)"10"); xmb[2].member[xmb[2].size-1].option_selected=(int) ((repeat_key_delay/2)-1); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Cache Partition", (char*)"Enable or disable 2GB temporary partition (/dev_hdd1).", (char*)"mount_hdd1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=mount_hdd1; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"BD-ROM Emulator", (char*)"Changes emulator type. System restart required to apply changes. ", (char*)"bd_emulator"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"None", (char*)"0"); if(bdemu2_present) add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Hermes", (char*)"1"); else add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"(Unavailable)", (char*)"1"); if(c_firmware==3.55f) add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Standard", (char*)"2"); if(c_firmware==3.41f && bd_emulator>1) bd_emulator=1; xmb[2].member[xmb[2].size-1].option_selected=bd_emulator; xmb[2].first=xmb_settings_sel; } void add_home_column() { sprintf(xmb[1].name, "%s", xmb_columns[1]); xmb[1].first=1; xmb[1].size=0; add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_UPDATE, (char*)STR_XC1_UPDATE1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_update, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); if(lock_fileman) add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_FILEMAN0, (char*)STR_XC1_FILEMAN1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_desk, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); else add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_FILEMAN, (char*)STR_XC1_FILEMAN1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_desk, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_PFS, (char*)STR_XC1_PFS1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_hdd, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_SS, (char*)STR_XC1_SS1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_ss, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_THEMES, (char*)STR_XC1_THEMES1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_theme, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_HELP, (char*)STR_XC1_HELP1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_help, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_RESTART, (char*)STR_XC1_RESTART1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[1].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_QUIT, (char*)STR_XC1_QUIT1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_quit, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); } void add_game_column(t_menu_list *list, int max, int sel, bool force_covers) { int toff=0; int first_sort=0; char icon_path[512]; u8 g_status; char t_ip[512]; u8 *g_icon=xmb[0].data; if(!xmb[5].init || !xmb[5].size) { xmb[5].first=0; xmb[5].size=0; add_xmb_member(xmb[5].member, &xmb[5].size, (char*)STR_XC5_LINK, (char*)STR_XC5_LINK1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_showtime, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[5].member, &xmb[5].size, (char*)STR_XC5_ST, (char*)STR_XC5_ST1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_showtime, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); } for(int m=0; m<xmb[5].size; m++) if(xmb[5].member[m].type==2) delete_xmb_member(xmb[5].member, &xmb[5].size, m); if(!xmb[6].init) { xmb[6].first=0; xmb[6].size=0; add_xmb_member(xmb[6].member, &xmb[6].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH2, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); xmb[7].first=0; xmb[7].size=0; } if(!xmb[6].init || !xmb[7].init) //!xmb[5].init || { for(int m=0; m<max; m++) { if(!strcmp(list[m].content, "PS3")) { if(!xmb[6].init) { if(xmb[6].group) { if( (int)((list[m].user>>16)&0x0f) != (xmb[6].group&0x0f) && (xmb[6].group&0x0f) ) continue; if(xmb[6].group>>4) { u8 m_grp= ((xmb[6].group>>4)-1)*2; if( (xmb[6].group>>4)!=15 && (m_grp+0x41) != list[m].title[0] && (m_grp+0x42) != list[m].title[0] && (m_grp+0x61) != list[m].title[0] && (m_grp+0x62) != list[m].title[0] ) continue; else if( (xmb[6].group>>4)==15 && ( ( list[m].title[0]>=0x41 && list[m].title[0]<=0x5a) || (list[m].title[0]>=0x61 && list[m].title[0]<=0x7a) ) ) continue; } } if(m==sel) xmb[6].first=xmb[6].size; toff=0; if(list[m].title[0]=='_') toff=1; if(strstr(list[m].path, "/dev_bdvd")==NULL) g_icon=xmb[0].data; else {g_icon=xmb_icon_blu; first_sort=1;} u16 g_iconw=320; u16 g_iconh=176; g_status=0; if(xmb_cover_column || force_covers) { sprintf(icon_path, "%s/%s.JPG", covers_dir, list[m].title_id); if(exist(icon_path)) {g_iconw=260; g_iconh=300; goto add_mem;} sprintf(icon_path, "%s/%s.PNG", covers_dir, list[m].title_id); if(exist(icon_path)) {g_iconw=260; g_iconh=300; goto add_mem;} if(list[xmb[xmb_icon].member[xmb[6].size].game_id].cover!=-1 && list[xmb[xmb_icon].member[xmb[6].size].game_id].cover!=1) { sprintf(icon_path, "%s/%s.JPG", covers_dir, list[m].title_id); download_cover(list[xmb[xmb_icon].member[xmb[6].size].game_id].title_id, icon_path); list[xmb[xmb_icon].member[xmb[6].size].game_id].cover=1; } } // if(strstr(list[m].path, "/pvd_usb")!=NULL) sprintf(icon_path, "%s/%s_320.PNG", cache_dir, list[m].title_id); // else // sprintf(icon_path, "%s/PS3_GAME/ICON0.PNG", list[m].path); if(exist(icon_path)) {g_iconw=320; g_iconh=176; goto add_mem;} sprintf(icon_path, "%s/ICON0.PNG", list[m].path); if(exist(icon_path)) {g_iconw=320; g_iconh=176; goto add_mem;} else {g_status=2; g_iconw=128; g_iconh=128;} add_mem: if(list[m].title[0]=='_') list[m].split=1; add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].path, /*type*/1, /*status*/g_status, /*game_id*/m, /*icon*/g_icon, g_iconw, g_iconh, /*f_path*/list[m].path, /*i_path*/(char*)icon_path, list[m].user, list[m].split); if(list[m].user & IS_FAV) { if(m==sel) xmb[7].first=xmb[7].size; add_xmb_member(xmb[7].member, &xmb[7].size, list[m].title+toff, list[m].path, /*type*/1, /*status*/g_status, /*game_id*/m, /*icon*/g_icon, g_iconw, g_iconh, /*f_path*/list[m].path, /*i_path*/(char*)icon_path, list[m].user, list[m].split); } sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); } } else if(!strcmp(list[m].content, "AVCHD") || !strcmp(list[m].content, "BDMV") || !strcmp(list[m].content, "DVD")) { if(cover_mode==8) //!xmb[5].init && { if(m==sel) xmb[5].first=xmb[5].size; toff=0; if(list[m].title[0]=='_') toff=1; else if(strstr(list[m].title, "[Video] ")!=NULL) toff=8; else if(strstr(list[m].title, "[HDD Video] ")!=NULL || strstr(list[m].title, "[DVD Video] ")!=NULL) toff=12; sprintf(t_ip, "%s/HDAVCTN/BDMT_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/POSTER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/COVER.JPG", list[m].path); if(exist(t_ip)) add_xmb_member(xmb[5].member, &xmb[5].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/0, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*) t_ip, 0, 0); else add_xmb_member(xmb[5].member, &xmb[5].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/2, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*)"/", 0, 0); } else { if(cover_mode!=8) { if(list[m].title[0]=='_') toff=1; else if(strstr(list[m].title, "[Video] ")!=NULL) toff=8; else if(strstr(list[m].title, "[HDD Video] ")!=NULL || strstr(list[m].title, "[DVD Video] ")!=NULL) toff=12; sprintf(t_ip, "%s/HDAVCTN/BDMT_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/POSTER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/COVER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/NOID.JPG", app_usrdir); if(exist(t_ip)) add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/0, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*) t_ip, 0, 0); else add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/2, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*)"/", 0, 0); sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); } } } } //sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); sort_xmb_col(xmb[7].member, xmb[7].size, 0); sort_xmb_col(xmb[5].member, xmb[5].size, 2); } for(int m=0; m<max; m++) { if(!strcmp(list[m].content, "PS3")) { if(m==sel) for(int m2=0; m2<xmb[6].size; m2++) if(xmb[6].member[m2].game_id==sel) xmb[6].first=m2; } else if(!strcmp(list[m].content, "AVCHD") || !strcmp(list[m].content, "BDMV") || !strcmp(list[m].content, "DVD")) { if(m==sel) for(int m2=0; m2<xmb[5].size; m2++) if(xmb[5].member[m2].game_id==sel) xmb[5].first=m2; } } if(xmb[6].size>1 && xmb[6].first==0) xmb[6].first=1; xmb[6].init=1; xmb[7].init=1; u8 main_group=xmb[6].group & 0x0f; u8 alpha_group=xmb[6].group>>4 & 0x0f; if(main_group) { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", genre[main_group], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", genre[main_group]); } else { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", xmb_columns[6], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", xmb_columns[6]); } if(xmb_icon==6) draw_xmb_icon_text(xmb_icon); } void add_web_column() { sprintf(xmb[9].name, "%s", xmb_columns[9]); xmb[9].first=0; xmb[9].size=0; add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Download PS3\xE2\x84\xA2 Demos and Utilities", (char*)"Browse PSX Store Website for rich content for your Playstation\xC2\xAE\x33 system", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_globe, 128, 128, /*f_path*/(char*)"http://www.psxstore.com/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Download Themes", (char*)"Check for new downloadable themes", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_theme, 128, 128, /*f_path*/(char*)"http://ps3.spiffy360.com/themes.php?category=3", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Visit multiMAN Forum", (char*)"Browse psx-scene thread for multiMAN discussions", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[1].data, 128, 128, /*f_path*/(char*)"http://psx-scene.com/forums/f187/multiman-multifunctional-tool-your-ps3-game-manager-file-manager-ftp-avchd-bdmv-72826/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"View Online User Guide", (char*)"Browse to GBATemp website for beginner's guide to multiMAN", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[9].data, 128, 128, /*f_path*/(char*)"http://gbatemp.net/t291170-multiman-beginner-s-guide", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Support multiMAN Development", (char*)"Find how to contribute to multiMAN development", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_help, 128, 128, /*f_path*/(char*)"http://www.google.com/search?q=donate+for+multiMAN", /*i_path*/(char*)"/", 0, 0); } void init_xmb_icons(t_menu_list *list, int max, int sel) { seconds_clock=0; xmb_legend_drawn=0; xmb_info_drawn=0; parental_pin_entered=0; xmb_sublevel=0; xmb_bg_show=0; xmb_bg_counter=200; load_texture(text_FMS, xmbicons, 128); load_texture(xmb_icon_dev, xmbdevs, 64); //load_texture(text_FMS+(33*65536), blankBG, 320); //mip_texture( text_FMS+(33*65536), text_FMS+(33*65536), 320, 178, -2); // -> 216x183 mip_texture( xmb_icon_star_small, xmb_icon_star, 128, 128, -4); load_texture(xmb_icon_retro, xmbicons2, 128); sprintf(auraBG, "%s/DROPS.PNG", app_usrdir); if(exist(auraBG)) load_texture(text_DROPS, auraBG, 256); else use_drops=false; if(cover_mode==8) { memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); } reset_xmb(0); free_text_buffers(); for(int n=0; n<MAX_XMB_THUMBS; n++) { xmb_icon_buf[n].used=-1; xmb_icon_buf[n].column=0; xmb_icon_buf[n].data=text_bmpUBG+(n*XMB_THUMB_WIDTH*XMB_THUMB_HEIGHT*4); } xmb_icon_buf_max=0; free_all_buffers(); if(cover_mode==8) { add_home_column(); add_settings_column(); add_web_column(); sprintf(xmb[4].name, "%s", xmb_columns[4]); if(xmb[4].group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[xmb[4].group>>4]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); sprintf(xmb[3].name, "%s", xmb_columns[3]); //video column sprintf(xmb[5].name, "%s", xmb_columns[5]); //game column sprintf(xmb[6].name, "%s", xmb_columns[6]); //game favorites sprintf(xmb[7].name, "%s", xmb_columns[7]); if(!xmb[7].init) { xmb[7].first=0; xmb[7].size=0; } draw_xmb_icon_text(xmb_icon); } add_game_column(list, max, sel, (cover_mode!=8)); if(cover_mode==4) { if(!xmb[6].first && xmb[6].size) xmb[6].first=1; load_coverflow_legend(); load_texture(text_legend, legend, 1665); } is_game_loading=0; // Retro columm if(!xmb[8].init) { xmb[8].first=0; xmb[8].size=0; } /*if(xmb_icon==5) add_video_column(); if(xmb_icon==4) add_music_column(); if(xmb_icon==3) add_photo_column(); if(xmb_icon==8) add_emulator_column();*/ if(cover_mode==8) { add_video_column(); add_music_column(); add_photo_column(); add_emulator_column(); } } void draw_xmb_clock(u8 *buffer, const int _xmb_icon) { if(_xmb_icon) seconds_clock=0; if( (time(NULL)-seconds_clock)<30) goto clock_text; if(_xmb_icon) seconds_clock=0; else seconds_clock=time(NULL); char xmb_date[32]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); // if(_xmb_icon==0) { if(date_format==0) sprintf(xmb_date, "%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); //, timeinfo->tm_sec else sprintf(xmb_date,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); // print_label_ex( 0.501f, 0.02f, 0.9f, 0xc0202020, xmb_date, 1.04f, 0.0f, 2, 6.40f, 36.0f, 1); print_label_ex( 0.5f, 0.0f, 0.9f, COL_XMB_CLOCK, xmb_date, 1.04f, 0.0f, 2, 6.40f, 36.0f, 1); } // else { if(_xmb_icon==-1) { if(time(NULL)&1) { set_texture(xmb[0].data, 128, 128); display_img(1770, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } if(_xmb_icon>0 && _xmb_icon<MAX_XMB_ICONS) { set_texture(xmb[_xmb_icon].data, 128, 128); display_img(1834, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } memset(buffer, 0, 36000); flush_ttf(buffer, 300, 30); clock_text: set_texture(buffer, 300, 30); display_img(1520, 90, 300, 30, 300, 30, 0.7f, 300, 30); } void draw_xmb_legend(const int _xmb_icon) { if(xmb_bg_counter>30 || _xmb_icon==1 || _xmb_icon==9 || c_opacity2<=0x40 || xmb_slide_step!=0 || xmb_slide_step_y!=0 || xmb_popup==0 || key_repeat) return; if(!xmb_legend_drawn) { u8 _menu_font=2; if(mm_locale) _menu_font=mui_font; xmb_legend_drawn=1; char xmb_text[32]; xmb_text[0]=0; for(int fsr=0; fsr<84000; fsr+=4) *(uint32_t*) ((uint8_t*)(text_MSG)+fsr)=0x22222280; if( (_xmb_icon==6 && xmb[_xmb_icon].first) || _xmb_icon==7) { sprintf(xmb_text, "%s", (char*) STR_POP_GS); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_triangle_x*4 + dox_triangle_y * dox_width*4), dox_triangle_w, dox_triangle_h, dox_width, 300, 8, 5); } if((_xmb_icon>1 &&_xmb_icon<6) || (_xmb_icon==6 && xmb[_xmb_icon].first==0) || _xmb_icon==8) { if(_xmb_icon==2 && xmb[_xmb_icon].first>1) sprintf(xmb_text, "%s", (char*) STR_POP_CHANGE_S); else if(_xmb_icon==2 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_VIEW_SYSINF); else if(_xmb_icon==2 && xmb[_xmb_icon].first==1) sprintf(xmb_text, "%s", (char*) STR_POP_LANGUAGE); else if(_xmb_icon==2 && xmb[_xmb_icon].first==2) sprintf(xmb_text, "%s", (char*) STR_POP_CACHE); else if(_xmb_icon==3) sprintf(xmb_text, "%s", (char*) STR_POP_PHOTO); else if(_xmb_icon==4) sprintf(xmb_text, "%s", (char*) STR_POP_MUSIC); else if(_xmb_icon==5 && xmb[_xmb_icon].first<2) sprintf(xmb_text, "%s", (char*) STR_POP_ST); else if(_xmb_icon==5 && xmb[_xmb_icon].first>1) sprintf(xmb_text, "%s", (char*) STR_POP_VIDEO); else if(_xmb_icon==6 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_REF_GAMES); else if(_xmb_icon==8 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_REF_ROMS); else if(_xmb_icon==8 && xmb[_xmb_icon].first) sprintf(xmb_text, "%s", (char*) STR_POP_ROM); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 300, 8, 5); } if(_xmb_icon==4 || _xmb_icon==6 || _xmb_icon==8) { if(_xmb_icon==6) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_GENRE, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); else if(_xmb_icon==8) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_EMU, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); else if(_xmb_icon==4) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_NAME, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_square_x *4 + dox_square_y * dox_width*4), dox_square_w, dox_square_h, dox_width, 300, 8, 36); } else { put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_l1_x*4 + dox_l1_y * dox_width*4), dox_l1_w, dox_l1_h, dox_width, 300, 8, 42); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_r1_x*4 + dox_r1_y * dox_width*4), dox_r1_w, dox_r1_h, dox_width, 300, 8+dox_l1_w+5, 42); print_label_ex( 0.475f, 0.55f, 0.6f, 0xffd0d0d0, (char*) STR_POP_SWITCH, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); } print_label_ex( 0.17f, 0.10f, 0.6f, 0xffd0d0d0, xmb_text, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); flush_ttf(text_MSG, 300, 70); } if(c_opacity2<=0x80) change_opacity(text_MSG, -95, 84000); set_texture(text_MSG, 300, 70); display_img(1520, 930, 300, 70, 300, 70, -0.1f, 300, 70); } void draw_xmb_info() { if( c_opacity2<=0x10 || (cover_mode!=5 && (xmb_bg_counter>30 || xmb_slide_step!=0 || xmb_slide_step_y!=0 || xmb_popup==0)) || !mm_is_playing || is_theme_playing || !(multiStreamStarted==1 && current_mp3!=0 && max_mp3>1)) return; if(!xmb_info_drawn) { u8 _menu_font=2; if(mm_locale) _menu_font=mui_font; xmb_info_drawn=1; char xmb_text[512]; xmb_text[0]=0; char mp3_tmp[512]; char *pch=mp3_playlist[current_mp3].path; char *pathpos=strrchr(pch,'/'); sprintf(mp3_tmp, "%s", pathpos+1); mp3_tmp[strlen(mp3_tmp)-4]=0; for(int fsr=0; fsr<106400; fsr+=4) *(uint32_t*) ((uint8_t*)(text_INFO)+fsr)=0x22222260; sprintf(xmb_text, "%s", mp3_tmp); xmb_text[46]='.'; xmb_text[47]='.'; xmb_text[48]='.'; xmb_text[49]=0; print_label_ex( 0.04f, 0.10f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 0); sprintf(xmb_text, (const char*)STR_POP_1OF1, (update_ms? ((char*)STR_POP_PLAYING) : ((char*)STR_POP_PAUSED) ), current_mp3, max_mp3); print_label_ex( 0.04f, 0.55f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 0); sprintf(xmb_text, (const char*)STR_POP_VOL,(int) (mp3_volume*100)); print_label_ex( 0.96f, 0.55f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 2); flush_ttf(text_INFO, 380, 70); } if(c_opacity2<=0x80 && c_opacity2) change_opacity(text_INFO, -95, 106400); set_texture(text_INFO, 380, 70); display_img( (cover_mode==5 ? 1540 : 100), (cover_mode==5 ? 880 : 930), 380, 70, 380, 70, -0.1f, 380, 70); } void redraw_column_texts(int _xmb_icon) { for(int n=0; n<xmb[_xmb_icon].size; n++) xmb[_xmb_icon].member[n].data=-1; if(_xmb_icon==2) //settings { u8 first=xmb[2].first; xmb[2].first=0; xmb[2].size=0; add_settings_column(); xmb[2].first=first; } } void draw_xmb_icon_text(int _xmb_icon) { xmb_legend_drawn=0; xmb_info_drawn=0; //draw column name max_ttf_label=0; // print_label_ex( 0.504f, 0.04f, 1.0f, 0x101010ff, xmb[_xmb_icon].name, 1.04f, 0.0f, 8, 4.48f, 24.0f, 1); print_label_ex( 0.5f, 0.0f, 1.0f, COL_XMB_COLUMN, xmb[_xmb_icon].name, 1.04f, 0.0f, mui_font, 4.48f, 24.0f, 1); memset(xmb_col, 0, 36000); flush_ttf(xmb_col, 300, 30); for(int n=0; n<xmb[_xmb_icon].size; n++) xmb[_xmb_icon].member[n].data=-1; } void draw_stars() { if(use_drops) set_texture(text_DROPS, 256, 256); for(int n=0; n<(use_drops?64:MAX_STARS); n++) { int move_star= rndv(10); if(use_drops) { display_img(stars[n].x*64, stars[n].y, 256, 256, 256, 256, 0.85f, 256, 256); if(move_star>4) {stars[n].y+=24; } else {stars[n].y+=16; } if(stars[n].x>1919 || stars[n].y>1016) { stars[n].x=rndv(28); stars[n].y=rndv(256); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } else { draw_square(((float)stars[n].x/1920.0f-0.5f)*2.0f, (0.5f-(float)stars[n].y/1080.0f)*2.0f, (stars[n].size/1920.f), (stars[n].size/1080.f), 0.0f, ( (XMB_SPARK_COLOR&0xffffff00) | stars[n].bri)); if(move_star==4) {stars[n].x++; } else if(move_star==5) {stars[n].x--; } if(move_star>3) {stars[n].y++; } if(move_star==2) {stars[n].y+=2; } if(move_star>6) stars[n].bri-=4; if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); if(cover_mode==8) stars[n].y=rndv(360)+360; else stars[n].y=rndv(1080); stars[n].bri=rndv(222); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } } } void launch_web_browser(char *start_page) { int mc_size; int ret = sys_memory_container_create( &memory_container_web, MEMORY_CONTAINER_SIZE_WEB); if(ret!=CELL_OK) { goto err_web; } cellWebBrowserConfig2(&config_full, CELL_WEBBROWSER_MK_VER(2, 0)); cellWebBrowserConfigSetFunction2(&config_full, CELL_WEBBROWSER_FUNCTION2_MOUSE | CELL_WEBBROWSER_FUNCTION2_URL_INPUT | CELL_WEBBROWSER_FUNCTION2_SETTING | CELL_WEBBROWSER_FUNCTION2_BOOKMARK); cellWebBrowserConfigSetTabCount2(&config_full, 2); cellWebBrowserConfigSetHeapSize2(&config_full, MB(36)); //2tabs 34mb and 62 container works cellWebBrowserConfigSetViewCondition2(&config_full, CELL_WEBBROWSER_VIEWCOND2_OVERFLOW_AUTO | CELL_WEBBROWSER_VIEWCOND2_TRANSPARENT | CELL_WEBBROWSER_VIEWCOND2_NO_FULL_SCREEN); cellWebBrowserConfigSetUnknownMIMETypeHook2(&config_full, unknown_mimetype_callback, NULL); cellWebBrowserEstimate2(&config_full, &mc_size); if((uint32_t)mc_size <= MEMORY_CONTAINER_SIZE_WEB) { dimc=0; dim=1;c_opacity_delta=-2; c_opacity=0x98; c_opacity2=0x98; www_running = 1; sprintf(status_info, "%s", "Web browser mode"); cellWebBrowserInitialize(system_callback, memory_container_web); cellWebBrowserCreate2(&config_full, start_page); } else { err_web: www_running = 0; status_info[0]=0; // sprintf(string1, "Browser disabled during Remote Play!\n\nNot enough memory to launch web browser!\n\nRequired memory: %.2f MB (allocated %.2f MB)", (double) mc_size/1024/1024, (double) MEMORY_CONTAINER_SIZE_ACTIVE/1024/1024);dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_NOMEM_WEB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } /****************************************************/ /* MAIN */ /****************************************************/ char bluray_game[64], bluray_id[10]; int bluray_pl=0; u8 read_pad_info() { u8 to_return=0; int skip_t=14; if ( ( ( (new_pad & BUTTON_UP) || ( (new_pad & BUTTON_L2) && (cover_mode==1 || cover_mode==7))) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_LEFT) && (cover_mode==4 || cover_mode==6)) ) { c_opacity_delta=16; dimc=0; dim=1; // old_pad=0; new_pad=0; counter_png=30; if(cover_mode==1) skip_t=4; else if(cover_mode==7) skip_t=8; else skip_t=1; if(cover_mode==1 && (new_pad & BUTTON_L2)) skip_t=8; if(cover_mode==7 && (new_pad & BUTTON_L2)) skip_t=32; if(cover_mode!=8 && cover_mode!=4) { game_sel_last=game_sel; game_sel-=skip_t; } new_pad=0; if((cover_mode==8 || cover_mode==4) && xmb[xmb_icon].size>1) { xmb_legend_drawn=0; xmb_info_drawn=0; xmb_bg_show=0; xmb_bg_counter=200; if(xmb[xmb_icon].first==0) {xmb[xmb_icon].first=xmb[xmb_icon].size-1; xmb_slide_y=0; xmb_slide_step_y=0; if(cover_mode==4) load_coverflow_legend();} else { if(xmb_slide_step_y!=0) { if(xmb_slide_y >0) { if(xmb[xmb_icon].first>0) xmb[xmb_icon].first-=repeat_counter3; xmb_slide_y=0;} if(xmb_slide_y <0) { if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first+=repeat_counter3; xmb_slide_y=0;} if(xmb[xmb_icon].first==1 || xmb[xmb_icon].first>=xmb[xmb_icon].size) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} if(xmb[xmb_icon].first>=xmb[xmb_icon].size) xmb[xmb_icon].first=xmb[xmb_icon].size-1; load_coverflow_legend(); } //else xmb_slide_step_y=10; } } //if(cover_mode==8) goto leave_for8; if(game_sel<0) { game_sel=max_menu_list-1; game_sel_last=game_sel; //if(cover_mode==8 && xmb_icon==6) xmb[xmb_icon].first=game_sel; //xmb_slide_step_y=0; counter_png=0; new_pad=0; if(cover_mode!=8 && cover_mode!=4) {to_return=1; goto leave_for8;}} if(cover_mode==0 || cover_mode==2) { draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); if( (int) (game_sel/14) != (int) (game_sel_last/14)) {counter_png=0;new_pad=0;{to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( (((new_pad & BUTTON_DOWN) || ( (new_pad & BUTTON_R2) && (cover_mode==1 || cover_mode==7))) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_RIGHT) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; c_opacity_delta=16; dimc=0; dim=1; counter_png=30; if(cover_mode==1) skip_t=4; else if(cover_mode==7) skip_t=8; else skip_t=1; if(cover_mode==1 && (new_pad & BUTTON_R2)) skip_t=8; if(cover_mode==7 && (new_pad & BUTTON_R2)) skip_t=32; if(cover_mode!=8 && cover_mode!=4) { game_sel_last=game_sel; game_sel+=skip_t; if(skip_t>1 && game_sel>=max_menu_list) game_sel=max_menu_list-1; } new_pad=0; if((cover_mode==8 || cover_mode==4) && xmb[xmb_icon].size>1) { xmb_legend_drawn=0; xmb_info_drawn=0; xmb_bg_show=0; xmb_bg_counter=200; if(xmb[xmb_icon].first==xmb[xmb_icon].size-1) {xmb[xmb_icon].first=0; xmb_slide_y=0; xmb_slide_step_y=0;if(cover_mode==4) load_coverflow_legend();} else { if(xmb_slide_step_y!=0) { if(xmb_slide_y >0) { if(xmb[xmb_icon].first>0) xmb[xmb_icon].first-=repeat_counter3; xmb_slide_y=0;} if(xmb_slide_y <0) { if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first+=repeat_counter3; xmb_slide_y=0;} if(xmb[xmb_icon].first>=xmb[xmb_icon].size-2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} load_coverflow_legend(); } //else xmb_slide_step_y=-10; if(xmb[xmb_icon].first>=xmb[xmb_icon].size) xmb[xmb_icon].first=xmb[xmb_icon].size-1; } } // if(cover_mode==8) goto leave_for8; if(game_sel>=max_menu_list) { //if(cover_mode==8 && xmb_icon==6) xmb[xmb_icon].first=0; //xmb_slide_step_y=0; game_sel=0; game_sel_last=0; counter_png=0; new_pad=0; if(cover_mode!=8 && cover_mode!=4) {to_return=1; goto leave_for8;} } if(cover_mode==0 || cover_mode==2) { if( (int) (game_sel/14) != (int) (game_sel_last/14)) {counter_png=0; new_pad=0; {to_return=1; goto leave_for8;}} else draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( ((new_pad & BUTTON_LEFT) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_UP) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; xmb_legend_drawn=0; xmb_info_drawn=0; if(cover_mode==8 && xmb_icon>1) { if(xmb_slide_step!=0) { if(xmb_slide >0) {if(xmb_icon>2) xmb_icon--; if(xmb_icon==2) free_all_buffers(); xmb_slide=0;draw_xmb_icon_text(xmb_icon);} if(xmb_slide <0) {if(xmb_icon<MAX_XMB_ICONS-2) xmb_icon++; if(xmb_icon==4) free_all_buffers(); xmb_slide=0; draw_xmb_icon_text(xmb_icon);} if(xmb_icon!=1) xmb_slide_step=15; if(xmb_icon==2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} } else xmb_slide_step=15; } if(cover_mode==8) goto leave_for8; if(cover_mode==1 || cover_mode==7) skip_t=1; else if(cover_mode==6) skip_t=3; else skip_t=14; c_opacity_delta=16; dimc=0; dim=1; if(game_sel == 0) { game_sel=max_menu_list-1; game_sel_last=game_sel; counter_png=0; new_pad=0; {to_return=1; goto leave_for8;}} else { // old_pad=0; new_pad=0; game_sel = game_sel-skip_t; game_sel_last=game_sel; if(game_sel<0) {game_sel = 0; game_sel_last=0; counter_png=0; new_pad=0;{to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( ((new_pad & BUTTON_RIGHT) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_DOWN) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; xmb_legend_drawn=0; xmb_info_drawn=0; if(cover_mode==8 && xmb_icon<MAX_XMB_ICONS-1) { if(xmb_slide_step!=0) { if(xmb_slide >0) {if(xmb_icon>2) xmb_icon--; if(xmb_icon==2) free_all_buffers(); xmb_slide=0; draw_xmb_icon_text(xmb_icon);} if(xmb_slide <0) {if(xmb_icon<MAX_XMB_ICONS-2) xmb_icon++; if(xmb_icon==4) free_all_buffers(); xmb_slide=0;draw_xmb_icon_text(xmb_icon);} xmb_slide_step=-15; if(xmb_icon!=MAX_XMB_ICONS-1) xmb_slide_step=-15; if(xmb_icon==MAX_XMB_ICONS-2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} } else xmb_slide_step=-15; } if(cover_mode==8) goto leave_for8; if(cover_mode==1 || cover_mode==7) skip_t=1; else if(cover_mode==6) skip_t=3; else skip_t=14; c_opacity_delta=16; dimc=0; dim=1; if(game_sel == max_menu_list-1) { game_sel = 0; game_sel_last=game_sel; } else { // old_pad=0; new_pad=0; game_sel = game_sel + skip_t; game_sel_last=game_sel; if(game_sel>=max_menu_list) {game_sel=max_menu_list-1; new_pad=0; game_sel_last=game_sel; counter_png=0; {to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0; {to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0; {to_return=1; goto leave_for8;}} } if((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_R2)) { c_opacity_delta=16; dimc=0; dim=1; new_pad=0; //state_draw=1; overscan+=0.01f; if(overscan>0.10f) overscan=0.10f; if(cover_mode==8 && xmb_icon==2) redraw_column_texts(xmb_icon); {to_return=1; goto leave_for8;} } if((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_L2)) { c_opacity_delta=16; dimc=0; dim=1; new_pad=0; //old_pad=0; state_draw=1; overscan-=0.01f;if(overscan<0.0f) overscan=0.00f; if(cover_mode==8 && xmb_icon==2) redraw_column_texts(xmb_icon); {to_return=1; goto leave_for8;} } leave_for8: return to_return; } void draw_whole_xmb(u8 mode) { char filename[1024]; drawing_xmb=1; if(mode) { pad_read(); read_pad_info(); ClearSurface(); } if((xmb_icon>1 && xmb_icon<6) || xmb_icon==8) xmb_bg_counter--; if(xmb_icon==5 && xmb[5].init==0) add_video_column();// && xmb_bg_counter<100 else if(xmb_icon==4 && xmb[4].init==0) add_music_column(); else if(xmb_icon==3 && xmb[3].init==0) add_photo_column(); else if(xmb_icon==8 && xmb[8].init==0) add_emulator_column(); if(xmb_slide_step!=0 || xmb_slide_step_y!=0 || (xmb_game_bg==0 && xmb_cover==0)) xmb_bg_show=0; if(!use_drops) if(xmb_sparks==1 || (xmb_sparks==2 && xmb_bg_show==0)) draw_stars(); if(!xmb_bg_show) set_texture( text_bmp, 1920, 1080); else set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops) if(xmb_sparks==1 || (xmb_sparks==2 && xmb_bg_show==0)) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_legend(xmb_icon); draw_xmb_info(); if(xmb_slide_step!=0) //xmmb sliding horizontally { xmb_slide+=xmb_slide_step; /*if(xmb_slide == 165) xmb_slide_step=3; //slow it down before settling else if(xmb_slide ==-165) xmb_slide_step=-3; else */ if(xmb_slide == 180) xmb_slide_step= 2; else if(xmb_slide ==-180) xmb_slide_step=-2; else if(xmb_slide >= 200) {xmb_slide_step= 0; if(xmb_icon==3) free_all_buffers(); xmb_icon--; xmb_slide=0; draw_xmb_icon_text(xmb_icon); parental_pin_entered=0;} else if(xmb_slide <=-200) {xmb_slide_step= 0; if(xmb_icon==3) free_all_buffers(); xmb_icon++; xmb_slide=0; draw_xmb_icon_text(xmb_icon); parental_pin_entered=0;} if(xmb_icon>MAX_XMB_ICONS-1) xmb_icon=MAX_XMB_ICONS-1; else if(xmb_icon<1) xmb_icon=1; if(xmb_slide_step==0) xmb_bg_counter=200; } if(xmb_slide_step_y!=0) //xmmb sliding vertically { xmb_slide_y+=xmb_slide_step_y; if(xmb_slide_y == 40) xmb_slide_step_y = 5; else if(xmb_slide_y ==-40) xmb_slide_step_y =-5; else if(xmb_slide_y == 80) xmb_slide_step_y = 2; else if(xmb_slide_y ==-80) xmb_slide_step_y =-2; else if(xmb_slide_y >= 90) {xmb_slide_step_y= 0; xmb_legend_drawn=0; if(xmb[xmb_icon].first>0) xmb[xmb_icon].first--; xmb_slide_y=0;} else if(xmb_slide_y <=-90) {xmb_slide_step_y= 0; xmb_legend_drawn=0; if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first++; xmb_slide_y=0;} if(xmb_slide_step_y==0) xmb_bg_counter=200; } if( (xmb_icon==6 || xmb_icon==7) && xmb[xmb_icon].size) // && max_menu_list>0 { if(xmb_bg_counter>0 && !xmb_bg_show) xmb_bg_counter--; if(xmb_bg_counter==0 && !xmb_bg_show && xmb_slide_step==0 && xmb_slide_step_y==0 && (xmb_game_bg==1 || xmb_cover==1) && (xmb_icon!=6 || (xmb_icon==6 && xmb[xmb_icon].first)) && !is_game_loading) { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename) && xmb_game_bg==1) { //load_png_partial(text_FONT, filename, 1920, 90, 0); //load_png_texture(text_FONT, filename, 1920); //sprintf(filename, "%s/PS3_GAME/PIC0.PNG", menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].path); //if(exist(filename)) load_png_texture(text_FONT+1998640, filename, 1920); load_png_texture(text_FONT, filename, 1920); //change_opacity(text_FONT, -75, 8294400); if(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].split==1 || menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title[0]=='_') gray_texture(text_FONT, 1920, 1080, 0); //blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 70, ((menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].split==1 || menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title[0]=='_') ? 1 : 0), 1, 1); } else memcpy(text_FONT, text_bmp, 8294400); if(xmb_cover==1)// && xmb_icon==6) { if(xmb_cover_column) { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename)) load_png_texture(text_FONT+4419016, filename, 1920);//(575*1920+814)*4 } else { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); char cvstr [128]; if(exist(filename)) { sprintf(cvstr, "%s/CBOX3.PNG", app_usrdir); if(exist(cvstr)){ load_texture(text_TEMP, cvstr, 349); put_texture_with_alpha( text_FONT, text_TEMP, 349, 356, 349, 785, 550, 0, 0); } load_jpg_texture(text_FONT+4419256, filename, 1920);//(575*1920+814)*4 sprintf(filename, "%s/GLC.PNG", app_usrdir); if(exist(filename)) { load_texture(text_TEMP, filename, 260); put_texture_with_alpha( text_FONT, text_TEMP, 260, 300, 260, 814, 575, 0, 0); } } else { if(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover!=-1 && menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover!=1) { download_cover(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id, filename); menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover=1; } sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename)) { sprintf(cvstr, "%s/CBOX3.PNG", app_usrdir); if(exist(cvstr)){ load_png_texture(text_TEMP, cvstr, 349); put_texture_with_alpha( text_FONT, text_TEMP, 349, 356, 349, 785, 550, 0, 0); } load_texture(text_FONT+(575*1920+814)*4, filename, 1920); sprintf(filename, "%s/GLC.PNG", app_usrdir); if(exist(filename)) { load_texture(text_TEMP, filename, 260); put_texture_with_alpha( text_FONT, text_TEMP, 260, 300, 260, 814, 575, 0, 0); } }// else xmb_bg_counter=-1; } } } // sprintf(icon_path, "%s/%s.PNG", covers_dir, list[m].title_id); // if(stat(icon_path, &s3)>=0) {g_iconw=260; g_iconh=300; goto add_mem;} xmb_bg_show=1; } } draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); if((xmb_icon==6 || xmb_icon==7 || xmb_icon==5) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; if(xmb_icon==2) xmb_settings_sel=xmb[2].first; if(mode) flip(); drawing_xmb=0; } void show_sysinfo() { char sys_info[512]; get_free_memory(); char line1[128]; char line2[128]; char line3[128]; char line4[128]; char line5[64]; cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); sprintf(line5, "Free HDD space: %.2f GB", (double) (freeSpace / 1073741824.00f)); strncpy(line4, current_version, 8); line4[8]=0; sprintf(line1, "Free Memory: %.0f KB", (double) (meminfo.avail/1024.0f));//, (double) ((meminfo.avail+meminfo.total)/1024.0f) if(payload==-1) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f", c_firmware); if(payload== 0 && payloadT[0]!=0x44) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-36 | PSGroove]", c_firmware); if(payload== 0 && payloadT[0]==0x44) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-36 | Standard]", c_firmware); if(payload== 1) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-8 | Hermes]", c_firmware); if(payload== 2) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-35 | PL3]", c_firmware); net_avail=cellNetCtlGetInfo(16, &net_info); if(net_avail<0) { sprintf(line3, "%s", "IP Address: [Not Available]"); } else sprintf(line3, "IP Address: %s", net_info.ip_address); sprintf(sys_info, "multiMAN Version: %s\n\n%s\n%s\n%s\n%s", line4, line2, line3, line1, line5); dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, sys_info, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } int main(int argc, char **argv) { cellSysutilRegisterCallback( 0, sysutil_callback, NULL ); payloadT[0]='M'; payloadT[1]=0; (void)argc; // (void)argv; int ret; int one_time=1; ret = cellSysmoduleLoadModule( CELL_SYSMODULE_GCM_SYS ); if (ret != CELL_OK) sys_process_exit(1); else unload_mod|=8; host_addr = memalign(MB(1), MB(1)); //cellGcmInitSystemMode(CELL_GCM_SYSTEM_MODE_IOMAP_512MB); if(cellGcmInit(KB(128), MB(1), host_addr) != CELL_OK) sys_process_exit(1); if(initDisplay()!=0) sys_process_exit(1); initShader(); setDrawEnv(); if(setRenderObject()) sys_process_exit(1); ret = cellPadInit(8); setRenderTarget(); initFont(); app_path[0]='B'; app_path[1]='L'; app_path[2]='E'; app_path[3]='S'; app_path[4]='8'; app_path[5]='0'; app_path[6]='6'; app_path[7]='0'; app_path[8]='8'; app_path[9]=0; if(!strncmp( argv[0], "/dev_hdd0/game/", 15)) { char *s; int n=0; s= ((char *) argv[0])+15; while(*s!=0 && *s!='/' && n<32) {app_path[n]=*s++; n++;} app_path[n]=0; } is_reloaded=0; sprintf(app_homedir, "/dev_hdd0/game/%s",app_path); if(strstr(argv[0],"/dev_hdd0/game/")==NULL) { mkdir(app_homedir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); mkdir(app_usrdir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); char string1x[512], string2x[512], string3x[512], string1[1024], filename[1024]; MM_LocaleSet (0); sprintf(disclaimer, "%s/DISCLM.BIN", app_usrdir); sprintf(string1 , "%s/DISACC.BIN", app_usrdir); cellMsgDialogAbort(); if(!exist(disclaimer) || exist(string1)) { sprintf(string1x, "multiMAN (referred hereafter as \"software\"), its author, partners, and associates do not condone piracy. multiMAN is a hobby project, distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nDo you accept this binding agreement (1/3)?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string1x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); sprintf(string2x, "The software is intended solely for educational and testing purposes, and while it may allow the user to create copies of legitimately acquired and/or owned content, it is required that such user actions must comply with local, federal and country legislation.\n\nFurthermore, the author of this software, its partners and associates shall assume NO responsibility, legal or otherwise implied, for any misuse of, or for any loss that may occur while using multiMAN.\n\nDo you accept this binding agreement (2/3)?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string2x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); sprintf(string3x, "You are solely responsible for complying with the applicable laws in your country and you must cease using this software should your actions during multiMAN operation lead to or may lead to infringement or violation of the rights of the respective content copyright holders.\n\nmultiMAN is not licensed, approved or endorsed by \"Sony Computer Entertainment, Inc.\" (SCEI) or any other party.\n\nDo you understand and accept this binding agreement?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string3x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); FILE *fpA; fpA = fopen ( disclaimer, "w" ); if(fpA!=NULL) { fputs ( "USER AGREED TO DISCLAIMER: ", fpA );fputs ( string1x, fpA );fputs ( string2x, fpA ); fputs ( string3x, fpA ); fclose( fpA); } remove(string1); } sprintf(string1x, "%s/RELOADED.BIN", app_usrdir); if(exist(string1x)) is_reloaded=1; else { FILE *fpA; fpA = fopen ( string1x, "w" ); fputs ( "multiMAN was reloaded", fpA );fputs ( string1x, fpA ); fclose( fpA); sprintf(string1, "%s/PARAM.SFO", app_homedir); change_param_sfo_version(string1); //change_param_sfo_field( string1, (char*)"TITLE", (char*) "multiMAN"); } sprintf(current_version_NULL, "%s", current_version); sys_spu_initialize(6, 0); ret = load_modules(); if(ret!=CELL_OK && ret!=0) sys_process_exit(1); cellSysutilEnableBgmPlayback(); // allocate buffers for images (one big buffer = 76MB) // XMMB mode uses 7 frame buffers (56MB) u32 buf_align= FB(1); u32 frame_buf_size = (buf_align * 8)+5324800;// for text_bmpS 320x320x13 -> 1920*648 * 4 frame_buf_size = ( frame_buf_size + 0xfffff ) & ( ~0xfffff ); text_bmp = (u8 *) memalign(0x100000, frame_buf_size); if(map_rsx_memory( text_bmp, frame_buf_size)) sys_process_exit(1); text_bmpUBG = text_bmp + buf_align * 1; //3 x 1920x1080 text_bmpUPSR= text_bmp + buf_align * 4; //2 x 1920x1080 text_FONT = text_bmp + buf_align * 6; text_FMS = text_bmp + buf_align * 7; text_bmpS = text_bmp + buf_align * 8; text_legend = text_bmpUPSR + buf_align; text_BOOT = text_bmpUBG + buf_align; //pData = (long)text_bmp + buf_align * 8;//(long)memalign(128, _mp3_buffer*1024*1024); //==================================================================== xmb_icon_globe = text_FMS+( 9*65536); xmb_icon_help = text_FMS+(10*65536); xmb_icon_quit = text_FMS+(11*65536); xmb_icon_star = text_FMS+(12*65536); xmb_icon_desk = text_FMS+(13*65536); xmb_icon_hdd = text_FMS+(14*65536); xmb_icon_blu = text_FMS+(15*65536); xmb_icon_tool = text_FMS+(16*65536); xmb_icon_note = text_FMS+(17*65536); xmb_icon_film = text_FMS+(18*65536); xmb_icon_photo = text_FMS+(19*65536); xmb_icon_update = text_FMS+(20*65536); xmb_icon_ss = text_FMS+(21*65536); xmb_icon_showtime= text_FMS+(22*65536); xmb_icon_theme = text_FMS+(23*65536); //XMB.PNG end (24 icons 128x128 = 128x3072) //==================================================================== xmb_icon_retro = text_FMS+(24*65536); //XMB2.PNG start xmb_icon_ftp = text_FMS+(25*65536); xmb_icon_folder = text_FMS+(26*65536); // text_??? = text_FMS+(25*65536); // // text_???LAST = text_FMS+(47*65536); //XMB2.PNG end (24 icons 128x128 = 128x3072) //==================================================================== xmb_icon_star_small = text_FMS+(48*65536);//+(16384*0)//64*64*4 // xmb_icon_????_small = text_FMS+(48*65536)+(16384*1); xmb_col = text_FMS+(49*65536); // Current XMMB Column name (300x30) xmb_clock = text_FMS+(50*65536); // Clock (300x30) //==================================================================== xmb_icon_dev = text_FMS+(51*65536); // XMB64.PNG start (32 icons 64x64 = 64x2048) (51->58) //==================================================================== text_DOX = text_FMS+(59*65536); // DOX.PNG (256x256) (59->62) //==================================================================== text_MSG = text_FMS+(63*65536); // Legend pop-up in XMMB mode (300x70) (63->64) text_INFO = text_FMS+(65*65536); // Info pop-up in XMMB mode (300x70) (65->66) // text_??? = text_FMS+(67*65536); // // text_???LAST = text_FMS+(125*65536);// end of text_FMS frame buffer //==================================================================== u32 buf_align2= (320 * 320 * 4); text_HDD = text_bmpS + buf_align2 * 1; text_USB = text_bmpS + buf_align2 * 2; text_BLU_1 = text_bmpS + buf_align2 * 3; text_OFF_2 = text_bmpS + buf_align2 * 4; text_CFC_3 = text_bmpS + buf_align2 * 5; text_SDC_4 = text_bmpS + buf_align2 * 6; text_MSC_5 = text_bmpS + buf_align2 * 7; text_NET_6 = text_bmpS + buf_align2 * 8; text_bmpIC = text_bmpS + buf_align2 * 9; text_TEMP = text_bmpS + buf_align2 * 10; //+11 text_DROPS = text_bmpS + buf_align2 * 12; sprintf(avchdBG, "%s/BOOT.PNG",app_usrdir); load_texture(text_BOOT, avchdBG, 1920); sprintf(string1, "%s/GLO.PNG", app_usrdir); if(exist(string1)) { load_texture(text_bmpUPSR, string1, 1920); put_texture_with_alpha( text_BOOT, text_bmpUPSR, 1920, 1080, 1920, 0, 0, 0, 0); } ClearSurface(); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); MEMORY_CONTAINER_SIZE_ACTIVE = MEMORY_CONTAINER_SIZE; ret = sys_memory_container_create( &memory_container, MEMORY_CONTAINER_SIZE_ACTIVE); if(ret!=CELL_OK) { MEMORY_CONTAINER_SIZE_ACTIVE = MEMORY_CONTAINER_SIZE - (2 * 1024 * 1024); ret = sys_memory_container_create( &memory_container, MEMORY_CONTAINER_SIZE_ACTIVE); } if(ret!=CELL_OK) sys_process_exit(1); //cellFsChmod(argv[0], 0666); url_base[ 0]=0x68; url_base[ 1]=0x74; url_base[ 2]=0x74; url_base[ 3]=0x70; url_base[ 4]=0x3a; url_base[ 5]=0x2f; url_base[ 6]=0x2f; url_base[ 7]=0x73; url_base[ 8]=0x68; url_base[ 9]=0x61; url_base[10]=0x6a; url_base[11]=0x2e; url_base[12]=0x6d; url_base[13]=0x65; url_base[14]=0x2f; url_base[15]=0x64; url_base[16]=0x65; url_base[17]=0x61; url_base[18]=0x6e; url_base[19]=0x2f; url_base[20]=0x6d; url_base[21]=0x75; url_base[22]=0x6c; url_base[23]=0x74; url_base[24]=0x69; url_base[25]=0x6d; url_base[26]=0x61; url_base[27]=0x6e; url_base[28]=0x00; // use 32MB virtual memory pool (with vm_real_size) real memory //sys_vm_memory_map(MB(32), MB(vm_real_size), SYS_MEMORY_CONTAINER_ID_INVALID, SYS_MEMORY_PAGE_SIZE_64K, SYS_VM_POLICY_AUTO_RECOMMENDED, &vm); //sys_vm_touch(vm, MB(vm_real_size)); pData = (char*) memalign(16, _mp3_buffer); //allocate 2 buffers for mp3 playback pDataB = pData; multiStreamStarted = StartMultiStream(); max_menu_list=0; c_firmware = (float) get_system_version(); if(c_firmware>3.40f && c_firmware<3.55f) c_firmware=3.41f; if(c_firmware>3.55f) c_firmware=3.55f; mod_mount_table((char*)"nothing", 0); //restore for(int n2=0;n2<99;n2++) { sprintf(string1, "/dev_usb%03i/PS3_GAME", n2); if(exist(string1)) check_usb_ps3game(string1); } sprintf(list_file, "%s/LLIST.BIN", app_usrdir); sprintf(list_file_state, "%s/LSTAT.BIN", app_usrdir); sprintf(snes_self, "%s", "/dev_hdd0/game/SNES90000/USRDIR/RELOAD.SELF"); sprintf(snes_roms, "%s", "/dev_hdd0/game/SNES90000/USRDIR/roms"); sprintf(genp_self, "%s", "/dev_hdd0/game/GENP00001/USRDIR/RELOAD.SELF"); sprintf(genp_roms, "%s", "/dev_hdd0/game/GENP00001/USRDIR/roms"); sprintf(fceu_self, "%s", "/dev_hdd0/game/FCEU90000/USRDIR/RELOAD.SELF"); sprintf(fceu_roms, "%s", "/dev_hdd0/game/FCEU90000/USRDIR/roms"); sprintf(vba_self, "%s", "/dev_hdd0/game/VBAM90000/USRDIR/RELOAD.SELF"); sprintf(vba_roms, "%s", "/dev_hdd0/game/VBAM90000/USRDIR/roms"); sprintf(fba_self, "%s", "/dev_hdd0/game/FBAN00000/USRDIR/RELOAD.SELF"); sprintf(fba_roms, "%s", "/dev_hdd0/game/FBAN00000/USRDIR/roms"); u32 reload_fdevices=0; if(is_reloaded || exist(list_file)) { // ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); // cellDbgFontPrintf( 0.28f, 0.85f, 1.0f, 0x90909090, "multiMAN is parsing last state data..."); // cellDbgFontDrawGcm(); setRenderColor(); flip(); //is_reloaded=0; FILE *flist; flist = fopen(list_file, "rb"); if ( flist != NULL ) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, GAME_LIST_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &menu_list, llist_size, 1, flist); fclose(flist); max_menu_list=(int)(llist_size / sizeof(t_menu_list))-1;//sizeof(t_menu_list)); if(!is_reloaded) {delete_entries(menu_list, &max_menu_list, 1); is_reloaded=1;} else is_reloaded=2; sort_entries(menu_list, &max_menu_list ); int i; for(i=0;i<max_menu_list;i++) { if(menu_list[i].cover==1) menu_list[i].cover=0; if(!exist(menu_list[i].path)) {max_menu_list=0; is_reloaded=0; break;} //else {is_reloaded=1; }//forcedevices=0x0001; } } else {fclose(flist);remove(list_file);is_reloaded=0;} } else is_reloaded=0; } if(exist(list_file_state)) { FILE *flist; flist = fopen(list_file_state, "rb"); if ( flist != NULL ) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, GAME_STATE_VER)!=NULL) { fread((char*) &reload_fdevices, sizeof(reload_fdevices), 1, flist); fread((char*) &mouseX, sizeof(mouseX), 1, flist); fread((char*) &mouseY, sizeof(mouseY), 1, flist); fread((char*) &mp3_volume, sizeof(mp3_volume), 1, flist); if(mp3_volume<0.0f) mp3_volume=0.0f; fread((char*) &current_left_pane, sizeof(current_left_pane), 1, flist); fread((char*) &current_right_pane, sizeof(current_right_pane), 1, flist); fread((char*) &xmb_icon_last, sizeof(xmb_icon), 1, flist); fread((char*) &xmb_icon_last_first, sizeof(xmb[xmb_icon].first), 1, flist); fread((char*) &xmb[6].group, sizeof(xmb[6].group), 1, flist); fread((char*) &xmb[8].group, sizeof(xmb[8].group), 1, flist); fread((char*) &xmb[4].group, sizeof(xmb[4].group), 1, flist); if(is_reloaded==1)forcedevices=0x0001; } fclose(flist); } } if(true) { for(int c=3;c<9;c++) { if(c>5) c=8; u8 main_group=xmb[c].group & 0x0f; u8 alpha_group=xmb[c].group>>4 & 0x0f; if(alpha_group>14) alpha_group=0; main_group&=0x0f; if(c==8 && xmb[8].group) { if(main_group>5) main_group=0; if(main_group) { read_xmb_column_type(8, main_group+7, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", retro_groups[main_group], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", retro_groups[main_group]); } else { read_xmb_column(8, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", xmb_columns[8], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", xmb_columns[8]); } } else { if(c==4) { read_xmb_column(c, alpha_group); if(alpha_group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[alpha_group]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); } else read_xmb_column(c, 0); } } free_all_buffers(); free_text_buffers(); //xmb[5].init=0; xmb[6].init=0; xmb[7].init=0; } // int reloaded_menu_list=max_menu_list; sprintf(string1, "%s/COLOR.INI", app_usrdir); if(exist(string1)) sprintf(color_ini, "%s/COLOR.INI", app_usrdir); else sprintf(color_ini, "%s/COLOR.BIN", app_usrdir); sprintf(options_bin, "%s/options.bin", app_usrdir); sprintf(parental_pass, "0000"); parental_pass[4]=0; if(!exist(options_bin)) {ftp_on(); ftp_service=1; save_options();} int usb_loop; for(usb_loop=0;usb_loop<8;usb_loop++) { sprintf(options_ini, "/dev_usb00%i/options.ini", usb_loop); if(!exist(options_ini)) sprintf(options_ini, "/dev_usb00%i/options_default.ini", usb_loop); if(exist(options_ini)) break; } if(exist(options_ini)) { sprintf(string1, "%s/options.ini", app_usrdir); file_copy((char *) options_ini, (char *) string1, 0); sprintf(options_ini, "%s/options.ini", app_usrdir); } if(!exist(options_ini)) { sprintf(options_ini, "%s/options.ini",app_usrdir); if(!exist(options_ini)) sprintf(options_ini, "%s/options_default.ini",app_usrdir); } sprintf(covers_dir, "%s/covers",app_usrdir); mkdir(covers_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(covers_retro, "%s/covers_retro",app_usrdir); mkdir(covers_retro, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(themes_dir, "%s/themes",app_usrdir); mkdir(themes_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(themes_web_dir, "%s/themes_web",app_usrdir); mkdir(themes_web_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(string1, "%s/lang", app_usrdir); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(string1, "%s/LICDIR/LIC.DAT", app_homedir); remove(string1); sprintf(string1, "%s/LICDIR", app_homedir); rmdir(string1); sprintf(string1, "%s/TROPDIR", app_homedir); my_game_delete(string1); rmdir(string1); pad_read();pad_read(); debug_mode = ( (new_pad | old_pad) & (BUTTON_R2 | BUTTON_L2) ); new_pad=0; old_pad=0; if(debug_mode) // Save default English GUI labels // New line characters are marked with "|" symbol, do not remove! { sprintf(string1, "%s/lang/LANG_DEFAULT.TXT", app_usrdir); remove(string1); FILE *fpA; fpA = fopen ( string1, "wb" ); if(fpA!=NULL) { char lab[512]; fputs ( "\xEF\xBB\xBF", fpA ); // set text file header to UTF-8 for(int n=0; n<STR_LAST_ID; n++) { sprintf(lab, "%s", (const char*)g_MMString[n].m_pStr); for(u16 m=0; m<strlen(lab); m++) if(lab[m]=='\n') lab[m]='|'; fwrite ( lab, strlen(lab), 1, fpA ); //g_MMString[n].m_pStr fputs ( (char*)"\r", fpA ); } fclose( fpA); } } parse_ini(options_ini,0); load_localization(mm_locale); for(usb_loop=0;usb_loop<8;usb_loop++) { sprintf(filename, "/dev_usb00%i/COLOR.INI", usb_loop); if(exist(filename)) { sprintf(string1, "%s/COLOR.INI", app_usrdir); file_copy(filename, string1, 0); break; } } sprintf(app_temp, "%s/TEMP",app_usrdir); del_temp(app_temp); rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR%i.JPG",app_usrdir, rnd); sprintf(userBG, "%s/PICBG.JPG",app_usrdir); sprintf(xmbicons, "%s/XMB.PNG", app_usrdir); sprintf(xmbicons2, "%s/XMB2.PNG", app_usrdir); sprintf(xmbdevs, "%s/XMB64.PNG", app_usrdir); sprintf(xmbbg, "%s/XMBBG.PNG", app_usrdir); sprintf(filename, "%s/XMBR.PNG", app_usrdir); remove(filename); sprintf(filename, "%s/DOX.PNG", app_usrdir); load_texture(text_DOX, filename, dox_width); sprintf(playBGR, "%s/PICPA.PNG",app_usrdir); /* sprintf(blankBG, "/dev_hdd0/game/%s/PIC0.PNG",app_path); sprintf(filename, "%s/XMB0.PNG",app_usrdir); if(exist(filename) && stat(blankBG, &s2)<0 ) file_copy(filename, blankBG, 0); sprintf(blankBG, "/dev_hdd0/game/%s/PIC1.PNG",app_path); sprintf(filename, "%s/XMB1.PNG",app_usrdir); if(exist(filename) && stat(blankBG, &s2)<0 ) file_copy(filename, blankBG, 0); */ sprintf(blankBG, "%s/ICON0.PNG", app_homedir); sprintf(filename, "%s/ICON0.PNG", app_usrdir); if(exist(filename)) file_copy(filename, blankBG, 0); if(V_WIDTH>1280) sprintf(filename, "%s/MP_HR.PNG",app_usrdir); else { sprintf(filename, "%s/MP_LR.PNG",app_usrdir); mp_WIDTH=15, mp_HEIGHT=21; //mouse icon LR } if(exist(filename)) {load_texture((unsigned char *) mouse, filename, mp_WIDTH);}// gray_texture(mouse, 32, 32);} sprintf(helpNAV, "%s/NAV.JPG",app_usrdir); sprintf(helpMME, "%s/help.MME",app_usrdir); sprintf(ps2png, "%s/PS2.JPG",app_usrdir); sprintf(dvdpng, "%s/DVD.JPG",app_usrdir); sprintf(avchdIN, "%s/AVCIN.DAT",app_usrdir); sprintf(avchdMV, "%s/AVCMV.DAT",app_usrdir); sprintf(iconHDD, "%s/HDD.JPG",app_usrdir); sprintf(iconUSB, "%s/USB.JPG",app_usrdir); sprintf(iconBLU, "%s/BLU.JPG",app_usrdir); sprintf(iconNET, "%s/NET.JPG",app_usrdir); sprintf(iconOFF, "%s/OFF.JPG",app_usrdir); sprintf(iconCFC, "%s/CFC.JPG",app_usrdir); sprintf(iconSDC, "%s/SDC.JPG",app_usrdir); sprintf(iconMSC, "%s/MSC.JPG",app_usrdir); sprintf(playBG, "%s/FMS.PNG",app_usrdir); sprintf(legend, "%s/LEGEND2.PNG", app_usrdir); sprintf(versionUP, "%s/VERSION.DAT",app_usrdir); sprintf(filename, "%s/DROPS.PNG",app_usrdir); if(!exist(filename) || !exist(xmbdevs)) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_INCOMPLETE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } ClearSurface(); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); load_texture(text_bmpUPSR, playBGR, 1920); load_texture(text_bmpIC, blankBG, 320); load_texture(text_HDD, iconHDD, 320); load_texture(text_USB, iconUSB, 320); load_texture(text_BLU_1, iconBLU, 320); load_texture(text_NET_6, iconNET, 320); load_texture(text_OFF_2, iconOFF, 320); load_texture(text_CFC_3, iconCFC, 320); load_texture(text_SDC_4, iconSDC, 320); load_texture(text_MSC_5, iconMSC, 320); sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(cache_dir, "%s/cache", app_usrdir); if(!exist(filename)) { is_reloaded=0; mkdir(cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } sprintf(filename, "%s/.mmcache002", cache_dir); if(!exist(filename)) {is_reloaded=0; file_copy(disclaimer, filename, 0); max_menu_list=0; forcedevices=0xffff;} //fix_perm_recursive(cache_dir); sprintf(filename, "%s/TEMP",app_usrdir); mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(game_cache_dir, "%s/game_cache",app_usrdir); mkdir(game_cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sc36_path_patch=0; payload = -1; // 0->psgroove 1->hermesV3/V4 2->PL3 payloadT[0]=0x20; if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); } else { payload=0; if (syscall35("/dev_hdd0", "/dev_hdd0") == 0) { payload=2; payloadT[0]=0x50; //P } else { payload=0; if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL && peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL) { pokeq(0x80000000002D8498ULL, 0x38A000064BD7623DULL ); // 09 symbols search pokeq(0x80000000002D8504ULL, 0x38A000024BD761D1ULL ); // 0x002D7800 (/app_home) 2 search // enable_sc36(); }//D payload=-1; system_call_1(36, (uint32_t) app_usrdir); sprintf(filename, "%s", "/dev_bdvd/EBOOT.BIN"); if(exist(filename)) { payload=0; payloadT[0]=0x47; //G if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL && peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL) {payloadT[0]=0x44; sc36_path_patch=1; }//D } } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(exist(filename)) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); fclose(fpV); if(len==488) {bdemu2_present=0; if(bd_emulator) bd_emulator=2;} if(len==4992) {bdemu2_present=1;} } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.55f && payload==-1 && exist(filename) && bd_emulator==2) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_SET); fread((void *) bdemu, 488, 1, fpV); fclose(fpV); payload=0; psgroove_main(0); if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL){ payload=0; if(peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL ) { payloadT[0]=0x44; //D sc36_path_patch=1; } else { payloadT[0]=0x47; //G sc36_path_patch=0; } } else { payload=-1; payloadT[0]=0x20; //NONE } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.55f && payload==-1 && exist(filename) && bd_emulator==1) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); if(len>=4992) { fseek(fpV, 488, SEEK_SET); fread((void *) bdemu, 1024, 1, fpV); fclose(fpV); payload=0; hermes_payload_355(0); if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); //ret = sys8_perm_mode(1); bdemu2_present=1; } else { payload=-1; payloadT[0]=0x20; //NONE } } else { payload=-1; payloadT[0]=0x20; //NONE fclose(fpV); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU1, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.41f && payload==-1 && exist(filename) && bd_emulator==1) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); if(len>=4992) { fseek(fpV, 1512, SEEK_SET); fread((void *) bdemu, 3480, 1, fpV); fclose(fpV); payload=0; hermes_payload_341(); sys_timer_usleep(250000); if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); bdemu2_present=1; } else { payload=-1; payloadT[0]=0x20; //NONE } } else { payload=-1; payloadT[0]=0x20; //NONE fclose(fpV); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU1, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); } } parse_color_ini(); parse_last_state(); clean_up(); if(payload==-1) { if(bd_emulator) { dialog_ret=0; sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(!exist(filename)) cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU2, dialog_fun2, (void*)0x0000aaab, NULL ); else cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU3, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if(c_firmware == 3.55f) psgroove_main(1); } else reset_mount_points(); disable_sc36(); if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode<3 || cover_mode>5) draw_legend=1; else draw_legend=0; if(c_firmware==3.41f && peekq(0x80000000000505d0ULL) == memvalnew) patchmode = 1; else patchmode = 0; if(mount_hdd1==1) { memset(&cache_param, 0x00 , sizeof(CellSysCacheParam)) ; strncpy(cache_param.cacheId, app_path, sizeof(cache_param.cacheId)) ; cellSysCacheMount( &cache_param ) ; remove( (char*) "/dev_hdd1/multiMAN" ); remove( (char*) "/dev_hdd1/multiMAN.srt" ); remove( (char*) "/dev_hdd1/multiMAN.ssa" ); remove( (char*) "/dev_hdd1/multiMAN.ass" ); } for(int n=0;n<max_hosts;n++) if(host_list[n].port>0) remove(host_list[n].name); for(int n=0; n<MAX_STARS;n++) { stars[n].x=rndv(1920); stars[n].y=rndv(1080); stars[n].bri=rndv(128); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } mkdir(covers_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); DIR *dir;dir=opendir (ini_hdd_dir); if(!dir) mkdir(ini_hdd_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else closedir(dir); strncpy(hdd_folder, ini_hdd_dir, 64); dir=opendir (ini_hdd_dir); if(!dir){ dialog_ret=0; force_disable_copy=1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_CRITICAL, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else closedir(dir); if(theme_sound && multiStreamStarted) { sprintf(bootmusic, "%s/SOUND.BIN", app_usrdir); if(exist(bootmusic)) { main_mp3((char*)bootmusic); main_mp3_th(bootmusic, 0); force_mp3=false; } } int find_device=0; game_last_page=-1; last_selected=-1; //use_depth=(cover_mode!=8); uint64_t nread; int dir_fd; CellFsDirent entryF; net_avail=cellNetCtlGetInfo(16, &net_info); init_finished=1; sys_ppu_thread_create( &download_thr_id, download_thread_entry, NULL, 3000, app_stack_size, 0, "multiMAN_downqueue" ); sys_ppu_thread_create( &misc_thr_id, misc_thread_entry, NULL, misc_thr_prio, app_stack_size, 0, "multiMAN_misc" );//SYS_PPU_THREAD_CREATE_JOINABLE ss_timer=0; ss_timer_last=time(NULL); get_free_memory(); if (meminfo.avail<16777216) // Quit if less than 16MB RAM available (at least 12 required for copy operations + 4 to be on the safe side) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_NOMEM, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } if(debug_mode) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_DEBUG_MODE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); current_version[6]=0x44; current_version[7]=0x44; current_version_NULL[6]=0x44; current_version_NULL[7]=0x44; } /* main loop */ while( pad_read() != 0) { start_of_loop: if(dim_setting>0) { dimc++; if( (dimc>(dim_setting*80) && cover_mode!=5) || ( (cover_mode==5 || cover_mode==8) && dimc>(dim_setting*80*7)) ) {dimc=0; dim=1;c_opacity_delta=-1;} } else { dimc=0; dim=0; c_opacity_delta=0;} int count_devices=0; int dev_changed=0; int dev_removed=0; int to_restore=1; if(one_time) {one_time=0;goto skip_find_device;} CellFsStat status; if( (time(NULL)-last_refresh)>3 || first_launch || forcedevices!=0 ) { u32 fdevices0=0; cellFsOpendir((char*) "/", &dir_fd); while(1) { last_refresh=time(NULL); cellFsReaddir(dir_fd, &entryF, &nread); if(nread==0) break; sprintf(filename, "%s", entryF.d_name); if(strstr(filename,"app_home")!=NULL || strstr(filename,"dev_hdd1")!=NULL) continue; find_device=-1; if(strstr(filename,"dev_hdd0")!=NULL) find_device=0; else if(strstr(filename,"dev_usb00")!=NULL) find_device=(filename[9])-0x2f; else if(strstr(filename,"dev_bdvd")!=NULL && hide_bd==0) find_device=11; else if(strstr(filename,"host_root")!=NULL && pfs_enabled) find_device=13; else if(strstr(filename,"dev_sd")!=NULL) find_device=14; else if(strstr(filename,"dev_ms")!=NULL) find_device=15; if(find_device!=-1) fdevices0|=(1<<find_device); } cellFsClosedir(dir_fd); #if (CELL_SDK_VERSION>0x210001) if ( ( (fdevices0>>13) & 1 ) && pfs_enabled) { sprintf(filename, "/pvd_usb000"); if (PfsmVolStat(0) == 0) fdevices0 |= 1 << 13; else fdevices0 &= ~(1 << 13); } else #endif fdevices0 &= ~(1 << 13); for(find_device=0;find_device<16;find_device++) { { if( (( (fdevices0>>find_device) & 1 ) ))// && ((forcedevices>>find_device) & 1)==0))// || find_device==0 { fdevices|= 1<<find_device; } else fdevices&= ~ (1<<find_device); } if(((fdevices>>find_device) & 1) && find_device!=11) { count_devices++; if(count_devices>14) fdevices&= ~ (1<<find_device); } // bdvd if(find_device==11) { if(((forcedevices>>find_device) & 1) || ((fdevices>>find_device) & 1)!=((fdevices_old>>find_device) & 1)) //fdevices!=fdevices_old || { c_opacity_delta=16; dimc=0; dim=1; dev_changed=1; if( ((fdevices>>11) & 1) && hide_bd==0) { sprintf(filename, "/dev_bdvd/PS3_GAME/PARAM.SFO"); bluray_game[0]=0; parse_param_sfo(filename, bluray_game, bluray_id, &bluray_pl); bluray_game[63]=0; sprintf(filename, "%s/%s_240.RAW", cache_dir, bluray_id); if(!exist(filename)) { sprintf(filename, "%s", "/dev_bdvd/PS3_GAME/PIC1.PNG"); cache_png(filename, bluray_id); } if(max_menu_list>=MAX_LIST) max_menu_list= MAX_LIST-1; sprintf(menu_list[max_menu_list].path, "/dev_bdvd"); memcpy(menu_list[max_menu_list].title, bluray_game, 63); sprintf(menu_list[max_menu_list].title_id, "%s", bluray_id); menu_list[max_menu_list].title[63]=0; menu_list[max_menu_list].flags=(1<<11); sprintf(menu_list[max_menu_list ].content, "%s", "PS3"); menu_list[max_menu_list].plevel=bluray_pl; menu_list[max_menu_list].user=0; menu_list[max_menu_list].split=0; if(!exist((char*) "/dev_bdvd/PS3_GAME/PARAM.SFO")) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[Disc] Data Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "Data Disc"); sprintf(menu_list[max_menu_list ].content, "%s", "DATA"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } //check for PS2/DVD sprintf(filename, "/dev_bdvd/BDMV/index.bdmv"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[BDMV] Blu-ray\xE2\x84\xA2 Video Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "[BDMV]"); sprintf(menu_list[max_menu_list ].content, "%s", "BDMV"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } sprintf(filename, "/dev_bdvd/SYSTEM.CNF"); if(!exist(filename)) sprintf(filename, "/dev_bdvd/system.cnf"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[PS2] Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "PS2 Game"); sprintf(menu_list[max_menu_list ].content, "%s", "PS2"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } else { sprintf(filename, "/dev_bdvd/VIDEO_TS/VIDEO_TS.IFO"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[DVD Video] Video Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd/VIDEO_TS"); sprintf(menu_list[max_menu_list ].entry, "DVD Video Disc"); sprintf(menu_list[max_menu_list ].content, "%s", "DVD"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } } max_menu_list++; } else { delete_entries(menu_list, &max_menu_list, (1<<11)); dev_removed=1; } sort_entries(menu_list, &max_menu_list ); old_fi=-1; game_last_page=-1; forcedevices &= ~ (1<<find_device); fdevices_old&= ~ (1<<find_device); fdevices_old|= fdevices & (1<<find_device); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } //end of bdrom disc else { //other devices if(((forcedevices>>find_device) & 1) || ((fdevices>>find_device) & 1)!=((fdevices_old>>find_device) & 1)) //fdevices!=fdevices_old || { if(to_restore) {if(cover_mode!=8) set_fm_stripes(); to_restore=0;} dev_changed=1; // game_sel=0; old_fi=-1; game_last_page=-1; state_read=1; first_left=0; first_right=0; state_draw=1; if(find_device==0) sprintf(filename, "%s", hdd_home); else { if(strstr (usb_home,"/")!=NULL) sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home); else sprintf(filename, "/dev_usb00%c/%s", 47+find_device, usb_home); if(find_device==13 && !pfs_enabled) sprintf(filename, "/dev_none"); if(find_device==13 && pfs_enabled) sprintf(filename, "/pvd_usb000%s", usb_home); if(find_device==14) sprintf(filename, "/dev_sd%s", usb_home); if(find_device==15) sprintf(filename, "/dev_ms%s", usb_home); } if((fdevices>>find_device) & 1) { if(strstr (filename,"/dev_hdd")!=NULL){ if(is_reloaded && (strstr(hdd_home_2,"/dev_usb")!=NULL || strstr(hdd_home_3,"/dev_usb")!=NULL || strstr(hdd_home_4,"/dev_usb")!=NULL || strstr(hdd_home_5,"/dev_usb")!=NULL) ) {max_menu_list=0; is_reloaded=0;} fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); if(strstr (hdd_home_2,"/dev_")!=NULL) fill_entries_from_device(hdd_home_2, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_3,"/dev_")!=NULL) fill_entries_from_device(hdd_home_3, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_4,"/dev_")!=NULL) fill_entries_from_device(hdd_home_4, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_5,"/dev_")!=NULL) fill_entries_from_device(hdd_home_5, menu_list, &max_menu_list, (1<<find_device), 2); if(scan_for_apps==1) fill_entries_from_device((char*)"/dev_hdd0/game", menu_list, &max_menu_list, (1<<find_device), 2); } if(strstr (filename,"/dev_usb")!=NULL){ fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_2); if(strstr (usb_home_2,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_3); if(strstr (usb_home_3,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_4); if(strstr (usb_home_4,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_5); if(strstr (usb_home_5,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); } if(strstr (filename,"/dev_sd")!=NULL && exist((char*)"/dev_sd")) { fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); } if(strstr (filename,"/dev_ms")!=NULL && exist((char*)"/dev_ms")){ fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); } #if (CELL_SDK_VERSION>0x210001) if(strstr (filename,"/pvd_usb")!=NULL && pfs_enabled){ int fsVol=0; for(fsVol=0;fsVol<(max_usb_volumes);fsVol++) { if (PfsmVolStat(fsVol) == 0) { if(strstr (usb_home,"/")!=NULL) sprintf(filename, "/pvd_usb00%i%s", fsVol, usb_home); else sprintf(filename, "/pvd_usb00%i/%s", fsVol, usb_home); if(fsVol==0) fill_entries_from_device_pfs(filename, menu_list, &max_menu_list, (1<<find_device), 0); else fill_entries_from_device_pfs(filename, menu_list, &max_menu_list, (1<<find_device), 2); } } } #endif } else { delete_entries(menu_list, &max_menu_list, (1<<find_device)); dev_removed=1; } if(cover_mode<3 || cover_mode>5) draw_legend=1; forcedevices &= ~ (1<<find_device); fdevices_old&= ~ (1<<find_device); fdevices_old|= fdevices & (1<<find_device); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } } } is_game_loading=0; if(dev_changed){ if(!first_launch) { xmb_icon_last=xmb_icon; xmb_icon_last_first=xmb[xmb_icon].first; } sort_entries(menu_list, &max_menu_list ); if(cover_mode!=5 && cover_mode!=8 && !first_launch) load_texture(text_legend, legend, 1665); if(!first_launch) { if(dev_removed) { reset_xmb_checked(); xmb[6].init=0; xmb[7].init=0; if(cover_mode==8 || cover_mode==4) {init_xmb_icons(menu_list, max_menu_list, game_sel );} } else { reset_xmb(1); if(cover_mode==8 || cover_mode==4) {init_xmb_icons(menu_list, max_menu_list, game_sel );} } } dev_changed=0; dev_removed=0; c_opacity_delta=16; dimc=0; dim=1; b_box_opaq= 0xfe; b_box_step= -4; } if(first_launch) { sort_entries(menu_list, &max_menu_list ); sprintf(avchdBG, "%s/AVCHD.JPG",app_usrdir); load_texture(text_bmpUBG, avchdBG, 1920); if(cover_mode==3) load_texture(text_FONT, userBG, 1920); first_launch=0; if(cover_mode!=5) load_texture(text_legend, legend, 1665); else set_fm_stripes(); parse_last_state(); if(cover_mode==8 || cover_mode==4) { if(cover_mode==4) xmb[6].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel ); if(xmb_icon_last!=6) { xmb_icon=xmb_icon_last; draw_xmb_icon_text(xmb_icon); if(xmb_icon==5 && xmb[5].init==0) add_video_column(); else if(xmb_icon==4 && xmb[4].init==0) add_music_column(); else if(xmb_icon==3 && xmb[3].init==0) add_photo_column(); else if(xmb_icon==8 && xmb[8].init==0) add_emulator_column(); else if(xmb_icon_last_first<xmb[xmb_icon].size) { xmb[xmb_icon].first=xmb_icon_last_first; xmb_icon_last_first=0;} } else if(xmb_icon_last_first<xmb[xmb_icon].size) { xmb[xmb_icon].first=xmb_icon_last_first; xmb_icon_last_first=0; xmb_icon_last=0; } if(cover_mode==4) load_coverflow_legend(); } } if(game_sel<0) game_sel=0; if(is_reloaded) {is_reloaded=0; //max_menu_list=reloaded_menu_list; //reload_fdevices=reload_fdevices&0xefff; //ignore bd disc 0000 0000 0000 //sprintf(string1, "fdevices=%8X fdevices_old=%8X reload_fdevices=%8X", fdevices, fdevices_old, reload_fdevices); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); fdevices_old=reload_fdevices; reload_fdevices=0; } force_reload: is_game_loading=0; //use_depth=(cover_mode!=8); if( (old_fi!=game_sel && game_sel>=0 && game_sel<max_menu_list && max_menu_list>0 && counter_png==0) || (cover_mode==1 && game_last_page!=int(game_sel/8)) || (cover_mode==7 && game_last_page!=int(game_sel/32)) ) { old_fi=game_sel; counter_png=10; if( (cover_mode!=1 && cover_mode!=7) || (cover_mode==1 && game_last_page!=int(game_sel/8)) || ( cover_mode==7 && game_last_page!=int(game_sel/32)) ) draw_legend=1; // if( ( (cover_mode!=1) || (cover_mode==1 && game_last_page!=int(game_sel/8))) || ( (cover_mode!=7) || (cover_mode==7 && game_last_page!=int(game_sel/32))) ) draw_legend=1; if(mode_list==0) { if(cover_mode==0 ) { if(strstr(menu_list[game_sel].path,"/pvd_usb")!=NULL && strstr(menu_list[game_sel].title_id, "NO_ID")==NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); else { sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } if(strstr(menu_list[game_sel].content,"PS2")!=NULL) sprintf(filename, "%s", ps2png); if(strstr(menu_list[game_sel].content,"DVD")!=NULL) sprintf(filename, "%s", dvdpng); if(!exist(filename)) sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); offX=0; offY=0; draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 1); sprintf(string1, "%s/%s_320.RAW", cache_dir, menu_list[game_sel].title_id); if(exist(string1)) { load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 320, 176, 320, 1440, 648, 2, 0xc0c0c080); } cover_available=0; if(strstr(menu_list[game_sel].content,"PS3")!=NULL) { sprintf(string1, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(exist(string1)) { cover_available=1; goto fixed_cover_dm0; } else sprintf(string1, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); if(exist(string1)) { cover_available=1; goto fixed_cover_dm0; } else { if((menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1)) { sprintf(string1, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); download_cover(menu_list[game_sel].title_id, string1); } } if(exist(string1)) { cover_available=1; } else { sprintf(string1, "%s/NOID.JPG", app_usrdir); cover_available=1; } fixed_cover_dm0: if(cover_available) { load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 260, 300, 320, 1470, 300, 2, 0xc0c0c080); } } else { sprintf(string1, "%s/NOID.JPG", app_usrdir); load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 260, 300, 320, 1470, 300, 2, 0xc0c0c080); } load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); counter_png=10; } if(cover_mode==1 && int(game_sel/8)!=game_last_page) { legend_y=760; rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR%i.JPG", app_usrdir, rnd); load_texture(text_bmp, auraBG, 1920); memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); game_last_page=int(game_sel/8); last_selected=-1; int game_rel=0, c_x=0, c_y=0, c_game=0, game_rel2, alpha_cbox=1; int glo_box=0; game_rel2=int(game_sel/8)*8; sprintf(filename, "%s/CBOX4.PNG", app_usrdir); if(exist(filename)) {alpha_cbox=2; load_texture(text_FONT+1024*1024*1, filename, 349);} else { sprintf(filename, "%s/CBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/CBOX.PNG", app_usrdir); alpha_cbox=0;} load_texture(text_FONT+1024*1024*1, filename, 459); } sprintf(filename, "%s/GLC2.PNG", app_usrdir); if(exist(filename)) { load_texture(text_FONT+1024*1024*2, filename, 260); glo_box=1; } for (game_rel=game_rel2; (((game_rel-game_rel2)<8) && game_rel<max_menu_list); game_rel++) { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover; } else { //menu_list[game_rel].cover=-1; // if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); // else // { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); // } cover_available=0; } goto fixed_cover; } else //not a ps3 game { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover; } if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) {sprintf(filename, "%s", dvdpng); goto fixed_cover;} sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover: offX=0; offY=0; load_texture(text_bmpS, filename, 320); } c_game=game_rel-game_rel2; if(c_game<4) { c_y=64; c_x= 150 + (433*c_game); } else { c_y=430; c_x= 150 + (433*(c_game-4)); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_bmpS, 320, 320, 0); if(cover_available==0) put_texture( text_bmp, text_bmpS, 320, 176, 320, c_x, c_y+124, 3, 0x0080ff80); else { menu_list[game_rel].cover=1; if(alpha_cbox!=0) { if(alpha_cbox==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1+9420, 335, 351, 459, c_x+8, c_y-19, 0, 0); else put_texture_with_alpha( text_bmp, text_FONT+1024*1024, 349, 356, 349, c_x+1, c_y-26, 0, 0); } else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1+9420, 335, 351, 459, c_x+8, c_y-19, 0, 0); put_texture( text_bmp, text_bmpS, 260, 300, 320, c_x+30, c_y, 0, 0x0080ff60); if(glo_box==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*2, 260, 300, 260, c_x+30, c_y, 0, 0); } } counter_png=40; } if(cover_mode==3) { if(strstr(menu_list[game_sel].title_id, "NO_ID")==NULL) sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); else sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(!exist(filename)) { sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/POSTER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/POSTER.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s", avchdBG); else if(strstr(filename, "POSTER")==NULL) //strstr (filename,"/dev_hdd0/")==NULL && { sprintf(string1, "%s", filename); sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) {cache_png(string1, menu_list[game_sel].title_id); load_texture(text_FONT, userBG, 1920);} } } offX=-1543; offY=0; if(!exist(filename)) { sprintf(filename, "%s", avchdBG); offX=0; } if(strstr (filename,"AVCHD.JPG")!=NULL) offX=0; if(game_bg_overlay==1) { load_texture(text_bmp, filename, 1920); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmp, 1920, 1080, 0); } cover_available=0; sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename) && menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1) {download_cover(menu_list[game_sel].title_id, filename);} if(exist(filename)) { cover_available=1; load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); } if(cover_available==0){ sprintf(filename, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/NOID.JPG", app_usrdir); if(exist(filename)) { cover_available=1; load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); } load_texture(text_FONT, userBG, 1920); } counter_png=40; } if(cover_mode==2) { cover_available=0; if(strstr(menu_list[game_sel].content,"PS2")!=NULL || strstr(menu_list[game_sel].content,"DVD")!=NULL) { sprintf(filename, "%s", avchdBG); goto DM2_load_textB; } if(strstr(menu_list[game_sel].content,"PS3")!=NULL) sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); else sprintf(filename, "%s/POSTER.JPG", menu_list[game_sel].path); if(strstr(menu_list[game_sel].content,"PS3")==NULL) { if(!exist(filename) && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL) sprintf(filename, "%s", avchdBG); } else { sprintf(string1, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(strstr(filename, "POSTER")==NULL) { //strstr (filename,"/dev_hdd0/")==NULL && sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) cache_png(string1, menu_list[game_sel].title_id); if(!exist(filename)) {sprintf(filename, "%s", avchdBG);} } } DM2_load_textB: load_texture(text_bmp, filename, 1920); draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 1); if(strstr(menu_list[game_sel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto DM2_load_text;} if(strstr(menu_list[game_sel].content,"DVD")!=NULL) { cover_available=1; sprintf(filename, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_sel].path); if(!exist(filename)) {sprintf(filename, "%s", dvdpng); cover_available=0; } goto DM2_load_text; } if(strstr(menu_list[game_sel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); else { cover_available=1; goto DM2_load_text; } if(!exist(filename)) { if(menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); download_cover(menu_list[game_sel].title_id, filename); if(exist(filename)) cover_available=1; else { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } } else { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } } else cover_available=1; goto DM2_load_text; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_sel].path); sprintf(string1, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(string1)) sprintf(string1, "%s/COVER.PNG", menu_list[game_sel].path); if(exist(string1)) { cover_available=1; sprintf(filename,"%s",string1); } else { //menu_list[game_sel].cover=-1; cover_available=1; sprintf(filename, "%s/NOID.JPG", app_usrdir); } if(!exist(filename)) sprintf(filename, "%s", blankBG); DM2_load_text: load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); counter_png=40; } if(cover_mode==6) { int a_offset=40, alpha_cbox=1, alpha_gbox=1; legend_y=170; sprintf(auraBG, "%s/AUR%i.JPG", app_usrdir, 4); load_texture(text_bmp, auraBG, 1920); if(game_last_page==-1) memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); last_selected=-1; int game_rel=0, game_rel2;//, c_x=0, c_y=0, c_game=0; game_rel2=int(game_sel/8)*8; game_rel=game_sel; sprintf(filename, "%s/CBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/CBOX.PNG", app_usrdir); alpha_cbox=0;} load_texture(text_FONT+1024*1024*1, filename, 459); sprintf(filename, "%s/GBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/GBOX.PNG", app_usrdir); alpha_gbox=0;} load_texture(text_FONT+1024*1024*2, filename, 717); game_last_page=int(game_sel/8); if(alpha_cbox) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1, 459, 356, 459, 353, 360-a_offset, 0, 0); else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1, 459, 356, 459, 353, 360-a_offset, 0, 0); if(alpha_gbox) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*2, 717, 473, 717, 1112, 302-a_offset, 0, 0); else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*2, 717, 473, 717, 1112, 302-a_offset, 0, 0); sprintf(filename, "%s/%s_640.RAW", cache_dir, menu_list[game_sel].title_id); load_texture(text_FONT+3453716, filename, 640); put_texture( text_bmp, text_FONT+3453716, 640, 360, 640, 1148, 372-a_offset, 0, 0x0080ff80); put_reflection( text_bmp, 1920, 1080, 654, 437, 1142, 322-a_offset, 1142, 756-a_offset, 3); if(game_sel>0) { sprintf(filename, "%s/%s_240.RAW", cache_dir, menu_list[game_sel-1].title_id); load_texture(text_FONT+3453716, filename, 240); put_texture( text_bmp, text_FONT+3453716, 240, 135, 240, 110, 473-a_offset, 2, 0x0080ff80); } if(game_sel>1) { sprintf(filename, "%s/%s_160.RAW", cache_dir, menu_list[game_sel-2].title_id); load_texture(text_FONT+3453716, filename, 160); put_texture( text_bmp, text_FONT+3453716, 160, 90, 160, 110, 630-a_offset, 1, 0x0080ff80); } if(game_sel>2) { sprintf(filename, "%s/%s_80.RAW", cache_dir, menu_list[game_sel-3].title_id); load_texture(text_FONT+3453716, filename, 80); put_texture( text_bmp, text_FONT+3453716, 80, 45, 80, 110, 742-a_offset, 1, 0x0080ff80); } if(game_sel<max_menu_list-1) { sprintf(filename, "%s/%s_240.RAW", cache_dir, menu_list[game_sel+1].title_id); load_texture(text_FONT+3453716, filename, 240); put_texture( text_bmp, text_FONT+3453716, 240, 135, 240, 810, 473-a_offset, 2, 0x0080ff80); } if(game_sel<max_menu_list-2) { sprintf(filename, "%s/%s_160.RAW", cache_dir, menu_list[game_sel+2].title_id); load_texture(text_FONT+3453716, filename, 160); put_texture( text_bmp, text_FONT+3453716, 160, 90, 160, 890, 630-a_offset, 1, 0x0080ff80); } if(game_sel<max_menu_list-3) { sprintf(filename, "%s/%s_80.RAW", cache_dir, menu_list[game_sel+3].title_id); load_texture(text_FONT+3453716, filename, 80); put_texture( text_bmp, text_FONT+3453716, 80, 45, 80, 970, 742-a_offset, 1, 0x0080ff80); } { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover6; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover6; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover6; } else { //menu_list[game_rel].cover=-1; // if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); // else // { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); // } cover_available=0; } goto fixed_cover6; } else //not a ps3 game { if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover6;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover6; } cover_available=0; sprintf(filename, "%s", dvdpng); goto fixed_cover6; } sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover6; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover6: offX=0; offY=0; if(cover_available==0) { memset(text_bmpS, 0x00, 409600); load_texture(text_bmpS+79360, filename, 320); } else load_texture(text_bmpS, filename, 320); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_bmpS, 320, 320, 0); if(cover_available==0) // put_texture( text_bmp, text_bmpS+120, 260, 176, 320, 435, 446-a_offset, 0, 0x0080ff60); put_texture( text_bmp, text_bmpS+120, 260, 300, 320, 435, 384-a_offset, 0, 0x0080ff60); else { menu_list[game_rel].cover=1; put_texture( text_bmp, text_bmpS, 260, 300, 320, 435, 384-a_offset, 0, 0x0080ff60); } put_reflection( text_bmp, 1920, 1080, 302, 332, 429, 378-a_offset, 429, 707-a_offset, 2); } counter_png=20; } if(cover_mode==7 && int(game_sel/32)!=game_last_page) { legend_y=760; //rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); ClearSurface(); set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); // gray_texture(text_bmp, 1920, 1080); // if(game_last_page==-1) memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); game_last_page=int(game_sel/32); last_selected=-1; int game_rel=0, c_x=0, c_y=0, c_game=0, game_rel2; game_rel2=int(game_sel/32)*32; int glo_box=0; sprintf(filename, "%s/SBOX.PNG", app_usrdir); load_texture(text_FONT+1024*1024*7, filename, 432); mip_texture( text_FONT+1024*1024*1, text_FONT+1024*1024*7, 432, 366, -2); // -> 216x183 sprintf(filename, "%s/GLC3.PNG", app_usrdir); if(exist(filename)) { load_texture(text_FONT+1024*1024*7, filename, 130); glo_box=1; } for (game_rel=game_rel2; (((game_rel-game_rel2)<32) && game_rel<max_menu_list); game_rel++) { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else { //menu_list[game_rel].cover=-1; if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); else { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); sprintf(filename, "%s/NOID.JPG", app_usrdir); cover_available=1; goto fixed_cover_7; // if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); } cover_available=0; } goto fixed_cover_7; } else //not a ps3 game { if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover_7;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } cover_available=0; sprintf(filename, "%s", dvdpng); goto fixed_cover_7; } sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover_7: offX=0; offY=0; load_texture(text_FONT+1024*1024*6, filename, 320); mip_texture( text_FONT+1024*1024*5, text_FONT+1024*1024*6, 320, 300, -2); } c_game=game_rel-game_rel2; if(c_game<8) { c_y=62; c_x= 118 + (int)(216.5f*c_game); } if(c_game>7 && c_game<16) { c_y=240; c_x= 118 + (int)(216.5f*(c_game-8)); } if(c_game>15 && c_game<24) { c_y=418; c_x= 118 + (int)(216.5f*(c_game-16)); } if(c_game>23 && c_game<32) { c_y=596; c_x= 118 + (int)(216.5f*(c_game-24)); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_FONT+1024*1024*5, 160, 160, 0); if(cover_available==0) put_texture( text_bmp, text_FONT+1024*1024*5, 160, 88, 160, c_x+7, c_y+62, 2, 0x0080ff80); else { menu_list[game_rel].cover=1; // put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1, 168, 174, 230, c_x+4, c_y-10, 0, 0); put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1, 216, 183, 216, c_x-28, c_y-16, 0, 0); put_texture( text_bmp, text_FONT+1024*1024*5, 130, 150, 160, c_x+15, c_y, 0, 0x0080ff60); if(glo_box==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*7, 130, 150, 130, c_x+15, c_y, 0, 0); } } counter_png=40; } //mode7 } } if(counter_png) counter_png--; if ((old_pad & BUTTON_START) && (new_pad & BUTTON_TRIANGLE)){ switch_ntfs: new_pad=0; if(!pfs_enabled) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_ATT_USB2, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { pfs_mode(1); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sys_timer_usleep(6000*1000); cellMsgDialogAbort(); forcedevices=0xFFFE; goto start_of_loop; } } else { pfs_mode(0); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sys_timer_usleep(6000*1000); cellMsgDialogAbort(); forcedevices=0xFFFE; goto start_of_loop; } } if ( ((old_pad & BUTTON_START) && (new_pad & BUTTON_R2))) { new_pad=0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); if(exist((char*)"/dev_usb000")){ sprintf(string1, "/dev_usb000/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); sprintf(video_mem, "%s", string1); } else if(exist((char*)"/dev_usb001")){ sprintf(string1, "/dev_usb001/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); sprintf(video_mem, "%s", string1); } sprintf(string1, "Screenshot successfully saved as:\n\n[%s]", video_mem); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_SQUARE)){ new_pad=0; stop_mp3(5); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_RIGHT)){ //next song new_pad=0; next_mp3(); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_LEFT)){ //prev song new_pad=0; prev_mp3(); } if ((new_pad & BUTTON_PAUSE)) { update_ms=!update_ms; xmb_info_drawn=0; } if ((old_pad & BUTTON_START) && ( (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_UP)) && multiStreamStarted==1) { //mp3 volume if((new_pad & BUTTON_UP)) mp3_volume+=0.05f; else mp3_volume-=0.05f; if(mp3_volume<0.0f) mp3_volume=0.0f; new_pad=0; set_channel_vol(nChannel, mp3_volume, 0.1f); xmb_info_drawn=0; } /*if ((old_pad & BUTTON_START) && ( (new_pad & BUTTON_L1) || (new_pad & BUTTON_R1))) { if((new_pad & BUTTON_L1)) mp3_skip-=1.0f; if(mp3_skip<0) mp3_skip=0.f; else mp3_skip+=1.f; main_mp3_th(force_mp3_file, mp3_skip); new_pad=0; }*/ if (((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_CIRCLE)) && cover_mode!=5 && (cover_mode!=8 || (cover_mode==8 && (xmb_icon==6 || xmb_icon==7))) ) { rename_title: new_pad=0; xmb_bg_show=0; xmb_bg_counter=200; if((strstr(menu_list[game_sel].path, "/dev_hdd0")!=NULL || strstr(menu_list[game_sel].path, "/dev_usb")!=NULL) && strstr(menu_list[game_sel].content, "PS3")!=NULL) { c_opacity_delta=16; dimc=0; dim=1; OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 64; OutputInfo.pResultString = Result_Text_Buffer; open_osk(4, (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 : menu_list[game_sel].title) ); if(cover_mode!=8) { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s", avchdBG); load_texture( text_FONT, filename, 1920);// gray_texture(text_FONT, 1920, 1080); max_ttf_label=0; sprintf(string1, "::: %s :::", (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 : menu_list[game_sel].title)); print_label_ex( 0.5f, 0.10f, 1.0f, 0xffffffff, string1, 1.04f, 0.0f, 1, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); max_ttf_label=0; sprintf(string1, "%s", "Enter new game title:"); print_label_ex( 0.5f, 0.20f, 1.2f, 0xffffffff, string1, 1.00f, 0.0f, 2, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); } while(1){ { ClearSurface(); if(cover_mode!=8) {set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } else draw_whole_xmb(0); setRenderColor(); flip(); } if(osk_dialog==1 || osk_dialog==-1) break; } osk_open=0; if(osk_dialog!=0) { char pin_result[128]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 64); if(strlen(pin_result)>1) { u8 n; for(n=0; n<(strlen(pin_result)-3); n++) { // (TM) = E2 84 A2 | 28 54 4D 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x54 || pin_result[n+1]==0x74) && (pin_result[n+2]==0x4D || pin_result[n+2]==0x6D) && pin_result[n+3]==0x29) { pin_result[n] =0xE2; pin_result[n+1]=0x84; pin_result[n+2]=0xA2; // pin_result[n+3]=0x20; strncpy(pin_result+n+3, pin_result+n+4, strlen(pin_result)-n-4); pin_result[strlen(pin_result)-1]=0; } } for(n=0; n<(strlen(pin_result)-2); n++) { // (R) = C2 AE | 28 52 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x52 || pin_result[n+1]==0x72) && pin_result[n+2]==0x29) { pin_result[n] =0xC2; pin_result[n+1]=0xAE; strncpy(pin_result+n+2, pin_result+n+3, strlen(pin_result)-n-3); pin_result[strlen(pin_result)-1]=0; } } for(n=0; n<(strlen(pin_result)-2); n++) { // (C) = C2 A9 | 28 63 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x43 || pin_result[n+1]==0x63) && pin_result[n+2]==0x29) { pin_result[n] =0xC2; pin_result[n+1]=0xA9; strncpy(pin_result+n+2, pin_result+n+3, strlen(pin_result)-n-3); pin_result[strlen(pin_result)-1]=0; } } sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_field( filename, (char*)"TITLE", pin_result); sprintf(menu_list[game_sel].title, "%s", pin_result); } } if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==8) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} game_last_page=-1; old_fi=-1; goto force_reload; } } if ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_R1)){ new_pad=0; c_opacity_delta=16; dimc=0; dim=1; display_mode++; if(display_mode>2) display_mode=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; forcedevices=0xFFFF; max_menu_list=0; game_last_page=-1; goto start_of_loop; } if ( (new_pad & BUTTON_R1) && (lock_display_mode==-1) ) {// && cover_mode!=5 next_for_FM: c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==3) {slide_screen_left(text_FONT); load_texture(text_bmpUPSR, playBGR, 1920);} else if(cover_mode==4 || cover_mode==5) slide_screen_left(text_bmpUPSR); else slide_screen_left(text_bmp); last_cover_mode=cover_mode; if(cover_mode==5) { load_texture(text_bmpUPSR, playBGR, 1920); if(lock_display_mode!=-1) cover_mode=lock_display_mode-1; } cover_mode++; if(cover_mode==5) cover_mode++; c_opacity=0xff; c_opacity2=0xff; game_last_page=-1; game_sel_last=game_sel; new_pad=0; state_read=1; state_draw=1; if(cover_mode>8) {cover_mode=0;} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==5) set_fm_stripes(); if(cover_mode<3 || cover_mode>5) load_texture(text_legend, legend, 1665);//&& last_cover_mode>2) if(cover_mode==8 || cover_mode==4) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} old_fi=-1; counter_png=0; goto force_reload; } if ( (old_pad & BUTTON_SELECT) && (new_pad & BUTTON_START)) { if(cover_mode==5) { new_pad=0; goto from_fm; } open_file_manager: state_draw=1; c_opacity=0xff; c_opacity2=0xff; if(!lock_fileman) { if(cover_mode!=5) last_cover_mode=cover_mode; cover_mode=5; counter_png=0; state_read=1; state_draw=1; memset(text_bmpUPSR, 0, 8294400); set_fm_stripes(); old_fi=-1; goto skip_to_FM; } } if ( ((new_pad & BUTTON_L1) || ((old_pad & BUTTON_SELECT) && ( (new_pad & BUTTON_L1) || (new_pad & BUTTON_START) )) ) && (lock_display_mode==-1 || cover_mode==5) ) { c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==3) slide_screen_right(text_FONT); else if(cover_mode==4 || cover_mode==5) slide_screen_right(text_bmpUPSR); else slide_screen_right(text_bmp); from_fm: if(cover_mode==5 || cover_mode==6) { load_texture(text_bmpUPSR, playBGR, 1920); load_texture(text_legend, legend, 1665); sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); game_last_page=-1; if((old_pad & BUTTON_SELECT)) { if(last_cover_mode==5) cover_mode--; else cover_mode=last_cover_mode; } else { last_cover_mode=cover_mode; cover_mode--; } } else { last_cover_mode=cover_mode; cover_mode--; game_last_page=-1; } if(cover_mode==5) cover_mode--; if(lock_display_mode!=-1) cover_mode=lock_display_mode; game_sel_last=game_sel; state_read=1; state_draw=1; new_pad=0; c_opacity=0xff; c_opacity2=0xff; if(cover_mode<0) {cover_mode=8;} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==5) set_fm_stripes(); if((cover_mode<3 || cover_mode>5) && last_cover_mode>2) load_texture(text_legend, legend, 1665); if(cover_mode==8 || cover_mode==4) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} old_fi=-1; counter_png=0; goto force_reload; } if ( (old_pad & BUTTON_START) && (new_pad & BUTTON_SELECT)) { char reload_self[128]; //new_pad=0; old_pad=0; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self) && net_used_ignore()) { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_RESTART, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1){ unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } } if (( (old_pad & BUTTON_L2) && (old_pad & BUTTON_R2)) || (ss_timer>=(ss_timeout*60) && ss_timeout) || www_running) screen_saver(); if(force_update_check==1) {check_for_update(); force_update_check=0;} if(cover_mode==5) {goto skip_to_FM;} skip_find_device: is_game_loading=0; if(read_pad_info()) goto force_reload; if ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_L3)){ reset_xmb(1); refresh_list: new_pad=0; is_reloaded=0; //sys_timer_usleep(1*1000*1000); c_opacity_delta=16; dimc=0; dim=1; old_fi=-1; counter_png=0; forcedevices=0xFFFF; max_menu_list=0; //if(cover_mode==8) reset_xmb(1); goto start_of_loop; } if ( new_pad & BUTTON_L3){ dir_mode++; new_pad=0; if(dir_mode>2) dir_mode=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; c_opacity_delta=16; dimc=0; dim=1; goto force_reload; } if ( (new_pad & BUTTON_R3)) { new_pad=0;//new_pad=0; user_font++; if (user_font>9) user_font=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; game_last_page=-1; goto force_reload; } if ( (old_pad & BUTTON_START) && (new_pad & BUTTON_R3)){ new_pad=0; update_title: if(strstr(menu_list[game_sel].content, "PS3")!=NULL) check_for_game_update(menu_list[game_sel].title_id, menu_list[game_sel].title); } if ( (new_pad & BUTTON_TRIANGLE) && cover_mode!=8) { if(cover_mode==4) { sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920);} int ret_f=open_mm_submenu(text_bmp);//, &game_sel); if(ret_f) {slide_screen_left(text_FONT);memset(text_bmp, 0, FB(1));} if(cover_mode==8 || ret_f==11) { load_texture(text_FMS, xmbicons, 128); load_texture(xmb_icon_retro, xmbicons2, 128); memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); if(ret_f==11) {cover_mode=8; xmb_icon=2; init_xmb_icons(menu_list, max_menu_list, game_sel ); } } if(cover_mode==4) {load_texture(text_legend, legend, 1665);init_xmb_icons(menu_list, max_menu_list, game_sel );} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); old_fi=-1; if(ret_f==1) force_update_check=1; if(ret_f==2) { if(!lock_fileman) {last_cover_mode=cover_mode; cover_mode=5; new_pad=0; goto open_file_manager;}} if(ret_f==3) goto switch_ntfs; // if(ret_f==4) {screenshot} if(ret_f==5 && net_used_ignore()) { char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } if(ret_f==6 && net_used_ignore()) {unload_modules(); sys_process_exit(1);} if(ret_f==7) goto refresh_list; if( (ret_f==8 || ret_f==9) && net_used_ignore() ) { sprintf(my_mp3_file, "%s/XMB Video", app_usrdir); if(!exist(my_mp3_file) || ret_f==9) { if(!exist(my_mp3_file)) mkdir(my_mp3_file, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else del_temp(my_mp3_file); max_dir_l=0; ps3_home_scan_bare2((char*)"/dev_hdd0/video", pane_l, &max_dir_l); char linkfile[512]; for(ret_f=0; ret_f<max_dir_l; ret_f++) { sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane_l[ret_f].name); sprintf(linkfile, "%s/%s", pane_l[ret_f].path, pane_l[ret_f].name); link(linkfile, filename); } } retry_showtime_mm: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime_mm; } } } if(ret_f==10) screen_saver(); // if(ret_f==11) goto open_setup; if(ret_f==12 && exist(helpMME) && net_used_ignore()) { unload_modules(); sys_game_process_exitspawn2((char*) helpMME, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } goto force_reload; } if ((old_pad & BUTTON_R1) && c_firmware!=3.41f && 0) { setperm_title: dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_SET_ACCESS, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(62); sprintf(filename, "%s", menu_list[game_sel].path); abort_rec=0; fix_perm_recursive(filename); new_pad=0; cellMsgDialogAbort(); flip(); } if ((new_pad & BUTTON_R2) && game_sel>=0 && max_menu_list>0 && mode_list==0 && 0) { test_title: time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; sprintf(string1,"Checking, please wait...\n\n%s",menu_list[game_sel].path); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); my_game_test( menu_list[game_sel].path, 0); DPrintf("Directories: %i Files: %i\nBig files: %i Split files: %i\n\n", num_directories, file_counter, num_files_big, num_files_split); int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy==2) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else if(abort_copy==1) sprintf(string1,"Folder contains over %i files. Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB+\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); else sprintf(string1,"Files tested: %i Time: %2.2i:%2.2i:%2.2i Size: %1.2f GB\nActual size : %.f bytes", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0),(double) global_device_bytes); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f,0xc0c0c0c0,string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } if ( (new_pad & BUTTON_SQUARE) && game_sel>=0 && max_menu_list>0 && mode_list==0 && (!(menu_list[game_sel].flags & 2048)) && disable_options!=1 && disable_options!=3 && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL && 0){ delete_title: int n; c_opacity_delta=16; dimc=0; dim=1; for(n=0;n<11;n++){ if((menu_list[game_sel].flags>>n) & 1) break; } if(n==0) sprintf(filename, "%s", (const char*) STR_DEL_TITLE_HDD); else sprintf(filename, (const char*) STR_DEL_TITLE_USB, 47+n); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1){ sprintf(filename, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); if(exist(filename)) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DEL_GCACHE, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==1){ sprintf(filename, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); my_game_delete(filename); } time_start= time(NULL); old_fi=-1; counter_png=0; game_last_page=-1; forcedevices=(1<<n); abort_copy=0; initConsole(); file_counter=0; new_pad=0; DPrintf("Deleting... \n %s\n\n", menu_list[game_sel].path); my_game_delete((char *) menu_list[game_sel].path); rmdir((char *) menu_list[game_sel].path); // delete this folder if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else {sprintf(string1,"Done! Files Deleted: %i Time: %2.2i:%2.2i:%2.2i\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60); break;} ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue."); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } xmb[6].init=0; xmb[7].init=0; } if ((new_pad & BUTTON_CIRCLE) && game_sel>=0 && max_menu_list>0 && mode_list==0 && disable_options!=2 && disable_options!=3 && 0)// && !patchmode { copy_title: c_opacity_delta=16; dimc=0; dim=1; if(menu_list[game_sel].flags & 2048) goto copy_from_bluray; int n; int curr_device=0; char name[1024]; int dest=0; dialog_ret=0; if(menu_list[game_sel].flags & 1) // is hdd0 { for(n=1;n<11;n++) { dialog_ret=0; if((fdevices>>n) & 1) { sprintf(filename, (const char*) STR_COPY_HDD2USB, 47+n); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) {curr_device=n;break;} // exit } } dest=n; if(dialog_ret==1) { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; // fix_perm_recursive(ini_usb_dir); sprintf(name, "/dev_usb00%c/%s", 47+curr_device, ini_usb_dir); mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+curr_device, ini_usb_dir, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } } else if(fdevices & 1) { for(n=1;n<13;n++) { if((menu_list[game_sel].flags>>n) & 1) break; } if(n==11 || n==12) continue; curr_device=0; dest=0; char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char dialog_ret=0; if(force_disable_copy==0) { if(strstr(menu_list[game_sel].path,"/pvd_usb")==NULL) sprintf(filename, (const char*) STR_COPY_USB2HDD, 47+n, n-1, ini_usb_dir, p, hdd_folder, p); else sprintf(filename, (const char*) STR_COPY_PFS2HDD, menu_list[game_sel].path, hdd_folder, p); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==1) { mkdir(hdd_folder, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "%s/%s", hdd_folder, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else //ext to ext (USB2USB) { for(int n3=1;n3<11;n3++) { dialog_ret=0; if( ((fdevices>>n3) & 1) && n3!=n ) { sprintf(filename, (const char*) STR_COPY_USB2USB, 47+n, 47+n3, n-1, ini_usb_dir, p, n3-1, ini_usb_dir, p); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(string1, "/dev_usb00%c/%s", 47+n3, ini_usb_dir); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+n3, ini_usb_dir, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); dest=n3; curr_device=n3; break; } } } } } if(dialog_ret==1) { old_fi=-1; counter_png=0; game_last_page=-1; forcedevices=(1<<curr_device); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; DPrintf("Copying... \n %s\n to %s\n\n", menu_list[game_sel].path, name); if(curr_device!=0) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; num_directories= file_counter= num_files_big= num_files_split= 0; my_game_copy((char *) menu_list[game_sel].path, (char *) name); //ret=cellMsgDialogAbort();sys_timer_usleep(100000); ClearSurface(); int seconds= (int) (time(NULL)-time_start); int vflip=0; if(copy_is_split && !abort_copy) { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char if(dest==0) sprintf(filename, "%s/_%s", hdd_folder, p); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+dest, ini_usb_dir, p); ret=rename(name, filename); } while(1) { if(abort_copy) sprintf(string1,"Aborted! (%i) Time: %2.2i:%2.2i:%2.2i\n", abort_copy, seconds/3600, (seconds/60) % 60, seconds % 60); else { if(use_symlinks==1) { sprintf(filename, "%s/USRDIR/EBOOT.BIN", menu_list[game_sel].path); sprintf(string1 , "%s/USRDIR/MM_EBOOT.BIN", name); file_copy(filename, string1, 0); } sprintf(string1,"Done! Files Copied: %i Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); } ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x200020ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } if(abort_copy ) { if(dest==0) sprintf(filename, (const char*) STR_DEL_PART_HDD, menu_list[game_sel].title); else sprintf(filename, (const char*) STR_DEL_PART_USB, menu_list[game_sel].title, 47+dest); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { abort_copy=0; time_start= time(NULL); file_counter=0; my_game_delete((char *) name); rmdir((char *) name); // delete this folder if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } else { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char if(dest==0) sprintf(filename, "%s/_%s", hdd_folder, p); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+dest, ini_usb_dir, p); ret=rename(name, filename); } } if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; termConsole(); } xmb[6].init=0; xmb[7].init=0; } overwrite_cancel: // copy from bluray if ( (new_pad & BUTTON_CIRCLE) & ((fdevices>>11) & 1) && mode_list==0 && disable_options!=2 && disable_options!=3) { copy_from_bluray: c_opacity_delta=16; dimc=0; dim=1; char name[1024]; int curr_device=0; // CellFsStat status; char id2[16], id[16]; int n; for(n=0;n<11;n++) { dialog_ret=0; if((fdevices>>n) & 1) { if(n==0) sprintf(filename, "%s", (const char*) STR_COPY_BD2HDD); else sprintf(filename, (const char*) STR_COPY_BD2USB, 47+n); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) {curr_device=n;break;} // exit } } if(dialog_ret==1) { if(curr_device==0) sprintf(name, "/dev_hdd0"); else sprintf(name, "/dev_usb00%c", 47+curr_device); if (cellFsStat(name, &status) == CELL_FS_SUCCEEDED && !parse_ps3_disc((char *) "/dev_bdvd/PS3_DISC.SFB", id2)) { old_fi=-1; counter_png=0; forcedevices=(1<<curr_device); int gn, gn2=0; char bluray_game2[128]; bluray_game2[0]=0; for(gn=0; (gn<(int)strlen(bluray_game) && gn<53 && gn2<53); gn++ ) { if( (bluray_game[gn]>0x2f && bluray_game[gn]<0x3a) || (bluray_game[gn]>0x60 && bluray_game[gn]<0x7b) || (bluray_game[gn]>0x40 && bluray_game[gn]<0x5b) || bluray_game[gn]==0x20) { bluray_game2[gn2]=bluray_game[gn]; bluray_game2[gn2+1]=0; gn2++; } } sprintf(id, "%s-[%s]", id2, bluray_game2); id[64]=0; if(curr_device==0) { mkdir(hdd_folder, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "%s/%s", hdd_folder, id); if(cellFsStat(name, &status)== CELL_FS_SUCCEEDED) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel_bdvd; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else { sprintf(name, "/dev_usb00%c/%s", 47+curr_device, ini_usb_dir); mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+curr_device, ini_usb_dir, id); if(cellFsStat(name, &status)== CELL_FS_SUCCEEDED) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel_bdvd; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; if(curr_device!=0) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; my_game_copy((char *) "/dev_bdvd", (char *) name);//ret=cellMsgDialogAbort();sys_timer_usleep(100000); int seconds= (int) (time(NULL)-time_start); int vflip=0; if(copy_is_split && !abort_copy) { if(curr_device==0) sprintf(filename, "%s/%s", hdd_folder, id); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+curr_device, ini_usb_dir, id); ret=rename(name, filename); } while(1) { if(abort_copy) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else { sprintf(string1,"Done! Files Copied: %i Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); } ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } if(abort_copy) { if(curr_device==0) sprintf(filename, (const char*) STR_DEL_PART_HDD, id); else sprintf(filename, (const char*) STR_DEL_PART_USB, id, 47+curr_device); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { time_start= time(NULL); file_counter=0; abort_copy=0; my_game_delete((char *) name); rmdir((char *) name); // delete this folder } else { if(curr_device==0) sprintf(filename, "%s/_%s", hdd_folder, id); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+curr_device, ini_usb_dir, id); ret=rename(name, filename); } } termConsole(); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; game_last_page=-1; xmb[6].init=0; xmb[7].init=0; } overwrite_cancel_bdvd: join_copy=0; if ( ((new_pad & BUTTON_CROSS) && (cover_mode==8 || cover_mode==4) && (xmb_icon!=6 || (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==6))) || ((new_pad & BUTTON_CIRCLE) && (cover_mode==8 || cover_mode==4) && (xmb_icon==2 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==7)) ) { while(xmb_slide || xmb_slide_y){draw_whole_xmb(xmb_icon);} if(xmb_icon==9) { if(xmb[9].first!=1) launch_web_browser(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); //web "http://www.psxstore.com/" else { slide_xmb_left(9); get_www_themes(www_theme, &max_theme); if(max_theme) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=480.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; int ret_f=open_theme_menu((char*) STR_BUT_DOWN_THM, 600, www_theme, max_theme, 320, 225, 16, 1); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { char tdl[512]; sprintf(tdl, "%s/%s.pkg", themes_web_dir, www_theme[ret_f].name); if(download_file(www_theme[ret_f].pkg, tdl, 4)==1 && net_used_ignore()) { syscall_mount(themes_web_dir, mount_bdvd); dialog_ret=0; sprintf(string1, (const char*) STR_INSTALL_THEME, www_theme[ret_f].name); cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) {reset_mount_points(); goto cancel_theme_exit;} unload_modules(); sys_process_exit(1); }; } } cancel_theme_exit: slide_xmb_right(); } } if(xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==6) { if(xmb[6].first==0) goto refresh_list; } if(xmb_icon==1) //home { if(xmb[1].first==0) force_update_check=1; if(xmb[1].first==1) { if(!lock_fileman) {last_cover_mode=cover_mode; cover_mode=5; new_pad=0; goto open_file_manager;}} if(xmb[1].first==2) goto refresh_list; if(xmb[1].first==3) goto switch_ntfs; if(xmb[1].first==4) {screen_saver(); goto start_of_loop; } if(xmb[1].first==5) select_theme(); if(xmb[1].first==6 && exist(helpMME) && net_used_ignore()) { unload_modules(); sys_game_process_exitspawn2((char*) helpMME, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(xmb[1].first==7 && net_used_ignore()) { char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } if(xmb[1].first==8 && net_used_ignore()) {unload_modules(); sys_process_exit(1);} } if(xmb_icon==2 && (xmb[2].member[xmb[2].first].option_size || xmb[2].first<3) ) //settings { if(xmb[2].first==0) // system information { is_any_xmb_column=xmb_icon; parse_ini(options_ini,1); show_sysinfo(); is_any_xmb_column=0; pad_read(); new_pad=0; goto xmb_cancel_option; } if(xmb[2].first==1) // select interface language { is_any_xmb_column=xmb_icon; select_language(); pad_read(); new_pad=0; is_any_xmb_column=0; goto xmb_cancel_option; } if(xmb[2].first==2) // clear game cache { if(delete_game_cache()!=-1) { pad_read(); new_pad=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_DEL_CACHE_DONE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); wait_dialog(); } goto xmb_cancel_option; } if(xmb[2].first>1) xmb[2].member[xmb[2].first].data=-1; if(!strcmp(xmb[2].member[xmb[2].first].optionini, "parental_level") || !strcmp(xmb[2].member[xmb[2].first].optionini, "parental_pass") || !strcmp(xmb[2].member[xmb[2].first].optionini, "disable_options") || !strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman")) { if(parental_pin_entered && (!strcmp(xmb[2].member[xmb[2].first].optionini, "disable_options") || !strcmp(xmb[2].member[xmb[2].first].optionini, "parental_level") || !strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman") )) goto xmb_pin_ok; { sprintf(string1, "%s", (const char*) STR_PIN_ENTER); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); is_any_xmb_column=xmb_icon; while(1){ draw_whole_xmb(xmb_icon); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(30); is_any_xmb_column=0; osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { parental_pin_entered=1; goto xmb_pin_ok; } } } dialog_ret=0; parental_pin_entered=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto xmb_cancel_option; } goto xmb_cancel_option; } xmb_pin_ok: if(!strcmp(xmb[2].member[xmb[2].first].optionini, "parental_pass")) { sprintf(string1, "%s", (const char*) STR_PIN_NEW); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ draw_xmb_bare(2, 1, 0, 0); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; parental_pin_entered=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { sprintf(parental_pass, "%s", pin_result); goto xmb_pin_ok2; } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto xmb_cancel_option; } xmb_pin_ok2: if(new_pad & BUTTON_CIRCLE) { if(xmb[2].member[xmb[2].first].option_selected<1) xmb[2].member[xmb[2].first].option_selected=xmb[2].member[xmb[2].first].option_size; xmb[2].member[xmb[2].first].option_selected--; } else { xmb[2].member[xmb[2].first].option_selected++; if(xmb[2].member[xmb[2].first].option_selected>=xmb[2].member[xmb[2].first].option_size) xmb[2].member[xmb[2].first].option_selected=0; } parse_settings(); if(!strcmp(xmb[2].member[xmb[2].first].optionini, "xmb_cover_column")) {free_all_buffers(); xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} if(!strcmp(xmb[2].member[xmb[2].first].optionini, "confirm_with_x")) {set_xo();xmb_legend_drawn=0;} if(!strcmp(xmb[2].member[xmb[2].first].optionini, "display_mode") || !strcmp(xmb[2].member[xmb[2].first].optionini, "hide_bd")) forcedevices=(1<<11);//0x0800; if(!strcmp(xmb[2].member[xmb[2].first].optionini, "bd_emulator") && xmb[2].member[xmb[2].first].option_selected==1 && !bdemu2_present) { if(c_firmware==3.55f) xmb[2].member[xmb[2].first].option_selected=2; else xmb[2].member[xmb[2].first].option_selected=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Selected option is not available.\n\nERROR: Incorrect BDEMU version!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman")) { if(lock_fileman) sprintf(xmb[1].member[1].name, "%s", "File Manager (Disabled)"); else sprintf(xmb[1].member[1].name, "%s", "File Manager"); for(int n=0; n<MAX_XMB_TEXTS; n++) { xmb_txt_buf[n].used=0; } xmb_txt_buf_max=0; for(int n=0; n<xmb[1].size; n++) xmb[1].member[n].data=-1; for(int n=0; n<xmb[2].size; n++) xmb[2].member[n].data=-1; } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "theme_sound")) { if(is_theme_playing && !theme_sound) stop_audio(5); if(is_theme_playing && theme_sound) sprintf(filename, "%s/SOUND.BIN", app_usrdir); if(exist(filename)) main_mp3((char*)filename); } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "user_font")) redraw_column_texts(xmb_icon); xmb_cancel_option: //redraw_column_texts(xmb_icon); dialog_ret=0; } if(xmb_icon==4 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==4) //music { char aufile[512]; sprintf(aufile, "%s", xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); if(exist(aufile) && (strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL)) { int ci2; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); //add the rest of the files as a playlist for(ci2=xmb[xmb_icon].first+1; ci2<xmb[xmb_icon].size; ci2++) { sprintf(aufile, "%s", xmb[xmb_icon].member[ci2].file_path); if(strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); } } for(ci2=0; ci2<(xmb[xmb_icon].first); ci2++) { sprintf(aufile, "%s", xmb[xmb_icon].member[ci2].file_path); if(strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); } } main_mp3((char*) mp3_playlist[1].path); } else if(exist(aufile)) goto retry_showtime_xmb; } if(xmb_icon==5 && ( (xmb[xmb_icon].member[xmb[xmb_icon].first].type==3) || xmb[xmb_icon].first<2) && net_used_ignore()) //video for showtime { sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); if(xmb[xmb_icon].first==0) { char linkfile[512]; max_dir_l=0; sprintf(filename, "%s/XMB Video", app_usrdir); if(exist(filename)) del_temp(filename); ps3_home_scan_bare2((char*)"/dev_hdd0/video", pane_l, &max_dir_l); ps3_home_scan_bare2((char*)"/dev_hdd0/VIDEO", pane_l, &max_dir_l); for(int ret_f=0; ret_f<max_dir_l; ret_f++) if( is_video(pane_l[ret_f].name) ) { sprintf(linkfile, "%s/%s", pane_l[ret_f].path, pane_l[ret_f].name); sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane_l[ret_f].name); link(linkfile, filename); } } retry_showtime_xmb: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { if(xmb[xmb_icon].first<2 && net_used_ignore()) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } FILE *flist; sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", xmb[xmb_icon].member[xmb[xmb_icon].first].file_path);fputs (filename, flist ); fclose(flist); if(net_used_ignore()) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime_xmb; } } } if(xmb_icon==8) { // emulators if(xmb[xmb_icon].first==0) { if(!is_retro_loading) { xmb[xmb_icon].init=0; xmb[xmb_icon].size=0; free_all_buffers(); sprintf(string1, "%s/XMBS.008", app_usrdir); remove(string1); xmb[xmb_icon].group=0; sprintf(xmb[8].name, "%s", (const char*) STR_GRP_RETRO); draw_xmb_icon_text(8); add_emulator_column(); } } else { if(xmb[xmb_icon].member[xmb[xmb_icon].first].type== 8) launch_snes_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type== 9) launch_fceu_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==10) launch_vba_emu (xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==11) launch_genp_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==12) launch_fba_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); } } if(xmb_icon==3) { //photo{ while(is_decoding_jpg){ draw_whole_xmb(xmb_icon);}//just wait for threaded decoding to finish int current_image=xmb[xmb_icon].first; char image_file[512]; long slide_time=0; int slide_show=0; int show_info=0; sprintf(image_file, "%s", xmb[xmb_icon].member[current_image].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { int to_break=0, slide_dir=0; float pic_zoom=1.0f; int pic_reload=1, pic_posY=0, pic_posX=0, pic_X=0, pic_Y=0; char pic_info[512]; mouseYDR=mouseXDR=mouseYDL=mouseXDL=0.0000f; while(1) { // Picture Viewer Mode use_analog=1; sprintf(image_file, "%s", xmb[xmb_icon].member[current_image].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL) { //cellDbgFontDrawGcm(); ClearSurface(); if(pic_reload!=0){ cellDbgFontDrawGcm(); pic_zoom=-1.0f; if(strstr(xmb[xmb_icon].member[current_image].file_path,"/pvd_usb")!=NULL) //ntfs { sprintf(image_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(xmb[xmb_icon].member[current_image].file_path, image_file, 0); } load_jpg_texture(text_bmp, image_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { cellDbgFontDrawGcm(); if(pic_reload!=0){ if(strstr(xmb[xmb_icon].member[current_image].file_path,"/pvd_usb")!=NULL) //ntfs { sprintf(image_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(xmb[xmb_icon].member[current_image].file_path, image_file, 0); } load_png_texture(text_bmp, image_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f)pic_zoom=4; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); pic_X=(int)((1920-png_w2)/2)+pic_posX; pic_Y=(int)((1080-png_h2)/2)+pic_posY; if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } int ci=current_image; to_break=0; char ss_status[8]; while(1){ pad_read(); ClearSurface(); set_texture( text_bmp, 1920, 1080); if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); else display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); if(show_info==1){ if(slide_show) sprintf(ss_status, "%s", "Stop"); else sprintf(ss_status, "%s", "Start"); sprintf(pic_info," Name: %s", xmb[xmb_icon].member[current_image].name); pic_info[95]=0; draw_text_stroke( 0.04f+0.025f, 0.867f, 0.7f ,0xc0a0a0a0, pic_info); if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) sprintf(pic_info," Info: PNG %ix%i (Zoom: %3.0f)\n Date: %s\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, xmb[xmb_icon].member[current_image].subname, ss_status); else sprintf(pic_info," Info: JPEG %ix%i (Zoom: %3.0f)\n Date: %s\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, xmb[xmb_icon].member[current_image].subname, ss_status); draw_text_stroke( 0.04f+0.025f, 0.89f, 0.7f ,0xc0a0a0a0, pic_info); cellDbgFontDrawGcm(); } flip(); if ( new_pad & BUTTON_SELECT ) {show_info=1-show_info; pic_reload=0; break;}//new_pad=0; old_pad=0; if ( new_pad & BUTTON_START ) { slide_time=0; //new_pad=0; old_pad=0; slide_show=1-slide_show; slide_dir=0; } if(slide_show==1) slide_time++; if ( ( new_pad & BUTTON_TRIANGLE ) || ( new_pad & BUTTON_CIRCLE ) ) {new_pad=0; to_break=1;break;}// old_pad=0; if ( ( new_pad & BUTTON_RIGHT ) || ( new_pad & BUTTON_R1 ) || ( new_pad & BUTTON_CROSS ) || (slide_show==1 && slide_time>600) ) { //find next image in the list for(ci=current_image+1; ci<xmb[xmb_icon].size; ci++) { sprintf(image_file, "%s", xmb[xmb_icon].member[ci].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { current_image=ci; xmb[xmb_icon].first=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_time=0; slide_dir=0; break; } } if(current_image>=xmb[xmb_icon].size || ci>=xmb[xmb_icon].size) current_image=0;//to_break=1; // || current_image==xmb[xmb_icon].first break; } if ( ( new_pad & BUTTON_LEFT ) || ( new_pad & BUTTON_L1 ) ) { //find previous image in the list if(current_image==0) current_image=xmb[xmb_icon].size; int one_time2=1; check_from_start2: for(ci=current_image-1; ci>=0; ci--) { sprintf(image_file, "%s", xmb[xmb_icon].member[ci].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { current_image=ci; xmb[xmb_icon].first=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_show=0; slide_dir=1; break; } } if((current_image<0 || ci<0) && one_time2) {one_time2=0; current_image=xmb[xmb_icon].size; goto check_from_start2;}// to_break=1; // || current_image==e break; } if (( new_pad & BUTTON_L3 ) || ( new_pad & BUTTON_DOWN )) { if(png_w!=0 && pic_zoom==1.0f) pic_zoom=float (1920.0f / png_w); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (( new_pad & BUTTON_R3 ) || ( new_pad & BUTTON_UP )) { if(png_h!=0 && pic_zoom==1.0f) pic_zoom=float (1080.0f / png_h); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (mouseXDL!=0.0f && png_w2>1920) { pic_posX-=(int) (mouseXDL*1920.0f); pic_reload=0; if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0-(int)((1920-png_w2)/2); break; } if (mouseYDL!=0.0f && png_h2>1080) { pic_posY-=(int) (mouseYDL*1080.0f); if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0-(int)((1080-png_h2)/2); pic_reload=0; break; } if (( new_pad & BUTTON_L2 ) || mouseXDR> 0.003f || mouseYDR> 0.003f) { if ( new_pad & BUTTON_L2 ) pic_zoom-=0.045f; else pic_zoom-=0.010f; if(pic_zoom<1.0f) pic_zoom=1.000f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } if (( new_pad & BUTTON_R2 ) || mouseXDR< -0.003f || mouseYDR< -0.003f) { if (new_pad & BUTTON_R2) pic_zoom+=0.045f; else pic_zoom+=0.010f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } } new_pad=0; if(to_break==1) break; } //picture viewer new_pad=0; use_analog=0; } load_texture(text_bmp, xmbbg, 1920); } } if (new_pad & BUTTON_CROSS && game_sel>=0 && (((mode_list==0) && max_menu_list>0)) && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL && ( (cover_mode!=8 && cover_mode!=4) || ((cover_mode==8 || cover_mode==4) && ( (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==1 && xmb[xmb_icon].size>1) || (xmb_icon==7 && xmb[xmb_icon].size) || (xmb_icon==5 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==2)))) ) { start_title: join_copy=0; c_opacity_delta=16; dimc=0; dim=1; if(parental_level<menu_list[game_sel].plevel && parental_level>0) { sprintf(string1, (const char*) STR_GAME_PIN, menu_list[game_sel].plevel ); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ sprintf(string1, "::: %s :::\n\n\nSelected game is restricted with parental level %i.\n\nPlease enter four alphanumeric parental password code:", menu_list[game_sel].title, menu_list[game_sel].plevel); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.9f, 0xd0000080); cellDbgFontPrintf( 0.10f, 0.10f, 1.0f, 0xffffffff, string1); setRenderColor(); cellDbgFontDrawGcm(); flip(); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { goto pass_ok; } } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto skip_1; } pass_ok: direct_launch_forced=0; if( (old_pad & BUTTON_SELECT) || (menu_list[game_sel].user & IS_DBOOT)) direct_launch_forced=1; char fileboot[1024]; memset(fileboot, 0, 1023); if( (menu_list[game_sel].flags & 2048) && net_used_ignore()) { flip(); if(direct_launch_forced && !(menu_list[game_sel].user & IS_DBOOT)) { sprintf(filename, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if(exist(filename)) { sprintf(fileboot, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if( ( (payload==0 && sc36_path_patch==0) || (menu_list[game_sel].user & IS_DISC) ) && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } dialog_ret=0; if(menu_list[game_sel].user & IS_DBOOT) { write_last_play( (char *)fileboot, (char *)menu_list[game_sel].path, (char *)menu_list[game_sel].title, (char *)menu_list[game_sel].title_id, 1); unload_modules(); //if(payload==0) //sys_game_process_exitspawn2((char *) fileboot, NULL, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); //else sprintf(string1, "%s", menu_list[game_sel].path); sprintf(fileboot, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); syscall_mount( string1, mount_bdvd); sys_game_process_exitspawn2((char *) fileboot, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); // sys_game_process_exitspawn2((char *) "/app_home/PS3_GAME/USRDIR/EBOOT.BIN", NULL, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); } else { write_last_play( (char *)fileboot, (char *)menu_list[game_sel].path, (char *)menu_list[game_sel].title, (char *)menu_list[game_sel].title_id, 0); unload_modules(); sprintf(string1, "%s", menu_list[game_sel].path); syscall_mount( string1, mount_bdvd); sys_process_exit(1); break; } } } else { reset_mount_points(); ret = unload_modules(); sys_process_exit(1); } } if( (strstr(menu_list[game_sel].content,"AVCHD")!=NULL || strstr(menu_list[game_sel].content,"BDMV")!=NULL) && net_used_ignore()) // Rename/activate USB HDD AVCHD folder { if(strstr(menu_list[game_sel].content,"BDMV")!=NULL && strstr(menu_list[game_sel].path,"/dev_hdd0")!=NULL) { sprintf(filename, (const char*) STR_BD2AVCHD3, menu_list[game_sel].title, menu_list[game_sel].entry, menu_list[game_sel].details); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_BD2AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char path[512], cfile[512], ffile[512], cfile0[16]; for(int n=0;n<128;n++){ sprintf(path, "%s/BDMV/CLIPINF", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/CLIPINF", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/PLAYLIST", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/PLAYLIST", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".m2ts")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MTS", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/index.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/INDEX.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/BACKUP/index.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/BACKUP/INDEX.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/MovieObject.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/MOVIEOBJ.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/BACKUP/MovieObject.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/BACKUP/MOVIEOBJ.BDM", menu_list[game_sel].path); rename(path, cfile); } sprintf(menu_list[game_sel].content, "AVCHD"); cellMsgDialogAbort(); } } if(strstr(menu_list[game_sel].content,"BDMV")!=NULL && payload!=0) { sprintf(filename, (const char*) STR_ACT_BDMV, menu_list[game_sel].title, menu_list[game_sel].entry, menu_list[game_sel].details); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { syscall_mount2((char *)"/dev_bdvd", (char *)menu_list[game_sel].path); ret = unload_modules(); sys_process_exit(1); break; } else goto skip_1; } //BDMV if(strstr(menu_list[game_sel].content,"AVCHD")!=NULL) { sprintf(filename, (const char*) STR_ACT_AVCHD, menu_list[game_sel].title); //, menu_list[game_sel].entry, menu_list[game_sel].details dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { if(strstr(menu_list[game_sel].path,"/dev_hdd0")!=NULL) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_ACT_AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char usb_save[32]="/none"; usb_save[5]=0; sprintf(filename, "/dev_sd"); if(exist(filename)) { sprintf(usb_save, "/dev_sd/PRIVATE"); if(!exist(usb_save)) mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } if(!exist(usb_save)) { sprintf(filename, "/dev_ms"); if(exist(filename)) { sprintf(usb_save, "/dev_ms"); } } if(!exist(usb_save)) { for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } } if(exist(usb_save)) { sprintf(filename, "%s/AVCHD", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV/INDEX.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdIN, (char *) filename, 0); sprintf(filename, "%s/AVCHD/BDMV/MOVIEOBJ.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdMV, (char *) filename, 0); sprintf(filename, "%s/AVCHD", usb_save); sprintf(usb_save, "%s", filename); cellMsgDialogAbort(); syscall_mount2((char *)usb_save, (char *)menu_list[game_sel].path); ret = unload_modules(); sys_process_exit(1); break; } else { dialog_ret=0; cellMsgDialogAbort(); ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ATT_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto skip_1; } } char usb_ROOT[12]; char avchd_OLD[64]; char avchd_OLD_path[128]; char avchd_ROOT[64]; char avchd_CURRENT[64]; char title_backup[64]; char line[64]; char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; FILE *fpA; strncpy(usb_ROOT, menu_list[game_sel].path, 11); usb_ROOT[11]=0; sprintf(avchd_ROOT, "%s/AVCHD", usb_ROOT); sprintf(avchd_CURRENT, "%s", menu_list[game_sel].path); sprintf(avchd_OLD, "AVCHD_VIDEO_[%i]", (int)(time(NULL))); sprintf(avchd_OLD_path, "%s/%s", usb_ROOT, avchd_OLD); if(strcmp(avchd_CURRENT, avchd_ROOT)) { if(exist(avchd_ROOT)) // AVCHD exists and has to be renamed { sprintf(title_backup, "%s/TitleBackup.txt", avchd_ROOT); if(!exist(title_backup)) { fpA = fopen ( title_backup, "w" ); fputs ( avchd_OLD, fpA );fputs ( CrLf, fpA ); fclose(fpA); } else { fpA = fopen ( title_backup, "r" ); if ( fpA != NULL ) { while ( fgets ( line, sizeof line, fpA ) != NULL ) { if(strlen(line)>2) { strncpy(avchd_OLD, line, strlen(line)-2);avchd_OLD[strlen(line)-2]=0; sprintf(avchd_OLD_path, "%s/%s", usb_ROOT, avchd_OLD); break; } } fclose(fpA); } } ret=cellFsRename(avchd_ROOT, avchd_OLD_path); } // AVCHD doesn't exist and selected folder can be renamed sprintf(title_backup, "%s/TitleBackup.txt", avchd_CURRENT); fpA = fopen ( title_backup, "w" ); fputs ( menu_list[game_sel].entry, fpA ); fputs ( CrLf, fpA ); fclose(fpA); ret=cellFsRename(avchd_CURRENT, avchd_ROOT); } if(!exist(avchd_ROOT)) { sprintf(line, (const char*) STR_ERR_MVAV, ret, avchd_CURRENT, avchd_ROOT); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, line, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else // Exit to XMB after AVCHD rename { unload_modules(); syscall_mount( (char *) "/dev_bdvd", mount_bdvd); sys_process_exit(1); break; } } } } else { if(game_sel>=0 && max_menu_list>0 && net_used_ignore()) { int selx=0; if((menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) && payload!=1) { if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else { again_sc8: reset_mount_points(); sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/PARAM.SFO", menu_list[game_sel].path); char c_split[512]; c_split[0]=0; char c_cached[512]; c_cached[0]=0; char s_tmp2[512]; u8 use_cache=0; if(exist(filename)) { if(strstr(filename, "/dev_hdd0/")==NULL && strstr(filename, "/dev_bdvd/")==NULL && (verify_data==2 || (verify_data==1)) ) // && payload==1 { abort_copy=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_VERIFYING, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sprintf(s_tmp2, "%s/PS3_GAME/USRDIR", menu_list[game_sel].path); join_copy= (payload==1 ? 1 : 0); max_joined=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; time_start= time(NULL); my_game_test(s_tmp2, 2); cellMsgDialogAbort(); flip(); if( ((num_files_big || num_files_split) && payload!=1) || (num_files_big>10) ) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT3, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; goto cancel_mount2; } if(num_files_big<=10 && max_joined<10 && payload==1) { abort_rec=0; //sys8_perm_mode(1); fix_perm_recursive(game_cache_dir); int reprocess=0; for(int sfj=0; sfj<max_joined; sfj++) { char *p=file_to_join[sfj].split_file; sprintf(c_cached, "%s/%s/%s", game_cache_dir, menu_list[game_sel].title_id, p+strlen(menu_list[game_sel].path)+17); sprintf(c_split, "%s", p+strlen(menu_list[game_sel].path)); sprintf(file_to_join[sfj].cached_file, "%s", c_cached); sprintf(file_to_join[sfj].split_file, "%s", c_split); if(!exist(c_cached)) reprocess=1; } // check cache dialog_ret=0; if(reprocess==1) { cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_PREPROCESS, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; if(dialog_ret!=1) goto cancel_mount2; abort_copy=0; char s_tmp[512]; sprintf(s_tmp, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); mkdir(s_tmp, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_tmp, CELL_FS_S_IFDIR | 0777); my_game_delete(s_tmp); mkdir(s_tmp, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_tmp, CELL_FS_S_IFDIR | 0777); cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); abort_copy=0; if((uint64_t)global_device_bytes>(uint64_t)freeSpace && freeSpace!=0) my_game_delete(game_cache_dir); cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); if((uint64_t)global_device_bytes>(uint64_t)freeSpace && freeSpace!=0) { sprintf(string1, (const char*) STR_ERR_NOSPACE0, (double) ((freeSpace)/1048576.00f), (double) ((global_device_bytes-freeSpace)/1048576.00f) ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount2; } sprintf(string1, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(string1, CELL_FS_S_IFDIR | 0777); char tb_name[512]; sprintf(tb_name, "%s/PS3NAME.DAT", string1); remove(tb_name); FILE *fpA; fpA = fopen ( tb_name, "w" ); if(fpA!=NULL) { fprintf(fpA, "%.0fGB: %s", (double) ((global_device_bytes)/1073741824.00f), (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 :menu_list[game_sel].title)); fclose(fpA); } //dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_SET_ACCESS1, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(62); sprintf(tb_name, "%s", menu_list[game_sel].path); //sys8_perm_mode(1); abort_rec=0; fix_perm_recursive(tb_name); new_pad=0; cellMsgDialogAbort(); flipc(62); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; copy_mode=0; max_joined=0; char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/USRDIR", menu_list[game_sel].path); sprintf(s_destination, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); join_copy=1; my_game_copy((char*)s_source, (char*)s_destination); cellMsgDialogAbort(); termConsole(); join_copy=0; new_pad=0; if(abort_copy) { sprintf(s_destination, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); abort_copy=0; my_game_delete(s_destination); rmdir(s_destination); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_CANCELED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); max_joined=0; goto cancel_mount2; } sprintf(s_destination, "%s", game_cache_dir); //, menu_list[game_sel].title_id cellFsChmod(s_destination, CELL_FS_S_IFDIR | 0777); abort_rec=0; fix_perm_recursive(s_destination); goto again_sc8; } use_cache=1; //dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, file_to_join, dialog_fun1, (void*)0x0000aaaa, NULL );wait_dialog(); //goto cancel_mount2; } } if( ( (payload==0 && sc36_path_patch==0) || (menu_list[game_sel].user & IS_DISC) ) && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } selx=0; get_game_flags(game_sel); FILE *fpA; if(strstr(menu_list[game_sel].path, "/dev_usb")!=NULL && ( c_firmware==3.15f || c_firmware==3.41f || c_firmware==3.55f) && ((direct_launch_forced==1 && !(menu_list[game_sel].user & IS_DBOOT)) || (menu_list[game_sel].user & IS_BDMIRROR)) ) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount2; } ret = mod_mount_table((char *) "restore", 0); //restore if(!exist((char*)"/dev_bdvd/PS3_GAME/PARAM.SFO") && (menu_list[game_sel].user & IS_DISC)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } selx=1; char just_drive[32]; char usb_mount0[512], usb_mount1[512], usb_mount2[512]; char path_backup[512], path_bup[512]; ret = mod_mount_table((char *) "restore", 0); //restore if(ret) { strncpy(just_drive, menu_list[game_sel].path, 11); just_drive[11]=0; sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_version(filename); sprintf(usb_mount1, "%s/PS3_GAME", just_drive); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fgets ( usb_mount2, 512, fpA )==NULL) sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); fclose(fpA); strncpy(usb_mount2, just_drive, 11); //always use current device } else sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); int pl, n; char tempname[512]; pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } if(!exist(usb_mount2)) rename (usb_mount1, usb_mount2); } if(!exist(usb_mount1)) { sprintf(usb_mount0, "%s/PS3_GAME", menu_list[game_sel].path); sprintf(path_backup, "%s/PS3PATH.BUP", usb_mount0); remove(path_backup); fpA = fopen ( path_backup, "w" ); fputs ( usb_mount0, fpA ); fclose(fpA); menu_list[game_sel].user|=IS_BDMIRROR; set_game_flags(game_sel); rename (usb_mount0, usb_mount1); ret = mod_mount_table(just_drive, 1); //modify if(ret) { if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); unload_modules(); sys_process_exit(1); } else { mod_mount_table((char *) "reset", 0); //reset rename (usb_mount1, usb_mount0); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL );; wait_dialog(); rename (usb_mount1, usb_mount0); goto cancel_mount2; } } else { dialog_ret=0; mod_mount_table((char *) "reset", 0); //reset ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MVGAME, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } cancel_mount2: use_cache=0; join_copy=0; new_pad=0; dialog_ret=0; goto skip_1; } sprintf(filename, "%s/USRDIR/RELOAD.SELF", menu_list[game_sel].path); if(exist(filename)) { unload_modules(); sys_game_process_exitspawn2((char *) filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(strstr(menu_list[game_sel].path, "/dev_usb")==NULL && ((menu_list[game_sel].user & IS_BDMIRROR) || (menu_list[game_sel].user & IS_USB && !(menu_list[game_sel].user & IS_HDD)) ) ) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_HDD_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit_2; } if(strstr(menu_list[game_sel].path, "/dev_hdd")==NULL && ( (menu_list[game_sel].user & IS_HDD && !(menu_list[game_sel].user & IS_USB)) ) ) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_USB_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit_2; } sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_version(filename); if((menu_list[game_sel].user & IS_PATCHED) && c_firmware==3.41f) pokeq(0x80000000000505d0ULL, memvalnew); char filename2[1024]; sprintf(filename2, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if((menu_list[game_sel].user & IS_DBOOT) || direct_launch_forced) { menu_list[game_sel].user|=IS_DBOOT; set_game_flags(game_sel); write_last_play( filename2, menu_list[game_sel].path, menu_list[game_sel].title, menu_list[game_sel].title_id, 1); char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/TROPDIR", menu_list[game_sel].path); sprintf(s_destination, "%s/TROPDIR", app_usrdir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/TROPDIR", app_homedir); my_game_copy((char*)s_source, (char*)s_destination); sprintf(s_source, "%s/PS3_GAME/LICDIR/LIC.DAT", menu_list[game_sel].path); sprintf(s_destination, "%s/LICDIR", app_homedir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/LICDIR/LIC.DAT", app_homedir); file_copy((char*)s_source, (char*)s_destination, 0); unload_modules(); sprintf(filename2, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); //if(stat("/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN", &s3)>=0) sprintf(filename, "%s", "/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN"); //else if(stat("/app_home/PS3_GAME/USRDIR/EBOOT.BIN", &s3)>=0) sprintf(filename, "%s", "/app_home/PS3_GAME/USRDIR/EBOOT.BIN"); sprintf(fileboot, "%s", menu_list[game_sel].path); if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); else mount_with_ext_data(menu_list[game_sel].path, menu_list[game_sel].user); //syscall_mount(fileboot, mount_bdvd); sys_game_process_exitspawn2((char *) filename2, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } else { write_last_play( filename, menu_list[game_sel].path, menu_list[game_sel].title, menu_list[game_sel].title_id, 0); unload_modules(); sprintf(fileboot, "%s", menu_list[game_sel].path); if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); else mount_with_ext_data(menu_list[game_sel].path, menu_list[game_sel].user);//syscall_mount(fileboot, mount_bdvd); sys_process_exit(1); } } else { if(strstr(menu_list[game_sel].content,"DVD")!=NULL) { sprintf(filename, "DVD-Video disc loaded. Insert any DVD-R disc and play the VOB videos from XMB\xE2\x84\xA2 Video tab.\n\n[%s]",menu_list[game_sel].path); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); syscall_mount( menu_list[game_sel].path, mount_bdvd); ret = unload_modules(); exit(0);//sys_process_exit(1); } if(strstr(menu_list[game_sel].content,"PS2")!=NULL && payload!=0) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Loading game disc, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); reset_mount_points(); uint64_t ret2=0x00ULL; ret2 = syscall_838("/dev_bdvd"); ret2 = syscall_838("/dev_ps2disc"); ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_ps2disc", 0, 1, 0, 0, 0); ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); syscall_mount( menu_list[game_sel].path, mount_bdvd); // ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_SIMPLE", "/dev_ps2disc", 0, 1, 0, 0, 0); // ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_SIMPLE", "/dev_ps2disc1", 0, 1, 0, 0, 0); // ret2 = syscall_837("CELL_FS_IOS:PATA0_BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); if(payload==1) { ret=sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x800])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].compare_addr= 0ULL; // the last entry always 0 strncpy(&open_table.arena[0], "/dev_ps2disc", 0x100); // compare 1 strncpy(&open_table.arena[0x800], menu_list[game_sel].path, 0x800); // replace 1 open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1 open_table.entries[0].replace_len= strlen(&open_table.arena[0x800]); sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); ret=sys8_path_table( dest_table_addr); } if(payload==2) { ret=syscall35((char *)"/dev_ps2disc", (char *)menu_list[game_sel].path); } cellMsgDialogAbort(); sprintf(filename, "PLAYSTATION\xC2\xAE\x32 game disc loaded!\n\n[%s]\n\n(experimental)",menu_list[game_sel].path); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); ret = unload_modules(); sys_process_exit(1); } else { if(strstr(menu_list[game_sel].path,"/pvd_usb")!=NULL) sprintf(string1, "::: %s :::\n\nYou can't load games from selected device!", menu_list[game_sel].title); else sprintf(string1, "::: %s :::\n\n%s not found", menu_list[game_sel].title, filename); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } } } } cancel_exit_2: skip_1: skip_to_FM: if((new_pad & BUTTON_SQUARE) && cover_mode==8 && (xmb_icon==4 || (xmb_icon==6 || xmb_icon==8)) && !is_retro_loading && !is_game_loading &&!is_video_loading) { // grouping bool use_ab= (old_pad & BUTTON_SELECT) || xmb_icon==4; u8 main_group=xmb[xmb_icon].group & 0x0f; u8 alpha_group=xmb[xmb_icon].group>>4 & 0x0f; if(use_ab) alpha_group++; else main_group++; //alpha_group&=0x0f; if(alpha_group>14) alpha_group=0; main_group&=0x0f; if(xmb_icon==8) { if(main_group>5) main_group=0; if(main_group) { read_xmb_column_type(8, main_group+7, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", retro_groups[main_group], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", retro_groups[main_group]); } else { read_xmb_column(8, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", xmb_columns[8], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", xmb_columns[8]); } redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); xmb[8].member[0].data=-1; xmb[8].member[0].status=2; xmb[8].member[0].icon=xmb[0].data; sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size) xmb[8].first=1; } else if(xmb_icon==4) { read_xmb_column(4, alpha_group); if(alpha_group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[alpha_group]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); sort_xmb_col(xmb[4].member, xmb[4].size, 0); } else if(xmb_icon==6 || xmb_icon==7) // game/faves { xmb[6].init=0; xmb[7].init=0; xmb[xmb_icon].group= (alpha_group<<4) | (main_group); add_game_column(menu_list, max_menu_list, game_sel, 0); if(main_group) { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", genre[(xmb[6].group&0xf)], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", genre[(xmb[6].group&0xf)]); } else { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", xmb_columns[6], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", xmb_columns[6]); } redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); } xmb[xmb_icon].group= (alpha_group<<4) | (main_group); free_text_buffers(); xmb_bg_counter=200; xmb_bg_show=0; new_pad=0; } if((new_pad & BUTTON_SQUARE) && cover_mode==8) {egg=1-egg; use_drops=(egg==1);} if ( ( ((new_pad & BUTTON_SQUARE) && cover_mode!=5 && cover_mode!=8) || ((new_pad & BUTTON_TRIANGLE) && cover_mode==8)) && game_sel<max_menu_list && max_menu_list>0 && (cover_mode!=8 || (cover_mode==8 && ( (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==1 && xmb[xmb_icon].size>1) || (xmb_icon==5 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==2) || (xmb_icon==7 && xmb[xmb_icon].size)))) ) { new_pad=0; if(cover_mode==4) { sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920);} int ret_f=open_submenu(text_bmp, &game_sel); old_fi=-1; if(ret_f) {slide_screen_left(text_FONT);memset(text_bmp, 0, FB(1));} if(cover_mode==8 || cover_mode==4) { {xmb[6].init=0; xmb[7].init=0;}init_xmb_icons(menu_list, max_menu_list, game_sel );} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(ret_f==1 && disable_options!=2 && disable_options!=3) goto copy_title; if(ret_f==2 && disable_options!=1 && disable_options!=3) goto delete_title; if(ret_f==3) goto rename_title; if(ret_f==4) goto update_title; if(ret_f==5) goto test_title; if(ret_f==6) goto setperm_title; if(ret_f==7) goto start_title; goto force_reload; } if ( new_pad & BUTTON_CIRCLE && cover_mode!=5 && cover_mode!=8 && net_used_ignore()) { new_pad=0; c_opacity_delta=16; dimc=0; dim=1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_QUIT1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { reset_mount_points(); char list_file2[128]; int i; sprintf(list_file2, "%s/LLIST.TXT", app_usrdir); FILE *flist; remove(list_file2); flist = fopen(list_file2, "w"); sprintf(filename, "%s", "\xEF\xBB\xBF"); fputs (filename, flist ); for(i=0;i<max_menu_list;i++) { sprintf(filename, "[%s] %s\r\n", menu_list[i].title_id, menu_list[i].title); fputs (filename, flist ); sprintf(filename, " --> %s\r\n", menu_list[i].path); fputs (filename, flist ); sprintf(filename, "%s", "\r\n"); fputs (filename, flist ); } fclose(flist); unload_modules(); sys_process_exit(1); break; } } ClearSurface(); c_opacity2=c_opacity; if(c_opacity2>0xc0) c_opacity2=0xc0; if(c_opacity2<0x21) c_opacity2=0x00; //mouse pointer if(cover_mode==5) { mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } if(!no_video) { if(game_sel>=0 && (((mode_list==0) /*&& max_menu_list>0*/)) ) // && png_w!=0 && png_h!=0 { if(cover_mode==0 && max_menu_list>0) { set_texture( text_bmpS, 320, 320); //ICON0.PNG if(offX<0 || offY<0 || offX>31 || offY>31 || animation==0 || animation==2) {offX=0; offY=0;} if(animation==0 || animation==2) incZ=0; {offX=0; offY=0; incZ=0;} offY+=(float)(incZ*0.5625f); offX+=incZ; if(offX>30) {incZ=-0.25f;};if(offX<1) {incZ=0.25f;}; display_img((int)(1440-offX), (int)(80-offY), 320+(int)(offX*2.0f), 176+(int)(offY*2.0f), 320, 176, 0.0f, 320, 320); } if((cover_mode==1 || cover_mode==6 || cover_mode==7) && max_menu_list>0) { set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==2 && max_menu_list>0) { set_texture( text_bmpS, 320, 320); if(offX<0 || offY<0 || offX>31 || animation==0 || animation==2) {offX=0; offY=0;} // offY>31 || if(animation==0 || animation==2) incZ=0; if(cover_available==1) offY+=(float)(incZ*1.1538f); else offY+=(float)(incZ*0.5500f); offX+=incZ; if(offX>30) {incZ=-0.3f;};if(offX<1) {incZ=0.3f;}; if(cover_available==1) display_img((int)(1540-offX), (int)(80-offY), 260+(int)(offX*2.0f), 300+(int)(offY*2.0f), 260, 300, -0.5f, 320, 320); else display_img((int)(1440-offX), (int)(80-offY), 320+(int)(offX*2.0f), 176+(int)(offY*2.0f), 320, 176, -0.5f, 320, 320); set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==3 && max_menu_list>0) { if(cover_available==1) { set_texture( text_bmpS, 320, 320); //cover display_img(1602, 80, 260, 300, 260, 300, 0.0f, 320, 320); } if(game_bg_overlay==1) { set_texture( text_bmp, 1920, 1080); //PIC1.PNG incZ=64; offX+=incZ; if(offX>0 || animation==0 || animation==1) {incZ=0; offX=0;} display_img((int)(offX), 80, 1547, 844, 1920, 1080, 0.0f, 1920, 1080); } set_texture( text_FONT, 1920, 1080); //PICBG.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==4 && max_menu_list>0) { if(!xmb[6].init) init_xmb_icons(menu_list, max_menu_list, game_sel); xmb_icon=6; draw_coverflow_icons(xmb, xmb_icon, xmb_slide_y); } if(cover_mode==8) draw_whole_xmb(0); if(cover_mode==5) { if ( (new_pad & BUTTON_LEFT ) && mouseX>=0.026f ) {mouseX-=0.026f;} if ( (new_pad & BUTTON_RIGHT) && mouseX<=0.974f ) {mouseX+=0.026f;} if ( ((old_pad & BUTTON_R2) || (old_pad & BUTTON_L2)) && (new_pad & BUTTON_UP) ) { state_draw=1; if(mouseX<0.54f) first_left=0; else first_right=0; new_pad=0;}// if ( ((old_pad & BUTTON_R2) || (old_pad & BUTTON_L2)) && (new_pad & BUTTON_DOWN) ) { state_draw=1; if(mouseX<0.54f) first_left=max_dir_l-20; else first_right=max_dir_r-20; new_pad=0;}// if ( ((new_pad & BUTTON_UP) && mouseY>=(0.12f+0.025f) && mouseY<=(0.12f+0.025f+0.026f)) ) { state_draw=1; if(mouseX<0.54f) {first_left-=1; if(first_left>1) {new_pad=0;}} else {first_right-=1; if(first_right>1) {new_pad=0;} } } if ( ((new_pad & BUTTON_DOWN) && mouseY>=(0.614f+0.025f) && mouseY<=(0.614f+0.025f+0.026f)) ) { state_draw=1; if(mouseX<0.54f) {first_left+=1; if(first_left+18<max_dir_l){new_pad=0;} } else {first_right+=1; if(first_right+18<max_dir_r){new_pad=0;} }} if ( (new_pad & BUTTON_UP ) && mouseY>=0.026f ) {mouseY-=0.026f;} if ( (new_pad & BUTTON_DOWN ) && mouseY<=0.974f ) {mouseY+=0.026f;} if ( (new_pad & BUTTON_L2) ) { state_draw=1; if(mouseX<0.54f) first_left-=12; else first_right-=12; new_pad=0;} if ( (new_pad & BUTTON_R2) ) { state_draw=1; if(mouseX<0.54f) first_left+=12; else first_right+=12; new_pad=0;} fm_sel=0x0; if(mouseX>=0.035f+0.025f && mouseX<=0.13f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //games { fm_sel=1; if(((new_pad & BUTTON_CROSS) || (new_pad & BUTTON_CIRCLE))) { load_texture(text_legend, legend, 1665); load_texture(text_bmpUPSR, playBGR, 1920); sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); if ((new_pad & BUTTON_CROSS)) { if(cover_mode==initial_cover_mode) cover_mode=0; else cover_mode=initial_cover_mode; } else cover_mode=4; if(lock_display_mode!=-1) cover_mode=lock_display_mode; cover_mode--; if(cover_mode<0) cover_mode=8; goto next_for_FM; } } if(mouseX>=0.139f+0.025f && mouseX<=0.245f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //update { fm_sel=1<<1; if ((new_pad & BUTTON_CROSS)) { new_pad=0; force_update_check=1; } } //if(c_opacity2>0x00) if(mouseX>=0.525f+0.025f && mouseX<=0.610f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //themes { fm_sel=1<<4; if ((new_pad & BUTTON_CROSS)) { new_pad=0; sprintf(current_right_pane, "%s", themes_dir); state_read=1; state_draw=1; } } float pane_x_l=0.04f+0.025f; float pane_x_r=0.54f; if(first_left>max_dir_l) first_left=0; if(first_right>max_dir_r) first_right=0; if(first_left<0) first_left=0; if(first_right<0) first_right=0; int help_open=0, about_open=0; if(mouseX>=0.41f+0.025f && mouseX<=0.495f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) { help_open=1; //help fm_sel=1<<3; } if(mouseX>=0.275f+0.025f && mouseX<=0.38f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) about_open=1; //about if(c_opacity2==0x00) {help_open=0; about_open=0;} if((help_open || about_open)) { new_pad=0; if(about_open) { fm_sel=1<<2; draw_square((0.250f-0.5f)*2.0f, (0.5f-0.210)*2.0f, 1.0f, 1.0f, -0.2f, 0x10101000); draw_square((0.240f-0.5f)*2.0f, (0.5f-0.200)*2.0f, 1.04f, 1.04f, -0.2f, 0x00080ff40); sprintf(string1, "About multiMAN\n ver %s\n", current_version); cellDbgFontPrintf( 0.43f, 0.25f, 0.7f, 0xa0a0a0a0, string1); cellDbgFontPrintf( 0.28f, 0.44f, 0.7f, 0xa0c0c0c0, " multiMAN is a hobby project, distributed in the\nhope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, " Copyleft (c) 2011"); } if(help_open)// && stat(helpNAV, &s3)<0 && stat(helpMME, &s3)<0) { fm_sel=1<<3; draw_square((0.250f-0.5f)*2.0f, (0.5f-0.210)*2.0f, 1.0f, 1.0f, -0.2f, 0x10101000); draw_square((0.240f-0.5f)*2.0f, (0.5f-0.200)*2.0f, 1.04f, 1.04f, -0.2f, 0x00080ff40); cellDbgFontPrintf( 0.38f, 0.25f, 0.9f, 0xa0a0a0a0, "Navigation and keys"); if(confirm_with_x) { cellDbgFontPrintf( 0.28f, 0.300f, 0.7f, 0xa0c0c0c0, "[D-PAD ] - move mouse in fixed increments\n[STICKS] - move mouse pointer\n\n[O] - Open command menu\n\n[R1] - Switch to next GAMES display mode\n[L1] - Switch to prev GAMES display mode\n[L2] - Page up\n[R2] - Page down"); cellDbgFontPrintf( 0.28f, 0.52f, 0.7f, 0xa0c0c0c0, "[X] - Enter selected folder\n[X] - View image or play music/video file\n\n[R2]+[UP] - Scroll to top of file list\n[R2]+[DOWN] - Scroll to bottom of file list"); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, "[X] - Load device folders in left pane\n[O] - Load device folders in right pane" ); } else { cellDbgFontPrintf( 0.28f, 0.300f, 0.7f, 0xa0c0c0c0, "[D-PAD ] - move mouse in fixed increments\n[STICKS] - move mouse pointer\n\n[X] - Open command menu\n\n[R1] - Switch to next GAMES display mode\n[L1] - Switch to prev GAMES display mode\n[L2] - Page up\n[R2] - Page down"); cellDbgFontPrintf( 0.28f, 0.52f, 0.7f, 0xa0c0c0c0, "[O] - Enter selected folder\n[O] - View image or play music/video file\n\n[R2]+[UP] - Scroll to top of file list\n[R2]+[DOWN] - Scroll to bottom of file list"); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, "[O] - Load device folders in left pane\n[X] - Load device folders in right pane" ); } } } // else { //if(c_opacity2>0x20 && viewer_open==0) { if(state_read) { if(!exist(current_left_pane) && strstr(current_left_pane, "/pvd_usb")==NULL && strstr(current_left_pane, "/ps3_home")==NULL && strstr(current_left_pane, "/net_host")==NULL) {sprintf(current_left_pane,"%s", "/");state_read=1; state_draw=1;} if(!exist(current_right_pane) && strstr(current_right_pane, "/pvd_usb")==NULL && strstr(current_right_pane, "/ps3_home")==NULL && strstr(current_right_pane, "/net_host")==NULL) {sprintf(current_right_pane,"%s","/");state_read=1; state_draw=1;} if(strstr(current_left_pane, "/pvd_usb")!=NULL && !pfs_enabled) {sprintf(current_left_pane,"%s", "/");state_read=1; state_draw=1;} if(strstr(current_right_pane, "/pvd_usb")!=NULL && !pfs_enabled) {sprintf(current_right_pane,"%s", "/");state_read=1; state_draw=1;} if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); } // if(state_read || state_draw) { state_read=0; max_ttf_label=0; draw_dir_pane( pane_l, max_dir_l, first_left, 22-(int)((1080*0.025f)/18.0f+1), pane_x_l); draw_dir_pane( pane_r, max_dir_r, first_right, 22-(int)((1080*0.025f)/18.0f+1), pane_x_r); if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); } if(state_draw || state_read) { if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); if(state_read) { max_ttf_label=0; draw_dir_pane( pane_l, max_dir_l, first_left, 22-(int)((1080*0.025f)/18.0f+1), pane_x_l); draw_dir_pane( pane_r, max_dir_r, first_right, 22-(int)((1080*0.025f)/18.0f+1), pane_x_r); } for(int fsr=0; fsr<V_WIDTH*V_HEIGHT*4; fsr+=4) *(uint32_t*) ((uint8_t*)(text_bmpUPSR)+fsr)=0x32323280; flush_ttf(text_bmpUPSR, V_WIDTH, V_HEIGHT); max_ttf_label=0; sprintf(string1,"[%s]", current_left_pane); string1[56]=0x2e; string1[57]=0x2e; string1[58]=0x5d; string1[59]=0; print_label( 0.04f+0.025f, 0.085f+0.025f, 0.8f, 0xc0c0c0c0, string1, 1.04f, 0.0f, 17); sprintf(string1,"[%s]", current_right_pane); string1[56]=0x2e; string1[57]=0x2e; string1[58]=0x5d; string1[59]=0; print_label( 0.54f, 0.085f+0.025f, 0.8f, 0xc0c0c0c0, string1, 1.04f, 0.0f, 17); flush_ttf(text_bmpUPSR, V_WIDTH, V_HEIGHT); state_draw=0; } max_ttf_label=0; } if ( (ss_timer>=(ss_timeout*60) && ss_timeout) ) screen_saver(); } if ( (new_pad & BUTTON_CROSS) && mouseX>=0.89459375f && mouseX<=0.9195f && mouseY>=0.05222f && mouseY<=0.09666f && net_used_ignore()) { dialog_ret=0; new_pad=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_QUIT1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { reset_mount_points(); unload_modules(); sys_process_exit(1); break; } new_pad=0; } time ( &rawtime ); timeinfo = localtime ( &rawtime ); float y = 0.83f-0.053f; char str[256]; int ok=0, n=0; float len; float x=0.07; char sizer[255]; char path[255]; int xZOOM=0; for(n=0;n<17;n++) { ok=0; if(n==11 && hide_bd==1) continue; if((fdevices>>n) & 1) ok=1; if( ok || n==12 || (n==16 && mount_hdd1==1) ) { switch(n) { case 0: sprintf(str, "HDD"); sprintf(path, "/dev_hdd0"); break; case 16: sprintf(str, "HDD#1"); sprintf(path, "/dev_hdd1"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d", n-1); break; case 11: sprintf(str, "%s", menu_list[0].title); sprintf(path, "/dev_bdvd"); break; case 12: if(cellNetCtlGetInfo(16, &net_info) < 0 || net_avail<0) {str[0]=0; path[0]=0; break;} sprintf(str, "PSX Store"); sprintf(path, "/web"); break; case 13: sprintf(str, "USB disk"); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC card"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, "MS card"); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d", n-1); break; } len=0.03f*(float)(strlen(str)); xZOOM=0; if(mouseX>=x && mouseX<=x+0.05f && mouseY>=y-0.044f && mouseY<=y+0.05) xZOOM=32; if(xZOOM>0) { draw_text_stroke( (x+0.025f)-(float)((0.0094f*(float)(strlen(str)))/2), y-0.115f, 0.75f, 0xffc0c0c0, str); if ( ((old_pad & BUTTON_CROSS) || (old_pad & BUTTON_L3) || (old_pad & BUTTON_CIRCLE) || (old_pad & BUTTON_R3)) && strstr(path, "/web")!=NULL) {new_pad=0; launch_web_browser((char*)"http://www.psxstore.com/");} if ( (old_pad & BUTTON_CROSS)) {state_draw=1; state_read=2; sprintf(current_left_pane, "%s", path); new_pad=0;} if ( (old_pad & BUTTON_CIRCLE)) {state_draw=1; state_read=3; sprintf(current_right_pane, "%s", path); new_pad=0;} } if(n!=11){ if(n!=12 && n!=13) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } if(n==13) { sprintf(sizer, "PFS Drive"); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } } else { sprintf(sizer, "%s", "BD-ROM"); if(strstr(menu_list[0].content, "PS3")!=NULL) sprintf(sizer, "%s", "PS3 Disc"); else if(strstr(menu_list[0].content, "PS2")!=NULL) sprintf(sizer, "%s", "PS2 Disc"); else if(strstr(menu_list[0].content, "DVD")!=NULL) sprintf(sizer, "%s", "DVD Video"); else if(strstr(menu_list[0].content, "AVCHD")!=NULL) sprintf(sizer, "%s", "AVCHD"); else if(strstr(menu_list[0].content, "BDMV")!=NULL) sprintf(sizer, "%s", "Blu-ray"); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } switch(n) { case 0: set_texture( text_HDD, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 16: set_texture( text_HDD, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 7: set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 11: set_texture( text_BLU_1, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 12: if(net_avail < 0) {x-=0.13; str[0]=0; break;} else { sprintf(sizer, "%s", net_info.ip_address); draw_text_stroke( (x+0.025f)-(float)((0.008f*(float)(strlen(sizer)))/2), y+0.046f, 0.65f, COL_LEGEND, sizer); set_texture( text_NET_6, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; } case 13: // set_texture( text_CFC_3, 320, 320); set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 14: set_texture( text_SDC_4, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 15: set_texture( text_MSC_5, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; default: set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; } x+=0.13; } } //sliding background draw_fileman(); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); } //end cover_mode==5 fileman } setRenderColor(); if(status_info[0] && debug_mode) cellDbgFontPrintf( 0.01f, 0.98f, 0.5f,0x60606080, status_info); if(patchmode==1 && (c_opacity2>0x00)) { if(cover_mode<3) cellDbgFontPrintf( 0.78f, 0.03f, 0.7f,0x90909080," USB patch"); else if(cover_mode!=5) cellDbgFontPrintf( 0.85f, 0.03f, 0.7f,0x90909080," USB patch"); } if(mode_list==0) { if(dim==1) c_opacity+=c_opacity_delta; if(c_opacity<0x20) c_opacity=0x20; if(c_opacity>0xff) c_opacity=0xff; if(cover_mode!=8) { draw_device_list(fdevices | ((game_sel>=0 && max_menu_list>0) ? (menu_list[game_sel].flags<<16) : 0), cover_mode, c_opacity2, menu_list[0].content); if(game_sel>=0 && max_menu_list>0) { if(cover_mode==0 || cover_mode==2) { if(cover_mode==0) draw_square(-0.9f, 0.9f, 2.0f-(0.70f-(0*2)), 2.0-0.50f-(2.0*0), 0.7f, 0x2080ff30); draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.2f, 1920, 1080); } else { draw_list( menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, game_sel_last, c_opacity); } } else if(cover_mode!=5 && cover_mode!=8) cellDbgFontPrintf( 0.08f, 0.1f, 1.0f, 0x80808080, "Insert Blu-ray game disc...\n\nPress [TRIANGLE] to access system menu.\nEdit options.ini if necessary!\n\nPress [SELECT]+[START] for File Manager mode."); } } } cellDbgFontDrawGcm(); if(cover_mode==5) draw_mouse_pointer(0); if(!first_launch) flip(); } //end of main loop reset_mount_points(); ret = unload_modules(); sys_process_exit(1); return 0; } //end of main void flip(void) { cellSysutilCheckCallback(); cellDbgFontPrintf( 0.99f, 0.98f, 0.5f,0x10101010, payloadT); cellDbgFontDrawGcm(); cellConsolePoll(); cellGcmResetFlipStatus(); // if(max_ttf_label) flush_ttf((uint8_t*)(color_base_addr)+video_buffer*(c_frame_index), V_WIDTH, V_HEIGHT); cellGcmSetFlip(gCellGcmCurrentContext, frame_index); cellGcmFlush(gCellGcmCurrentContext); setDrawEnv(); setRenderColor(); cellGcmSetWaitFlip(gCellGcmCurrentContext); frame_index = 1- frame_index;// (frame_index+1) & 1; setRenderTarget(); vert_indx=0; // reset the vertex index vert_texture_indx=0; angle+=3.6f; if(angle>=360.f) angle=0.f; /* if(cover_mode==8 && !key_repeat) { if(abs(xmb_slide_y) && abs(xmb_slide_y)<100) sys_timer_usleep( 6673 ); else if(abs(xmb_slide) && abs(xmb_slide)<100) sys_timer_usleep( 6673 ); }*/ } void change_bri(u8 *buffer, int delta, u32 size) { u32 pixel; u32 deltaR; u32 deltaG; u32 deltaB; float delta2=1.0f; //positive increases brightness if(delta<0) delta2=0.f; //negative decreases brightness delta=abs(delta); //size=+/-% for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); deltaR = ((u32)((float)((pixel>>24)&0xff)*(delta2+(float)delta/100.f)));if(deltaR>0xff) deltaR=0xff; deltaG = ((u32)((float)((pixel>>16)&0xff)*(delta2+(float)delta/100.f)));if(deltaG>0xff) deltaG=0xff; deltaB = ((u32)((float)((pixel>> 8)&0xff)*(delta2+(float)delta/100.f)));if(deltaB>0xff) deltaB=0xff; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= deltaR<<24 | deltaG<<16 | deltaB<<8 | pixel&0xff; } } static void png_thread_entry( uint64_t arg ) { (void)arg; is_decoding_png=1; if(init_finished) { int _xmb_icon=arg&0xf; int cn=arg>>8; if(xmb[_xmb_icon].member[cn].status==1) { load_png_texture_th( xmb[_xmb_icon].member[cn].icon, xmb[_xmb_icon].member[cn].icon_path);//, _xmb_icon==8?408:xmb[_xmb_icon].member[cn].iconw); if(png_w_th && png_h_th && ((png_w_th+png_h_th)<=(XMB_THUMB_WIDTH+XMB_THUMB_HEIGHT)) && (xmb[_xmb_icon].member[cn].status==1)) { xmb[_xmb_icon].member[cn].iconw=png_w_th; xmb[_xmb_icon].member[cn].iconh=png_h_th; xmb[_xmb_icon].member[cn].status=2; if(_xmb_icon==7) put_texture_with_alpha_gen( xmb[_xmb_icon].member[cn].icon, xmb_icon_star_small, 32, 32, 32, 320, 283, 5); } else { xmb[_xmb_icon].member[cn].status=2; if(cover_mode==8) { if(_xmb_icon==6) xmb[_xmb_icon].member[cn].icon=xmb[6].data; else if(_xmb_icon==7) xmb[_xmb_icon].member[cn].icon=xmb[7].data; else if(_xmb_icon==5) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else if(_xmb_icon==3) xmb[_xmb_icon].member[cn].icon=xmb_icon_photo; else if(_xmb_icon==8) xmb[_xmb_icon].member[cn].icon=xmb_icon_retro; } else { if(xmb[_xmb_icon].member[cn].type==2) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else xmb[_xmb_icon].member[cn].icon=xmb[6].data; } } } } is_decoding_png=0; sys_ppu_thread_exit(0); } static void jpg_thread_entry( uint64_t arg ) { (void)arg; is_decoding_jpg=1; if(init_finished) { int _xmb_icon=arg&0xf; int cn=arg>>8; if(xmb[_xmb_icon].member[cn].status==1) { scale_icon_h=176; load_jpg_texture_th( xmb[_xmb_icon].member[cn].icon, xmb[_xmb_icon].member[cn].icon_path, xmb[_xmb_icon].member[cn].iconw); if(jpg_w && jpg_h && ((jpg_w+jpg_h)<=(XMB_THUMB_WIDTH+XMB_THUMB_HEIGHT)) && (xmb[_xmb_icon].member[cn].status==1)) { xmb[_xmb_icon].member[cn].iconw=jpg_w; xmb[_xmb_icon].member[cn].iconh=jpg_h; xmb[_xmb_icon].member[cn].status=2; } else { xmb[_xmb_icon].member[cn].status=2; if(_xmb_icon==5) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else if(_xmb_icon==3) xmb[_xmb_icon].member[cn].icon=xmb_icon_photo; else if(_xmb_icon==8) xmb[_xmb_icon].member[cn].icon=xmb_icon_retro; } } } scale_icon_h=0; is_decoding_jpg=0; sys_ppu_thread_exit(0); } void load_jpg_threaded(int _xmb_icon, int cn) { if(is_decoding_jpg) return; is_decoding_jpg=1; sys_ppu_thread_create( &jpgdec_thr_id, jpg_thread_entry, (_xmb_icon | (cn<<8) ), misc_thr_prio-100, app_stack_size, 0, "multiMAN_jpeg" ); } void load_png_threaded(int _xmb_icon, int cn) { if(is_decoding_png) return; is_decoding_png=1; sys_ppu_thread_create( &pngdec_thr_id, png_thread_entry, (_xmb_icon | (cn<<8) ), misc_thr_prio-100, app_stack_size,//misc_thr_prio 0, "multiMAN_png" ); } static void download_thread_entry( uint64_t arg ) { (void)arg; while(init_finished) { for(int n=0;n<MAX_DOWN_LIST;n++) { if(downloads[n].status==1) { downloads[n].status=2; if(!exist(downloads[n].local)) { download_file_th(downloads[n].url, downloads[n].local, 0); } sys_timer_usleep(1000*1000); } sys_timer_usleep(3336); } sys_ppu_thread_yield(); sys_timer_usleep(5000*1000); } sys_ppu_thread_exit( 0 ); } static void misc_thread_entry( uint64_t arg ) { (void)arg; while(init_finished) { if(force_mp3) { if(main_mp3_th(force_mp3_file, 0)) force_mp3=false; else { if(max_mp3!=0) { current_mp3++; if(current_mp3>max_mp3) current_mp3=1; sprintf(force_mp3_file, "%s", mp3_playlist[current_mp3].path); force_mp3=true; } } } sys_timer_usleep(3336); if(cover_mode==8 && is_game_loading && !drawing_xmb && !first_launch) { drawing_xmb=1; xmb_bg_counter=200; xmb_bg_show=0; draw_whole_xmb(xmb_icon); sys_ppu_thread_yield(); } //cellConsolePoll(); sys_ppu_thread_yield(); } sys_ppu_thread_exit( 0 ); }
000kev000-toy
source/multiman.cpp
C++
oos
906,223
#include "hvcall.h" #include "peek_poke.h" int lv1_insert_htab_entry(u64 htab_id, u64 hpte_group, u64 hpte_v, u64 hpte_r, u64 bolted_flag, u64 flags, u64 * hpte_index, u64 * hpte_evicted_v, u64 * hpte_evicted_r) { INSTALL_HVSC_REDIRECT(0x9E); // redirect to hvcall 158 // call lv1_insert_htab_entry u64 ret = 0, ret_hpte_index = 0, ret_hpte_evicted_v = 0, ret_hpte_evicted_r = 0; __asm__ __volatile__("mr %%r3, %4;" "mr %%r4, %5;" "mr %%r5, %6;" "mr %%r6, %7;" "mr %%r7, %8;" "mr %%r8, %9;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;" "mr %2, %%r5;" "mr %3, %%r6;":"=r"(ret), "=r"(ret_hpte_index), "=r"(ret_hpte_evicted_v), "=r"(ret_hpte_evicted_r) :"r"(htab_id), "r"(hpte_group), "r"(hpte_v), "r"(hpte_r), "r"(bolted_flag), "r"(flags) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *hpte_index = ret_hpte_index; *hpte_evicted_v = ret_hpte_evicted_v; *hpte_evicted_r = ret_hpte_evicted_r; return (int)ret; } int lv1_allocate_memory(u64 size, u64 page_size_exp, u64 flags, u64 * addr, u64 * muid) { INSTALL_HVSC_REDIRECT(0x0); // redirect to hvcall 0 // call lv1_allocate_memory u64 ret = 0, ret_addr = 0, ret_muid = 0; __asm__ __volatile__("mr %%r3, %3;" "mr %%r4, %4;" "li %%r5, 0;" "mr %%r6, %5;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;" "mr %2, %%r5;":"=r"(ret), "=r"(ret_addr), "=r"(ret_muid) :"r"(size), "r"(page_size_exp), "r"(flags) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *addr = ret_addr; *muid = ret_muid; return (int)ret; } int lv1_undocumented_function_114(u64 start, u64 page_size, u64 size, u64 * lpar_addr) { INSTALL_HVSC_REDIRECT(0x72); // redirect to hvcall 114 // call lv1_undocumented_function_114 u64 ret = 0, ret_lpar_addr = 0; __asm__ __volatile__("mr %%r3, %2;" "mr %%r4, %3;" "mr %%r5, %4;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;":"=r"(ret), "=r"(ret_lpar_addr) :"r"(start), "r"(page_size), "r"(size) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *lpar_addr = ret_lpar_addr; return (int)ret; } void lv1_undocumented_function_115(u64 lpar_addr) { INSTALL_HVSC_REDIRECT(0x73); // redirect to hvcall 115 // call lv1_undocumented_function_115 __asm__ __volatile__("mr %%r3, %0;" SYSCALL(HVSC_SYSCALL) : // no return registers :"r"(lpar_addr) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); } u64 lv2_alloc(u64 size, u64 pool) { // setup syscall to redirect to alloc func u64 original_syscall_code_1 = lv2_peek(HVSC_SYSCALL_ADDR); u64 original_syscall_code_2 = lv2_peek(HVSC_SYSCALL_ADDR + 8); u64 original_syscall_code_3 = lv2_peek(HVSC_SYSCALL_ADDR + 16); lv2_poke(HVSC_SYSCALL_ADDR, 0x7C0802A67C140378ULL); lv2_poke(HVSC_SYSCALL_ADDR + 8, 0x4BECB6317E80A378ULL); lv2_poke(HVSC_SYSCALL_ADDR + 16, 0x7C0803A64E800020ULL); u64 ret = 0; __asm__ __volatile__("mr %%r3, %1;" "mr %%r4, %2;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;":"=r"(ret) :"r"(size), "r"(pool) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); // restore original syscall code lv2_poke(HVSC_SYSCALL_ADDR, original_syscall_code_1); lv2_poke(HVSC_SYSCALL_ADDR + 8, original_syscall_code_2); lv2_poke(HVSC_SYSCALL_ADDR + 16, original_syscall_code_3); return ret; }
000kev000-toy
source/hvcall.cpp
C++
oos
4,070
.PHONY: mm CELL_MK_DIR = $(CELL_SDK)/samples/mk include $(CELL_MK_DIR)/sdk.makedef.mk CELL_INC_DIR = $(CELL_SDK)/target/include MM = source/ RELEASE = ./release BIN = bin/ NPDRM = /NPDRM_RELEASE MM_REL = multiMAN APPID = BLES80608 CONTENT_ID=MM4PS3-$(APPID)_00-MULTIMANAGER0201 MAKE_SELF_NPDRM = make_self_npdrm PPU_SRCS = $(MM)main.cpp PPU_TARGET = $(MM_REL)_BOOT.elf PPU_OPTIMIZE_LV := -O2 -fno-exceptions PPU_INCDIRS= -Iinclude -I$(CELL_INC_DIR) -I$(CELL_SDK)/target/ppu/include/sysutil -I$(CELL_SDK)/target/ppu/include PPU_LDLIBS += -lpthread -lsysutil_stub all : $(PPU_TARGET) PPU_CFLAGS += -g -O2 -fno-exceptions include $(CELL_MK_DIR)/sdk.target.mk mm : $(PPU_TARGET) @mkdir -p $(BIN) @$(PPU_STRIP) -s $< -o $(OBJS_DIR)/$(PPU_TARGET) @$(MAKE_SELF_NPDRM) ./objs/$(MM_REL)_BOOT.elf $(RELEASE)$(NPDRM)/USRDIR/EBOOT.BIN $(CONTENT_ID) > nul @rm $(PPU_TARGET) $(MAKE) -f makefile.multiman mm
000kev000-toy
makefile
Makefile
oos
950
#ifndef PEEK_POKE_H #define PEEK_POKE_H #include "common.h" u64 lv2_peek(u64 address); void lv2_poke(u64 address, u64 value); void lv2_poke32(u64 address, u32 value); u64 lv1_peek(u64 address); void lv1_poke(u64 address, u64 value); void install_new_poke(); void remove_new_poke(); #endif
000kev000-toy
include/peek_poke.h
C
oos
293
typedef struct MMString { unsigned int m_Len; unsigned char* m_pStr; } MMString __attribute__( ( aligned( 4 ) ) ); extern MMString g_MMString []; #define MM_STRING( ID ) g_MMString[ ID ].m_pStr // *********************************************************************************** #define STR_DEBUG_MODE MM_STRING( 0 ) #define STR_QUIT MM_STRING( 1 ) #define STR_QUIT1 MM_STRING( 2 ) #define STR_RESTART MM_STRING( 3 ) #define STR_WARN_FTP MM_STRING( 4 ) #define STR_WARN_SNES MM_STRING( 5 ) #define STR_WARN_GEN MM_STRING( 6 ) #define STR_WARN_FCEU MM_STRING( 7 ) #define STR_WARN_VBA MM_STRING( 8 ) #define STR_WARN_FBA MM_STRING( 9 ) #define STR_COPY0 MM_STRING( 10 ) #define STR_COPY1 MM_STRING( 11 ) #define STR_COPY2 MM_STRING( 12 ) #define STR_COPY3 MM_STRING( 13 ) #define STR_COPY4 MM_STRING( 14 ) #define STR_COPY5 MM_STRING( 15 ) #define STR_COPY6 MM_STRING( 16 ) #define STR_COPY7 MM_STRING( 17 ) #define STR_COPY8 MM_STRING( 18 ) #define STR_COPY9 MM_STRING( 19 ) #define STR_COPY10 MM_STRING( 20 ) #define STR_COPY11 MM_STRING( 21 ) #define STR_COPY12 MM_STRING( 22 ) #define STR_NETCOPY0 MM_STRING( 23 ) #define STR_NETCOPY1 MM_STRING( 24 ) #define STR_NETCOPY2 MM_STRING( 25 ) #define STR_NETCOPY3 MM_STRING( 26 ) #define STR_NETCOPY4 MM_STRING( 27 ) #define STR_MOVE0 MM_STRING( 28 ) #define STR_MOVE1 MM_STRING( 29 ) #define STR_MOVE2 MM_STRING( 30 ) #define STR_MOVE3 MM_STRING( 31 ) #define STR_MOVE4 MM_STRING( 32 ) #define STR_WARN_INET MM_STRING( 33 ) #define STR_ERR_SRV0 MM_STRING( 34 ) #define STR_ERR_UPD0 MM_STRING( 35 ) #define STR_ERR_UPD1 MM_STRING( 36 ) #define STR_ERR_MNT MM_STRING( 37 ) #define STR_ERR_MVGAME MM_STRING( 38 ) #define STR_ERR_MVAV MM_STRING( 39 ) #define STR_DOWN_UPD MM_STRING( 40 ) #define STR_DOWN_COVER MM_STRING( 41 ) #define STR_DOWN_FILE MM_STRING( 42 ) #define STR_DOWN_THM MM_STRING( 43 ) #define STR_DOWN_MSG0 MM_STRING( 44 ) #define STR_DOWN_MSG1 MM_STRING( 45 ) #define STR_DOWN_MSG2 MM_STRING( 46 ) #define STR_PARAM_VER MM_STRING( 47 ) #define STR_LP_DATA MM_STRING( 48 ) #define STR_SET_ACCESS MM_STRING( 49 ) #define STR_SET_ACCESS1 MM_STRING( 50 ) #define STR_PREPROCESS MM_STRING( 51 ) #define STR_ERR_NOSPACE0 MM_STRING( 52 ) #define STR_ERR_NOSPACE1 MM_STRING( 53 ) #define STR_ERR_NOMEM_WEB MM_STRING( 54 ) #define STR_ERR_NOMEM MM_STRING( 55 ) #define STR_PLEASE_WAIT MM_STRING( 56 ) #define STR_WHATS_NEW MM_STRING( 57 ) #define STR_NEW_VER MM_STRING( 58 ) #define STR_NEW_VER_DL MM_STRING( 59 ) #define STR_NEW_VER_NN MM_STRING( 60 ) #define STR_NEW_VER_USB MM_STRING( 61 ) #define STR_GAME_UPD1 MM_STRING( 62 ) #define STR_GAME_UPD2 MM_STRING( 63 ) #define STR_GAME_UPD3 MM_STRING( 64 ) #define STR_GAME_UPD5 MM_STRING( 65 ) #define STR_GAME_UPD6 MM_STRING( 66 ) #define STR_GAME_UPD7 MM_STRING( 67 ) #define STR_SEL_THEME MM_STRING( 68 ) #define STR_SEL_LANG MM_STRING( 69 ) #define STR_DEL_GAME_CACHE MM_STRING( 70 ) #define STR_FM_GAMES MM_STRING( 71 ) #define STR_FM_UPDATE MM_STRING( 72 ) #define STR_FM_ABOUT MM_STRING( 73 ) #define STR_FM_HELP MM_STRING( 74 ) #define STR_FM_THEMES MM_STRING( 75 ) #define STR_CM_MULDIR MM_STRING( 76 ) #define STR_CM_MULFILE MM_STRING( 77 ) #define STR_CM_COPY MM_STRING( 78 ) #define STR_CM_MOVE MM_STRING( 79 ) #define STR_CM_RENAME MM_STRING( 80 ) #define STR_CM_DELETE MM_STRING( 81 ) #define STR_CM_SHORTCUT MM_STRING( 82 ) #define STR_CM_SHADOWPKG MM_STRING( 83 ) #define STR_CM_BDMIRROR MM_STRING( 84 ) #define STR_CM_NETHOST MM_STRING( 85 ) #define STR_CM_HEXVIEW MM_STRING( 86 ) #define STR_CM_PROPS MM_STRING( 87 ) #define STR_CM_NEWDIR MM_STRING( 88 ) #define STR_APPLY_THEME MM_STRING( 89 ) // System Settings Menu #define STR_MM_UPDATE MM_STRING( 90 ) #define STR_MM_UPDATE_L1 MM_STRING( 91 ) #define STR_MM_UPDATE_L2 MM_STRING( 92 ) #define STR_MM_UPDATE_L3 MM_STRING( 93 ) #define STR_MM_UPDATE_L4 MM_STRING( 94 ) #define STR_MM_REFRESH MM_STRING( 95 ) #define STR_MM_REFRESH_L1 MM_STRING( 96 ) #define STR_MM_REFRESH_L2 MM_STRING( 97 ) #define STR_MM_REFRESH_L3 MM_STRING( 98 ) #define STR_MM_REFRESH_L4 MM_STRING( 99 ) #define STR_MM_FILEMAN MM_STRING( 100 ) #define STR_MM_FILEMAN_L1 MM_STRING( 101 ) #define STR_MM_FILEMAN_L2 MM_STRING( 102 ) #define STR_MM_FILEMAN_L3 MM_STRING( 103 ) #define STR_MM_FILEMAN_L4 MM_STRING( 104 ) #define STR_MM_SHOW_ST MM_STRING( 105 ) #define STR_MM_SHOW_ST_L1 MM_STRING( 106 ) #define STR_MM_SHOW_ST_L2 MM_STRING( 107 ) #define STR_MM_SHOW_ST_L3 MM_STRING( 108 ) #define STR_MM_SHOW_ST_L4 MM_STRING( 109 ) #define STR_MM_NTFS MM_STRING( 110 ) #define STR_MM_NTFS_L1 MM_STRING( 111 ) #define STR_MM_NTFS_L2 MM_STRING( 112 ) #define STR_MM_NTFS_L3 MM_STRING( 113 ) #define STR_MM_NTFS_L4 MM_STRING( 114 ) #define STR_MM_SHOW_LK MM_STRING( 115 ) #define STR_MM_SHOW_LK_L1 MM_STRING( 116 ) #define STR_MM_SHOW_LK_L2 MM_STRING( 117 ) #define STR_MM_SHOW_LK_L3 MM_STRING( 118 ) #define STR_MM_SHOW_LK_L4 MM_STRING( 119 ) #define STR_MM_SCRSHOT MM_STRING( 120 ) #define STR_MM_SCRSHOT_L1 MM_STRING( 121 ) #define STR_MM_SCRSHOT_L2 MM_STRING( 122 ) #define STR_MM_SCRSHOT_L3 MM_STRING( 123 ) #define STR_MM_SCRSHOT_L4 MM_STRING( 124 ) #define STR_MM_SCRSAVE MM_STRING( 125 ) #define STR_MM_SCRSAVE_L1 MM_STRING( 126 ) #define STR_MM_SCRSAVE_L2 MM_STRING( 127 ) #define STR_MM_SCRSAVE_L3 MM_STRING( 128 ) #define STR_MM_SCRSAVE_L4 MM_STRING( 129 ) #define STR_MM_RESTART MM_STRING( 130 ) #define STR_MM_RESTART_L1 MM_STRING( 131 ) #define STR_MM_RESTART_L2 MM_STRING( 132 ) #define STR_MM_RESTART_L3 MM_STRING( 133 ) #define STR_MM_RESTART_L4 MM_STRING( 134 ) #define STR_MM_SETUP MM_STRING( 135 ) #define STR_MM_SETUP_L1 MM_STRING( 136 ) #define STR_MM_SETUP_L2 MM_STRING( 137 ) #define STR_MM_SETUP_L3 MM_STRING( 138 ) #define STR_MM_SETUP_L4 MM_STRING( 139 ) #define STR_MM_QUIT MM_STRING( 140 ) #define STR_MM_QUIT_L1 MM_STRING( 141 ) #define STR_MM_QUIT_L2 MM_STRING( 142 ) #define STR_MM_QUIT_L3 MM_STRING( 143 ) #define STR_MM_QUIT_L4 MM_STRING( 144 ) #define STR_MM_HELP MM_STRING( 145 ) #define STR_MM_HELP_L1 MM_STRING( 146 ) #define STR_MM_HELP_L2 MM_STRING( 147 ) #define STR_MM_HELP_L3 MM_STRING( 148 ) #define STR_MM_HELP_L4 MM_STRING( 149 ) // Button labels #define STR_BUT_NAV MM_STRING( 150 ) #define STR_BUT_SELECT MM_STRING( 151 ) #define STR_BUT_BACK MM_STRING( 152 ) #define STR_BUT_CANCEL MM_STRING( 153 ) #define STR_BUT_APPLY MM_STRING( 154 ) #define STR_BUT_CONFIRM MM_STRING( 155 ) #define STR_BUT_GENRE MM_STRING( 156 ) #define STR_BUT_DOWNLOAD MM_STRING( 157 ) #define STR_BUT_LOAD MM_STRING( 158 ) #define STR_BUT_PREV MM_STRING( 159 ) #define STR_BUT_NEXT MM_STRING( 160 ) #define STR_BUT_LAST MM_STRING( 161 ) #define STR_BUT_FIRST MM_STRING( 162 ) #define STR_SEL_GENRE MM_STRING( 163 ) #define STR_BUT_DOWN_THM MM_STRING( 164 ) // Game Settings Menu #define STR_GM_COPY MM_STRING( 165 ) #define STR_GM_COPY_L1 MM_STRING( 166 ) #define STR_GM_COPY_L2 MM_STRING( 167 ) #define STR_GM_COPY_L3 MM_STRING( 168 ) #define STR_GM_DELETE MM_STRING( 169 ) #define STR_GM_DELETE_L1 MM_STRING( 170 ) #define STR_GM_DELETE_L2 MM_STRING( 171 ) #define STR_GM_DELETE_L3 MM_STRING( 172 ) #define STR_GM_RENAME MM_STRING( 173 ) #define STR_GM_RENAME_L1 MM_STRING( 174 ) #define STR_GM_RENAME_L2 MM_STRING( 175 ) #define STR_GM_RENAME_L3 MM_STRING( 176 ) #define STR_GM_UPDATE MM_STRING( 177 ) #define STR_GM_UPDATE_L1 MM_STRING( 178 ) #define STR_GM_UPDATE_L2 MM_STRING( 179 ) #define STR_GM_UPDATE_L3 MM_STRING( 180 ) #define STR_GM_TEST MM_STRING( 181 ) #define STR_GM_TEST_L1 MM_STRING( 182 ) #define STR_GM_TEST_L2 MM_STRING( 183 ) #define STR_GM_TEST_L3 MM_STRING( 184 ) #define STR_GM_PERM MM_STRING( 185 ) #define STR_GM_PERM_L1 MM_STRING( 186 ) #define STR_GM_PERM_L2 MM_STRING( 187 ) #define STR_GM_PERM_L3 MM_STRING( 188 ) //XMMB Context Info pop-up #define STR_POP_GS MM_STRING( 189 ) #define STR_POP_CHANGE_S MM_STRING( 190 ) #define STR_POP_VIEW_SYSINF MM_STRING( 191 ) #define STR_POP_LANGUAGE MM_STRING( 192 ) #define STR_POP_CACHE MM_STRING( 193 ) #define STR_POP_PHOTO MM_STRING( 194 ) #define STR_POP_MUSIC MM_STRING( 195 ) #define STR_POP_ST MM_STRING( 196 ) #define STR_POP_VIDEO MM_STRING( 197 ) #define STR_POP_REF_GAMES MM_STRING( 198 ) #define STR_POP_REF_ROMS MM_STRING( 199 ) #define STR_POP_ROM MM_STRING( 200 ) // MP3 Info pop-up #define STR_POP_GRP_GENRE MM_STRING( 201 ) #define STR_POP_GRP_EMU MM_STRING( 202 ) #define STR_POP_GRP_NAME MM_STRING( 203 ) #define STR_POP_SWITCH MM_STRING( 204 ) #define STR_POP_1OF1 MM_STRING( 205 ) #define STR_POP_PLAYING MM_STRING( 206 ) #define STR_POP_PAUSED MM_STRING( 207 ) #define STR_POP_VOL MM_STRING( 208 ) #define STR_OTHER MM_STRING( 209 ) // Genres #define STR_GEN_OTHER MM_STRING( 210 ) #define STR_GEN_ACT MM_STRING( 210 ) #define STR_GEN_ADV MM_STRING( 212 ) #define STR_GEN_FAM MM_STRING( 213 ) #define STR_GEN_FIGHT MM_STRING( 214 ) #define STR_GEN_PARTY MM_STRING( 215 ) #define STR_GEN_PLAT MM_STRING( 216 ) #define STR_GEN_PUZZ MM_STRING( 217 ) #define STR_GEN_ROLE MM_STRING( 218 ) #define STR_GEN_RACE MM_STRING( 219 ) #define STR_GEN_SHOOT MM_STRING( 220 ) #define STR_GEN_SIM MM_STRING( 221 ) #define STR_GEN_SPORT MM_STRING( 222 ) #define STR_GEN_STRAT MM_STRING( 223 ) #define STR_GEN_TRIV MM_STRING( 224 ) #define STR_GEN_3D MM_STRING( 225 ) // Retro Groups #define STR_GRP_RETRO MM_STRING( 226 ) #define STR_GRP_SNES MM_STRING( 227 ) #define STR_GRP_FCEU MM_STRING( 228 ) #define STR_GRP_VBA MM_STRING( 229 ) #define STR_GRP_GEN MM_STRING( 230 ) #define STR_GRP_FBA MM_STRING( 231 ) // XMMB Column Names #define STR_XC_SET MM_STRING( 232 ) #define STR_XC_PHO MM_STRING( 233 ) #define STR_XC_MUS MM_STRING( 234 ) #define STR_XC_VID MM_STRING( 235 ) #define STR_XC_GAM MM_STRING( 236 ) #define STR_XC_FAV MM_STRING( 237 ) #define STR_XC_WEB MM_STRING( 238 ) #define STR_PS2DISC MM_STRING( 239 ) #define STR_PKGXMB MM_STRING( 240 ) #define STR_NOSPLIT1 MM_STRING( 241 ) #define STR_NOSPLIT2 MM_STRING( 242 ) #define STR_NOSPLIT3 MM_STRING( 243 ) #define STR_VERIFYING MM_STRING( 244 ) #define STR_CANCELED MM_STRING( 245 ) #define STR_NOTSUPPORTED MM_STRING( 246 ) #define STR_NOTSUPPORTED2 MM_STRING( 247 ) #define STR_PS3DISC MM_STRING( 248 ) #define STR_INSTALL_THEME MM_STRING( 249 ) #define STR_TO_DBOOT MM_STRING( 250 ) #define STR_DL_ST MM_STRING( 251 ) #define STR_START_BD1 MM_STRING( 252 ) #define STR_START_BD2 MM_STRING( 253 ) #define STR_OVERWRITE MM_STRING( 254 ) #define STR_INCOMPLETE MM_STRING( 255 ) #define STR_ERR_BDEMU1 MM_STRING( 256 ) #define STR_ERR_BDEMU2 MM_STRING( 257 ) #define STR_ERR_BDEMU3 MM_STRING( 258 ) #define STR_CRITICAL MM_STRING( 259 ) #define STR_DEL_FILE MM_STRING( 260 ) #define STR_DEL_FILES MM_STRING( 261 ) #define STR_DEL_DIR MM_STRING( 262 ) #define STR_DEL_DIRS MM_STRING( 263 ) #define STR_DEL_TITLE_HDD MM_STRING( 264 ) #define STR_DEL_TITLE_USB MM_STRING( 265 ) #define STR_DEL_GCACHE MM_STRING( 266 ) #define STR_COPY_HDD2USB MM_STRING( 267 ) #define STR_COPY_USB2HDD MM_STRING( 268 ) #define STR_COPY_PFS2HDD MM_STRING( 269 ) #define STR_COPY_USB2USB MM_STRING( 270 ) #define STR_TITLE_EXISTS MM_STRING( 271 ) #define STR_DEL_PART_HDD MM_STRING( 272 ) #define STR_DEL_PART_USB MM_STRING( 273 ) #define STR_DEL_CACHE_DONE MM_STRING( 274 ) #define STR_COPY_BD2HDD MM_STRING( 275 ) #define STR_COPY_BD2USB MM_STRING( 276 ) #define STR_GAME_PIN MM_STRING( 277 ) #define STR_PIN_ERR MM_STRING( 278 ) #define STR_PIN_ENTER MM_STRING( 279 ) #define STR_PIN_NEW MM_STRING( 280 ) #define STR_PIN_ERR2 MM_STRING( 281 ) #define STR_BD2AVCHD MM_STRING( 282 ) #define STR_BD2AVCHD2 MM_STRING( 283 ) #define STR_ACT_AVCHD MM_STRING( 284 ) #define STR_ACT_AVCHD2 MM_STRING( 285 ) #define STR_BD2AVCHD3 MM_STRING( 286 ) #define STR_ACT_BDMV MM_STRING( 287 ) #define STR_ATT_USB MM_STRING( 288 ) #define STR_ATT_USB2 MM_STRING( 289 ) #define STR_CACHE_FILE MM_STRING( 290 ) #define STR_HDD_ERR MM_STRING( 291 ) #define STR_USB_ERR MM_STRING( 292 ) #define STR_TITLE_LOCKED MM_STRING( 293 ) #define STR_TITLE_RO MM_STRING( 294 ) #define STR_RENAMETO MM_STRING( 295 ) #define STR_CREATENEW MM_STRING( 296 ) #define STR_XC1_UPDATE MM_STRING( 297 ) #define STR_XC1_UPDATE1 MM_STRING( 298 ) #define STR_XC1_FILEMAN MM_STRING( 299 ) #define STR_XC1_FILEMAN0 MM_STRING( 300 ) #define STR_XC1_FILEMAN1 MM_STRING( 301 ) #define STR_XC1_REFRESH MM_STRING( 302 ) #define STR_XC1_REFRESH1 MM_STRING( 303 ) #define STR_XC1_REFRESH2 MM_STRING( 304 ) #define STR_XC1_REFRESH3 MM_STRING( 305 ) #define STR_XC1_PFS MM_STRING( 306 ) #define STR_XC1_PFS1 MM_STRING( 307 ) #define STR_XC1_SS MM_STRING( 308 ) #define STR_XC1_SS1 MM_STRING( 309 ) #define STR_XC1_THEMES MM_STRING( 310 ) #define STR_XC1_THEMES1 MM_STRING( 311 ) #define STR_XC1_HELP MM_STRING( 312 ) #define STR_XC1_HELP1 MM_STRING( 313 ) #define STR_XC1_RESTART MM_STRING( 314 ) #define STR_XC1_RESTART1 MM_STRING( 315 ) #define STR_XC1_QUIT MM_STRING( 316 ) #define STR_XC1_QUIT1 MM_STRING( 317 ) #define STR_XC5_LINK MM_STRING( 318 ) #define STR_XC5_LINK1 MM_STRING( 319 ) #define STR_XC5_ST MM_STRING( 320 ) #define STR_XC5_ST1 MM_STRING( 321 ) #define STR_XC2_SI MM_STRING( 322 ) #define STR_XC2_SI1 MM_STRING( 323 ) #define STR_XC2_IL MM_STRING( 324 ) #define STR_XC2_IL1 MM_STRING( 325 ) #define STR_XC2_GC MM_STRING( 326 ) #define STR_XC2_GC1 MM_STRING( 327 ) #define STR_LAST_ID 328 // *********************************************************************************** #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ int MM_LocaleInit ( char *lang_file ); void MM_LocaleSet ( bool mm_language ); #ifdef __cplusplus } #endif /* __cplusplus */
000kev000-toy
include/language.h
C
oos
14,499
#ifndef H_COMMON #define H_COMMON #define MAXPATHLEN 1024 #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <psl1ght/lv2.h> #define HVSC_SYSCALL 811 // which syscall to overwrite with hvsc redirect #define HVSC_SYSCALL_ADDR 0x8000000000195540ULL // where above syscall is in lv2 #define NEW_POKE_SYSCALL 813 // which syscall to overwrite with new poke #define NEW_POKE_SYSCALL_ADDR 0x8000000000195A68ULL // where above syscall is in lv2 #define SYSCALL_TABLE 0x8000000000346570ULL #define SYSCALL_PTR(n) (SYSCALL_TABLE + 8 * (n)) #define HV_BASE 0x8000000014000000ULL // where in lv2 to map lv1 #define HV_SIZE 0x001000 // 0x1000 (we need 4k from lv1 only) #define HV_PAGE_SIZE 0x0c // 4k = 0x1000 (1 << 0x0c) #define HV_START_OFFSET 0x363000 // remove lv2 protection #define HV_OFFSET 0x000a78 // at address 0x363a78 #endif
000kev000-toy
include/common.h
C
oos
961
#ifndef INCLUDED_FONTS_H #ifdef __cplusplus extern "C" { #endif #include <cell/sysmodule.h> #include <cell/font.h> #include <cell/fontFT.h> #define FONT_FILE_CACHE_SIZE (2*1024*1024) //1MB #define SYSTEM_FONT_MAX (10) #define USER_FONT_MAX (32-SYSTEM_FONT_MAX) enum { FONT_SYSTEM_FONT0 = 0, FONT_SYSTEM_GOTHIC_LATIN, FONT_SYSTEM_GOTHIC_JP, FONT_SYSTEM_SANS_SERIF, FONT_SYSTEM_SERIF, FONT_SYSTEM_5, FONT_SYSTEM_6, FONT_SYSTEM_7, FONT_SYSTEM_8, FONT_SYSTEM_9, FONT_USER_FONT0 = SYSTEM_FONT_MAX }FontEnum; #define FONT_ENABLE_BIT(n) (1<<(n)) typedef struct { int sysFontMax; CellFont SystemFont[ SYSTEM_FONT_MAX ]; int userFontMax; CellFont UserFont[ USER_FONT_MAX ]; uint32_t openState; } Fonts_t; int Fonts_LoadModules( void ); Fonts_t* Fonts_Init( void ); int Fonts_InitLibraryFreeType( const CellFontLibrary** ); int Fonts_CreateRenderer( const CellFontLibrary*, uint32_t initSize, CellFontRenderer* ); int Fonts_OpenFonts( const CellFontLibrary*, Fonts_t*, char *app_usrdir ); int Fonts_GetFontsHorizontalLayout( Fonts_t*, uint32_t fontmask, float scale, float* lineHeight, float*baseLineY ); int Fonts_AttachFont( Fonts_t* fonts, int fontEnum, CellFont*cf ); int Fonts_SetFontScale( CellFont* cf, float scale ); int Fonts_SetFontEffectWeight( CellFont* cf, float effWeight ); int Fonts_SetFontEffectSlant( CellFont* cf, float effSlant ); int Fonts_GetFontHorizontalLayout( CellFont* cf, float* lineHeight, float*baseLineY ); int Fonts_GetFontVerticalLayout( CellFont* cf, float* lineWidth, float*baseLineX ); float Fonts_GetPropTextWidth( CellFont*, uint8_t* utf8, float xScale, float yScale, float slant, float between, float* strWidth, uint32_t* count ); float Fonts_GetVerticalTextHeight( CellFont*, uint8_t* utf8, float w, float h, float between, float* strHeight, uint32_t* count ); float Fonts_GetTextRescale( float scale, float w, float newW, float*ratio ); float Fonts_GetPropTextWidthRescale( float scale, float w, float newW, float*ratio ); float Fonts_GetVerticalTextHeightRescale( float scale, float h, float newH, float*ratio ); int Fonts_BindRenderer( CellFont*, CellFontRenderer* rend ); float Fonts_RenderPropText( CellFont*, CellFontRenderSurface* surf, float x, float y, uint8_t* utf8, float xScale, float yScale, float slant, float between, int32_t _color ); float Fonts_RenderVerticalText( CellFont* cf, CellFontRenderSurface* surf, float x, float y, uint8_t* utf8, float xScale, float yScale, float slant, float between ); int Fonts_UnbindRenderer( CellFont* ); int Fonts_DetachFont( CellFont*cf ); int Fonts_CloseFonts( Fonts_t* ); int Fonts_DestroyRenderer( CellFontRenderer* rend ); int Fonts_EndLibrary( const CellFontLibrary* lib ); int Fonts_End( void ); void Fonts_UnloadModules( void ); void Fonts_PrintError( const char*mess, int d ); #ifdef __cplusplus } #endif #define INCLUDED_FONTS_H #endif
000kev000-toy
include/fonts.h
C
oos
3,249
#ifndef MM_H #define MM_H #include "common.h" int mm_insert_htab_entry(u64 va_addr, u64 lpar_addr, u64 prot, u64 *index); int mm_map_lpar_memory_region(u64 lpar_start_addr, u64 ea_start_addr, u64 size, u64 page_shift, u64 prot); #endif
000kev000-toy
include/mm.h
C
oos
240
#ifndef _PFSM_H_ #define _PFSM_H_ /* * path to device must be in format '/pvd_usbXXX' where XXX represents volume ID * pvd = Playstation Virtual Device * example: '/pvd_usb000/DIR/FILE' */ #define PFSM_DEVPATH "/pvd_usb" #define PFSM_DEVNAME_SIZE 15 /* "PFSM_VVVV:PPPP" */ #define PFS_FILE_INVALID NULL #define PFS_FIND_INVALID NULL #define PFS_FILE_SEEK_BEGIN 0 #define PFS_FILE_SEEK_CURRENT 1 #define PFS_FILE_SEEK_END 2 #define PFS_FIND_DIR 0x10 #define PFS_FIND_META 0x80000000 typedef struct _PFSM_DEVICE { char Name[PFSM_DEVNAME_SIZE]; } PFSM_DEVICE; #ifndef PFS_INTERNALS typedef void * PFS_HFILE; typedef void * PFS_HFIND; typedef void * PFS_HSTREAM; #endif typedef struct _PFS_INFO_DATA { uint32_t FileAttributes; uint64_t CreationTime; uint64_t LastAccessTime; uint64_t LastWriteTime; uint64_t FileSize; uint32_t NumberOfLinks; uint64_t FileIndex; } PFS_INFO_DATA; typedef struct _PFS_FIND_DATA { uint32_t FileAttributes; uint64_t CreationTime; uint64_t LastAccessTime; uint64_t LastWriteTime; uint64_t FileSize; char * FileName; } PFS_FIND_DATA; typedef struct _PFS_STREAM_DATA { uint64_t StreamSize; char * StreamName; } PFS_STREAM_DATA; #ifdef __cplusplus extern "C" { #endif int32_t PfsmInit(int32_t max_volumes); void PfsmUninit(void); int32_t PfsmDevAdd(uint16_t vid, uint16_t pid, PFSM_DEVICE *dev); int32_t PfsmDevDel(PFSM_DEVICE *dev); int32_t PfsmVolStat(int32_t vol_id); PFS_HFILE PfsFileOpen(const char *path); int32_t PfsFileRead(PFS_HFILE file, void *buffer, uint32_t size, uint32_t *read); int32_t PfsFileSeek(PFS_HFILE file, int64_t distance, uint32_t move_method); int32_t PfsFileGetSize(const char *path, uint64_t *size); int32_t PfsFileGetSizeFromHandle(PFS_HFILE file, uint64_t *size); int32_t PfsFileGetInfo(PFS_HFILE file, PFS_INFO_DATA *info); void PfsFileClose(PFS_HFILE file); PFS_HFIND PfsFileFindFirst(const char *path, PFS_FIND_DATA *find_data); int32_t PfsFileFindNext(PFS_HFIND find, PFS_FIND_DATA *find_data); void PfsFileFindClose(PFS_HFIND find); PFS_HSTREAM PfsStreamFindFirst(const char *path, PFS_STREAM_DATA *stream_data); int32_t PfsStreamFindNext(PFS_HSTREAM stream, PFS_STREAM_DATA *stream_data); void PfsStreamClose(PFS_HSTREAM stream); #ifdef __cplusplus } /* closing brace for extern "C" */ #endif #endif
000kev000-toy
include/libpfsm.h
C
oos
2,329
#include <cell/gcm.h> #include <cell/dbgfont.h> typedef unsigned int u32; typedef unsigned short u16; typedef unsigned char u8; #define CONSOLE_WIDTH (76+16) #define CONSOLE_HEIGHT (31) #define DISPLAY_WIDTH 1920 #define DISPLAY_HEIGHT 1080 typedef struct { unsigned flags; char title[64]; char title_id[64]; char path[768]; char entry[64]; char content[8]; //PS2 PS3 AVCHD char details[128]; //load AVCHD details from details.txt int split; int plevel; int cover; u32 user; //user options flag // u8 selected; } t_menu_list; extern u32 COL_PS3DISC; extern u32 COL_PS3DISCSEL; extern u32 COL_SEL; extern u32 COL_PS3; extern u32 COL_PS2; extern u32 COL_DVD; extern u32 COL_BDMV; extern u32 COL_AVCHD; extern u32 COL_LEGEND; extern u32 COL_FMFILE; extern u32 COL_FMDIR; extern u32 COL_FMJPG; extern u32 COL_FMMP3; extern u32 COL_FMEXE; extern u32 COL_HEXVIEW; extern u32 COL_SPLIT; extern float c_firmware; extern uint32_t blockSize; extern uint64_t freeSize; extern uint64_t freeSpace; extern char bluray_game[64]; extern float angle; //extern int cover_mode; //extern unsigned icon_raw[8192]; void put_vertex(float x, float y, float z, u32 color); void put_texture_vertex(float x, float y, float z, float tx, float ty); void draw_square(float x, float y, float w, float h, float z, u32 rgba); void draw_square_angle(float x, float y, float w, float h, float z, u32 color, float angle); void draw_triangle(float x, float y, float w, float h, float z, u32 rgba); void utf8_to_ansi(char *utf8, char *ansi, int len); int set_texture( u8 *buffer, u32 x_size, u32 y_size ); void display_img(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty); void display_img_nr(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty); void display_img_angle(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, float angle); void display_img_persp(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, int keystoneL, int keystoneR); void draw_device_list(u32 flags, int cover_mode, int opaq, char *content); int initConsole(); int termConsole(); int initFont(void); int termFont(void); int initDisplay(void); int setRenderObject(void); void setRenderColor(void); void setRenderTarget(void); void initShader(void); void setDrawEnv(void); void draw_list( t_menu_list *menu, int menu_size, int selected, int dir_mode, int display_mode, int cover_mode, int game_sel_last, int opaq); void drawResultWindow( int result, int busy ); int DPrintf( const char *string, ... ); #include <types.h> #include <sys/synchronization.h>
000kev000-toy
include/graphics.h
C
oos
2,744
/* syscall8.h Copyright (c) 2010 Hermes <www.elotrolado.net> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _SYS8_H_ #define _SYS8_H_ #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /* FUNCTIONS TO USE IN KERNEL AREA 0x8000000000000000 - 0x80000000007fffff payload V3 is loaded at 0x80000000007ff000 */ // hook_open typedef struct { uint64_t compare_addr; // kernel address to compare string uint64_t replace_addr; // kernel address to replace string int compare_len; // len of compare string int replace_len; // len of replace string } path_open_entry; /* NOTES about path_open_entry: compare_addr can be a string full path for files or not. The size of the string can be len+1 replacea_ddr can replace a file, files or directories. The size of the string must be replace_string + hook_open string remnant+1 (recommended 0x800 to work with directories) // example 1: replacing a file compare_addr: "/app_home/PS3_GAME/USRDIR/EBOOT.BIN" replace_addr: "/dev_usb000/PS3_GAME/USRDIR/EBOOT.BIN" compare_len= strlen(compare_addr); replace_len= strlen(replace_addr); // example 2: replacing files by a unique file compare_addr: "/app_home/PS3_GAME/ICON" replace_addr: "/dev_usb000/PS3_GAME/ICON0.PNG" compare_len= strlen(compare_addr); replace_len= strlen(replace_addr)+1; // example 3: replacing directories compare_addr: "/app_home/PS3_GAME" replace_addr: "/dev_usb000/PS3_GAME" compare_len= strlen(compare_addr); replace_len= strlen(replace_addr); */ /* sys8_disable: disable syscalls 6,7, 36 and stealth syscall 8 key: 64 bits key to enable syscalls */ int sys8_disable(uint64_t key); /* sys8_enable: enable syscalls 6,7, 36 and 8 when key: 64 bits key to enable syscalls or 0 to test return: 0x80010003 (<0) or current version (0x100) */ int sys8_enable(uint64_t key); /* sys8_memcpy: 64 bits address memory copy dst: destination addr src: source addr size: number of bytes to copy return: destination addr */ uint64_t sys8_memcpy(uint64_t dst, uint64_t src, uint64_t size); /* sys8_memset: 64 bits address memory set dst: destination addr val: value to set (only the 8 bits lower) size: number of bytes to set return: destination addr */ uint64_t sys8_memset(uint64_t dst, uint64_t val, uint64_t size); /* sys8_call: kernel 64 bits address to call param1: first 64 bits param (maybe IN datas addr) param2: second 64 bits param (maybe OUT datas addr) return: value returned by kernel call */ uint64_t sys8_call(uint64_t addr, uint64_t param1, uint64_t param2); /* sys8_alloc: kernel function to alloc memory size: bytes to alloc pool: Usually 0x27 from psjailbreak return: 64 bits addr allocated */ uint64_t sys8_alloc(uint64_t size, uint64_t pool); /* sys8_free: kernel function to free memory addr: 64 bits addr to free pool: Usually 0x27 from psjailbreak return: unknown 64 bits addr */ uint64_t sys8_free(uint64_t addr, uint64_t pool); /* sys8_panic: kernel panic function */ void sys8_panic(void); /* sys8_perm_mode: function to changes as work 0x80000000000505d0 calls (connected with access permissions) mode: 0 -> PS3 perms normally, 1-> Psjailbreak by default, 2-> Special for games as F1 2010 (option by default) return: 0 - Ok */ int sys8_perm_mode(uint64_t mode); /* sys8_path_table: function to add one table for path redirections in hook_open addr_table: kernel 64 bits addr from one path_open_entry array, starts. The last path_open_entry.compare_addr must be 0 to stop return: last addr_table */ uint64_t sys8_path_table(uint64_t addr_table); /* Developers notes: To test if syscall8 is working: int ret= sys8_enable(0); if(ret<0) { //try to put the correct key ret= sys8_enable(key); } if(ret<0) printf("Sorry, syscall8 unavailable\n"); else printf("Current version %x\n", ret); ------------------------------------------------------------ To Test sys8_alloc(), sys8_free(), sys8_memcpy() and sys8_call(): uint32_t my_fun[0x10/4]={0x38601234, 0x4e800020}; // li %r3, 0x1234, blr .................................................. uint64_t memo= sys8_alloc(0x10ULL, 0x27ULL); // alloc 16 bytes printf("ret: %llx\n", sys8_call( memo , 0ULL, 0ULL)); sys8_free( memo , 0x27ULL) ------------------------------------------------------------ To test path redirections: // struct for 3 paths typedef struct { path_open_entry entries[4]; char arena[0x2000]; } path_open_table; path_open_table open_table; uint64_t dest_table_addr; .................................................. // disable table printf(" last table %llx\n", sys8_path_table(0ULL)); // calculate dest_table addr from payload start to back dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); // fix the start addresses open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x800])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].compare_addr= ((uint64_t) &open_table.arena[0x100]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].replace_addr= ((uint64_t) &open_table.arena[0x1000])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[2].compare_addr= ((uint64_t) &open_table.arena[0x200]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[2].replace_addr= ((uint64_t) &open_table.arena[0x1800])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[3].compare_addr= 0ULL; // the last entry always 0 // copy the paths strncpy(&open_table.arena[0], "/app_home/PS3_GAME/USRDIR", 0x100); // compare 1 strncpy(&open_table.arena[0x800], "/dev_usb000/PS3_GAME/USRDIR", 0x800); // replace 1: replaces all content or USRDIR strncpy(&open_table.arena[0x100], "/app_home/PS3_GAME/ICON0.PNG", 0x100); // compare 2 strncpy(&open_table.arena[0x1000], "/dev_usb000/PS3_GAME/ICON0.PNG", 0x800); // replace 2: replace only ICON0.PNG strncpy(&open_table.arena[0x200], "/app_home/PS3_GAME/ICO", 0x100); // compare 3 strncpy(&open_table.arena[0x1800], "/dev_usb000/PS3_GAME/ICON0.PNG", 0x800); // replace 3: // replace all ICONxxxx by ICON0.PNG // fix the string len open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1 open_table.entries[0].replace_len= strlen(&open_table.arena[0x800]); open_table.entries[1].compare_len= strlen(&open_table.arena[0x100]); // 2 open_table.entries[1].replace_len= strlen(&open_table.arena[0x1000]); open_table.entries[2].compare_len= strlen(&open_table.arena[0x200]); // 3 open_table.entries[2].replace_len= strlen(&open_table.arena[0x1800]) +1; // truncate the name because it skip '\0' // copy the datas to the destination address sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); // set the path table sys8_path_table( dest_table_addr)); */ #ifdef __cplusplus } #endif #endif
000kev000-toy
include/syscall8.h
C
oos
8,756
void psgroove_main(int enable); void hermes_payload_341(); void hermes_payload_355(int enable);
000kev000-toy
include/syscall36.h
C
oos
101
#ifndef HVCALL_H #define HVCALL_H #include "common.h" #define HPTE_V_BOLTED 0x0000000000000010ULL #define HPTE_V_LARGE 0x0000000000000004ULL #define HPTE_V_VALID 0x0000000000000001ULL #define HPTE_R_PROT_MASK 0x0000000000000003ULL #define MM_EA2VA(ea) ((ea) & ~0x8000000000000000ULL) #define SC_QUOTE_(x) #x #define SYSCALL(num) "li %%r11, " SC_QUOTE_(num) "; sc;" #define INSTALL_HVSC_REDIRECT(hvcall) u64 original_syscall_code_1 = lv2_peek(HVSC_SYSCALL_ADDR); \ u64 original_syscall_code_2 = lv2_peek(HVSC_SYSCALL_ADDR + 8); \ u64 original_syscall_code_3 = lv2_peek(HVSC_SYSCALL_ADDR + 16); \ u64 original_syscall_code_4 = lv2_peek(HVSC_SYSCALL_ADDR + 24); \ lv2_poke(HVSC_SYSCALL_ADDR, 0x7C0802A6F8010010ULL); \ lv2_poke(HVSC_SYSCALL_ADDR + 8, 0x3960000044000022ULL | (u64)hvcall << 32); \ lv2_poke(HVSC_SYSCALL_ADDR + 16, 0xE80100107C0803A6ULL); \ lv2_poke(HVSC_SYSCALL_ADDR + 24, 0x4e80002060000000ULL); #define REMOVE_HVSC_REDIRECT() lv2_poke(HVSC_SYSCALL_ADDR, original_syscall_code_1); \ lv2_poke(HVSC_SYSCALL_ADDR + 8, original_syscall_code_2); \ lv2_poke(HVSC_SYSCALL_ADDR + 16, original_syscall_code_3); \ lv2_poke(HVSC_SYSCALL_ADDR + 24, original_syscall_code_4); int lv1_insert_htab_entry(u64 htab_id, u64 hpte_group, u64 hpte_v, u64 hpte_r, u64 bolted_flag, u64 flags, u64 *hpte_index, u64 *hpte_evicted_v, u64 *hpte_evicted_r); int lv1_allocate_memory(u64 size, u64 page_size_exp, u64 flags, u64 *addr, u64 *muid); int lv1_undocumented_function_114(u64 start, u64 page_size, u64 size, u64 *lpar_addr); void lv1_undocumented_function_115(u64 lpar_addr); u64 lv2_alloc(u64 size, u64 pool); #endif
000kev000-toy
include/hvcall.h
C
oos
1,639
#ifndef MS_COMMON_H #define MS_COMMON_H #include <sysutil/sysutil_sysparam.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <types.h> #include <sys/ppu_thread.h> #include <sys/sys_time.h> #include <sys/timer.h> #include <sys/process.h> #include <sys/spu_initialize.h> #include <fcntl.h> #include <cell/fs/cell_fs_errno.h> #include <cell/fs/cell_fs_file_api.h> #include <cell/mstream.h> #include <assert.h> #include <sys/paths.h> #include <cell/audio.h> #include <cell/gcm.h> #include <sys/system_types.h> #include <cell/spurs/control.h> #include <cell/spurs/task.h> #include <cell/spurs/event_flag.h> #include <cell/sysmodule.h> extern CellAudioPortParam audioParam; extern CellAudioPortConfig portConfig; long InitialiseAudio( const long nStreams, const long nmaxSubs, int &_nPortNumber, CellAudioPortParam &_audioParam, CellAudioPortConfig &_portConfig); int InitSPURS(void); int InitFile(const char *filename,long *addr, long *size); void ShutdownMultiStream(); #define SUPPRESS_COMPILER_WARNING(x) (void)x #endif
000kev000-toy
include/mscommon.h
C
oos
1,130
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DAO; using DTO; namespace BUS { public class KhachHangBUS { public static List<KhachHang> Search(String str) { try { return KhachHangDAO.Search(str); } catch (Exception ex) { throw ex; } } public static List<KhachHang> Search(KhachHang emp) { try { return KhachHangDAO.Search(emp); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/KhachHangBUS.cs
C#
art
735
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using DAO; namespace BUS { public class VeBUS { public static List<Ve> Select_All() { try { return VeDAO.Select_All(); } catch (Exception ex) { throw ex; } } public static List<Ve> Select_Ve_DatTruoc() { try { return VeDAO.Select_Ve_DatTruoc(); } catch (Exception ex) { throw ex; } } public static bool Insert(Ve emp) { try { return VeDAO.Insert(emp); } catch (Exception ex) { throw ex; } } public static bool ThanhToan(String MaKH, String MaXe, String MaGhe, String MaTD, String Ngay) { try { return VeDAO.ThanhToan(MaKH, MaXe, MaGhe, MaTD, Ngay); } catch (Exception ex) { throw ex; } } public static bool Update(Ve ve_cu, Ve ve_moi) { try { return VeDAO.Update(ve_cu, ve_moi); } catch (Exception ex) { throw ex; } } public static bool Delete(String MaKH, String MaXe, String MaGhe, String MaTD, String Ngay) { try { return VeDAO.Delete(MaKH, MaXe, MaGhe, MaTD, Ngay); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/VeBUS.cs
C#
art
1,885
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DAO; using DTO; namespace BUS { public class ChucVuBUS { public static List<ChucVu> Select_All() { try { return ChucVuDAO.Select_All(); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/ChucVuBUS.cs
C#
art
439
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DAO; using DTO; namespace BUS { public class NhanVienBUS { public static List<NhanVien> Select_TaiXe() { try { return NhanVienDAO.Select_TaiXe(); } catch (Exception ex) { throw ex; } } public static List<NhanVien> Select_TiepVien() { try { return NhanVienDAO.Select_TiepVien(); } catch (Exception ex) { throw ex; } } public static List<NhanVien> Search(NhanVien emp) { try { return NhanVienDAO.Search(emp); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/NhanVienBUS.cs
C#
art
992
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using DAO; namespace BUS { public class GheBUS { public static List<Ghe> Select_GheTrong(Ve ve) { return GheDAO.Select_GheTrong(ve); } public static bool Update_TinhTrang(String MaGhe,String TinhTrang) { try { return GheDAO.Update_TinhTrang(MaGhe,TinhTrang); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/GheBUS.cs
C#
art
609
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DAO; using DTO; namespace BUS { public class XeBUS { public static List<Xe> Select_Xe_by_MaTuyenDuong(String MaTuyenDuong,String Ngay) { try { return XeDAO.Select_Xe_by_MaTuyenDuong(MaTuyenDuong,Ngay); } catch (Exception ex) { throw ex; } } public static void CapNhatTinhTrangXeTheoSoGheConTrong(String MaXe) { try { XeDAO.CapNhatTinhTrangXeTheoSoGheConTrong(MaXe); } catch (Exception ex) { throw ex; } } public static List<Xe> Select_All() { try { return XeDAO.Select_All(); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/XeBUS.cs
C#
art
1,061
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using DAO; namespace BUS { public class TuyenDuongBUS { public static List<TuyenDuong> Select_All() { return TuyenDuongDAO.Select_All(); } } }
12hca1-cnpm-11
trunk/Source/BUS/TuyenDuongBUS.cs
C#
art
309
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using DAO; namespace BUS { public class LichChayBUS { public static List<LichChay> Select_All() { try { return LichChayDAO.Select_All(); } catch (Exception ex) { throw ex; } } public static List<LichChay> Search(LichChay emp) { try { return LichChayDAO.Search(emp); } catch (Exception ex) { throw ex; } } public static bool Insert(LichChay emp) { try { return LichChayDAO.Insert(emp); } catch (Exception ex) { throw ex; } } public static bool Delete(String MaXe,String MaTD,String Ngay,String GioXuatBen) { try { return LichChayDAO.Delete(MaXe, MaTD, Ngay, GioXuatBen); } catch (Exception ex) { throw ex; } } public static bool Update(LichChay emp_cu,LichChay emp_moi) { try { return LichChayDAO.Update(emp_cu, emp_moi); } catch (Exception ex) { throw ex; } } public static List<LichChay> Select_by_TenTuyenDuong(String TenTD) { try { return LichChayDAO.Select_by_TenTuyenDuong(TenTD); } catch (Exception ex) { throw ex; } } public static List<LichChay> Select_GioXuatBen_ThemVe(String MaTD, String MaXe) { try { return LichChayDAO.Select_GioXuatBen_ThemVe(MaTD, MaXe); } catch (Exception ex) { throw ex; } } public static List<LichChay> Select_TuyenDuong_by_Ngay(String Ngay) { try { return LichChayDAO.Select_TuyenDuong_by_Ngay(Ngay); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/BUS/LichChayBUS.cs
C#
art
2,532
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DAO; using DTO; namespace BUS { public class GiaVeBUS { public static String Select_GiaTien(String MaXe, String MaTuyenDuong) { return GiaVeDAO.Select_GiaTien(MaXe, MaTuyenDuong); } } }
12hca1-cnpm-11
trunk/Source/BUS/GiaVeBUS.cs
C#
art
347
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BUS")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("BUS")] [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4931a7c5-aa45-4aec-bc7c-34e9787b9d41")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
12hca1-cnpm-11
trunk/Source/BUS/Properties/AssemblyInfo.cs
C#
art
1,436
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class XeDAO { public static List<Xe> Select_Xe_by_MaTuyenDuong(String MaTuyenDuong,String Ngay) { List<Xe> list = new List<Xe>(); String strSql = "select DISTINCT x.MaXe,BienSo from LICHCHAY lc,Xe x where x.MaXe=lc.MaXe and " + "lc.Ngay='"+Ngay+"' and lc.MaTuyenDuong='" + MaTuyenDuong + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { Xe emp = new Xe(); emp.MaXe = dr["MaXe"].ToString(); emp.BienSo = dr["BienSo"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<Xe> Select_All() { List<Xe> list = new List<Xe>(); String strSql = "select * from Xe"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { Xe emp = new Xe(); emp.MaXe = dr["MaXe"].ToString(); emp.BienSo = dr["BienSo"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static void CapNhatTinhTrangXeTheoSoGheConTrong(String MaXe) { String strSql = "select * from Ghe where TinhTrang='False' and MaXe='" + MaXe + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); if (dt.Rows.Count == 0)//nếu ko ghế nào còn trống thì xe đã đầy strSql = "update Xe set TinhTrang='True' where MaXe=@MaXe"; else strSql = "update Xe set TinhTrang='False' where MaXe=@MaXe"; List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaXe", MaXe)); SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); } catch (Exception ex) { throw ex; } } } }
12hca1-cnpm-11
trunk/Source/DAO/XeDAO.cs
C#
art
2,656
using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Data; using System.Data.SqlClient; namespace DAO { public class SqlDataAccessHelper { #region ConnectString protected static String ConnectString { get { return ReadConnectString("ConnectionString.xml"); } } public static String ReadConnectString(String file) { try { XmlDocument doc = new XmlDocument(); doc.Load(file); XmlElement root = doc.DocumentElement; String ConnectString = root.InnerText; return ConnectString; } catch (Exception ex) { throw ex; } } #endregion #region ExcuteNoneQuery public static int ExcuteNoneQuery(string strSql,List<SqlParameter> sqlParams) { int n = 0; try { SqlConnection connect = new SqlConnection(ConnectString); connect.Open(); try { SqlCommand command = connect.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = strSql; if (sqlParams != null) { foreach (SqlParameter param in sqlParams) { command.Parameters.Add(param); } } n = command.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Loi khi thuc hien lenh " + strSql + ex.ToString()); } finally { connect.Close(); } } catch (Exception ex) { throw new Exception(ex.Message); } return n; } #endregion #region ExcuteQuery public static DataTable ExcuteQuery(string strSql, List<SqlParameter> sqlParams) { DataTable dt = new DataTable(); try { SqlConnection connect = new SqlConnection(ConnectString); connect.Open(); SqlCommand command; try { command = new SqlCommand(strSql, connect); command.CommandType = CommandType.Text; if (sqlParams != null) { foreach (SqlParameter param in sqlParams) { command.Parameters.Add(param); } } SqlDataAdapter adapt = new SqlDataAdapter(command); adapt.Fill(dt); } catch (Exception ex) { throw new Exception("Loi khi truy van : " + strSql, ex); } finally { connect.Close(); } } catch (Exception ex) { throw new Exception(ex.Message); } return dt; } public static DataTable ExcuteQuery(String strSql) { return ExcuteQuery(strSql,null); } #endregion #region Report public static DataSet Report(String strSQL,String TenBang) { SqlConnection con = new SqlConnection(ConnectString); con.Open(); SqlCommand cmd = new SqlCommand(strSQL, con); DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(ds, TenBang); return ds; } #endregion } }
12hca1-cnpm-11
trunk/Source/DAO/SqlDataAccessHelper.cs
C#
art
4,171
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class TuyenDuongDAO { public static List<TuyenDuong> Select_All() { List<TuyenDuong> list = new List<TuyenDuong>(); String strSql = "select * from TUYENDUONG td,BENXE bx where td.BenXeKhoiHanh=bx.MaBenXe"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { TuyenDuong emp = new TuyenDuong(); emp.MaTuyenDuong= dr["MaTuyenDuong"].ToString(); emp.TenTuyenDuong = dr["TenTuyenDuong"].ToString(); emp.KhoangCach = float.Parse(dr["KhoangCach"].ToString()); emp.TramDung = dr["TramDung"].ToString(); emp.BenXeKhoiHanh = dr["BenXeKhoiHanh"].ToString(); emp.BenXeKetThuc = dr["BenXeKetThuc"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } } }
12hca1-cnpm-11
trunk/Source/DAO/TuyenDuongDAO.cs
C#
art
1,311
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class NhanVienDAO { public static List<NhanVien> Select_TaiXe() { List<NhanVien> list = new List<NhanVien>(); String strSql = "select * from NhanVien where MaChucVu='CV3'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { NhanVien emp = new NhanVien(); emp.MaNhanVien = dr["MaNhanVien"].ToString(); emp.TenNhanVien = dr["TenNhanVien"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<NhanVien> Select_TiepVien() { List<NhanVien> list = new List<NhanVien>(); String strSql = "select * from NhanVien where MaChucVu='CV4'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { NhanVien emp = new NhanVien(); emp.MaNhanVien = dr["MaNhanVien"].ToString(); emp.TenNhanVien = dr["TenNhanVien"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<NhanVien> Search(NhanVien emp) { List<NhanVien> list = new List<NhanVien>(); String strSql = "select * from NhanVien nv,ChucVu cv where nv.MaChucVu=cv.MaChucVu and cv.TenChucVu=N'"+emp.TenChucVu+"' "; strSql += "and GioiTinh=" + emp.GioiTinh + " and NgaySinh='" + emp.NgaySinh + "' "; if (!emp.TenNhanVien.Equals("")) strSql += "and TenNhanVien like N'%" + emp.TenNhanVien + "%'"; if (!emp.CMND.Equals("")) strSql += "and CMND='" + emp.CMND + "'"; if (!emp.DienThoai.Equals("")) strSql += "and DienThoai='" + emp.DienThoai + "'"; if (!emp.DiaChi.Equals("")) strSql += "and DiaChi='" + emp.DiaChi + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { NhanVien emp2 = new NhanVien(); emp2.MaNhanVien = dr["MaNhanVien"].ToString(); emp2.TenNhanVien = dr["TenNhanVien"].ToString(); emp2.CMND = dr["CMND"].ToString(); emp2.NgaySinh = dr["NgaySinh"].ToString(); if(dr["GioiTinh"].ToString().Equals("1")) emp2.GioiTinh = "Nam"; else emp2.GioiTinh = "Nữ"; emp2.DienThoai = dr["DienThoai"].ToString(); emp2.DiaChi = dr["DiaChi"].ToString(); emp2.TenChucVu = dr["TenChucVu"].ToString(); list.Add(emp2); } } catch (Exception ex) { throw ex; } return list; } } }
12hca1-cnpm-11
trunk/Source/DAO/NhanVienDAO.cs
C#
art
3,607
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class VeDAO { public static List<Ve> Select_All() { List<Ve> list = new List<Ve>(); String strSql = "select TenKhachHang,BienSo,TenGhe,TenTuyenDuong,Ngay,vx.TinhTrang "; strSql += "from VeXe vx,KhachHang kh,Xe x,Ghe gh,TuyenDuong td "; strSql += "where vx.MaXe=x.MaXe and vx.MaKhachHang=kh.MaKhachHang "; strSql += "and vx.MaTuyenDuong=td.MaTuyenDuong and vx.MaGhe=gh.MaGhe"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { Ve emp = new Ve(); emp.MaKhachHang = dr["TenKhachHang"].ToString(); emp.MaXe = dr["BienSo"].ToString(); emp.MaGhe = dr["TenGhe"].ToString(); emp.MaTuyenDuong = dr["TenTuyenDuong"].ToString(); emp.Ngay = dr["Ngay"].ToString(); emp.TinhTrang = dr["TinhTrang"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<Ve> Select_Ve_DatTruoc() { List<Ve> list = new List<Ve>(); String strSql = "select vx.GioXuatBen,TenKhachHang,BienSo,TenGhe,TenTuyenDuong,Ngay,vx.TinhTrang,GiaTien,"; strSql += "vx.MaKhachHang,vx.MaXe,vx.MaGhe,vx.MaTuyenDuong "; strSql += "from VeXe vx,KhachHang kh,Xe x,Ghe gh,TuyenDuong td,GiaVe gv "; strSql +="where vx.MaXe=x.MaXe and vx.MaKhachHang=kh.MaKhachHang and gv.MaXe=x.MaXe and gv.MaTuyenDuong=td.MaTuyenDuong "; strSql += "and vx.MaTuyenDuong=td.MaTuyenDuong and vx.MaGhe=gh.MaGhe and vx.TinhTrang='False' "; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { Ve emp = new Ve(); emp.MaKhachHang = dr["MaKhachHang"].ToString(); emp.TenKhachHang = dr["TenKhachHang"].ToString(); emp.MaXe = dr["MaXe"].ToString(); emp.BienSo = dr["BienSo"].ToString(); emp.MaGhe = dr["MaGhe"].ToString(); emp.SoGhe = dr["TenGhe"].ToString(); emp.MaTuyenDuong = dr["MaTuyenDuong"].ToString(); emp.TuyenDuong = dr["TenTuyenDuong"].ToString(); emp.Ngay = dr["Ngay"].ToString(); emp.TinhTrang = dr["TinhTrang"].ToString(); emp.GiaTien = dr["GiaTien"].ToString(); emp.GioXuatBen = dr["GioXuatBen"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static bool Insert(Ve emp) { bool result = false; string strSql = "insert into VeXe "; strSql += "values(@MaKhachHang,@MaXe,@MaGhe,@MaTuyenDuong,@Ngay,@GioXuatBen,@TinhTrang)"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaKhachHang", emp.MaKhachHang)); sqlPara.Add(new SqlParameter("@MaXe", emp.MaXe)); sqlPara.Add(new SqlParameter("@MaGhe", emp.MaGhe)); sqlPara.Add(new SqlParameter("@MaTuyenDuong", emp.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@Ngay", emp.Ngay)); sqlPara.Add(new SqlParameter("@GioXuatBen", emp.GioXuatBen)); sqlPara.Add(new SqlParameter("@TinhTrang", emp.TinhTrang)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } public static bool ThanhToan(String MaKH,String MaXe,String MaGhe,String MaTD,String Ngay) { bool result = false; string strSql = "update VeXe set TinhTrang='True' where MaKhachHang=@MaKH and MaXe=@MaXe and MaGhe=@MaGhe and MaTuyenDuong=@MaTD and DateDiff(DAY,Ngay,@Ngay)=0"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaKH", MaKH)); sqlPara.Add(new SqlParameter("@MaXe", MaXe)); sqlPara.Add(new SqlParameter("@MaGhe", MaGhe)); sqlPara.Add(new SqlParameter("@MaTD", MaTD)); sqlPara.Add(new SqlParameter("@Ngay", Ngay)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } public static bool Update(Ve ve_cu,Ve ve_moi) { bool result = false; string strSql = "update vexe set MaXe=@MaXeMoi,MaGhe=@MaGheMoi,MaTuyenDuong=@MaTDMoi,Ngay=@NgayMoi,GioXuatBen=@GioXBmoi "; strSql += "where MaKhachHang=@MaKH and MaXe=@MaXeCu and MaGhe=@MaGheCu and MaTuyenDuong=@MaTDCu and Ngay=@Ngay and GioXuatBen=@GioXBCu"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaKH", ve_cu.MaKhachHang)); sqlPara.Add(new SqlParameter("@MaXeCu", ve_cu.MaXe)); sqlPara.Add(new SqlParameter("@MaGheCu", ve_cu.MaGhe)); sqlPara.Add(new SqlParameter("@MaTDCu", ve_cu.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@GioXBCu", ve_cu.GioXuatBen)); sqlPara.Add(new SqlParameter("@Ngay", ve_cu.Ngay)); sqlPara.Add(new SqlParameter("@MaXeMoi", ve_moi.MaXe)); sqlPara.Add(new SqlParameter("@MaGheMoi", ve_moi.MaGhe)); sqlPara.Add(new SqlParameter("@MaTDMoi", ve_moi.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@GioXBMoi", ve_moi.GioXuatBen)); sqlPara.Add(new SqlParameter("@NgayMoi", ve_moi.Ngay)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } public static bool Delete(String MaKH, String MaXe, String MaGhe, String MaTD, String Ngay) { bool result = false; string strSql = "delete from VeXe where MaKhachHang=@MaKH and MaXe=@MaXe and MaGhe=@MaGhe and MaTuyenDuong=@MaTD and Ngay=@Ngay"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaKH", MaKH)); sqlPara.Add(new SqlParameter("@MaXe", MaXe)); sqlPara.Add(new SqlParameter("@MaGhe", MaGhe)); sqlPara.Add(new SqlParameter("@MaTD", MaTD)); sqlPara.Add(new SqlParameter("@Ngay", Ngay)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } } }
12hca1-cnpm-11
trunk/Source/DAO/VeDAO.cs
C#
art
8,094
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class GheDAO { public static List<Ghe> Select_GheTrong(Ve ve)//ghế trống { List<Ghe> list = new List<Ghe>(); String strSql = "select MaGhe,TenGhe from Ghe gh,Xe x where x.MaXe=gh.MaXe and x.MaXe='"+ve.MaXe+"' "; strSql += "and MaGhe not in (select MaGhe from VeXe where MaXe='" + ve.MaXe + "' "; strSql += "and MaTuyenDuong='" + ve.MaTuyenDuong + "' and GioXuatBen='" + ve.GioXuatBen + "')"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { Ghe emp = new Ghe(); emp.MaGhe = dr["MaGhe"].ToString(); emp.TenGhe = dr["TenGhe"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static bool Update_TinhTrang(String MaGhe,String TinhTrang) { bool result = false; string strSql = "update Ghe set TinhTrang=@TinhTrang where MaGhe=@MaGhe"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaGhe", MaGhe)); sqlPara.Add(new SqlParameter("@TinhTrang", TinhTrang)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } } }
12hca1-cnpm-11
trunk/Source/DAO/GheDAO.cs
C#
art
1,956
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class ChucVuDAO { public static List<ChucVu> Select_All() { List<ChucVu> list = new List<ChucVu>(); String strSql = "select * from ChucVu "; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { ChucVu emp = new ChucVu(); emp.MaChucVu = dr["MaChucVu"].ToString(); emp.TenChucVu = dr["TenChucVu"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } } }
12hca1-cnpm-11
trunk/Source/DAO/ChucVuDAO.cs
C#
art
936
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class LichChayDAO { public static List<LichChay> Select_All() { List<LichChay> list = new List<LichChay>(); String strSql = "select x.MaXe,BienSo,td.MaTuyenDuong,TenTuyenDuong,Ngay,GioXuatBen,nv1.TenNhanVien as 'TenTaiChinh',"; strSql += "nv2.TenNhanVien as 'TenTaiPhu',nv3.TenNhanVien as 'TenTiepVien',TaiChinh,TaiPhu,TiepVien "; strSql += "from LichChay lc,NhanVien nv1,NhanVien nv2,NhanVien nv3,TuyenDuong td,Xe x "; strSql += "where lc.MaXe=x.MaXe and lc.MaTuyenDuong=td.MaTuyenDuong and lc.TaiChinh=nv1.MaNhanVien "; strSql += "and lc.TaiPhu=nv2.MaNhanVien and lc.TiepVien=nv3.MaNhanVien and DateDiff(DAY,GETDATE(),lc.Ngay)>=0"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { LichChay emp = new LichChay(); emp.MaXe = dr["MaXe"].ToString(); emp.BienSo = dr["BienSo"].ToString(); emp.MaTuyenDuong = dr["MaTuyenDuong"].ToString(); emp.TenTuyenDuong = dr["TenTuyenDuong"].ToString(); emp.Ngay = dr["Ngay"].ToString(); emp.GioXuatBen = dr["GioXuatBen"].ToString(); emp.TaiChinh = dr["TaiChinh"].ToString(); emp.TaiPhu = dr["TaiPhu"].ToString(); emp.TiepVien = dr["TiepVien"].ToString(); emp.TenTaiChinh = dr["TenTaiChinh"].ToString(); emp.TenTaiPhu = dr["TenTaiPhu"].ToString(); emp.TenTiepVien = dr["TenTiepVien"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<LichChay> Select_by_TenTuyenDuong(String TenTD) { List<LichChay> list = new List<LichChay>(); String strSql = "select x.MaXe,BienSo,td.MaTuyenDuong,TenTuyenDuong,Ngay,GioXuatBen,nv1.TenNhanVien as 'TenTaiChinh',"; strSql += "nv2.TenNhanVien as 'TenTaiPhu',nv3.TenNhanVien as 'TenTiepVien',TaiChinh,TaiPhu,TiepVien "; strSql += "from LichChay lc,NhanVien nv1,NhanVien nv2,NhanVien nv3,TuyenDuong td,Xe x "; strSql += "where lc.MaXe=x.MaXe and lc.MaTuyenDuong=td.MaTuyenDuong and lc.TaiChinh=nv1.MaNhanVien "; strSql += "and lc.TaiPhu=nv2.MaNhanVien and lc.TiepVien=nv3.MaNhanVien and DateDiff(DAY,GETDATE(),lc.Ngay)>=0 and TenTuyenDuong like N'%" + TenTD + "%'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { LichChay emp = new LichChay(); emp.MaXe = dr["MaXe"].ToString(); emp.BienSo = dr["BienSo"].ToString(); emp.MaTuyenDuong = dr["MaTuyenDuong"].ToString(); emp.TenTuyenDuong = dr["TenTuyenDuong"].ToString(); emp.Ngay = dr["Ngay"].ToString(); emp.GioXuatBen = dr["GioXuatBen"].ToString(); emp.TaiChinh = dr["TaiChinh"].ToString(); emp.TaiPhu = dr["TaiPhu"].ToString(); emp.TiepVien = dr["TiepVien"].ToString(); emp.TenTaiChinh = dr["TenTaiChinh"].ToString(); emp.TenTaiPhu = dr["TenTaiPhu"].ToString(); emp.TenTiepVien = dr["TenTiepVien"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<LichChay> Select_TuyenDuong_by_Ngay(String Ngay) { List<LichChay> list = new List<LichChay>(); String strSql = "select DISTINCT td.MaTuyenDuong,TenTuyenDuong from LichChay lc,TuyenDuong td where "; strSql += "lc.MaTuyenDuong=td.MaTuyenDuong and Ngay='" + Ngay + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { LichChay emp = new LichChay(); emp.MaTuyenDuong = dr["MaTuyenDuong"].ToString(); emp.TenTuyenDuong = dr["TenTuyenDuong"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<LichChay> Search(LichChay emp) { List<LichChay> list = new List<LichChay>(); String strSql = "select x.MaXe,BienSo,td.MaTuyenDuong,TenTuyenDuong,Ngay,GioXuatBen,nv1.TenNhanVien as 'TenTaiChinh',"; strSql += "nv2.TenNhanVien as 'TenTaiPhu',nv3.TenNhanVien as 'TenTiepVien',TaiChinh,TaiPhu,TiepVien "; strSql += "from LichChay lc,NhanVien nv1,NhanVien nv2,NhanVien nv3,TuyenDuong td,Xe x "; strSql += "where lc.MaXe=x.MaXe and lc.MaTuyenDuong=td.MaTuyenDuong and lc.TaiChinh=nv1.MaNhanVien "; strSql += "and lc.TaiPhu=nv2.MaNhanVien and lc.TiepVien=nv3.MaNhanVien "; strSql += "and TenTuyenDuong like N'%" + emp.TenTuyenDuong + "%' and BienSo ='" + emp.BienSo + "' and Ngay='" + emp.Ngay + "' "; strSql += "and nv1.TenNhanVien like N'%" + emp.TenTaiChinh + "%' and nv2.TenNhanVien like N'%" + emp.TenTaiPhu + "%' "; strSql += "and nv3.TenNhanVien like N'%" + emp.TenTiepVien + "%' "; if (!emp.GioXuatBen.Equals("")) strSql += "and GioXuatBen='" + emp.GioXuatBen + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { LichChay emp2 = new LichChay(); emp2.MaXe = dr["MaXe"].ToString(); emp2.BienSo = dr["BienSo"].ToString(); emp2.MaTuyenDuong = dr["MaTuyenDuong"].ToString(); emp2.TenTuyenDuong = dr["TenTuyenDuong"].ToString(); emp2.Ngay = dr["Ngay"].ToString(); emp2.GioXuatBen = dr["GioXuatBen"].ToString(); emp2.TaiChinh = dr["TaiChinh"].ToString(); emp2.TaiPhu = dr["TaiPhu"].ToString(); emp2.TiepVien = dr["TiepVien"].ToString(); emp2.TenTaiChinh = dr["TenTaiChinh"].ToString(); emp2.TenTaiPhu = dr["TenTaiPhu"].ToString(); emp2.TenTiepVien = dr["TenTiepVien"].ToString(); list.Add(emp2); } } catch (Exception ex) { throw ex; } return list; } public static bool Insert(LichChay emp) { bool result = false; string strSql = "insert into LichChay "; strSql += "values(@MaXe,@MaTuyenDuong,@Ngay,@GioXuatBen,@TaiChinh,@TaiPhu,@TiepVien)"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaXe", emp.MaXe)); sqlPara.Add(new SqlParameter("@MaTuyenDuong", emp.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@Ngay", DateTime.Parse(emp.Ngay))); sqlPara.Add(new SqlParameter("@GioXuatBen", emp.GioXuatBen)); sqlPara.Add(new SqlParameter("@TaiChinh", emp.TaiChinh)); sqlPara.Add(new SqlParameter("@TaiPhu", emp.TaiPhu)); sqlPara.Add(new SqlParameter("@TiepVien", emp.TiepVien)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } public static List<LichChay> Select_GioXuatBen_ThemVe(String MaTD, String MaXe) { List<LichChay> list = new List<LichChay>(); String strSql = "select GioXuatBen from LichChay where MaTuyenDuong='" + MaTD + "' and MaXe='" + MaXe + "' and DateDiff(DAY,GETDATE(),Ngay)=0"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { LichChay emp = new LichChay(); emp.GioXuatBen = dr["GioXuatBen"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static bool Delete(String MaXe,String MaTD,String Ngay,String GioXuatBen) { bool result = false; string strSql = "delete from LichChay where "; strSql += "MaXe=@MaXe and MaTuyenDuong=@MaTD and Ngay=@Ngay and GioXuatBen=@GioXB"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaXe", MaXe)); sqlPara.Add(new SqlParameter("@MaTD", MaTD)); sqlPara.Add(new SqlParameter("@Ngay", Ngay)); sqlPara.Add(new SqlParameter("@GioXB", GioXuatBen)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } public static bool Update(LichChay emp_cu,LichChay emp_moi) { bool result = false; string strSql = "update LichChay set "; strSql += "MaXe=@MaXeMoi,MaTuyenDuong=@MaTDMoi,Ngay=@NgayMoi,GioXuatBen=@GioXBMoi,TaiChinh=@TaiChinhMoi,"; strSql += "TaiPhu=@TaiPhuMoi,TiepVien=@TiepVienMoi "; strSql += "where MaXe=@MaXeCu and MaTuyenDuong=@MaTDCu and Ngay=@NgayCu and GioXuatBen=@GioXBCu"; try { List<SqlParameter> sqlPara = new List<SqlParameter>(); sqlPara.Add(new SqlParameter("@MaXeCu", emp_cu.MaXe)); sqlPara.Add(new SqlParameter("@MaTDCu", emp_cu.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@NgayCu", emp_cu.Ngay)); sqlPara.Add(new SqlParameter("@GioXBCu", emp_cu.GioXuatBen)); sqlPara.Add(new SqlParameter("@MaXeMoi", emp_moi.MaXe)); sqlPara.Add(new SqlParameter("@MaTDMoi", emp_moi.MaTuyenDuong)); sqlPara.Add(new SqlParameter("@NgayMoi", emp_moi.Ngay)); sqlPara.Add(new SqlParameter("@GioXBMoi", emp_moi.GioXuatBen)); sqlPara.Add(new SqlParameter("@TaiChinhMoi", emp_moi.TaiChinh)); sqlPara.Add(new SqlParameter("@TaiPhuMoi", emp_moi.TaiPhu)); sqlPara.Add(new SqlParameter("@TiepVienMoi", emp_moi.TiepVien)); int n = SqlDataAccessHelper.ExcuteNoneQuery(strSql, sqlPara); if (n == 1) result = true; } catch (Exception ex) { throw ex; } return result; } } }
12hca1-cnpm-11
trunk/Source/DAO/LichChayDAO.cs
C#
art
12,031
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DAO")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("DAO")] [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("63f44762-a0f4-4b11-9474-164240c650e0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
12hca1-cnpm-11
trunk/Source/DAO/Properties/AssemblyInfo.cs
C#
art
1,436
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class KhachHangDAO { public static List<KhachHang> Search(String str) { List<KhachHang> list = new List<KhachHang>(); String strSql = "select * from KhachHang where TenKhachHang like N'%" + str + "%'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { KhachHang emp = new KhachHang(); emp.MaKhachHang = dr["MaKhachHang"].ToString(); emp.TenKhachHang = dr["TenKhachHang"].ToString(); emp.NgaySinh = dr["NgaySinh"].ToString(); emp.CMND = dr["CMND"].ToString(); emp.DiaChi = dr["DiaChi"].ToString(); emp.DienThoai = dr["DienThoai"].ToString(); list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } public static List<KhachHang> Search(KhachHang emp1) { List<KhachHang> list = new List<KhachHang>(); String strSql = "select * from KhachHang where NgaySinh='"+emp1.NgaySinh+"' and GioiTinh="+emp1.GioiTinh+" "; if (!emp1.TenKhachHang.Equals("")) strSql += "and TenKhachHang like N'%" + emp1.TenKhachHang + "%' "; if (!emp1.CMND.Equals("")) strSql += "and CMND='" + emp1.CMND + "' "; if (!emp1.DiaChi.Equals("")) strSql += "and DiaChi='" + emp1.DiaChi + "' "; if (!emp1.DienThoai.Equals("")) strSql += "and DienThoai='" + emp1.DienThoai + "' "; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { KhachHang emp = new KhachHang(); emp.MaKhachHang = dr["MaKhachHang"].ToString(); emp.TenKhachHang = dr["TenKhachHang"].ToString(); emp.NgaySinh = dr["NgaySinh"].ToString(); emp.CMND = dr["CMND"].ToString(); emp.DiaChi = dr["DiaChi"].ToString(); emp.DienThoai = dr["DienThoai"].ToString(); if (dr["GioiTinh"].ToString().Equals("1")) emp.GioiTinh = "Nam"; else emp.GioiTinh = "Nữ"; list.Add(emp); } } catch (Exception ex) { throw ex; } return list; } } }
12hca1-cnpm-11
trunk/Source/DAO/KhachHangDAO.cs
C#
art
2,961
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTO; using System.Data; using System.Data.SqlClient; namespace DAO { public class GiaVeDAO { public static String Select_GiaTien(String MaXe,String MaTuyenDuong) { String GiaTien = ""; String strSql = "select GiaTien from GiaVe where MaXe='" + MaXe + "' and MaTuyenDuong='" + MaTuyenDuong + "'"; try { DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql); foreach (DataRow dr in dt.Rows) { GiaTien = dr["GiaTien"].ToString(); } } catch (Exception ex) { throw ex; } return GiaTien; } } }
12hca1-cnpm-11
trunk/Source/DAO/GiaVeDAO.cs
C#
art
863
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class KhachHang { String _MaKhachHang; public String MaKhachHang { get { return _MaKhachHang; } set { _MaKhachHang = value; } } String _TenKhachHang; public String TenKhachHang { get { return _TenKhachHang; } set { _TenKhachHang = value; } } String _CMND; public String CMND { get { return _CMND; } set { _CMND = value; } } String _NgaySinh; public String NgaySinh { get { return _NgaySinh; } set { _NgaySinh = value; } } String _DiaChi; public String DiaChi { get { return _DiaChi; } set { _DiaChi = value; } } String _DienThoai; public String DienThoai { get { return _DienThoai; } set { _DienThoai = value; } } String _GioiTinh; public String GioiTinh { get { return _GioiTinh; } set { _GioiTinh = value; } } public KhachHang () { _MaKhachHang = String.Empty; _TenKhachHang = String.Empty; _CMND = String.Empty; _NgaySinh = String.Empty; _DiaChi = String.Empty; _DienThoai = String.Empty; _GioiTinh = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/KhachHang.cs
C#
art
1,628
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class Ve { String _MaKhachHang; public String MaKhachHang { get { return _MaKhachHang; } set { _MaKhachHang = value; } } String _MaXe; public String MaXe { get { return _MaXe; } set { _MaXe = value; } } String _MaGhe; public String MaGhe { get { return _MaGhe; } set { _MaGhe = value; } } String _MaTuyenDuong; public String MaTuyenDuong { get { return _MaTuyenDuong; } set { _MaTuyenDuong = value; } } String _Ngay; public String Ngay { get { return _Ngay; } set { _Ngay = value; } } private String _TinhTrang; public String TinhTrang { get { return _TinhTrang; } set { _TinhTrang = value; } } String _GiaTien; public String GiaTien { get { return _GiaTien; } set { _GiaTien = value; } } String _TenKhachHang; public String TenKhachHang { get { return _TenKhachHang; } set { _TenKhachHang = value; } } String _BienSo; public String BienSo { get { return _BienSo; } set { _BienSo = value; } } String _SoGhe; public String SoGhe { get { return _SoGhe; } set { _SoGhe = value; } } String _TuyenDuong; public String TuyenDuong { get { return _TuyenDuong; } set { _TuyenDuong = value; } } String _GioXuatBen; public String GioXuatBen { get { return _GioXuatBen; } set { _GioXuatBen = value; } } public Ve() { _MaKhachHang = String.Empty; _MaXe = String.Empty; _MaGhe = String.Empty; _MaTuyenDuong = String.Empty; _Ngay = String.Empty; _TinhTrang = String.Empty; _GiaTien = String.Empty; _TenKhachHang = String.Empty; _BienSo = String.Empty; _SoGhe = String.Empty; _TuyenDuong = String.Empty; _GioXuatBen = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/Ve.cs
C#
art
2,615
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class ChucVu { String _MaChucVu; public String MaChucVu { get { return _MaChucVu; } set { _MaChucVu = value; } } String _TenChucVu; public String TenChucVu { get { return _TenChucVu; } set { _TenChucVu = value; } } public ChucVu() { _MaChucVu = String.Empty; _TenChucVu = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/ChucVu.cs
C#
art
611
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class TuyenDuong { String _MaTuyenDuong; public String MaTuyenDuong { get { return _MaTuyenDuong; } set { _MaTuyenDuong = value; } } String _TenTuyenDuong; public String TenTuyenDuong { get { return _TenTuyenDuong; } set { _TenTuyenDuong = value; } } float _KhoangCach; public float KhoangCach { get { return _KhoangCach; } set { _KhoangCach = value; } } String _TramDung; public String TramDung { get { return _TramDung; } set { _TramDung = value; } } String _BenXeKhoiHanh; public String BenXeKhoiHanh { get { return _BenXeKhoiHanh; } set { _BenXeKhoiHanh = value; } } String _BenXeKetThuc; public String BenXeKetThuc { get { return _BenXeKetThuc; } set { _BenXeKetThuc = value; } } public TuyenDuong() { _MaTuyenDuong = String.Empty; _TenTuyenDuong = String.Empty; _KhoangCach = 0; _TramDung = String.Empty; _BenXeKhoiHanh = String.Empty; _BenXeKetThuc = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/TuyenDuong.cs
C#
art
1,505
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class BenXe { String _MaBenXe; public String MaBenXe { get { return _MaBenXe; } set { _MaBenXe = value; } } String _TenBenXe; public String TenBenXe { get { return _TenBenXe; } set { _TenBenXe = value; } } String _DiaChi; public String DiaChi { get { return _DiaChi; } set { _DiaChi = value; } } public BenXe() { _MaBenXe = String.Empty; _TenBenXe = String.Empty; _DiaChi = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/BenXe.cs
C#
art
790
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DTO")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("DTO")] [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("433b1afc-b798-4eb2-934b-7ffe7e517c76")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
12hca1-cnpm-11
trunk/Source/DTO/Properties/AssemblyInfo.cs
C#
art
1,436
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class Ghe { String _MaGhe; public String MaGhe { get { return _MaGhe; } set { _MaGhe = value; } } String _TenGhe; public String TenGhe { get { return _TenGhe; } set { _TenGhe = value; } } Xe _xe; public Xe Xe { get { return _xe; } set { _xe = value; } } String _TinhTrang; public String TinhTrang { get { return _TinhTrang; } set { _TinhTrang = value; } } public Ghe() { _MaGhe = String.Empty; _TenGhe = String.Empty; _xe = null; _TinhTrang = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/Ghe.cs
C#
art
936
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class Xe { String _MaXe; public String MaXe { get { return _MaXe; } set { _MaXe = value; } } String _BienSo; public String BienSo { get { return _BienSo; } set { _BienSo = value; } } String _SoCho; public String SoCho { get { return _SoCho; } set { _SoCho = value; } } String _TinhTrang; public String TinhTrang { get { return _TinhTrang; } set { _TinhTrang = value; } } String _LoaiGhe; public String LoaiGhe { get { return _LoaiGhe; } set { _LoaiGhe = value; } } public Xe() { _MaXe = String.Empty; _BienSo = String.Empty; _SoCho = String.Empty; _TinhTrang = String.Empty; _LoaiGhe = String.Empty; } public Xe(String BienSo) { _BienSo = BienSo; } } }
12hca1-cnpm-11
trunk/Source/DTO/Xe.cs
C#
art
1,245
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class NhanVien { String _MaNhanVien; public String MaNhanVien { get { return _MaNhanVien; } set { _MaNhanVien = value; } } String _TenNhanVien; public String TenNhanVien { get { return _TenNhanVien; } set { _TenNhanVien = value; } } String _CMND; public String CMND { get { return _CMND; } set { _CMND = value; } } String _NgaySinh; public String NgaySinh { get { return _NgaySinh; } set { _NgaySinh = value; } } String _GioiTinh; public String GioiTinh { get { return _GioiTinh; } set { _GioiTinh = value; } } String _DienThoai; public String DienThoai { get { return _DienThoai; } set { _DienThoai = value; } } String _DiaChi; public String DiaChi { get { return _DiaChi; } set { _DiaChi = value; } } String _MaChucVu; public String MaChucVu { get { return _MaChucVu; } set { _MaChucVu = value; } } String _TenChucVu; public String TenChucVu { get { return _TenChucVu; } set { _TenChucVu = value; } } public NhanVien() { _MaNhanVien = String.Empty; _TenNhanVien = String.Empty; _CMND = String.Empty; _NgaySinh = String.Empty; _GioiTinh = String.Empty; _DienThoai = String.Empty; _DiaChi = String.Empty; _MaChucVu = String.Empty; _TenChucVu = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/NhanVien.cs
C#
art
2,022
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class LichChay { String _MaXe; public String MaXe { get { return _MaXe; } set { _MaXe = value; } } String _MaTuyenDuong; public String MaTuyenDuong { get { return _MaTuyenDuong; } set { _MaTuyenDuong = value; } } String _Ngay; public String Ngay { get { return _Ngay; } set { _Ngay = value; } } String _GioXuatBen; public String GioXuatBen { get { return _GioXuatBen; } set { _GioXuatBen = value; } } String _TaiChinh; public String TaiChinh { get { return _TaiChinh; } set { _TaiChinh = value; } } String _TaiPhu; public String TaiPhu { get { return _TaiPhu; } set { _TaiPhu = value; } } String _TiepVien; public String TiepVien { get { return _TiepVien; } set { _TiepVien = value; } } String _TenTuyenDuong; public String TenTuyenDuong { get { return _TenTuyenDuong; } set { _TenTuyenDuong = value; } } String _BienSo; public String BienSo { get { return _BienSo; } set { _BienSo = value; } } String _TenTaiChinh; public String TenTaiChinh { get { return _TenTaiChinh; } set { _TenTaiChinh = value; } } String _TenTaiPhu; public String TenTaiPhu { get { return _TenTaiPhu; } set { _TenTaiPhu = value; } } String _TenTiepVien; public String TenTiepVien { get { return _TenTiepVien; } set { _TenTiepVien = value; } } public LichChay() { _MaXe = String.Empty; _MaTuyenDuong = String.Empty; _Ngay = String.Empty; _GioXuatBen = String.Empty; _TaiChinh = String.Empty; _TaiPhu = String.Empty; _TiepVien = String.Empty; _BienSo = String.Empty; _TenTuyenDuong = String.Empty; _TenTaiChinh = String.Empty; _TenTaiPhu = String.Empty; _TenTiepVien = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/LichChay.cs
C#
art
2,650
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTO { public class GiaVe { String _GiaTien; public String GiaTien { get { return _GiaTien; } set { _GiaTien = value; } } String _MaXe; public String MaXe { get { return _MaXe; } set { _MaXe = value; } } String _MaTuyenDuong; public String MaTuyenDuong { get { return _MaTuyenDuong; } set { _MaTuyenDuong = value; } } public GiaVe() { _MaXe = String.Empty; _MaTuyenDuong = String.Empty; _GiaTien = String.Empty; } } }
12hca1-cnpm-11
trunk/Source/DTO/GiaVe.cs
C#
art
800
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_SearchNhanVien : Form { public frm_SearchNhanVien() { InitializeComponent(); } private void frm_SearchNhanVien_Load(object sender, EventArgs e) { cmb_ChucVu.DisplayMember = "TenChucVu"; cmb_ChucVu.ValueMember = "MaChucVu"; cmb_ChucVu.DataSource = ChucVuBUS.Select_All(); dateTimePicker1.Value = DateTime.Parse("1/1/1990"); } private void btn_Search_Click(object sender, EventArgs e) { dtg_NhanVien.AutoGenerateColumns = false; NhanVien emp = new NhanVien(); emp.TenNhanVien = txt_TenNV.Text; emp.CMND = txt_CMND.Text; emp.NgaySinh = dateTimePicker1.Value.ToShortDateString(); if (radioButton1.Checked) emp.GioiTinh = "1"; else emp.GioiTinh = "0"; emp.DienThoai = txt_DienThoai.Text; emp.DiaChi = txt_DiaChi.Text; emp.TenChucVu = cmb_ChucVu.Text; List<NhanVien> list = NhanVienBUS.Search(emp); if (list.Count != 0) dtg_NhanVien.DataSource = list; else MessageBox.Show("Không tìm thấy kết quả nào !!!"); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_SearchNhanVien.cs
C#
art
1,590
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_SearchKhachHang : Form { public frm_SearchKhachHang() { InitializeComponent(); } private void btn_Search_Click(object sender, EventArgs e) { dtg_KhachHang.AutoGenerateColumns = false; KhachHang emp = new KhachHang(); emp.TenKhachHang = txt_TenKH.Text; emp.CMND = txt_CMND.Text; emp.NgaySinh = dateTimePicker1.Value.ToShortDateString(); if (radioButton1.Checked) emp.GioiTinh = "1"; else emp.GioiTinh = "0"; emp.DienThoai = txt_DienThoai.Text; emp.DiaChi = txt_DiaChi.Text; List<KhachHang> list = KhachHangBUS.Search(emp); if (list.Count != 0) dtg_KhachHang.DataSource = list; else MessageBox.Show("Không tìm thấy kết quả nào !!!"); } private void frm_SearchKhachHang_Load(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Parse("1/1/1990"); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_SearchKhachHang.cs
C#
art
1,389
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_QLDatVe : Form { public frm_QLDatVe() { InitializeComponent(); } private void frm_QLDatVe_Load(object sender, EventArgs e) { dateTimePicker1.MinDate = DateTime.Today; cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = LichChayBUS.Select_TuyenDuong_by_Ngay(dateTimePicker1.Value.ToShortDateString()); } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = LichChayBUS.Select_TuyenDuong_by_Ngay(dateTimePicker1.Value.ToShortDateString()); } private void cmb_TuyenDuong_SelectedIndexChanged(object sender, EventArgs e) { cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_Xe_by_MaTuyenDuong(cmb_TuyenDuong.SelectedValue.ToString(),dateTimePicker1.Value.ToShortDateString()); } private void cmb_Xe_SelectedIndexChanged(object sender, EventArgs e) { cmb_GioXuatBen.DisplayMember = "GioXuatBen"; cmb_GioXuatBen.DataSource = LichChayBUS.Select_GioXuatBen_ThemVe(cmb_TuyenDuong.SelectedValue.ToString(), cmb_Xe.SelectedValue.ToString()); String GiaVe = GiaVeBUS.Select_GiaTien(cmb_Xe.SelectedValue.ToString(), cmb_TuyenDuong.SelectedValue.ToString()); String tmp = ""; while (GiaVe.Length > 3) { tmp = "." + GiaVe.Substring(GiaVe.Length - 3) + tmp; GiaVe = GiaVe.Substring(0, GiaVe.Length - 3); } GiaVe = GiaVe + tmp; lbl_TienVe.Text = GiaVe; } private void cmb_GioXuatBen_SelectedIndexChanged(object sender, EventArgs e) { Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); } public void Get_TenKhachHang(String str) { txt_KhachHang.Text = str; } public void Get_MaKhachHang(String str) { txt_KhachHang.Tag = str; } private void txt_KhachHang_MouseClick(object sender, MouseEventArgs e) { TimKiemKhachHang frm = new TimKiemKhachHang(); frm.Get_TenKhachHang = new TimKiemKhachHang.GetString(Get_TenKhachHang); frm.Get_MaKhachHang = new TimKiemKhachHang.GetString(Get_MaKhachHang); frm.Show(); } private void btn_NhapVe_Click(object sender, EventArgs e) { if (!txt_KhachHang.Text.Equals("") || checkBox1.Checked) { try { Ve Ve = new Ve(); if (checkBox1.Checked) Ve.MaKhachHang = "KHVL"; else Ve.MaKhachHang = txt_KhachHang.Tag.ToString(); Ve.MaXe = cmb_Xe.SelectedValue.ToString(); Ve.MaGhe = cmb_Ghe.SelectedValue.ToString(); Ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); Ve.Ngay = DateTime.Now.ToString(); Ve.GioXuatBen = cmb_GioXuatBen.Text; Ve.TinhTrang = "False"; bool b = VeBUS.Insert(Ve); if (b == true) MessageBox.Show("Đặt vé thành công !!!"); Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else MessageBox.Show("Chưa nhập khách hàng !!!"); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_QLDatVe.cs
C#
art
4,914
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_QLCapNhatVe : Form { public frm_QLCapNhatVe() { InitializeComponent(); } private void frm_UpdateVe_Load(object sender, EventArgs e) { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = TuyenDuongBUS.Select_All(); dtg_Ve.AutoGenerateColumns = false; List<Ve> list = VeBUS.Select_Ve_DatTruoc(); dtg_Ve.DataSource = list; } private void cmb_Xe_SelectedIndexChanged(object sender, EventArgs e) { cmb_GioXuatBen.DisplayMember = "GioXuatBen"; cmb_GioXuatBen.DataSource = LichChayBUS.Select_GioXuatBen_ThemVe(cmb_TuyenDuong.SelectedValue.ToString(), cmb_Xe.SelectedValue.ToString()); String GiaVe = GiaVeBUS.Select_GiaTien(cmb_Xe.SelectedValue.ToString(), cmb_TuyenDuong.SelectedValue.ToString()); String tmp = ""; while (GiaVe.Length > 3) { tmp = "." + GiaVe.Substring(GiaVe.Length - 3) + tmp; GiaVe = GiaVe.Substring(0, GiaVe.Length - 3); } GiaVe = GiaVe + tmp; lbl_TienVeMoi.Text = GiaVe; } private void cmb_TuyenDuong_SelectedIndexChanged(object sender, EventArgs e) { cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_Xe_by_MaTuyenDuong(cmb_TuyenDuong.SelectedValue.ToString(),dateTimePicker1.Value.ToShortDateString()); } String Ngay = ""; private void dtg_Ve_SelectionChanged(object sender, EventArgs e) { lbl_TenKhachHang.Text= dtg_Ve.CurrentRow.Cells[0].Value.ToString(); lbl_TenKhachHang.Tag = dtg_Ve.CurrentRow.Cells[7].Value.ToString(); lbl_KhachHangMoi.Text = dtg_Ve.CurrentRow.Cells[0].Value.ToString(); lbl_KhachHangMoi.Tag = dtg_Ve.CurrentRow.Cells[7].Value.ToString(); lbl_Xe.Text = dtg_Ve.CurrentRow.Cells[1].Value.ToString(); lbl_Xe.Tag = dtg_Ve.CurrentRow.Cells[8].Value.ToString(); lbl_Ghe.Text = dtg_Ve.CurrentRow.Cells[2].Value.ToString(); lbl_Ghe.Tag = dtg_Ve.CurrentRow.Cells[9].Value.ToString(); lbl_TuyenDuong.Text = dtg_Ve.CurrentRow.Cells[3].Value.ToString(); lbl_TuyenDuong.Tag = dtg_Ve.CurrentRow.Cells[10].Value.ToString(); Ngay = dtg_Ve.CurrentRow.Cells[4].Value.ToString(); lbl_Ngay.Text = Ngay.Split(' ')[0]; String GiaVe = dtg_Ve.CurrentRow.Cells[6].Value.ToString(); lbl_GioXuatBen.Text = dtg_Ve.CurrentRow.Cells[11].Value.ToString(); String tmp = ""; while (GiaVe.Length > 3) { tmp = "." + GiaVe.Substring(GiaVe.Length - 3) + tmp; GiaVe = GiaVe.Substring(0, GiaVe.Length - 3); } GiaVe = GiaVe + tmp; lbl_TienVeCu.Text = GiaVe; //MessageBox.Show(dtg_Ve.CurrentRow.Cells[4].Value.ToString()); } private void btn_ThanhToan_Click(object sender, EventArgs e) { try { bool b = VeBUS.ThanhToan(lbl_TenKhachHang.Tag.ToString(), lbl_Xe.Tag.ToString(), lbl_Ghe.Tag.ToString(), lbl_TuyenDuong.Tag.ToString(), Ngay.Split(' ')[0]); if (b) MessageBox.Show("Thanh toán thành công !!!"); dtg_Ve.DataSource = VeBUS.Select_Ve_DatTruoc(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btn_CapNhat_Click(object sender, EventArgs e) { //MessageBox.Show(lbl_GioXuatBen.Text); try { Ve ve_cu = new Ve(); ve_cu.MaKhachHang = lbl_TenKhachHang.Tag.ToString(); ve_cu.MaXe = lbl_Xe.Tag.ToString(); ve_cu.MaGhe = lbl_Ghe.Tag.ToString(); ve_cu.MaTuyenDuong = lbl_TuyenDuong.Tag.ToString(); ve_cu.Ngay = Ngay.Split(' ')[0]; ve_cu.GioXuatBen = lbl_GioXuatBen.Text; Ve ve_moi = new Ve(); ve_moi.MaXe = cmb_Xe.SelectedValue.ToString(); ve_moi.MaGhe = cmb_Ghe.SelectedValue.ToString(); ve_moi.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve_moi.GioXuatBen = cmb_GioXuatBen.Text; ve_moi.Ngay = dateTimePicker1.Value.ToShortDateString(); bool b = VeBUS.Update(ve_cu, ve_moi); if (b) { MessageBox.Show("Cập nhật thành công!!!"); dtg_Ve.DataSource = VeBUS.Select_Ve_DatTruoc(); GheBUS.Update_TinhTrang(ve_cu.MaGhe, "False"); GheBUS.Update_TinhTrang(ve_moi.MaGhe, "True"); XeBUS.CapNhatTinhTrangXeTheoSoGheConTrong(ve_moi.MaXe); cmb_GioXuatBen.DisplayMember = "GioXuatBen"; cmb_GioXuatBen.DataSource = LichChayBUS.Select_GioXuatBen_ThemVe(cmb_TuyenDuong.SelectedValue.ToString(), cmb_Xe.SelectedValue.ToString()); cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_Xe_by_MaTuyenDuong(cmb_TuyenDuong.SelectedValue.ToString(),dateTimePicker1.Value.ToShortDateString()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btn_Xoa_Click(object sender, EventArgs e) { try { bool b = VeBUS.Delete(lbl_TenKhachHang.Tag.ToString(), lbl_Xe.Tag.ToString(), lbl_Ghe.Tag.ToString(), lbl_TuyenDuong.Tag.ToString(), Ngay.Split(' ')[0]); if (b) { MessageBox.Show("Xóa thành công !!!"); Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); dtg_Ve.DataSource = VeBUS.Select_Ve_DatTruoc(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = LichChayBUS.Select_TuyenDuong_by_Ngay(dateTimePicker1.Value.ToShortDateString()); } private void cmb_GioXuatBen_SelectedIndexChanged(object sender, EventArgs e) { Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_QLCapNhatVe.cs
C#
art
7,969
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace QL_BenXe { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frm_Main()); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/Program.cs
C#
art
503
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_SearchLichXeChay : Form { public frm_SearchLichXeChay() { InitializeComponent(); } private void frm_SearchLichXeChay_Load(object sender, EventArgs e) { LoadData(); } private void LoadData() { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = TuyenDuongBUS.Select_All(); cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_All(); cmb_TaiChinh.DisplayMember = "TenNhanVien"; cmb_TaiChinh.ValueMember = "MaNhanVien"; cmb_TaiChinh.DataSource = NhanVienBUS.Select_TaiXe(); cmb_TaiPhu.DisplayMember = "TenNhanVien"; cmb_TaiPhu.ValueMember = "MaNhanVien"; cmb_TaiPhu.DataSource = NhanVienBUS.Select_TaiXe(); cmb_TiepVien.DisplayMember = "TenNhanVien"; cmb_TiepVien.ValueMember = "MaNhanVien"; cmb_TiepVien.DataSource = NhanVienBUS.Select_TiepVien(); } private void btn_Search_Click(object sender, EventArgs e) { try { dtg_LichXeChay.AutoGenerateColumns = false; LichChay emp = new LichChay(); emp.BienSo = cmb_Xe.Text; emp.TenTuyenDuong = cmb_TuyenDuong.Text; emp.Ngay = dateTimePicker1.Value.ToShortDateString(); if (!txt_Gio.Text.Equals("")) { emp.GioXuatBen = txt_Gio.Text; if (!txt_Phut.Text.Equals("")) emp.GioXuatBen += ":" + txt_Phut.Text; } emp.TenTaiChinh = cmb_TaiChinh.Text; emp.TenTaiPhu = cmb_TaiPhu.Text; emp.TenTiepVien = cmb_TiepVien.Text; List<LichChay> list=LichChayBUS.Search(emp); if (list.Count != 0) dtg_LichXeChay.DataSource = list; else MessageBox.Show("Không tìm thấy kết quả nào"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_SearchLichXeChay.cs
C#
art
2,656
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class frm_QLLichXeChay : Form { public frm_QLLichXeChay() { InitializeComponent(); } private void frm_QLLichXeChay_Load(object sender, EventArgs e) { dtg_LichXeChay.AutoGenerateColumns = false; dtg_LichXeChay.DataSource = LichChayBUS.Select_All(); dateTimePicker1.MinDate = DateTime.Today; LoadData(); } private void LoadData() { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = TuyenDuongBUS.Select_All(); cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_All(); cmb_TaiChinh.DisplayMember = "TenNhanVien"; cmb_TaiChinh.ValueMember = "MaNhanVien"; cmb_TaiChinh.DataSource = NhanVienBUS.Select_TaiXe(); cmb_TaiPhu.DisplayMember = "TenNhanVien"; cmb_TaiPhu.ValueMember = "MaNhanVien"; cmb_TaiPhu.DataSource = NhanVienBUS.Select_TaiXe(); cmb_TiepVien.DisplayMember = "TenNhanVien"; cmb_TiepVien.ValueMember = "MaNhanVien"; cmb_TiepVien.DataSource = NhanVienBUS.Select_TiepVien(); } private void btn_Them_Click(object sender, EventArgs e) { try { LichChay emp = new LichChay(); emp.MaXe = cmb_Xe.SelectedValue.ToString(); emp.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); emp.Ngay = dateTimePicker1.Value.ToShortDateString(); emp.GioXuatBen = txt_Gio.Text + ":" + txt_Phut.Text; emp.TaiChinh = cmb_TaiChinh.SelectedValue.ToString(); emp.TaiPhu = cmb_TaiPhu.SelectedValue.ToString(); emp.TiepVien = cmb_TiepVien.SelectedValue.ToString(); bool b = LichChayBUS.Insert(emp); if (b) { MessageBox.Show("Thêm thành công !!!"); dtg_LichXeChay.DataSource = LichChayBUS.Select_All(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btnXoa_Click(object sender, EventArgs e) { try { bool b = LichChayBUS.Delete(MaXe,MaTD,Ngay,GioXB); if (b) { MessageBox.Show("Xóa thành công !!!"); dtg_LichXeChay.DataSource = LichChayBUS.Select_All(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } String MaXe; String MaTD; String Ngay; String GioXB; private void dtg_LichXeChay_SelectionChanged(object sender, EventArgs e) { MaXe = dtg_LichXeChay.CurrentRow.Cells[7].Value.ToString(); MaTD = dtg_LichXeChay.CurrentRow.Cells[8].Value.ToString(); Ngay = dtg_LichXeChay.CurrentRow.Cells[2].Value.ToString(); GioXB = dtg_LichXeChay.CurrentRow.Cells[3].Value.ToString(); cmb_Xe.Text = dtg_LichXeChay.CurrentRow.Cells[0].Value.ToString(); cmb_TuyenDuong.Text = dtg_LichXeChay.CurrentRow.Cells[1].Value.ToString(); dateTimePicker1.Value = DateTime.Parse(dtg_LichXeChay.CurrentRow.Cells[2].Value.ToString()); txt_Gio.Text = GioXB.Split(':')[0]; txt_Phut.Text = GioXB.Split(':')[1]; cmb_TaiChinh.Text = dtg_LichXeChay.CurrentRow.Cells[4].Value.ToString(); cmb_TaiPhu.Text = dtg_LichXeChay.CurrentRow.Cells[5].Value.ToString(); cmb_TiepVien.Text = dtg_LichXeChay.CurrentRow.Cells[6].Value.ToString(); } private void btn_CapNhat_Click(object sender, EventArgs e) { try { LichChay emp_moi = new LichChay(); emp_moi.MaXe = cmb_Xe.SelectedValue.ToString(); emp_moi.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); emp_moi.Ngay = dateTimePicker1.Value.ToShortDateString(); emp_moi.GioXuatBen = txt_Gio.Text + ":" + txt_Phut.Text; emp_moi.TaiChinh = cmb_TaiChinh.SelectedValue.ToString(); emp_moi.TaiPhu = cmb_TaiPhu.SelectedValue.ToString(); emp_moi.TiepVien = cmb_TiepVien.SelectedValue.ToString(); LichChay emp_cu = new LichChay(); emp_cu.MaXe = MaXe; emp_cu.MaTuyenDuong = MaTD; emp_cu.Ngay = Ngay; emp_cu.GioXuatBen = GioXB; bool b = LichChayBUS.Update(emp_cu,emp_moi); if (b) { MessageBox.Show("Cập nhật thành công !!!"); dtg_LichXeChay.DataSource = LichChayBUS.Select_All(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void txt_TimKiem_TextChanged(object sender, EventArgs e) { try { dtg_LichXeChay.DataSource = LichChayBUS.Select_by_TenTuyenDuong(txt_TimKiem.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_QLLichXeChay.cs
C#
art
5,929
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DTO; using BUS; namespace QL_BenXe { public partial class frm_QLBanVe : Form { public frm_QLBanVe() { InitializeComponent(); } public void Get_TenKhachHang(String str) { txt_KhachHang.Text = str; } public void Get_MaKhachHang(String str) { txt_KhachHang.Tag = str; } private void textBox1_MouseClick(object sender, MouseEventArgs e) { TimKiemKhachHang frm = new TimKiemKhachHang(); frm.Get_TenKhachHang = new TimKiemKhachHang.GetString(Get_TenKhachHang); frm.Get_MaKhachHang= new TimKiemKhachHang.GetString(Get_MaKhachHang); frm.Show(); } private void frm_QLVe_Load(object sender, EventArgs e) { cmb_TuyenDuong.DisplayMember = "TenTuyenDuong"; cmb_TuyenDuong.ValueMember = "MaTuyenDuong"; cmb_TuyenDuong.DataSource = TuyenDuongBUS.Select_All(); } private void cmb_Xe_SelectedIndexChanged(object sender, EventArgs e) { cmb_GioXuatBen.DisplayMember = "GioXuatBen"; cmb_GioXuatBen.DataSource = LichChayBUS.Select_GioXuatBen_ThemVe(cmb_TuyenDuong.SelectedValue.ToString(), cmb_Xe.SelectedValue.ToString()); String GiaVe = GiaVeBUS.Select_GiaTien(cmb_Xe.SelectedValue.ToString(), cmb_TuyenDuong.SelectedValue.ToString()); String tmp = ""; while (GiaVe.Length > 3) { tmp = "." + GiaVe.Substring(GiaVe.Length - 3) + tmp; GiaVe = GiaVe.Substring(0, GiaVe.Length - 3); } GiaVe = GiaVe + tmp; lbl_TienVe.Text = GiaVe; } private void cmb_TuyenDuong_SelectedIndexChanged(object sender, EventArgs e) { cmb_Xe.DisplayMember = "BienSo"; cmb_Xe.ValueMember = "MaXe"; cmb_Xe.DataSource = XeBUS.Select_Xe_by_MaTuyenDuong(cmb_TuyenDuong.SelectedValue.ToString(),DateTime.Today.ToShortDateString()); } private void btn_NhapVe_Click(object sender, EventArgs e) { if (!txt_KhachHang.Text.Equals("") || checkBox1.Checked) { try { Ve Ve = new Ve(); if (checkBox1.Checked) Ve.MaKhachHang = "KHVL"; else Ve.MaKhachHang = txt_KhachHang.Tag.ToString(); Ve.MaXe = cmb_Xe.SelectedValue.ToString(); Ve.MaGhe = cmb_Ghe.SelectedValue.ToString(); Ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); Ve.Ngay = DateTime.Now.ToString(); Ve.GioXuatBen = cmb_GioXuatBen.Text; Ve.TinhTrang = "True"; bool b = VeBUS.Insert(Ve); if (b == true) MessageBox.Show("Thêm vé thành công !!!"); //dtg_Ve.DataSource = VeBUS.Select_All(); Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else MessageBox.Show("Chưa nhập thông tin khách hàng !!!"); } private void cmb_GioXuatBen_SelectedIndexChanged(object sender, EventArgs e) { Ve ve = new Ve(); ve.MaXe = cmb_Xe.SelectedValue.ToString(); ve.MaTuyenDuong = cmb_TuyenDuong.SelectedValue.ToString(); ve.GioXuatBen = cmb_GioXuatBen.Text; cmb_Ghe.DisplayMember = "TenGhe"; cmb_Ghe.ValueMember = "MaGhe"; cmb_Ghe.DataSource = GheBUS.Select_GheTrong(ve); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_QLBanVe.cs
C#
art
4,518
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("QL_BenXe")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("QL_BenXe")] [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fa32dfae-60cf-4822-b9c1-cf02892db6fb")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
12hca1-cnpm-11
trunk/Source/QL_BenXe/Properties/AssemblyInfo.cs
C#
art
1,446
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace QL_BenXe { public partial class frm_Main : Form { public frm_Main() { InitializeComponent(); } private void thêmVéĐặtVéToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_QLBanVe")) { form.Close(); } } frm_QLBanVe frm = new frm_QLBanVe(); frm.MdiParent = this; frm.Show(); } private void cậpNhậtVéHủyVéToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_QLCapNhatVe")) { form.Close(); } } frm_QLCapNhatVe frm = new frm_QLCapNhatVe(); frm.MdiParent = this; frm.Show(); } private void lậpLịchXeChạyToolStripMenuItem1_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_QLLichXeChay")) { form.Close(); } } frm_QLLichXeChay frm = new frm_QLLichXeChay(); frm.MdiParent = this; frm.Show(); } private void frm_Main_Load(object sender, EventArgs e) { } private void tìmKiếmNângCaoToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_SearchLichXeChay")) { form.Close(); } } frm_SearchLichXeChay frm = new frm_SearchLichXeChay(); frm.MdiParent = this; frm.Show(); } private void traCứuToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_SearchNhanVien")) { form.Close(); } } frm_SearchNhanVien frm = new frm_SearchNhanVien(); frm.MdiParent = this; frm.Show(); } private void traCứuToolStripMenuItem1_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_SearchKhachHang")) { form.Close(); } } frm_SearchKhachHang frm = new frm_SearchKhachHang(); frm.MdiParent = this; frm.Show(); } private void đặtVéToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form.Name.Equals("frm_QLDatVe")) { form.Close(); } } frm_QLDatVe frm = new frm_QLDatVe(); frm.MdiParent = this; frm.Show(); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/frm_Main.cs
C#
art
3,582
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using BUS; using DTO; namespace QL_BenXe { public partial class TimKiemKhachHang : Form { public TimKiemKhachHang() { InitializeComponent(); } public delegate void GetString(String MyString); public GetString Get_TenKhachHang; public GetString Get_MaKhachHang; private void TimKiemKhachHang_Load(object sender, EventArgs e) { } private void btn_TimKiem_Click(object sender, EventArgs e) { List<KhachHang> list=KhachHangBUS.Search(txt_TimKiem.Text); dtg_TimKiem.DataSource = list; } private void txt_TimKiem_TextChanged(object sender, EventArgs e) { List<KhachHang> list = KhachHangBUS.Search(txt_TimKiem.Text); dtg_TimKiem.DataSource = list; } private void dtg_TimKiem_CellClick(object sender, DataGridViewCellEventArgs e) { String str = dtg_TimKiem.CurrentRow.Cells[1].Value.ToString(); String str2 = dtg_TimKiem.CurrentRow.Cells[0].Value.ToString(); if (Get_TenKhachHang != null) { Get_TenKhachHang(str); Get_MaKhachHang(str2); } this.Close(); } } }
12hca1-cnpm-11
trunk/Source/QL_BenXe/TimKiemKhachHang.cs
C#
art
1,520